awesome_translations 0.0.62 → 0.0.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/awesome_translations/caches_controller.rb +1 -1
- data/app/controllers/awesome_translations/clean_ups_controller.rb +1 -1
- data/app/controllers/awesome_translations/handlers_controller.rb +3 -7
- data/app/controllers/awesome_translations/movals_controller.rb +1 -1
- data/config/locales/en.yml +3 -0
- data/lib/awesome_translations/cache_database_generator.rb +11 -9
- data/lib/awesome_translations/config.rb +2 -2
- data/lib/awesome_translations/engine.rb +1 -1
- data/lib/awesome_translations/erb_inspector/file_inspector.rb +14 -6
- data/lib/awesome_translations/handlers/devise_handler.rb +1 -1
- data/lib/awesome_translations/handlers/rails_handler.rb +1 -1
- data/lib/awesome_translations/handlers/validations_handler.rb +1 -1
- data/lib/awesome_translations/handlers/will_paginate_handler.rb +1 -1
- data/lib/awesome_translations/version.rb +1 -1
- metadata +10 -293
- data/spec/controllers/groups_controller_spec.rb +0 -83
- data/spec/controllers/handlers_controller_spec.rb +0 -51
- data/spec/controllers/users_controller_spec.rb +0 -21
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/config/manifest.js +0 -3
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/translations.js +0 -3
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -15
- data/spec/dummy/app/controllers/locales_controller.rb +0 -6
- data/spec/dummy/app/controllers/users_controller.rb +0 -43
- data/spec/dummy/app/helpers/application_helper.rb +0 -7
- data/spec/dummy/app/mailers/my_mailer.rb +0 -5
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/app/models/role.rb +0 -17
- data/spec/dummy/app/models/user.rb +0 -8
- data/spec/dummy/app/services/application_service.rb +0 -3
- data/spec/dummy/app/services/test_translate_service.rb +0 -9
- data/spec/dummy/app/views/layouts/application.html.erb +0 -28
- data/spec/dummy/app/views/users/_partial_test.html.erb +0 -1
- data/spec/dummy/app/views/users/edit.html.liquid +0 -7
- data/spec/dummy/app/views/users/index.html.haml +0 -16
- data/spec/dummy/app/views/users/show.html.erb +0 -7
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config/application.rb +0 -35
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -32
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -13
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/routes.rb +0 -7
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/awesome_translations.sqlite3 +0 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20141018081559_create_users.rb +0 -9
- data/spec/dummy/db/migrate/20141018081640_create_roles.rb +0 -10
- data/spec/dummy/db/migrate/20150607110245_add_price_cents_to_roles.rb +0 -5
- data/spec/dummy/db/schema.rb +0 -30
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -52
- data/spec/dummy/log/test.log +0 -1188
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/2m/2mnPY9uUnBNkGHLxtFaWv5hB3oA7sY2K1ZtwQlZLnAY.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/5r/5rpKlqLSFsRCibev7g6MQkIOhWuOah-1KAN3aqV_fYI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/6E/6ExTs_VkmUe-fovt99Kw8rq-xCfx0_qGsSoldSWScZI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8O/8OrG8phjC9s5-_7GAI2TEmRjsrGsuvq1gnJQPdMm8v8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8f/8f4REKYOWkNfHexyAVqGXnbOP3vky_ANapWzlRMDeQ4.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8n/8n_viDw_qMQaQmqHM0ObPADed5uRyEYo3gDZIiTqUyA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/9e/9euY4B26kaHeiqfd1Qc0bsfRjpzmq36X6uqUfaRNtIs.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AB/AB5PxrhEqi8qOm7AmSf-sHDs9ffj_iTsytaHas2ryPA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AI/AICJO1oM9dzlQ_N1QlHcCN9e8PC0wjtYk7-VmuNdfwg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ca/CaGQBiCuFgkHQ5gw8ZnGQqO8iP1md3GcllDsmaKBFdQ.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ch/ChWez9UVXMuuBpLJMDRGuDmMuXy8gIuFo6794-wBgXc.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/D9/D9eOwgl8pLlC7LJu-LL59UeHm9d-CH1mPgsA8j6xkMg.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Hn/Hn53895nYKzu-g1FJKYS_yszYqCADXasTmN615R_qMQ.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/It/ItV7jxV0bfHndR-H3cidDwpTFGhvs0ETLRqCTmZMXB8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/LL/LL0EenAcTXP-UNCqfcKtMF4Z8oDeWvdlwLQfuOVRPdw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/NU/NUN9oO9gyoo-sY32AOLHdDACjLIxisCxXdKd84ou6cs.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ob/ObuKkBd-camcT52YpgeuyheU-GDFLZCJnoVtq2plgW0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Og/Og_HPfE6734sqkQ0_h4EkOOx3Aoq1LABLH9ovjl6Bvw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Pw/Pwuhz_6So_JcSrxT0Uf4VaLhh_FFSJMKxLZFMbS0LNQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/R-/R-nohuDiORrLlJJtKc5bQsjIRS8yTQFVR3EIxJx3JZw.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/SX/SXA6qKBlsAQ-MLPi7-KPCPcSx9Gg2VR1xa-lCmgipgA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Sb/Sb1Vug319YfPL2Rci1PLMLXJjeIFYcNbHb5hKOvO1eo.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/_f/_f0DjbdXTMEPb52THCCF5qbKkDs28tHHnap5ag4jsdU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/dT/dTb1O_9BwFdhA3VT1UTxY-XIIoAGDHGHVO9bzRUNIfc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/dV/dVTKOfd8qDIHT3VD-4emnl0yAIxcSF1pY0CUESPHwdM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/i0/i0TQIUsntlYrsibtn9YfB3qbI6bj8hLPom8KUfxR078.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/jF/jFFXBsyFdv_TiNykX219AHs3Q7dQInYRP_80cAWZsgE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/mX/mXfx3VRudxpXrRx1aejtNA5YHOwND3kwWUfvdXHSors.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/nG/nGQXdOLWsP4c926DJJBNXFUE0cKfZynnqN5aQ4T1I48.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/oX/oXeqOS7RZb4eFbKrraeQtr6TUrXPTueLN_Crp7S0RLE.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/p2/p27Ube4R6tciXRc0F8lpz6wUzmXIPxwqz7dKaUYVVuc.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/pv/pv6tV3CDkIAmLXdU8EPLlNEkXAKJPufVD4VP30o4fWo.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/q6/q6BYa32YJF11eGVapO4ouNl6gayPIsARgMavlzZmoi0.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/r5/r5draRYO72lGMZZKpqYbscAWxAawJVG7uO0uyx3iw24.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/r7/r7kGQJTsdrqs3i-prYAVnngsoc6uAtrjLTULTJdgy9g.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rI/rITk_65QtUwq61bjRPAksGeJxbLUFfz-sFPnQiZPHjw.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rR/rRS9OkVGJ9Wvs1fwZH-raqD4sXkbV8WmlLGIibYpZmI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/u9/u9nsXMBU9hA4UnH4SDHgk19ev_JNeeiS1-EZDrgStCI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/un/unZXcRqhGJwHvVWJmJ1rTizBZq6H5jF28E5-FHyTYL4.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/wP/wP-1NwhQC0Sp_5PHpwAI7N0_N99vLNy0TA2FcMd6zgE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/x7/x7KkTV3ibfIEysLB_ug5bfmnn2VLV_BldukPR3EoPBk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/xr/xrDdkyCzfXr-pIE8gfvD8iFiWPuq9EwuZIl-uU9s0_o.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/yc/yc3EXb1cvVLmwnk8aQN89bgVFeuwsVz2k2p0mvC2c3c.cache +0 -1
- data/spec/factories/group.rb +0 -8
- data/spec/factories/handler.rb +0 -11
- data/spec/factories/handler_translation.rb +0 -13
- data/spec/factories/translation_key.rb +0 -8
- data/spec/factories/translation_value.rb +0 -9
- data/spec/factories/user.rb +0 -7
- data/spec/features/clean_ups_spec.rb +0 -38
- data/spec/features/duplicates_spec.rb +0 -61
- data/spec/features/movals_spec.rb +0 -60
- data/spec/handlers/file_handler_spec.rb +0 -103
- data/spec/handlers/model_handler_spec.rb +0 -40
- data/spec/handlers/validations_handler_spec.rb +0 -31
- data/spec/handlers_spec.rb +0 -9
- data/spec/lib/cache_database_generator_spec.rb +0 -59
- data/spec/lib/erb_inspector/file_inspector_spec.rb +0 -46
- data/spec/lib/erb_inspector/translation_inspector_spec.rb +0 -33
- data/spec/lib/erb_inspector_spec.rb +0 -30
- data/spec/lib/model_inspector/attribute_spec.rb +0 -18
- data/spec/lib/model_inspector_spec.rb +0 -39
- data/spec/lib/object_extensions_spec.rb +0 -7
- data/spec/lib/translation_migrator_spec.rb +0 -46
- data/spec/models/awesome_translations/handler_spec.rb +0 -8
- data/spec/models/awesome_translations/translated_value_spec.rb +0 -41
- data/spec/models/awesome_translations/translation_spec.rb +0 -54
- data/spec/services/test_translate_service_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -76
@@ -1,83 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe AwesomeTranslations::GroupsController do
|
4
|
-
routes { AwesomeTranslations::Engine.routes }
|
5
|
-
|
6
|
-
let(:model_locales_path) { Rails.root.join("config/locales/awesome_translations/models").to_s }
|
7
|
-
let(:user_yml_path) { "#{model_locales_path}/user/da.yml" }
|
8
|
-
let(:role_yml_path) { "#{model_locales_path}/role/da.yml" }
|
9
|
-
let(:date_time_path) { Rails.root.join("config/locales/awesome_translations/date_time/da.yml").to_s }
|
10
|
-
|
11
|
-
before do
|
12
|
-
AwesomeTranslations::CacheDatabaseGenerator.current.cache_translations
|
13
|
-
|
14
|
-
FileUtils.rm_f(model_locales_path) if File.exist?(model_locales_path)
|
15
|
-
FileUtils.rm_f(date_time_path) if File.exist?(date_time_path)
|
16
|
-
|
17
|
-
I18n.load_path.delete(date_time_path)
|
18
|
-
I18n.load_path.delete(model_locales_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
render_views
|
22
|
-
|
23
|
-
describe "#update" do
|
24
|
-
it "updates translations" do
|
25
|
-
expect(I18n.load_path).not_to include model_locales_path
|
26
|
-
|
27
|
-
put :update, params: {handler_id: "model_handler", id: "User", t: {
|
28
|
-
"activerecord.attributes.user.password" => {"da" => "Adgangskode", "de" => "Kenwort", "en" => "Password"}
|
29
|
-
}}
|
30
|
-
|
31
|
-
danish_user_translations = YAML.load_file(user_yml_path)
|
32
|
-
expect(danish_user_translations["da"]["activerecord"]["attributes"]["user"]["password"]).to eq "Adgangskode"
|
33
|
-
end
|
34
|
-
|
35
|
-
it "updates paths" do
|
36
|
-
key_to_update = "activerecord.attributes.role.role"
|
37
|
-
|
38
|
-
put :update, params: {handler_id: "model_handler", id: "Role", t: {
|
39
|
-
key_to_update => {"da" => "Rolle", "de" => "Die type", "en" => "Role"}
|
40
|
-
}}
|
41
|
-
|
42
|
-
da_translation_value = AwesomeTranslations::CacheDatabaseGenerator::TranslationValue
|
43
|
-
.joins(:translation_key)
|
44
|
-
.find_by(translation_keys: {key: key_to_update}, locale: "da")
|
45
|
-
|
46
|
-
de_translation_value = AwesomeTranslations::CacheDatabaseGenerator::TranslationValue
|
47
|
-
.joins(:translation_key)
|
48
|
-
.find_by(translation_keys: {key: key_to_update}, locale: "de")
|
49
|
-
|
50
|
-
expect(da_translation_value).not_to eq nil
|
51
|
-
expect(da_translation_value.value).to eq "Rolle"
|
52
|
-
|
53
|
-
expect(de_translation_value).not_to eq nil
|
54
|
-
expect(de_translation_value.value).to eq "Die type"
|
55
|
-
|
56
|
-
expect(I18n.load_path).to include role_yml_path
|
57
|
-
end
|
58
|
-
|
59
|
-
it "handles array translations" do
|
60
|
-
put :update, params: {handler_id: "rails_handler", id: "date_time", t: {
|
61
|
-
"date.day_names" => {
|
62
|
-
"1" => {
|
63
|
-
"da" => "Mandag"
|
64
|
-
},
|
65
|
-
"4" => {
|
66
|
-
"da" => "Torsdag"
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}}
|
70
|
-
|
71
|
-
translations = YAML.load_file(date_time_path)
|
72
|
-
|
73
|
-
expect(translations["da"]["date"]["day_names"][1]).to eq "Mandag"
|
74
|
-
expect(translations["da"]["date"]["day_names"][4]).to eq "Torsdag"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
it "#update_translations_cache" do
|
79
|
-
request.env["HTTP_REFERER"] = handler_group_path("rails_handler", "date_time")
|
80
|
-
post :update_translations_cache, params: {handler_id: "rails_handler", id: "date_time"}
|
81
|
-
expect(response).to redirect_to handler_group_path("rails_handler", "date_time")
|
82
|
-
end
|
83
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
describe AwesomeTranslations::HandlersController do
|
5
|
-
let!(:group) { create :group }
|
6
|
-
let!(:handler_translation) { create :handler_translation, group: group }
|
7
|
-
|
8
|
-
routes { AwesomeTranslations::Engine.routes }
|
9
|
-
|
10
|
-
render_views
|
11
|
-
|
12
|
-
describe "#index" do
|
13
|
-
it "renders the page" do
|
14
|
-
get :index
|
15
|
-
expect(response).to be_successful
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#show" do
|
20
|
-
it "renders the page" do
|
21
|
-
AwesomeTranslations::CacheDatabaseGenerator.current.cache_translations
|
22
|
-
get :show, params: {id: "model_handler"}
|
23
|
-
expect(response).to be_successful
|
24
|
-
end
|
25
|
-
|
26
|
-
it "filters with missing translations" do
|
27
|
-
AwesomeTranslations::CacheDatabaseGenerator.current.cache_translations
|
28
|
-
get :show, params: {id: "model_handler", with_missing_translations: "only_with"}
|
29
|
-
|
30
|
-
all_groups = AwesomeTranslations::CacheDatabaseGenerator::Group.all
|
31
|
-
groups = assigns(:groups)
|
32
|
-
|
33
|
-
expect(all_groups.length).to be > groups.length
|
34
|
-
expect(groups.length).to eq 5
|
35
|
-
expect(response).to be_successful
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
it "#update_cache" do
|
40
|
-
request.env["HTTP_REFERER"] = handlers_path
|
41
|
-
post :update_cache
|
42
|
-
expect(response).to redirect_to :handlers
|
43
|
-
end
|
44
|
-
|
45
|
-
it "#update_groups_cache" do
|
46
|
-
AwesomeTranslations::CacheDatabaseGenerator.current.cache_translations
|
47
|
-
request.env["HTTP_REFERER"] = handler_path("rails_handler")
|
48
|
-
post :update_groups_cache, params: {id: "rails_handler"}
|
49
|
-
expect(response).to redirect_to handler_path("rails_handler")
|
50
|
-
end
|
51
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe UsersController do
|
4
|
-
let(:user) { create :user }
|
5
|
-
|
6
|
-
render_views
|
7
|
-
|
8
|
-
around do |example|
|
9
|
-
I18n.with_locale(:en) do
|
10
|
-
example.call
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "#update" do
|
15
|
-
patch :update, params: {id: user.id, user: {email: "newemail@example.com"}}
|
16
|
-
expect(response).to redirect_to user_url(user)
|
17
|
-
|
18
|
-
# Ensure correct key
|
19
|
-
expect(flash[:notice]).to eq "translation missing: en.users.user_was_updated"
|
20
|
-
end
|
21
|
-
end
|
data/spec/dummy/README.rdoc
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
== README
|
2
|
-
|
3
|
-
This README would normally document whatever steps are necessary to get the
|
4
|
-
application up and running.
|
5
|
-
|
6
|
-
Things you may want to cover:
|
7
|
-
|
8
|
-
* Ruby version
|
9
|
-
|
10
|
-
* System dependencies
|
11
|
-
|
12
|
-
* Configuration
|
13
|
-
|
14
|
-
* Database creation
|
15
|
-
|
16
|
-
* Database initialization
|
17
|
-
|
18
|
-
* How to run the test suite
|
19
|
-
|
20
|
-
* Services (job queues, cache servers, search engines, etc.)
|
21
|
-
|
22
|
-
* Deployment instructions
|
23
|
-
|
24
|
-
* ...
|
25
|
-
|
26
|
-
|
27
|
-
Please feel free to use a different markup language if you do not plan to run
|
28
|
-
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
DELETED
File without changes
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require_tree .
|
13
|
-
*/
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
include AwesomeTranslations::ControllerTranslateFunctionality
|
3
|
-
|
4
|
-
# Prevent CSRF attacks by raising an exception.
|
5
|
-
# For APIs, you may want to use :null_session instead.
|
6
|
-
protect_from_forgery with: :exception
|
7
|
-
|
8
|
-
around_action :with_locale
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def with_locale(&blk)
|
13
|
-
I18n.with_locale(session[:locale] || :en, &blk)
|
14
|
-
end
|
15
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class UsersController < ApplicationController
|
2
|
-
before_action :set_user
|
3
|
-
|
4
|
-
def index
|
5
|
-
@users = User.all
|
6
|
-
end
|
7
|
-
|
8
|
-
def show; end
|
9
|
-
|
10
|
-
def new; end
|
11
|
-
|
12
|
-
def create
|
13
|
-
if @user.save
|
14
|
-
flash[:notice] = t(".user_was_created")
|
15
|
-
redirect_to user_path(@user)
|
16
|
-
else
|
17
|
-
flash[:error] = @user.errors.full_messages.join(". ")
|
18
|
-
render :new
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def edit; end
|
23
|
-
|
24
|
-
def update
|
25
|
-
if @user.update(user_params)
|
26
|
-
flash[:notice] = controller_t(".user_was_updated")
|
27
|
-
redirect_to user_path(@user)
|
28
|
-
else
|
29
|
-
flash[:error] = @user.errors.full_messages.join(". ")
|
30
|
-
render :edit
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def set_user
|
37
|
-
@user = User.find(params[:id].to_i) if params[:id].to_i > 0
|
38
|
-
end
|
39
|
-
|
40
|
-
def user_params
|
41
|
-
params.require(:user).permit(:email)
|
42
|
-
end
|
43
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class Role < ApplicationRecord
|
2
|
-
translates :name
|
3
|
-
belongs_to :user
|
4
|
-
validates :role, presence: true
|
5
|
-
monetize :price_cents, allow_nil: true
|
6
|
-
|
7
|
-
def self.roles
|
8
|
-
{
|
9
|
-
t(".administrator") => "admin",
|
10
|
-
t(".moderator") => "moderator"
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.roles_array
|
15
|
-
[[t(".user"), "user"]]
|
16
|
-
end
|
17
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag "application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div class="awesome-translations">
|
11
|
-
<%= link_to t(".awesome_translations"), try(:awesome_translations_path) %>
|
12
|
-
</div>
|
13
|
-
<div class="language">
|
14
|
-
<%= link_to t(".english"), locales_path(locale: :en), method: :post %>
|
15
|
-
<%= link_to t(".danish"), locales_path(locale: :da), method: :post %>
|
16
|
-
</div>
|
17
|
-
<div class="current-language">
|
18
|
-
<%= t(".the_current_language_is", locale: I18n.locale) %>
|
19
|
-
</div>
|
20
|
-
<%= t(".hello_world") %>
|
21
|
-
<%= t(".hello_world") %>
|
22
|
-
<div class="helper_hello_world">
|
23
|
-
Hello world from helper
|
24
|
-
<%= hello_world %>
|
25
|
-
</div>
|
26
|
-
<%= yield %>
|
27
|
-
</body>
|
28
|
-
</html>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= t(".partial_test") %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<h1>{{ ".edit_user" | t }}</h1>
|
2
|
-
|
3
|
-
{{ '.test_for_liquid_templates' | t }}
|
4
|
-
{{ ".test_for_liquid_templates_with_escape" | t | escape }}
|
5
|
-
{{ ".test_for_liquid_templates_with_var_escape" | val: "something", something | t | escape }}
|
6
|
-
{{ ".test_for_liquid_templates_with_var_double_quotes" | val: "something", something | t }}
|
7
|
-
{{ '.test_for_liquid_templates_with_var_single_quotes' | val: 'something', something | t }}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
%h1= User.model_name.human(count: 2)
|
2
|
-
|
3
|
-
.hello-world-i18n= t(".hello_world")
|
4
|
-
|
5
|
-
%h2= t(".list_of_users")
|
6
|
-
%table
|
7
|
-
%thead
|
8
|
-
%tr
|
9
|
-
%th= User.human_attribute_name(:id)
|
10
|
-
%tbody
|
11
|
-
- @users.each do |user|
|
12
|
-
%tr
|
13
|
-
%td= link_to user.id, user_path(user)
|
14
|
-
- unless @users.any?
|
15
|
-
%tr
|
16
|
-
%td{colspan: 1}= t(".no_users_was_found")
|
data/spec/dummy/bin/bundle
DELETED
data/spec/dummy/bin/rails
DELETED
data/spec/dummy/bin/rake
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path("boot", __dir__)
|
2
|
-
|
3
|
-
# Pick the frameworks you want:
|
4
|
-
require "active_record/railtie"
|
5
|
-
require "action_controller/railtie"
|
6
|
-
require "action_mailer/railtie"
|
7
|
-
require "sprockets/railtie"
|
8
|
-
# require "rails/test_unit/railtie"
|
9
|
-
|
10
|
-
Bundler.require(*Rails.groups)
|
11
|
-
|
12
|
-
require "money-rails"
|
13
|
-
require "awesome_translations"
|
14
|
-
|
15
|
-
module Dummy; end
|
16
|
-
|
17
|
-
class Dummy::Application < Rails::Application
|
18
|
-
# Settings in config/environments/* take precedence over those specified here.
|
19
|
-
# Application configuration should go into files in config/initializers
|
20
|
-
# -- all .rb files in that directory are automatically loaded.
|
21
|
-
|
22
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
23
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
24
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
25
|
-
|
26
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
27
|
-
config.i18n.load_path += Dir[Rails.root.join("config/locales/**/*.{rb,yml}").to_s]
|
28
|
-
config.i18n.available_locales = [:da, :de, :en]
|
29
|
-
config.i18n.default_locale = :en
|
30
|
-
|
31
|
-
config.assets.precompile += %w[
|
32
|
-
awesome_translations/application.css
|
33
|
-
awesome_translations/application.js
|
34
|
-
]
|
35
|
-
end
|
data/spec/dummy/config/boot.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
development:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: db/development.sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
|
-
test:
|
16
|
-
adapter: sqlite3
|
17
|
-
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports and disable caching.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send.
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger.
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Raise an error on page load if there are pending migrations
|
23
|
-
config.active_record.migration_error = :page_load
|
24
|
-
|
25
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
-
# This option may cause significant delays in view rendering with a large
|
27
|
-
# number of complex assets.
|
28
|
-
config.assets.debug = true
|
29
|
-
|
30
|
-
# Raises error for missing translations
|
31
|
-
# config.action_view.raise_on_missing_translations = true
|
32
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# Code is not reloaded between requests.
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both thread web servers
|
9
|
-
# and those relying on copy on write to perform better.
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
11
|
-
config.eager_load = true
|
12
|
-
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
14
|
-
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
16
|
-
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
-
# config.action_dispatch.rack_cache = true
|
21
|
-
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
config.serve_static_files = false
|
24
|
-
|
25
|
-
# Compress JavaScripts and CSS.
|
26
|
-
config.assets.js_compressor = :uglifier
|
27
|
-
# config.assets.css_compressor = :sass
|
28
|
-
|
29
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
-
config.assets.compile = false
|
31
|
-
|
32
|
-
# Generate digests for assets URLs.
|
33
|
-
config.assets.digest = true
|
34
|
-
|
35
|
-
# Version of your assets, change this if you want to expire all your assets.
|
36
|
-
config.assets.version = "1.0"
|
37
|
-
|
38
|
-
# Specifies the header that your server uses for sending files.
|
39
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
-
|
42
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
-
# config.force_ssl = true
|
44
|
-
|
45
|
-
# Set to :debug to see everything in the log.
|
46
|
-
config.log_level = :info
|
47
|
-
|
48
|
-
# Prepend all log lines with the following tags.
|
49
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
-
|
51
|
-
# Use a different logger for distributed setups.
|
52
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
-
|
54
|
-
# Use a different cache store in production.
|
55
|
-
# config.cache_store = :mem_cache_store
|
56
|
-
|
57
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
-
|
60
|
-
# Precompile additional assets.
|
61
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
-
# config.assets.precompile += %w( search.js )
|
63
|
-
|
64
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
-
# config.action_mailer.raise_delivery_errors = false
|
67
|
-
|
68
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
-
# the I18n.default_locale when a translation can not be found).
|
70
|
-
config.i18n.fallbacks = true
|
71
|
-
|
72
|
-
# Send deprecation notices to registered listeners.
|
73
|
-
config.active_support.deprecation = :notify
|
74
|
-
|
75
|
-
# Disable automatic flushing of the log to improve performance.
|
76
|
-
# config.autoflush_log = false
|
77
|
-
|
78
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
-
config.log_formatter = ::Logger::Formatter.new
|
80
|
-
end
|