Class: DataController

Inherits:
ApplicationController show all
Defined in:
app/controllers/data_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#check_discountObject



34
35
36
37
38
# File 'app/controllers/data_controller.rb', line 34

def check_discount
  @discount = TranslationCms::Api::Discounts::Ticket.find(params[:code]).first

  json_responce!
end

#check_ipObject



78
79
80
81
82
83
# File 'app/controllers/data_controller.rb', line 78

def check_ip
  # render request geocoder result
  data = request.location.try(:data).try(:as_json) || {}
  data[:redirect] = Settings.blacklist_redirect_url if blacklisted?
  render json: data
end

#countriesObject



8
9
10
11
12
# File 'app/controllers/data_controller.rb', line 8

def countries
  @countries = TranslationCms::Country.all

  json_responce!
end

#country_codeObject



14
15
16
17
18
19
# File 'app/controllers/data_controller.rb', line 14

def country_code
  respond_to do |format|
    format.json { render json: { country_code: request_country_code.upcase } }
    format.all { render text: request_country_code }
  end
end

#feedback_reasonsObject



21
22
23
24
25
# File 'app/controllers/data_controller.rb', line 21

def feedback_reasons
  @reasons = FeedbackReason.sorted

  json_responce!
end

#languagesObject



27
28
29
30
31
32
# File 'app/controllers/data_controller.rb', line 27

def languages
  @languages = TranslationCms::Api::Language.all!
  @language_rates = TranslationCms::Api::Rates::Language.all!

  json_responce!
end

#payment_ratesObject



40
41
42
43
# File 'app/controllers/data_controller.rb', line 40

def payment_rates
  @payment_types = PaymentType.visible
  @exchange_rates = TranslationCms::Api::Rates::Currency.all!
end

#ratesObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'app/controllers/data_controller.rb', line 45

def rates
  @service_types = ServiceType.all
  @urgency_types = UrgencyType.all
  @feature_types = FeatureType.all
  @payment_types = PaymentType.visible

  @services = TranslationCms::Api::Service.all!
  @languages = TranslationCms::Api::Language.all!

  # @categories = TranslationCms::Api::Category.all!
  @industry_expertises = TranslationCms::Api::IndustryExpertise.all!
  @certificates = TranslationCms::Api::Certificate.all!

  @packages = TranslationCms::Api::OrderPackage.all!

  @service_rates = TranslationCms::Api::Rates::Service.all!
  @language_rates = TranslationCms::Api::Rates::Language.all!
  @feature_rates = TranslationCms::Api::Rates::Feature.all!
  @certificate_rates = TranslationCms::Api::Rates::Certificate.all!

  @exchange_rates = TranslationCms::Api::Rates::Currency.all!

  @countries = TranslationCms::Country.all

  @work_capacity_rates = TranslationCms::Api::Rates::WorkCapacity.all!
  @urgency_rates = TranslationCms::Api::Rates::Urgency.all!
  @urgency_rates.push(TranslationCms::Api::Rates::Urgency.new(id: 0, urgency_division: 999_999, price: 0))

  @settings = TranslationCms::Api::Setting.all!.first

  json_responce!
end