Class: Account::FeedbacksController

Inherits:
BaseController show all
Defined in:
app/controllers/account/feedbacks_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#checkObject



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 
      format.json { render json: .present? && api_responce.present? }
    rescue JsonApiClient::Errors::NotFound
      format.json { render json: false }
    end
    format.all { redirect_to  }
  end
end

#createObject



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: )
end

#indexObject



17
18
19
20
# File 'app/controllers/account/feedbacks_controller.rb', line 17

def index
  find_structure('feedbacks-text')
  respond_with @records
end

#ordersObject



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  }
  end
end

#showObject

Raises:

  • (ActiveRecord::RecordNotFound)


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])

  # Seo meta tags
  @meta_record = @writer
  respond_with @writer
end