Class: Account::FeedbacksController
Instance Method Summary
collapse
caches_page_with_cache_marker, #raise_not_found!
Instance Method Details
#check ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/account/feedbacks_controller.rb', line 39
def check
respond_to do |format|
begin
api_responce = TranslationCms::Api::Customers::Writer.find(params[:id]) if current_account
format.json { render json: current_account.present? && api_responce.present? }
rescue JsonApiClient::Errors::NotFound
format.json { render json: false }
end
format.all { redirect_to account_dashboard_path }
end
end
|
#create ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'app/controllers/account/feedbacks_controller.rb', line 22
def create
if !@violation || (@violation.valid? && @violation.submit)
@form.submit if @form.valid?
end
result = !@violation || @violation.errors.blank? ? @form : @violation
respond_with(result, location: account_feedbacks_path)
end
|
#index ⇒ Object
17
18
19
20
|
# File 'app/controllers/account/feedbacks_controller.rb', line 17
def index
find_structure('feedbacks-text')
respond_with @records
end
|
#orders ⇒ Object
31
32
33
34
35
36
37
|
# File 'app/controllers/account/feedbacks_controller.rb', line 31
def orders
@orders = TranslationCms::Api::Customers::Feedbacks::Writer.find(params[:id])
respond_to do |format|
format.json { render }
format.all { redirect_to account_dashboard_path }
end
end
|
#show ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'app/controllers/account/feedbacks_controller.rb', line 51
def show
api_responce = TranslationCms::Api::Customers::Writer.find(params[:id])
raise ActiveRecord::RecordNotFound, "Writer #{params[:id]} not found" if api_responce.errors.present?
@writer = api_responce.first
@feedbacks = @writer.writer_feedbacks(skip_user_id: @account.profile.id)
@industries = TranslationCms::Api::IndustryExpertise.all!
@orders = TranslationCms::Api::Customers::Feedbacks::Writer.find(params[:id])
@meta_record = @writer
respond_with @writer
end
|