Add default currencies

This commit is contained in:
Thaleia Tagaraki 2017-12-02 17:59:31 +02:00 committed by Astradeni
parent 33d32b9294
commit ff6497ea46
6 changed files with 11 additions and 4 deletions

View file

@ -542,7 +542,7 @@ Style/NumericLiteralPrefix:
Exclude:
- 'spec/controllers/admin/conferences_controller_spec.rb'
- 'spec/controllers/conference_registration_controller_spec.rb'
- 'spec/helpers/date_time_helper_spec.rb'
- 'spec/helpers/date_time_currency_helper_spec.rb'
- 'spec/models/conference_spec.rb'
- 'spec/models/email_settings_spec.rb'
- 'spec/models/registration_spec.rb'

View file

@ -1,4 +1,4 @@
module DateTimeHelper
module DateTimeCurrencyHelper
##
# Includes functions related to date or time manipulations
##
@ -34,4 +34,8 @@ module DateTimeHelper
"#{h} h #{min.round} min"
end
end
def currencies
default_currencies = YAML::load(ENV['OSEM_DEFAULT_CURRENCIES'])
end
end

View file

@ -12,7 +12,7 @@
= f.input :title, input_html: { autofocus: true }
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }
= f.input :price
= f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY', 'CHF'], include_blank: false
= f.input :price_currency, as: :select, class: 'form-control', collection: currencies, include_blank: false
= f.input :registration_ticket, hint: 'A registration ticket is with which user register for the conference.'
%p.text-right
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -80,3 +80,5 @@ RECAPTCHA_SECRET_KEY=""
# The url of the redis server
OSEM_REDIS_URL='redis://localhost:6379/1'
OSEM_DEFAULT_CURRENCIES="['USD', 'EURO', 'GBP', 'INR', 'CNY']"

View file

@ -1,6 +1,7 @@
require 'spec_helper'
feature Ticket do
ENV['OSEM_DEFAULT_CURRENCIES'] = "['USD', 'EURO', 'GBP', 'INR', 'CNY']"
let!(:conference) { create(:conference, title: 'ExampleCon') }
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe DateTimeHelper, type: :helper do
describe DateTimeCurrencyHelper, type: :helper do
describe 'format_datetime' do
it 'returns nothing if there is no parameter' do