Merge pull request #314 from AyuntamientoMadrid/setting

Settings improvements
This commit is contained in:
Raimond Garcia
2015-09-01 21:15:57 +02:00
9 changed files with 26 additions and 11 deletions

View File

@@ -5,8 +5,8 @@ module AdminHelper
end end
def official_level_options def official_level_options
options = [] options = [["",0]]
(0..5).each do |i| (1..5).each do |i|
options << [[t("admin.officials.level_#{i}"), Setting.value_for("official_level_#{i}_name")].compact.join(': '), i] options << [[t("admin.officials.level_#{i}"), Setting.value_for("official_level_#{i}_name")].compact.join(': '), i]
end end
options options

View File

@@ -3,7 +3,7 @@
<ul class="admin-list"> <ul class="admin-list">
<% @settings.each do |setting| %> <% @settings.each do |setting| %>
<li> <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| %> <%= 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) %> <%= f.text_field :value, label: false, id: dom_id(setting) %>

View File

@@ -80,7 +80,7 @@ en:
registered_at: "Registered at:" registered_at: "Registered at:"
hidden_at: "Hidden at:" hidden_at: "Hidden at:"
officials: officials:
level_0: Level 0 level_0: Not an official
level_1: Level 1 level_1: Level 1
level_2: Level 2 level_2: Level 2
level_3: Level 3 level_3: Level 3

View File

@@ -80,7 +80,7 @@ es:
registered_at: "Fecha de alta:" registered_at: "Fecha de alta:"
hidden_at: "Bloqueado:" hidden_at: "Bloqueado:"
officials: officials:
level_0: Nivel 0 level_0: "No es cargo público"
level_1: Nivel 1 level_1: Nivel 1
level_2: Nivel 2 level_2: Nivel 2
level_3: Nivel 3 level_3: Nivel 3

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

@@ -1,6 +1,5 @@
# Names for the moderation console, as a hint for moderators # Names for the moderation console, as a hint for moderators
# to know better how to assign users with official positions # to know better how to assign users with official positions
Setting.create(key: 'official_level_0_name', value: 'No cargo público')
Setting.create(key: 'official_level_1_name', value: 'Empleados públicos') Setting.create(key: 'official_level_1_name', value: 'Empleados públicos')
Setting.create(key: 'official_level_2_name', value: 'Organización Municipal') Setting.create(key: 'official_level_2_name', value: 'Organización Municipal')
Setting.create(key: 'official_level_3_name', value: 'Directores generales') Setting.create(key: 'official_level_3_name', value: 'Directores generales')

View File

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

View File

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