adds translation for admin settings' keys names

This commit is contained in:
Juanjo Bazán
2015-09-01 19:56:37 +02:00
parent 174bd73b89
commit c6c32a0795
5 changed files with 22 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
<ul class="admin-list">
<% @settings.each do |setting| %>
<li>
<strong><%= setting.key.classify %></strong>
<strong><%= t("settings.#{setting.key}") %></strong>
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
<%= f.text_field :value, label: false, id: dom_id(setting) %>

View File

@@ -0,0 +1,8 @@
en:
settings:
official_level_1_name: "Level 1 official positions"
official_level_2_name: "Level 2 official positions"
official_level_3_name: "Level 3 official positions"
official_level_4_name: "Level 4 official positions"
official_level_5_name: "Level 5 official positions"
max_ratio_anon_votes_on_debates: "Max allowed percentage of anonymous votes per debate"

View File

@@ -0,0 +1,8 @@
es:
settings:
official_level_1_name: "Cargos públicos de nivel 1"
official_level_2_name: "Cargos públicos de nivel 2"
official_level_3_name: "Cargos públicos de nivel 3"
official_level_4_name: "Cargos públicos de nivel 4"
official_level_5_name: "Cargos públicos de nivel 5"
max_ratio_anon_votes_on_debates: "Porcentaje máximo de votos anónimos por debate"

View File

@@ -140,8 +140,8 @@ FactoryGirl.define do
end
factory :setting do
sequence(:key) { |n| "setting key number #{n}" }
sequence(:value) { |n| "setting number #{n} value" }
sequence(:key) { |n| "Setting Key #{n}" }
sequence(:value) { |n| "Setting #{n} Value" }
end
factory :ahoy_event, :class => Ahoy::Event do

View File

@@ -12,9 +12,9 @@ feature 'Admin settings' do
scenario 'Index' do
visit admin_settings_path
expect(page).to have_content @setting1.key.classify
expect(page).to have_content @setting2.key.classify
expect(page).to have_content @setting3.key.classify
expect(page).to have_content @setting1.key
expect(page).to have_content @setting2.key
expect(page).to have_content @setting3.key
end
scenario 'Update' do