Merge pull request #5509 from consuldemocracy/labels_everywhere

Associate all form inputs with labels
This commit is contained in:
Javi Martín
2024-11-11 15:21:25 +01:00
committed by GitHub
79 changed files with 674 additions and 397 deletions

View File

@@ -956,34 +956,6 @@ table {
// 10. Budgets
// -----------------
.advanced-filters {
margin: $line-height 0;
@include breakpoint(medium) {
margin: calc(#{$line-height} / 2) 0 0;
}
}
.advanced-filters-content {
background: $highlight;
clear: both;
margin: $line-height 0;
padding: calc(#{$line-height} / 2);
.filter {
display: inline-block;
margin: 0 calc(#{$line-height} / 2);
label {
font-weight: normal;
margin: 0;
}
}
.button {
margin-top: calc(#{$line-height} / 2);
}
}
.columns-selector {

View File

@@ -0,0 +1,54 @@
.admin-budget-investments-search-form {
.advanced-filters {
@include link;
float: $global-right;
margin: $line-height 0;
@include breakpoint(medium) {
margin: calc(#{$line-height} / 2) 0 0;
}
}
.advanced-filters-content {
background: $highlight;
clear: both;
margin: $line-height 0;
padding: calc(#{$line-height} / 2);
.filter {
display: inline-block;
margin: 0 calc(#{$line-height} / 2);
label {
font-weight: normal;
margin: 0;
}
}
.button {
margin-top: calc(#{$line-height} / 2);
}
}
.basic-filters {
align-items: flex-end;
clear: both;
display: flex;
flex-wrap: wrap;
> * {
@include grid-column-gutter;
width: 100%;
@include breakpoint(medium) {
width: 25%;
}
}
> .title-or-id-filter {
@include breakpoint(medium) {
width: 50%;
}
}
}
}

View File

@@ -47,6 +47,7 @@
@import "documents/**/*";
@import "layout/**/*";
@import "machine_learning/**/*";
@import "management/**/*";
@import "moderation/**/*";
@import "polls/**/*";
@import "proposals/**/*";

View File

@@ -0,0 +1,5 @@
.management-investments-search {
.checkbox-label {
font-weight: normal;
}
}

View File

@@ -1,8 +1,8 @@
<%= render "shared/globalize_locales", resource: @banner %>
<%= render "shared/globalize_locales", resource: banner %>
<%= translatable_form_for [:admin, @banner] do |f| %>
<%= translatable_form_for [:admin, banner] do |f| %>
<%= render "shared/errors", resource: @banner %>
<%= render "shared/errors", resource: banner %>
<div class="row">
<div class="small-12 medium-3 column">
@@ -36,7 +36,7 @@
<div class="row">
<fieldset class="small-12 column">
<legend><%= t("admin.banners.banner.sections_label") %></legend>
<%= f.collection_check_boxes(:web_section_ids, @banner_sections, :id, :name) do |b| %>
<%= f.collection_check_boxes(:web_section_ids, sections, :id, :name) do |b| %>
<%= b.label do %>
<%= b.check_box + t("admin.banners.banner.sections.#{b.text}") %>
<% end %>
@@ -45,12 +45,12 @@
</div>
<div class="row">
<div class="small-12 medium-6 large-3 column">
<%= f.label :background_color, nil, for: "background_color_input" %>
<div class="small-12 medium-6 large-3 column background-color-inputs">
<%= f.label :background_color, nil, for: "background_color_input", id: "background_color_label" %>
<p class="help-text"><%= t("admin.shared.color_help") %></p>
<div class="row collapse">
<div class="small-12 medium-6 column">
<%= f.text_field :background_color, label: false, type: :color %>
<%= f.text_field :background_color, label: false, type: :color, "aria-labelledby": "background_color_label" %>
</div>
<div class="small-12 medium-6 column">
<%= f.text_field :background_color, label: false, id: "background_color_input" %>
@@ -58,12 +58,12 @@
</div>
</div>
<div class="small-12 medium-6 large-3 column end">
<%= f.label :font_color, nil, for: "font_color_input" %>
<div class="small-12 medium-6 large-3 column end font-color-inputs">
<%= f.label :font_color, nil, for: "font_color_input", id: "font_color_label" %>
<p class="help-text"><%= t("admin.shared.color_help") %></p>
<div class="row collapse">
<div class="small-12 medium-6 column">
<%= f.text_field :font_color, label: false, type: :color %>
<%= f.text_field :font_color, label: false, type: :color, "aria-labelledby": "font_color_label" %>
</div>
<div class="small-12 medium-6 column">
<%= f.text_field :font_color, label: false, id: "font_color_input" %>
@@ -79,6 +79,6 @@
</div>
<div class="row">
<%= render Shared::BannerComponent.new(@banner) %>
<%= render Shared::BannerComponent.new(banner) %>
</div>
<% end %>

View File

@@ -0,0 +1,15 @@
class Admin::Banners::FormComponent < ApplicationComponent
include TranslatableFormHelper
include GlobalizeHelper
attr_reader :banner
def initialize(banner)
@banner = banner
end
private
def sections
WebSection.all
end
end

View File

@@ -0,0 +1,78 @@
<%= form_tag(admin_budget_budget_investments_path(budget), method: :get, enforce_utf8: false, class: "admin-budget-investments-search-form") do %>
<div class="small-12 column">
<%= button_tag t("admin.budget_investments.index.advanced_filters"),
type: :button,
data: { toggle: "advanced_filters" },
class: "advanced-filters" %>
</div>
<div id="advanced_filters" class="<%= advanced_menu_visibility %>" data-toggler=".hide">
<div class="small-12 column">
<div class="advanced-filters-content">
<% %w[feasible selected undecided unfeasible without_admin without_valuator under_valuation
valuation_finished winners].each do |filter| %>
<div class="filter">
<%= check_box_tag "advanced_filters[]", filter, advanced_filters_params.index(filter), id: "advanced_filters_#{filter}" %>
<%= label_tag "advanced_filters[#{filter}]", t("admin.budget_investments.index.filters.#{filter}") %>
</div>
<% end %>
<div>
<div class="filter">
<%= label_tag :min_total_supports, t("admin.budget_investments.index.filters.min_total_supports") %>
<%= text_field_tag :min_total_supports, params["min_total_supports"] %>
</div>
<div class="filter">
<%= label_tag :max_total_supports, t("admin.budget_investments.index.filters.max_total_supports") %>
<%= text_field_tag :max_total_supports, params["max_total_supports"] %>
</div>
</div>
</div>
</div>
</div>
<div class="basic-filters">
<div class="filter">
<%= label_tag :administrator_id, attribute_name(:administrator_id) %>
<%= select_tag :administrator_id,
options_for_select(admin_select_options, params[:administrator_id]),
{ prompt: t("admin.budget_investments.index.administrator_filter_all") } %>
</div>
<div class="filter">
<%= label_tag :valuator_or_group_id, t("admin.budget_investments.index.basic_filters.valuator_or_group") %>
<%= select_tag :valuator_or_group_id,
options_for_select(valuator_or_group_select_options, params[:valuator_or_group_id]),
{ prompt: t("admin.budget_investments.index.valuator_filter_all") } %>
</div>
<div class="filter">
<%= label_tag :heading_id, attribute_name(:heading_id) %>
<%= select_tag :heading_id,
options_for_select(budget_heading_select_options(budget), params[:heading_id]),
{ prompt: t("admin.budget_investments.index.heading_filter_all") } %>
</div>
<div class="filter">
<%= label_tag :tag_name, attribute_name(:valuation_tag_list) %>
<%= select_tag :tag_name,
options_for_select(investment_tags_select_options("valuation_tags"), params[:tag_name]),
{ prompt: t("admin.budget_investments.index.tags_filter_all") } %>
</div>
<div class="filter">
<%= label_tag :milestone_tag_name, attribute_name(:milestone_tag_list) %>
<%= select_tag :milestone_tag_name,
options_for_select(investment_tags_select_options("milestone_tags"), params[:milestone_tag_name]),
{ prompt: t("admin.budget_investments.index.milestone_tags_filter_all") } %>
</div>
<div class="filter title-or-id-filter">
<%= label_tag :title_or_id, t("admin.budget_investments.index.basic_filters.title_or_id") %>
<%= text_field_tag :title_or_id, params["title_or_id"] %>
</div>
<div class="filter">
<%= submit_tag t("admin.budget_investments.index.buttons.filter"), class: "button expanded" %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,49 @@
class Admin::BudgetInvestments::SearchFormComponent < ApplicationComponent
attr_reader :budget
use_helpers :budget_heading_select_options
def initialize(budget)
@budget = budget
end
private
def attribute_name(attribute)
Budget::Investment.human_attribute_name(attribute)
end
def advanced_filters_params
params[:advanced_filters] ||= []
end
def advanced_menu_visibility
if advanced_filters_params.empty? &&
params["min_total_supports"].blank? &&
params["max_total_supports"].blank?
"hide"
else
""
end
end
def admin_select_options
budget.administrators.with_user.map { |v| [v.description_or_name, v.id] }.sort_by { |a| a[0] }
end
def valuator_or_group_select_options
valuator_group_select_options + valuator_select_options
end
def valuator_group_select_options
ValuatorGroup.order("name ASC").map { |g| [g.name, "group_#{g.id}"] }
end
def valuator_select_options
budget.valuators.order("description ASC").order("users.email ASC").includes(:user)
.map { |v| [v.description_or_email, "valuator_#{v.id}"] }
end
def investment_tags_select_options(context)
budget.investments.tags_on(context).order(:name).pluck(:name)
end
end

View File

@@ -24,14 +24,14 @@
<%= f.text_area :geojson, rows: "10", hint: t("admin.geozones.geozone.geojson_help") %>
</div>
<div class="small-12 large-3 column">
<%= f.label :color, nil, for: "color_input", id: "color_input_label" %>
<div class="small-12 large-3 column color-inputs">
<%= f.label :color, nil, for: "color_input", id: "color_label" %>
<p class="help-text">
<%= t("admin.geozones.geozone.color_help", format_help: t("admin.shared.color_help")) %>
</p>
<div class="row collapse">
<div class="small-12 medium-6 column">
<%= f.text_field :color, label: false, type: :color %>
<%= f.text_field :color, label: false, type: :color, "aria-labelledby": "color_label" %>
</div>
<div class="small-12 medium-6 column">
<%= f.text_field :color, label: false, id: "color_input" %>

View File

@@ -1,8 +1,8 @@
<%= render "shared/globalize_locales", resource: @process %>
<%= render "shared/globalize_locales", resource: process %>
<%= translatable_form_for [:admin, @process], html: { class: "legislation-process-form" } do |f| %>
<%= translatable_form_for [:admin, process], html: { class: "legislation-process-form" } do |f| %>
<%= render "shared/errors", resource: @process %>
<%= render "shared/errors", resource: process %>
<fieldset>
<legend class="small-12 medium-4 column">
@@ -18,7 +18,7 @@
<%= f.date_field :draft_end_date, id: "draft_end_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :draft_phase_enabled, checked: @process.draft_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :draft_phase_enabled, checked: process.draft_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -35,7 +35,7 @@
<%= f.date_field :end_date, id: "end_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :published, checked: @process.published?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :published, checked: process.published?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -52,7 +52,7 @@
<%= f.date_field :debate_end_date, id: "debate_end_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :debate_phase_enabled, checked: @process.debate_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :debate_phase_enabled, checked: process.debate_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -69,7 +69,7 @@
<%= f.date_field :proposals_phase_end_date, id: "proposals_phase_end_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :proposals_phase_enabled, checked: @process.proposals_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :proposals_phase_enabled, checked: process.proposals_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -86,7 +86,7 @@
<%= f.date_field :allegations_end_date, id: "allegations_end_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :allegations_phase_enabled, checked: @process.allegations_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :allegations_phase_enabled, checked: process.allegations_phase.enabled?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -95,7 +95,7 @@
<%= f.date_field :draft_publication_date, id: "draft_publication_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :draft_publication_enabled, checked: @process.draft_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :draft_publication_enabled, checked: process.draft_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -104,7 +104,7 @@
<%= f.date_field :result_publication_date, id: "result_publication_date" %>
</div>
<div class="small-12 medium-2 column margin-top">
<%= f.check_box :result_publication_enabled, checked: @process.result_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
<%= f.check_box :result_publication_enabled, checked: process.result_publication.enabled?, label: t("admin.legislation.processes.form.enabled") %>
</div>
</fieldset>
@@ -121,12 +121,12 @@
<h3><%= t("admin.legislation.processes.form.banner_title") %></h3>
</div>
<div class="small-6 large-3 column">
<%= f.label :background_color, nil, for: "background_color_input" %>
<div class="small-6 large-3 column background-color-inputs">
<%= f.label :background_color, nil, for: "background_color_input", id: "background_color_label" %>
<p class="help-text"><%= t("admin.shared.color_help") %></p>
<div class="row collapse">
<div class="small-12 medium-6 column">
<%= f.text_field :background_color, label: false, type: :color %>
<%= f.text_field :background_color, label: false, type: :color, "aria-labelledby": "background_color_label" %>
</div>
<div class="small-12 medium-6 column">
<%= f.text_field :background_color, label: false, id: "background_color_input" %>
@@ -134,12 +134,12 @@
</div>
</div>
<div class="small-6 large-3 column end">
<%= f.label :font_color, nil, for: "font_color_input" %>
<div class="small-6 large-3 column end font-color-inputs">
<%= f.label :font_color, nil, for: "font_color_input", id: "font_color_label" %>
<p class="help-text"><%= t("admin.shared.color_help") %></p>
<div class="row collapse">
<div class="small-12 medium-6 column">
<%= f.text_field :font_color, label: false, type: :color %>
<%= f.text_field :font_color, label: false, type: :color, "aria-labelledby": "font_color_label" %>
</div>
<div class="small-12 medium-6 column">
<%= f.text_field :font_color, label: false, id: "font_color_input" %>
@@ -182,7 +182,7 @@
<div class="row">
<div class="small-12 medium-3 column clear end">
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(process)}.submit_button")) %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,11 @@
class Admin::Legislation::Processes::FormComponent < ApplicationComponent
include TranslatableFormHelper
include GlobalizeHelper
attr_reader :process
use_helpers :admin_submit_action
def initialize(process)
@process = process
end
end

View File

@@ -1,6 +1,6 @@
<%= render "shared/globalize_locales", resource: @progress_bar %>
<%= render "shared/globalize_locales", resource: progress_bar %>
<%= translatable_form_for @progress_bar, url: admin_polymorphic_path(@progress_bar) do |f| %>
<%= translatable_form_for progress_bar, url: admin_polymorphic_path(progress_bar) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
@@ -16,13 +16,13 @@
<% end %>
</div>
<% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %>
<div class="row">
<div class="row percentage-inputs">
<div class="small-12 medium-6 large-2 column">
<%= f.label :percentage %>
<%= f.label :percentage, nil, id: "percentage_label" %>
<%= f.text_field :percentage, { type: :range,
id: "percentage_range",
label: false,
"aria-labelledby": "percentage_label",
class: "column" }.merge(progress_options) %>
</div>

View File

@@ -0,0 +1,15 @@
class Admin::ProgressBars::FormComponent < ApplicationComponent
include TranslatableFormHelper
include GlobalizeHelper
attr_reader :progress_bar
def initialize(progress_bar)
@progress_bar = progress_bar
end
private
def progress_options
{ min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 }
end
end

View File

@@ -12,7 +12,7 @@
<% images.each do |image| %>
<tr id="image_<%= image.name %>">
<td>
<strong><%= image.name %></strong> (<%= image.required_width %>x<%= image.required_height %>)
<%= image_description(image) %>
</td>
<td>
<%= render Admin::SiteCustomization::Images::TableActionsComponent.new(image) %>

View File

@@ -11,4 +11,17 @@ class Admin::SiteCustomization::Images::IndexComponent < ApplicationComponent
def title
t("admin.site_customization.images.index.title")
end
def image_description(image)
safe_join([
tag.strong(image.name),
tag.span(image_hint(image), id: dom_id(image, :hint))
], " ")
end
def image_hint(image)
t("admin.site_customization.images.index.dimensions",
width: image.required_width,
height: image.required_height)
end
end

View File

@@ -2,7 +2,10 @@
<%= form_for([:admin, image], html: { id: "edit_#{dom_id(image)}" }) do |f| %>
<div>
<%= image_tag image.image if image.persisted_attachment? %>
<%= f.file_field :image, label: false %>
<%= f.file_field :image,
label: false,
"aria-label": image.name,
"aria-describedby": dom_id(image, :hint) %>
</div>
<%= f.submit(t("admin.site_customization.images.index.update"), class: "button hollow") %>

View File

@@ -6,7 +6,7 @@
<% end %>
<% contents.each do |group| %>
<% group.each do |content| %>
<b><%= content.key %></b>
<%= hidden_field_tag "contents[content_#{content.key}][id]", content.key %>
<% (content.globalize_locales & enabled_locales.map(&:to_sym)).each do |locale| %>
<%= render Admin::SiteCustomization::InformationTexts::FormFieldComponent.new(content, locale: locale) %>
<% end %>

View File

@@ -1,9 +1,6 @@
<% globalize(locale) do %>
<%= hidden_field_tag "contents[content_#{i18n_content.key}][id]", i18n_content.key %>
<%= text_area_tag "contents[content_#{i18n_content.key}]values[value_#{locale}]",
text,
rows: 5,
class: "js-globalize-attribute",
style: site_customization_display_translation_style,
data: { locale: locale } %>
<div class="js-globalize-attribute" data-locale="<%= locale %>" style="<%= display_style %>">
<%= label_tag html_id, i18n_key %>
<%= text_area_tag html_name, text, id: html_id, rows: 5 %>
</div>
<% end %>

View File

@@ -20,10 +20,22 @@ class Admin::SiteCustomization::InformationTexts::FormFieldComponent < Applicati
end
def i18n_text
I18n.translate(i18n_content.key, locale: locale)
I18n.translate(i18n_key, locale: locale)
end
def site_customization_display_translation_style
def i18n_key
i18n_content.key
end
def html_id
html_name.tr("[", "_").tr("]", "")
end
def html_name
"contents[content_#{i18n_key}]values[value_#{locale}]"
end
def display_style
site_customization_enable_translation?(locale) ? "" : "display: none;"
end
end

View File

@@ -1,25 +1,29 @@
<%= form_for(Budget::Investment.new, url: url, as: :budget_investment, method: :get) do |f| %>
<%= form_tag(url, options) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<%= label_tag :search, search_label_text %>
<%= text_field_tag :search, "" %>
</div>
<div class="small-12 medium-6 column">
<%= label_tag :heading_id, attribute_name(:heading_id) %>
<%= select_tag :heading_id,
options_for_select(budget_heading_select_options(@budget),
options_for_select(budget_heading_select_options(budget),
params[:heading_id]),
include_blank: true %>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 column">
<%= check_box_tag :unfeasible, "1", params[:unfeasible].present? %>
<%= t("admin.budget_investments.search_unfeasible") %>
<div class="small-12 column">
<%= label_tag :unfeasible, class: "checkbox-label" do %>
<%= check_box_tag :unfeasible, "1", params[:unfeasible].present? %>
<%= t("admin.budget_investments.search_unfeasible") %>
<% end %>
</div>
</div>
<div class="row">
<div class="form-inline small-12 medium-3 column end">
<%= f.submit t("shared.search"), class: "button" %>
<%= submit_tag t("shared.search"), class: "button" %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,26 @@
class Management::Budgets::Investments::SearchComponent < ApplicationComponent
attr_reader :budget, :url
use_helpers :budget_heading_select_options
def initialize(budget, url:)
@budget = budget
@url = url
end
private
def options
{
method: :get,
class: "management-investments-search"
}
end
def search_label_text
t("management.budget_investments.search.label")
end
def attribute_name(attribute)
Budget::Investment.human_attribute_name(attribute)
end
end

View File

@@ -6,9 +6,9 @@
<%= selected_languages_description %>
</strong>
</span>
<%= label_tag :select_language, t("shared.translations.current_language") %>
<%= select_tag :select_language,
options_for_select_language,
prompt: t("shared.translations.select_language_prompt"),
class: "js-select-language" %>
<%= select_language_error %>
<div class="margin-bottom">
@@ -24,9 +24,10 @@
</div>
<div class="small-6 large-3 column margin-top end">
<% if manage_languages %>
<%= label_tag :add_language, t("shared.translations.add_language") %>
<%= select_tag :add_language,
options_for_add_language,
prompt: t("shared.translations.add_language"),
prompt: "",
class: "js-add-language" %>
<% end %>
</div>

View File

@@ -69,8 +69,4 @@ class Admin::AdminNotificationsController < Admin::BaseController
def allowed_params
[:link, :segment_recipient, translation_params(AdminNotification)]
end
def resource
AdminNotification.find(params[:id])
end
end

View File

@@ -3,8 +3,6 @@ class Admin::BannersController < Admin::BaseController
has_filters %w[all with_active with_inactive], only: :index
before_action :banner_sections, only: [:edit, :new, :create, :update]
respond_to :html, :js
load_and_authorize_resource
@@ -46,12 +44,4 @@ class Admin::BannersController < Admin::BaseController
translation_params(Banner),
web_section_ids: []]
end
def banner_sections
@banner_sections = WebSection.all
end
def resource
@banner ||= Banner.find(params[:id])
end
end

View File

@@ -45,8 +45,4 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
def allowed_params
[:status, :final_version, translation_params(Legislation::DraftVersion)]
end
def resource
@draft_version
end
end

View File

@@ -26,8 +26,4 @@ class Admin::Legislation::HomepagesController < Admin::Legislation::BaseControll
def allowed_params
[:homepage, :homepage_enabled, translation_params(::Legislation::Process)]
end
def resource
@process || ::Legislation::Process.find(params[:id])
end
end

View File

@@ -77,8 +77,4 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
image_attributes: image_attributes
]
end
def resource
@process || ::Legislation::Process.find(params[:id])
end
end

View File

@@ -55,8 +55,4 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
translation_params(::Legislation::QuestionOption)]
]
end
def resource
@question || ::Legislation::Question.find(params[:id])
end
end

View File

@@ -15,10 +15,6 @@ class Admin::SiteCustomization::InformationTextsController < Admin::SiteCustomiz
private
def resource
I18nContent.find(content_params[:id])
end
def content_params
params.require(:contents).values
end

View File

@@ -43,8 +43,4 @@ class Admin::SiteCustomization::PagesController < Admin::SiteCustomization::Base
[*attributes, translation_params(SiteCustomization::Page)]
end
def resource
SiteCustomization::Page.find(params[:id])
end
end

View File

@@ -1,36 +0,0 @@
module AdminBudgetInvestmentsHelper
def advanced_menu_visibility
if params[:advanced_filters].empty? &&
params["min_total_supports"].blank? &&
params["max_total_supports"].blank?
"hide"
else
""
end
end
def init_advanced_menu
params[:advanced_filters] = [] unless params[:advanced_filters]
end
def admin_select_options(budget)
budget.administrators.with_user.map { |v| [v.description_or_name, v.id] }.sort_by { |a| a[0] }
end
def valuator_or_group_select_options(budget)
valuator_group_select_options + valuator_select_options(budget)
end
def valuator_select_options(budget)
budget.valuators.order("description ASC").order("users.email ASC").includes(:user)
.map { |v| [v.description_or_email, "valuator_#{v.id}"] }
end
def valuator_group_select_options
ValuatorGroup.order("name ASC").map { |g| [g.name, "group_#{g.id}"] }
end
def investment_tags_select_options(budget, context)
budget.investments.tags_on(context).order(:name).pluck(:name)
end
end

View File

@@ -5,6 +5,6 @@
<h1><%= t("admin.banners.edit.editing") %></h1>
<%= render "form" %>
<%= render Admin::Banners::FormComponent.new(@banner) %>
</div>
</div>

View File

@@ -5,6 +5,6 @@
<h1><%= t("admin.banners.new.creating") %></h1>
<%= render "form" %>
<%= render Admin::Banners::FormComponent.new(@banner) %>
</div>
</div>

View File

@@ -1,71 +0,0 @@
<% init_advanced_menu %>
<%= form_tag(admin_budget_budget_investments_path(budget: @budget), method: :get, enforce_utf8: false) do %>
<div class="small-12 column">
<%= link_to "#advanced_filters_content",
data: { toggle: "advanced_filters" },
class: "advanced-filters float-right clear" do %>
<%= t("admin.budget_investments.index.advanced_filters") %>
<% end %>
</div>
<div id="advanced_filters" class="<%= advanced_menu_visibility %>" data-toggler=".hide">
<div class="small-12 column">
<div class="advanced-filters-content">
<% %w[feasible selected undecided unfeasible without_admin without_valuator under_valuation
valuation_finished winners].each do |filter| %>
<div class="filter">
<%= check_box_tag "advanced_filters[]", filter, params[:advanced_filters].index(filter), id: "advanced_filters_#{filter}" %>
<%= label_tag "advanced_filters[#{filter}]", t("admin.budget_investments.index.filters.#{filter}") %>
</div>
<% end %>
<div>
<div class="filter">
<%= label_tag :min_total_supports, t("admin.budget_investments.index.filters.min_total_supports") %>
<%= text_field_tag :min_total_supports, params["min_total_supports"] %>
</div>
<div class="filter">
<%= label_tag :max_total_supports, t("admin.budget_investments.index.filters.max_total_supports") %>
<%= text_field_tag :max_total_supports, params["max_total_supports"] %>
</div>
</div>
</div>
</div>
</div>
<div class="small-12 medium-3 column">
<%= select_tag :administrator_id,
options_for_select(admin_select_options(@budget), params[:administrator_id]),
{ prompt: t("admin.budget_investments.index.administrator_filter_all") } %>
</div>
<div class="small-12 medium-3 column">
<%= select_tag :valuator_or_group_id,
options_for_select(valuator_or_group_select_options(@budget), params[:valuator_or_group_id]),
{ prompt: t("admin.budget_investments.index.valuator_filter_all") } %>
</div>
<div class="small-12 medium-3 column">
<%= select_tag :heading_id,
options_for_select(budget_heading_select_options(@budget), params[:heading_id]),
{ prompt: t("admin.budget_investments.index.heading_filter_all") } %>
</div>
<div class="small-12 medium-3 column">
<%= select_tag :tag_name,
options_for_select(investment_tags_select_options(@budget, "valuation_tags"), params[:tag_name]),
{ prompt: t("admin.budget_investments.index.tags_filter_all") } %>
</div>
<div class="small-12 medium-3 column">
<%= select_tag :milestone_tag_name,
options_for_select(investment_tags_select_options(@budget, "milestone_tags"), params[:milestone_tag_name]),
{ prompt: t("admin.budget_investments.index.milestone_tags_filter_all") } %>
</div>
<div class="small-12 medium-6 column">
<div class="input-group">
<%= text_field_tag :title_or_id, params["title_or_id"], placeholder: t("admin.budget_investments.index.placeholder") %>
</div>
</div>
<div class="small-12 medium-3 column end">
<%= submit_tag t("admin.budget_investments.index.buttons.filter"), class: "button expanded" %>
</div>
<% end %>

View File

@@ -8,7 +8,7 @@
<h2 class="inline-block"><%= @budget.name %> - <%= t("admin.budget_investments.index.title") %></h2>
<%= render "search_form" %>
<%= render Admin::BudgetInvestments::SearchFormComponent.new(@budget) %>
<%= render "/shared/filter_subnav", i18n_namespace: "admin.budget_investments.index" %>

View File

@@ -9,5 +9,5 @@
<%= render "subnav", process: @process, active: "info" %>
<%= render "form" %>
<%= render Admin::Legislation::Processes::FormComponent.new(@process) %>
</div>

View File

@@ -7,5 +7,5 @@
<h2><%= t("admin.legislation.processes.new.title") %></h2>
<%= render "form" %>
<%= render Admin::Legislation::Processes::FormComponent.new(@process) %>
</div>

View File

@@ -12,4 +12,4 @@
<h2><%= bar_title %></h2>
<%= render "form" %>
<%= render Admin::ProgressBars::FormComponent.new(@progress_bar) %>

View File

@@ -6,4 +6,4 @@
<h2><%= t("admin.progress_bars.new.creating") %></h2>
<%= render "form" %>
<%= render Admin::ProgressBars::FormComponent.new(@progress_bar) %>

View File

@@ -1,5 +1,5 @@
<span class="not-print">
<%= render "admin/shared/budget_investment_search", url: management_budget_investments_path(@budget) %>
<%= render Management::Budgets::Investments::SearchComponent.new(@budget, url: management_budget_investments_path(@budget)) %>
</span>
<div class="wrap row">

View File

@@ -1,5 +1,5 @@
<span class="not-print">
<%= render "admin/shared/budget_investment_search", url: print_management_budget_investments_path(@budget) %>
<%= render Management::Budgets::Investments::SearchComponent.new(@budget, url: print_management_budget_investments_path(@budget)) %>
</span>
<div class="wrap row">

View File

@@ -1,7 +1,7 @@
<h2><%= t("management.user_invites.new.title") %></h2>
<%= form_tag management_user_invites_path do %>
<label><%= t("management.user_invites.new.label") %></label>
<%= label_tag :emails, t("management.user_invites.new.label") %>
<p class="help-text" id="emails-help-text"><%= t("management.user_invites.new.info") %></p>
<%= text_area_tag "emails", nil, rows: 5,
aria: { describedby: "emails-help-text" } %>

View File

@@ -27,7 +27,11 @@
</div>
</td>
<td class="text-center">
<%= check_box_tag "budget_investment_ids[]", investment.id, nil, id: "#{dom_id(investment)}_check" %>
<%= check_box_tag "budget_investment_ids[]",
investment.id,
nil,
id: "#{dom_id(investment)}_check",
"aria-label": investment.title %>
</td>
</tr>
<% end %>

View File

@@ -12,7 +12,9 @@
<tr id="comment_<%= comment.id %>">
<td>
<%= comment.commentable_type.constantize.model_name.human %> -
<%= link_to comment.commentable.title, commentable_path(comment) %>
<%= link_to comment.commentable.title,
commentable_path(comment),
id: dom_id(comment, :title) %>
<br>
<span class="date"><%= l comment.updated_at.to_date %></span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
@@ -25,7 +27,11 @@
</div>
</td>
<td class="text-center">
<%= check_box_tag "comment_ids[]", comment.id, nil, id: "#{dom_id(comment)}_check" %>
<%= check_box_tag "comment_ids[]",
comment.id,
nil,
id: "#{dom_id(comment)}_check",
"aria-labelledby": dom_id(comment, :title) %>
</td>
</tr>
<% end %>

View File

@@ -24,7 +24,11 @@
</div>
</td>
<td class="text-center">
<%= check_box_tag "debate_ids[]", debate.id, nil, id: "#{dom_id(debate)}_check" %>
<%= check_box_tag "debate_ids[]",
debate.id,
nil,
id: "#{dom_id(debate)}_check",
"aria-label": debate.title %>
</td>
</tr>
<% end %>

View File

@@ -23,7 +23,8 @@
<%= check_box_tag "proposal_notification_ids[]",
proposal_notification.id,
nil,
id: "#{dom_id(proposal_notification)}_check" %>
id: "#{dom_id(proposal_notification)}_check",
"aria-label": proposal_notification.title %>
</td>
</tr>
<% end %>

View File

@@ -24,7 +24,11 @@
</div>
</td>
<td class="text-center">
<%= check_box_tag "proposal_ids[]", proposal.id, nil, id: "#{dom_id(proposal)}_check" %>
<%= check_box_tag "proposal_ids[]",
proposal.id,
nil,
id: "#{dom_id(proposal)}_check",
"aria-label": proposal.title %>
</td>
</tr>
<% end %>

View File

@@ -38,7 +38,7 @@
<div class="small-12 medium-5 column end">
<div class="inline-block">
<%= f.label t("verification.residence.new.document_number") %>
<%= f.label :document_number, t("verification.residence.new.document_number") %>
</div>
<button type="button" class="inline-block" data-toggle="info-document-number">

View File

@@ -235,12 +235,14 @@ en:
title: "%{budget} phases"
budget_investments:
index:
basic_filters:
valuator_or_group: Valuator or group
title_or_id: Title or ID
heading_filter_all: All headings
administrator_filter_all: All administrators
valuator_filter_all: All valuators
tags_filter_all: All tags
advanced_filters: Advanced filters
placeholder: Search projects
filters:
all: All
without_admin: Without assigned admin
@@ -1615,6 +1617,7 @@ en:
subnavigation_right: Main Navigation Right
images:
index:
dimensions: "(%{width}x%{height})"
title: Custom images
update: Update
image: Image

View File

@@ -742,7 +742,7 @@ en:
see_more: See more recommendations
hide: Hide recommendations
translations:
select_language_prompt: Choose language
current_language: Current language
remove_language: Remove language
add_language: Add language
languages_in_use:

View File

@@ -95,6 +95,8 @@ en:
unfeasible: Unfeasible investment
print:
print_button: Print
search:
label: "Search investments"
search_results:
one: " containing the term '%{search_term}'"
other: " containing the term '%{search_term}'"

View File

@@ -235,12 +235,14 @@ es:
title: "Fases de %{budget}"
budget_investments:
index:
basic_filters:
valuator_or_group: Evaluador o grupo
title_or_id: Título o ID
heading_filter_all: Todas las partidas
administrator_filter_all: Todos los administradores
valuator_filter_all: Todos los evaluadores
tags_filter_all: Todas las etiquetas
advanced_filters: Filtros avanzados
placeholder: Buscar proyectos
filters:
all: Todos
without_admin: Sin administrador
@@ -1615,6 +1617,7 @@ es:
subnavigation_right: Navegación principal derecha
images:
index:
dimensions: "(%{width}x%{height})"
title: Personalizar imágenes
update: Actualizar
image: Imagen

View File

@@ -742,7 +742,7 @@ es:
see_more: Ver más recomendaciones
hide: Ocultar recomendaciones
translations:
select_language_prompt: Seleccionar idioma
current_language: Idioma actual
remove_language: Eliminar idioma
add_language: Añadir idioma
languages_in_use:

View File

@@ -95,6 +95,8 @@ es:
unfeasible: Proyectos no factibles
print:
print_button: Imprimir
search:
label: "Buscar proyectos"
search_results:
one: " que contiene '%{search_term}'"
other: " que contienen '%{search_term}'"

View File

@@ -0,0 +1,38 @@
require "rails_helper"
describe Admin::Banners::FormComponent do
let(:banner) { build(:banner) }
let(:component) { Admin::Banners::FormComponent.new(banner) }
describe "background color fields" do
it "renders two inputs sharing the same label" do
render_inline component
page.find(".background-color-inputs") do |color_inputs|
expect(color_inputs).to have_css "input", count: 2
expect(color_inputs).to have_css "label", count: 1
expect(color_inputs).to have_css "label#background_color_label[for=background_color_input]"
expect(color_inputs.all("input")[0][:"aria-labelledby"]).to eq "background_color_label"
expect(color_inputs.all("input")[0][:id]).not_to eq "background_color_input"
expect(color_inputs.all("input")[1][:id]).to eq "background_color_input"
end
end
end
describe "font color fields" do
it "renders two inputs sharing the same label" do
render_inline component
page.find(".font-color-inputs") do |color_inputs|
expect(color_inputs).to have_css "input", count: 2
expect(color_inputs).to have_css "label", count: 1
expect(color_inputs).to have_css "label#font_color_label[for=font_color_input]"
expect(color_inputs.all("input")[0][:"aria-labelledby"]).to eq "font_color_label"
expect(color_inputs.all("input")[0][:id]).not_to eq "font_color_input"
expect(color_inputs.all("input")[1][:id]).to eq "font_color_input"
end
end
end
end

View File

@@ -1,19 +1,23 @@
require "rails_helper"
describe AdminBudgetInvestmentsHelper do
describe Admin::BudgetInvestments::SearchFormComponent do
describe "#admin_select_options" do
it "includes administrators assigned to the budget" do
admin = create(:administrator, user: create(:user, username: "Winston"))
budget = create(:budget, administrators: [admin])
expect(admin_select_options(budget)).to eq([["Winston", admin.id]])
render_inline Admin::BudgetInvestments::SearchFormComponent.new(budget)
expect(page).to have_select options: ["All administrators", "Winston"]
end
it "does not include other administrators" do
create(:administrator, user: create(:user, username: "Winston"))
budget = create(:budget, administrators: [])
expect(admin_select_options(budget)).to be_empty
render_inline Admin::BudgetInvestments::SearchFormComponent.new(budget)
expect(page).to have_select options: ["All administrators"]
end
end
@@ -22,14 +26,18 @@ describe AdminBudgetInvestmentsHelper do
valuator = create(:valuator, description: "Kodogo")
budget = create(:budget, valuators: [valuator])
expect(valuator_select_options(budget)).to eq([["Kodogo", "valuator_#{valuator.id}"]])
render_inline Admin::BudgetInvestments::SearchFormComponent.new(budget)
expect(page).to have_select options: ["All valuators", "Kodogo"]
end
it "does not include other valuators" do
create(:valuator, description: "Kodogo")
budget = create(:budget, valuators: [])
expect(valuator_select_options(budget)).to be_empty
render_inline Admin::BudgetInvestments::SearchFormComponent.new(budget)
expect(page).to have_select options: ["All valuators"]
end
end
end

View File

@@ -0,0 +1,22 @@
require "rails_helper"
describe Admin::Geozones::FormComponent do
let(:geozone) { build(:geozone) }
let(:component) { Admin::Geozones::FormComponent.new(geozone) }
describe "color fields" do
it "renders two inputs sharing the same label" do
render_inline component
page.find(".color-inputs") do |color_inputs|
expect(color_inputs).to have_css "input", count: 2
expect(color_inputs).to have_css "label", count: 1
expect(color_inputs).to have_css "label#color_label[for=color_input]"
expect(color_inputs.all("input")[0][:"aria-labelledby"]).to eq "color_label"
expect(color_inputs.all("input")[0][:id]).not_to eq "color_input"
expect(color_inputs.all("input")[1][:id]).to eq "color_input"
end
end
end
end

View File

@@ -0,0 +1,38 @@
require "rails_helper"
describe Admin::Legislation::Processes::FormComponent, :admin do
let(:process) { build(:legislation_process) }
let(:component) { Admin::Legislation::Processes::FormComponent.new(process) }
describe "background color fields" do
it "renders two inputs sharing the same label" do
render_inline component
page.find(".background-color-inputs") do |color_inputs|
expect(color_inputs).to have_css "input", count: 2
expect(color_inputs).to have_css "label", count: 1
expect(color_inputs).to have_css "label#background_color_label[for=background_color_input]"
expect(color_inputs.all("input")[0][:"aria-labelledby"]).to eq "background_color_label"
expect(color_inputs.all("input")[0][:id]).not_to eq "background_color_input"
expect(color_inputs.all("input")[1][:id]).to eq "background_color_input"
end
end
end
describe "font color fields" do
it "renders two inputs sharing the same label" do
render_inline component
page.find(".font-color-inputs") do |color_inputs|
expect(color_inputs).to have_css "input", count: 2
expect(color_inputs).to have_css "label", count: 1
expect(color_inputs).to have_css "label#font_color_label[for=font_color_input]"
expect(color_inputs.all("input")[0][:"aria-labelledby"]).to eq "font_color_label"
expect(color_inputs.all("input")[0][:id]).not_to eq "font_color_input"
expect(color_inputs.all("input")[1][:id]).to eq "font_color_input"
end
end
end
end

View File

@@ -0,0 +1,22 @@
require "rails_helper"
describe Admin::ProgressBars::FormComponent do
let(:progress_bar) { build(:progress_bar) }
let(:component) { Admin::ProgressBars::FormComponent.new(progress_bar) }
describe "percentage fields" do
it "renders two inputs sharing the same label" do
render_inline component
page.find(".percentage-inputs") do |percentage_inputs|
expect(percentage_inputs).to have_css "input:not([type=submit])", count: 2
expect(percentage_inputs).to have_css "label", count: 1
expect(percentage_inputs).to have_css "label#percentage_label[for=progress_bar_percentage]"
expect(percentage_inputs.all("input")[0][:"aria-labelledby"]).to eq "percentage_label"
expect(percentage_inputs.all("input")[0][:id]).not_to eq "percentage_input"
expect(percentage_inputs.all("input")[1][:id]).to eq "progress_bar_percentage"
end
end
end
end

View File

@@ -0,0 +1,17 @@
require "rails_helper"
describe Management::Budgets::Investments::SearchComponent do
include Rails.application.routes.url_helpers
let(:budget) { create(:budget) }
let(:url) { management_budget_investments_path(budget) }
let(:component) { Management::Budgets::Investments::SearchComponent.new(budget, url: url) }
it "renders a label for each field" do
render_inline component
expect(page).to have_field "Search investments"
expect(page).to have_select "Heading"
expect(page).to have_field "Search unfeasible", type: :checkbox
end
end

View File

@@ -8,13 +8,13 @@ describe Shared::GlobalizeLocalesComponent do
I18n.with_locale(:en) do
render_inline Shared::GlobalizeLocalesComponent.new
expect(page).to have_select options: ["Choose language", "English"]
expect(page).to have_select "Current language", options: ["English"]
end
I18n.with_locale(:es) do
render_inline Shared::GlobalizeLocalesComponent.new
expect(page).to have_select options: ["Seleccionar idioma"]
expect(page).to have_select "Idioma actual", options: []
end
end
end
@@ -43,7 +43,7 @@ describe Shared::GlobalizeLocalesComponent do
render_inline Shared::GlobalizeLocalesComponent.new
expect(page).to have_select options: ["Add language", "English", "Nederlands"]
expect(page).to have_select "Add language", options: ["", "English", "Nederlands"]
end
end
end

View File

@@ -95,7 +95,7 @@ describe "Admin banners magement", :admin do
expect_to_have_language_selected "English"
click_link "Remove language"
select "Français", from: "add_language"
select "Français", from: "Add language"
fill_in "Title", with: "En Français"
fill_in "Description", with: "Link en Français"

View File

@@ -144,7 +144,7 @@ describe "Admin budget groups", :admin do
visit edit_admin_budget_group_path(budget, group)
select "Español", from: :add_language
select "Español", from: "Add language"
fill_in "Group name", with: "Spanish name"
click_button "Save group"
@@ -156,7 +156,7 @@ describe "Admin budget groups", :admin do
visit edit_admin_budget_group_path(budget, group)
select "English", from: :select_language
select "English", from: "Current language"
fill_in "Group name", with: "New English Name"
click_button "Save group"

View File

@@ -181,7 +181,7 @@ describe "Admin budget headings", :admin do
visit edit_admin_budget_group_heading_path(budget, group, heading)
select "Español", from: :add_language
select "Español", from: "Add language"
fill_in "Heading name", with: "Spanish name"
click_button "Save heading"
@@ -193,7 +193,7 @@ describe "Admin budget headings", :admin do
visit edit_admin_budget_group_heading_path(budget, group, heading)
select "English", from: :select_language
select "English", from: "Current language"
fill_in "Heading name", with: "New English Name"
click_button "Save heading"

View File

@@ -98,28 +98,28 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Change name")
expect(page).to have_link("Plant trees")
select "Parks: Central Park", from: "heading_id"
select "Parks: Central Park", from: "Heading"
click_button "Filter"
expect(page).not_to have_link("Realocate visitors")
expect(page).not_to have_link("Change name")
expect(page).to have_link("Plant trees")
select "All headings", from: "heading_id"
select "All headings", from: "Heading"
click_button "Filter"
expect(page).to have_link("Realocate visitors")
expect(page).to have_link("Change name")
expect(page).to have_link("Plant trees")
select "Streets: Main Avenue", from: "heading_id"
select "Streets: Main Avenue", from: "Heading"
click_button "Filter"
expect(page).to have_link("Realocate visitors")
expect(page).not_to have_link("Change name")
expect(page).not_to have_link("Plant trees")
select "Streets: Mercy Street", from: "heading_id"
select "Streets: Mercy Street", from: "Heading"
click_button "Filter"
expect(page).not_to have_link("Realocate visitors")
@@ -142,28 +142,28 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Realocate visitors")
expect(page).to have_link("Destroy the city")
select "Admin 1", from: "administrator_id"
select "Admin 1", from: "Administrator"
click_button "Filter"
expect(page).to have_content("There is 1 investment")
expect(page).not_to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "Alias", from: "administrator_id"
select "Alias", from: "Administrator"
click_button "Filter"
expect(page).to have_content("There are no investment projects")
expect(page).not_to have_link("Destroy the city")
expect(page).not_to have_link("Realocate visitors")
select "All administrators", from: "administrator_id"
select "All administrators", from: "Administrator"
click_button "Filter"
expect(page).to have_content("There are 2 investments")
expect(page).to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "Admin 1", from: "administrator_id"
select "Admin 1", from: "Administrator"
click_button "Filter"
expect(page).to have_content("There is 1 investment")
@@ -183,21 +183,21 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Realocate visitors")
expect(page).to have_link("Destroy the city")
select "Valuator 1", from: "valuator_or_group_id"
select "Valuator 1", from: "Valuator or group"
click_button "Filter"
expect(page).to have_content("There is 1 investment")
expect(page).not_to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "All valuators", from: "valuator_or_group_id"
select "All valuators", from: "Valuator or group"
click_button "Filter"
expect(page).to have_content("There are 2 investments")
expect(page).to have_link("Destroy the city")
expect(page).to have_link("Realocate visitors")
select "Valuator 1", from: "valuator_or_group_id"
select "Valuator 1", from: "Valuator or group"
click_button "Filter"
expect(page).to have_content("There is 1 investment")
expect(page).not_to have_link("Destroy the city")
@@ -215,21 +215,21 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Build a hospital")
expect(page).to have_link("Build a theatre")
select "Health", from: "valuator_or_group_id"
select "Health", from: "Valuator or group"
click_button "Filter"
expect(page).to have_content("There is 1 investment")
expect(page).to have_link("Build a hospital")
expect(page).not_to have_link("Build a theatre")
select "All valuators", from: "valuator_or_group_id"
select "All valuators", from: "Valuator or group"
click_button "Filter"
expect(page).to have_content("There are 2 investments")
expect(page).to have_link("Build a hospital")
expect(page).to have_link("Build a theatre")
select "Culture", from: "valuator_or_group_id"
select "Culture", from: "Valuator or group"
click_button "Filter"
expect(page).to have_content("There is 1 investment")
@@ -245,7 +245,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Investment without admin")
expect(page).to have_link("Investment with admin")
click_link "Advanced filters"
click_button "Advanced filters"
check("Without assigned admin")
click_button "Filter"
@@ -269,7 +269,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Investment without valuator")
expect(page).to have_link("Investment with valuator")
click_link "Advanced filters"
click_button "Advanced filters"
check "Without assigned valuator"
click_button "Filter"
@@ -305,7 +305,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Investment without valuation")
expect(page).to have_link("Investment with valuation")
click_link "Advanced filters"
click_button "Advanced filters"
check "Under valuation"
click_button "Filter"
@@ -329,7 +329,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Investment valuation open")
expect(page).to have_link("Investment valuation finished")
click_link "Advanced filters"
click_button "Advanced filters"
check "Valuation finished"
click_button "Filter"
@@ -353,7 +353,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("Investment winner")
expect(page).to have_link("Investment without winner")
click_link "Advanced filters"
click_button "Advanced filters"
check "Winners"
click_button "Filter"
@@ -497,7 +497,7 @@ describe "Admin budget investments", :admin do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Winners"
click_button "Filter"
@@ -515,7 +515,7 @@ describe "Admin budget investments", :admin do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Winners"
click_button "Filter"
@@ -551,7 +551,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("St. 200 supports")
expect(page).to have_link("St. 300 supports")
click_link "Advanced filters"
click_button "Advanced filters"
fill_in "min_total_supports", with: 180
click_button "Filter"
@@ -587,7 +587,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_link("St. 200 supports")
expect(page).to have_link("St. 300 supports")
click_link "Advanced filters"
click_button "Advanced filters"
fill_in "max_total_supports", with: 180
click_button "Filter"
@@ -619,7 +619,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("More schools")
expect(page).to have_content("More hospitals")
select "Admin 1", from: "administrator_id"
select "Admin 1", from: "Administrator"
click_button "Filter"
expect(page).to have_css(".budget_investment", count: 2)
@@ -627,7 +627,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("More schools")
expect(page).not_to have_content("More hospitals")
fill_in "title_or_id", with: educate_children.id
fill_in "Title or ID", with: educate_children.id
click_button "Filter"
expect(page).to have_css(".budget_investment", count: 1)
@@ -651,7 +651,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("More schools")
expect(page).to have_content("More hospitals")
click_link "Advanced filters"
click_button "Advanced filters"
check("Feasible")
click_button "Filter"
@@ -661,7 +661,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("More schools")
expect(page).not_to have_content("More hospitals")
fill_in "title_or_id", with: educate_children.id
fill_in "Title or ID", with: educate_children.id
click_button "Filter"
expect(page).to have_css(".budget_investment", count: 1)
@@ -694,7 +694,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("More hospitals")
expect(page).to have_content("More hostals")
select "Admin 1", from: "administrator_id"
select "Admin 1", from: "Administrator"
click_button "Filter"
expect(page).to have_css(".budget_investment", count: 3)
@@ -703,7 +703,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("More hospitals")
expect(page).not_to have_content("More hostals")
click_link "Advanced filters"
click_button "Advanced filters"
within("#advanced_filters") { check("Feasible") }
click_button("Filter")
@@ -714,7 +714,7 @@ describe "Admin budget investments", :admin do
expect(page).not_to have_content("More hospitals")
expect(page).not_to have_content("More hostals")
fill_in "title_or_id", with: educate_children.id
fill_in "Title or ID", with: educate_children.id
click_button "Filter"
expect(page).to have_css(".budget_investment", count: 1)
@@ -759,13 +759,13 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("Proyecto de inversión")
expect(page).to have_content("Some other investment")
fill_in "title_or_id", with: "Proyecto de inversión"
fill_in "Title or ID", with: "Proyecto de inversión"
click_button "Filter"
expect(page).to have_content("Proyecto de inversión")
expect(page).not_to have_content("Some other investment")
fill_in "title_or_id", with: "Some other investment"
fill_in "Title or ID", with: "Some other investment"
click_button "Filter"
expect(page).not_to have_content("Proyecto de inversión")
@@ -778,7 +778,7 @@ describe "Admin budget investments", :admin do
expect(page).to have_content("Proyecto de inversión")
expect(page).to have_content("Some other investment")
fill_in "title_or_id", with: first_investment.id
fill_in "Title or ID", with: first_investment.id
click_button "Filter"
expect(page).to have_content("Some other investment")
@@ -1339,7 +1339,7 @@ describe "Admin budget investments", :admin do
scenario "Filtering by valuation and selection" do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Valuation finished"
click_button "Filter"
@@ -1384,7 +1384,7 @@ describe "Admin budget investments", :admin do
scenario "Aggregating results" do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
within("#advanced_filters") { check("Undecided") }
click_button("Filter")
@@ -1422,7 +1422,7 @@ describe "Admin budget investments", :admin do
end
end
click_link "Advanced filters"
click_button "Advanced filters"
within("#advanced_filters") { check("Selected") }
click_button("Filter")
@@ -1438,7 +1438,7 @@ describe "Admin budget investments", :admin do
scenario "Unselecting an investment" do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
within("#advanced_filters") { check("Selected") }
click_button("Filter")
@@ -1507,7 +1507,7 @@ describe "Admin budget investments", :admin do
investment2.update!(administrator: admin)
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Under valuation"
click_button "Filter"
@@ -1561,7 +1561,7 @@ describe "Admin budget investments", :admin do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Under valuation"
click_button "Filter"
@@ -1614,7 +1614,7 @@ describe "Admin budget investments", :admin do
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Under valuation"
click_button "Filter"
@@ -1704,7 +1704,7 @@ describe "Admin budget investments", :admin do
create(:budget_investment, :finished, budget: budget, title: "Finished Investment")
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Valuation finished"
click_button "Filter"

View File

@@ -315,7 +315,7 @@ describe "Admin budgets", :admin do
visit edit_admin_budget_path(budget)
select "Español", from: :add_language
select "Español", from: "Add language"
fill_in "Name", with: "Spanish name"
click_button "Update Budget"
@@ -327,7 +327,7 @@ describe "Admin budgets", :admin do
visit edit_admin_budget_path(budget)
select "English", from: :select_language
select "English", from: "Current language"
fill_in "Name", with: "New English Name"
click_button "Update Budget"
@@ -490,7 +490,7 @@ describe "Admin budgets", :admin do
create(:budget_investment, :winner, budget: budget)
visit admin_budget_budget_investments_path(budget)
click_link "Advanced filters"
click_button "Advanced filters"
check "Winners"
click_button "Filter"

View File

@@ -149,7 +149,7 @@ describe "Admin legislation questions", :admin do
find("#nested_question_options input").set("Option 1")
select "Español", from: :select_language
select "Español", from: "Current language"
find("#nested_question_options input").set("Opción 1")
@@ -158,7 +158,7 @@ describe "Admin legislation questions", :admin do
expect(page).to have_field(field_en[:id], with: "Option 1")
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field(field_es[:id], with: "Opción 1")
end
@@ -166,13 +166,13 @@ describe "Admin legislation questions", :admin do
scenario "Add new question option after changing active locale" do
visit edit_question_url
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Add option"
find("#nested_question_options input").set("Opción 1")
select "English", from: :select_language
select "English", from: "Current language"
find("#nested_question_options input").set("Option 1")
@@ -182,7 +182,7 @@ describe "Admin legislation questions", :admin do
expect(page).to have_field(field_en[:id], with: "Option 1")
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field(field_es[:id], with: "Opción 1")
end

View File

@@ -10,7 +10,7 @@ describe "Admin custom images", :admin do
end
within("tr#image_logo_header") do
attach_file "site_customization_image_image", file_fixture("logo_header.png")
attach_file "logo_header", file_fixture("logo_header.png")
click_button "Update"
end
@@ -22,7 +22,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path
within("tr#image_map") do
attach_file "site_customization_image_image", file_fixture("custom_map.jpg")
attach_file "map", file_fixture("custom_map.jpg")
click_button "Update"
end
@@ -38,7 +38,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path
within("tr#image_map") do
attach_file "site_customization_image_image", file_fixture("custom_map.jpg")
attach_file "map", file_fixture("custom_map.jpg")
click_button "Update"
end
@@ -78,7 +78,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path
within("tr#image_logo_email") do
attach_file "site_customization_image_image", file_fixture("logo_email_custom.png")
attach_file "logo_email", file_fixture("logo_email_custom.png")
click_button "Update"
end
@@ -93,7 +93,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path
within("tr#image_social_media_icon") do
attach_file "site_customization_image_image", file_fixture("logo_header.png")
attach_file "social_media_icon", file_fixture("logo_header.png")
click_button "Update"
end
@@ -105,7 +105,7 @@ describe "Admin custom images", :admin do
visit admin_site_customization_images_path
within("tr#image_social_media_icon") do
attach_file "site_customization_image_image", file_fixture("social_media_icon.png")
attach_file "social_media_icon", file_fixture("social_media_icon.png")
click_button "Update"
end

View File

@@ -67,7 +67,7 @@ describe "Admin custom information texts", :admin do
visit admin_site_customization_information_texts_path
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "contents[content_#{key}]values[value_fr]", with: "Aide personalise sur les débats"
click_button "Save"
@@ -75,7 +75,7 @@ describe "Admin custom information texts", :admin do
expect(page).to have_content "Translation updated successfully"
visit admin_site_customization_information_texts_path
select "Français", from: :select_language
select "Français", from: "Current language"
expect(page).to have_content "Aide personalise sur les débats"
expect(page).not_to have_content "Aide sur les débats"
@@ -87,14 +87,14 @@ describe "Admin custom information texts", :admin do
visit admin_site_customization_information_texts_path(tab: "proposals")
select "Français", from: :select_language
select "Français", from: "Current language"
fill_in "contents_content_#{key}values_value_fr", with: "Partager personalise"
click_button "Save"
expect(page).to have_content "Translation updated successfully"
visit admin_site_customization_information_texts_path(tab: "proposals")
select "Français", from: :select_language
select "Français", from: "Current language"
expect(page).to have_content "Partager personalise"
expect(page).not_to have_content "Partager la proposition"
@@ -111,14 +111,14 @@ describe "Admin custom information texts", :admin do
visit admin_site_customization_information_texts_path(tab: "debates")
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Remove language"
click_button "Save"
expect(page).not_to have_link "Español"
visit admin_site_customization_information_texts_path(tab: "debates")
select "English", from: :select_language
select "English", from: "Current language"
expect(page).to have_content "Start a new debate"
expect(page).to have_content "Custom featured"

View File

@@ -22,7 +22,7 @@ describe "Admin edit translatable records", :admin do
scenario "Maintains existing translations" do
visit path
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "Heading name", with: "Nom en Français"
click_button "Save heading"
@@ -30,11 +30,11 @@ describe "Admin edit translatable records", :admin do
expect(page).to have_field "Heading name", with: "Heading name in English"
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "Heading name", with: "Nombre de la partida en español"
select "Français", from: :select_language
select "Français", from: "Current language"
expect(page).to have_field "Heading name", with: "Nom en Français"
end
@@ -47,7 +47,7 @@ describe "Admin edit translatable records", :admin do
scenario "Maintains existing translations" do
visit path
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "Title", with: "Titre en Français"
fill_in "Subtitle", with: "Sous-titres en Français"
fill_in_ckeditor "Content", with: "Contenu en Français"
@@ -57,11 +57,11 @@ describe "Admin edit translatable records", :admin do
expect(page).to have_ckeditor "Content", with: "Content in English"
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_ckeditor "Content", with: "Contenido en español"
select "Français", from: :select_language
select "Français", from: "Current language"
expect(page).to have_ckeditor "Content", with: "Contenu en Français"
end
@@ -74,7 +74,7 @@ describe "Admin edit translatable records", :admin do
scenario "Maintains existing translations" do
visit path
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "Version title", with: "Titre en Français"
click_link class: "fullscreen-toggle"
fill_in "Text", with: "Texte en Français"
@@ -87,13 +87,13 @@ describe "Admin edit translatable records", :admin do
expect(page).to have_field "Text", with: "Text in English"
click_link class: "fullscreen-toggle"
select "Español", from: :select_language
select "Español", from: "Current language"
click_link class: "fullscreen-toggle"
expect(page).to have_field "Text", with: "Texto en español"
click_link class: "fullscreen-toggle"
select "Français", from: :select_language
select "Français", from: "Current language"
click_link class: "fullscreen-toggle"
expect(page).to have_field "Text", with: "Texte en Français"
@@ -107,7 +107,7 @@ describe "Admin edit translatable records", :admin do
scenario "Adds a translation for that locale" do
visit path
select "Português brasileiro", from: :add_language
select "Português brasileiro", from: "Add language"
fill_in "Question", with: "Português"
click_button "Save changes"
@@ -128,13 +128,13 @@ describe "Admin edit translatable records", :admin do
scenario "Shows validation erros" do
visit edit_admin_budget_path(translatable)
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "Name", with: ""
click_button "Update Budget"
expect(page).to have_css "#error_explanation"
select "Français", from: :select_language
select "Français", from: "Current language"
expect(page).to have_field "Name", with: "", class: "is-invalid-input"
end
@@ -146,14 +146,14 @@ describe "Admin edit translatable records", :admin do
scenario "Shows validation errors" do
visit edit_admin_budget_budget_investment_path(translatable.budget, translatable)
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "Title", with: "Titre en Français"
fill_in_ckeditor "Description", with: ""
click_button "Update"
expect(page).to have_css "#error_explanation"
select "Français", from: :select_language
select "Français", from: "Current language"
expect(page).to have_ckeditor "Description", with: ""
end
@@ -165,7 +165,7 @@ describe "Admin edit translatable records", :admin do
scenario "Shows validation errors" do
visit edit_admin_legislation_process_draft_version_path(translatable.process, translatable)
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in "Version title", with: "Titre en Français"
click_link class: "fullscreen-toggle"
fill_in "Text", with: ""
@@ -174,7 +174,7 @@ describe "Admin edit translatable records", :admin do
expect(page).to have_css "#error_explanation"
select "Français", from: :select_language
select "Français", from: "Current language"
click_link class: "fullscreen-toggle"
expect(page).to have_field "Text", with: "", class: "is-invalid-input"
@@ -190,7 +190,7 @@ describe "Admin edit translatable records", :admin do
scenario "Changes the existing translation" do
visit path
select "Español", from: :select_language
select "Español", from: "Current language"
within(".translatable-fields") do
fill_in "Title", with: "Título corregido"
@@ -221,7 +221,7 @@ describe "Admin edit translatable records", :admin do
scenario "Changes the existing translation" do
visit path
select "Español", from: :select_language
select "Español", from: "Current language"
within(".translatable-fields") do
fill_in "Answer", with: "Respuesta corregida"
@@ -266,7 +266,7 @@ describe "Admin edit translatable records", :admin do
scenario "Show validation errors" do
visit edit_admin_banner_path(translatable)
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "Title", with: "Title en español"
@@ -275,7 +275,7 @@ describe "Admin edit translatable records", :admin do
expect(page).to have_css "#error_explanation"
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "Title", with: "", class: "is-invalid-input"
end
@@ -287,7 +287,7 @@ describe "Admin edit translatable records", :admin do
scenario "Shows validation errors" do
visit edit_admin_legislation_process_draft_version_path(translatable.process, translatable)
select "Español", from: :select_language
select "Español", from: "Current language"
click_link class: "fullscreen-toggle"
expect(page).to have_field "Text", with: "Texto en español"
@@ -298,7 +298,7 @@ describe "Admin edit translatable records", :admin do
expect(page).to have_css "#error_explanation"
select "Español", from: :select_language
select "Español", from: "Current language"
click_link class: "fullscreen-toggle"
expect(page).to have_field "Text", with: ""
@@ -338,17 +338,17 @@ describe "Admin edit translatable records", :admin do
scenario "Keeps the other languages" do
visit path
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Remove language"
expect(page).not_to have_select :select_language, with_options: ["Español"]
expect(page).not_to have_select "Current language", with_options: ["Español"]
click_button "Save group"
visit path
expect(page).not_to have_select :select_language, with_options: ["Español"]
expect(page).to have_select :select_language, with_options: ["English"]
expect(page).not_to have_select "Current language", with_options: ["Español"]
expect(page).to have_select "Current language", with_options: ["English"]
end
end
@@ -389,10 +389,10 @@ describe "Admin edit translatable records", :admin do
scenario "Doesn't remove the translation" do
visit path
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Remove language"
select "English", from: :select_language
select "English", from: "Current language"
fill_in "Question", with: ""
click_button "Save"
@@ -402,7 +402,7 @@ describe "Admin edit translatable records", :admin do
expect_not_to_have_language "Español"
visit path
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "Question", with: "Pregunta en español"
end
@@ -417,9 +417,9 @@ describe "Admin edit translatable records", :admin do
visit edit_admin_admin_notification_path(translatable)
select "English", from: :select_language
select "English", from: "Current language"
click_link "Remove language"
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Remove language"
click_button "Update notification"
@@ -436,9 +436,9 @@ describe "Admin edit translatable records", :admin do
visit edit_admin_budget_budget_phase_path(translatable.budget, translatable)
select "English", from: :select_language
select "English", from: "Current language"
click_link "Remove language"
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Remove language"
click_button "Save changes"
@@ -458,9 +458,9 @@ describe "Admin edit translatable records", :admin do
visit edit_admin_active_polls_path(translatable)
select "English", from: :select_language
select "English", from: "Current language"
click_link "Remove language"
select "Español", from: :select_language
select "Español", from: "Current language"
click_link "Remove language"
click_button "Save"
@@ -496,20 +496,20 @@ describe "Admin edit translatable records", :admin do
scenario "Show selected locale form" do
visit path
expect(page).to have_field "contents_content_#{content.key}values_value_en", with: "Value in English"
expect(page).to have_field content.key, with: "Value in English"
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "contents_content_#{content.key}values_value_es", with: "Value en español"
expect(page).to have_field content.key, with: "Value en español"
end
scenario "Select a locale and add it to the form" do
visit path
select "Français", from: :add_language
select "Français", from: "Add language"
expect_to_have_language_selected "Français"
expect(page).to have_select :add_language, selected: "Add language"
expect(page).to have_select "Add language", selected: ""
expect(page).to have_field "contents_content_#{content.key}values_value_fr"
end
@@ -523,7 +523,7 @@ describe "Admin edit translatable records", :admin do
scenario "Increase description count after add new language" do
visit path
select "Français", from: :add_language
select "Français", from: "Add language"
expect(page).to have_content "3 languages in use"
end

View File

@@ -329,7 +329,7 @@ describe "Emails" do
login_as_manager
visit new_management_user_invite_path
fill_in "emails", with: " john@example.com, ana@example.com,isable@example.com "
fill_in "Emails", with: " john@example.com, ana@example.com,isable@example.com "
click_button "Send invitations"
expect(page).to have_content "3 invitations have been sent."

View File

@@ -143,7 +143,7 @@ describe "Budget Investments" do
click_link "Support budget investments"
end
fill_in "search", with: "what you got"
fill_in "Search investments", with: "what you got"
click_button "Search"
within("#budget-investments") do
@@ -170,7 +170,7 @@ describe "Budget Investments" do
click_link "Support budget investments"
end
fill_in "search", with: "Area 52"
fill_in "Search investments", with: "Area 52"
click_button "Search"
within("#budget-investments") do
@@ -523,8 +523,8 @@ describe "Budget Investments" do
expect(page).to have_content(low_investment.title)
end
select "District Nine", from: "heading_id"
click_button("Search")
select "District Nine", from: "Heading"
click_button "Search"
within "#budget-investments" do
expect(page).not_to have_content(unvoted_investment.title)

View File

@@ -55,9 +55,7 @@ describe "Moderate budget investments" do
visit moderation_budget_investments_path
click_link "All"
within("#investment_#{investment.id}") do
check "budget_investment_#{investment.id}_check"
end
check investment.title
end
scenario "Hide the investment" do

View File

@@ -49,9 +49,7 @@ describe "Moderate debates" do
visit moderation_debates_path
click_link "All"
within("#debate_#{debate.id}") do
check "debate_#{debate.id}_check"
end
check debate.title
end
scenario "Hide the debate" do

View File

@@ -57,9 +57,7 @@ describe "Moderate proposal notifications" do
visit moderation_proposal_notifications_path
click_link "All"
within("#proposal_notification_#{proposal_notification.id}") do
check "proposal_notification_#{proposal_notification.id}_check"
end
check proposal_notification.title
end
scenario "Hide the proposal" do

View File

@@ -48,9 +48,7 @@ describe "Moderate proposals" do
visit moderation_proposals_path
click_link "All"
within("#proposal_#{proposal.id}") do
check "proposal_#{proposal.id}_check"
end
check proposal.title
end
scenario "Hide the proposal" do

View File

@@ -43,7 +43,7 @@ describe "Public area translatable records" do
fill_in_new_investment_title with: "My awesome project"
fill_in_ckeditor "Description", with: "Everything is awesome!"
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in_new_investment_title with: "Titre en Français"
fill_in_ckeditor "Description", with: "Contenu en Français"
@@ -56,7 +56,7 @@ describe "Public area translatable records" do
scenario "Add only single translation at once not having the current locale" do
visit new_proposal_path
click_link "Remove language"
select "Français", from: :add_language
select "Français", from: "Add language"
fill_in_new_proposal_title with: "Titre en Français"
fill_in "Proposal summary", with: "Résumé en Français"
@@ -71,7 +71,7 @@ describe "Public area translatable records" do
visit new_budget_investment_path(budget)
click_link "Remove language"
select "Português brasileiro", from: :add_language
select "Português brasileiro", from: "Add language"
fill_in_new_investment_title with: "Titre en Français"
fill_in_ckeditor "Description", with: "Contenu en Français"
@@ -123,7 +123,7 @@ describe "Public area translatable records" do
scenario "Select a locale and add it to the form" do
visit new_budget_investment_path(create(:budget))
select "Français", from: :add_language
select "Français", from: "Add language"
expect(page).to have_field "Title", with: ""
end
@@ -147,7 +147,7 @@ describe "Public area translatable records" do
scenario "Increase description count after add new language" do
visit new_proposal_path
select "Español", from: :add_language
select "Español", from: "Add language"
expect(page).to have_content "2 languages in use"
end
@@ -195,7 +195,7 @@ describe "Public area translatable records" do
scenario "Changes the existing translation" do
visit path
select "Español", from: :select_language
select "Español", from: "Current language"
fill_in "Debate title", with: "Título corregido"
fill_in_ckeditor "Initial debate text", with: "Texto corregido"
@@ -218,7 +218,7 @@ describe "Public area translatable records" do
scenario "Show validation errors" do
visit edit_proposal_path(translatable)
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "Proposal title", with: "Título en español"
@@ -227,7 +227,7 @@ describe "Public area translatable records" do
expect(page).to have_css "#error_explanation"
select "Español", from: :select_language
select "Español", from: "Current language"
expect(page).to have_field "Proposal title", with: "", class: "is-invalid-input"
end

View File

@@ -5,7 +5,7 @@ describe "User invites" do
login_as_manager
visit new_management_user_invite_path
fill_in "emails", with: "john@example.com, ana@example.com, isable@example.com"
fill_in "Emails", with: "john@example.com, ana@example.com, isable@example.com"
click_button "Send invitations"
expect(page).to have_content "3 invitations have been sent."

View File

@@ -10,7 +10,7 @@ describe "Residence" do
visit account_path
click_link "Verify my account"
fill_in "residence_document_number", with: "12345678Z"
fill_in "Document number", with: "12345678Z"
select "DNI", from: "residence_document_type"
select_date "31-December-1980", from: "residence_date_of_birth"
fill_in "residence_postal_code", with: "28013"
@@ -28,7 +28,7 @@ describe "Residence" do
visit account_path
click_link "Verify my account"
fill_in "residence_document_number", with: "12345678Z"
fill_in "Document number", with: "12345678Z"
select "DNI", from: "residence_document_type"
select_date "31-December-1980", from: "residence_date_of_birth"
fill_in "residence_postal_code", with: "28013"
@@ -63,7 +63,7 @@ describe "Residence" do
visit account_path
click_link "Verify my account"
fill_in "residence_document_number", with: "12345678Z"
fill_in "Document number", with: "12345678Z"
select "DNI", from: "residence_document_type"
select_date "31-December-1980", from: "residence_date_of_birth"
fill_in "residence_postal_code", with: "28013"
@@ -98,7 +98,7 @@ describe "Residence" do
visit account_path
click_link "Verify my account"
fill_in "residence_document_number", with: "12345678Z"
fill_in "Document number", with: "12345678Z"
select "DNI", from: "residence_document_type"
select "1997", from: "residence_date_of_birth_1i"
select "January", from: "residence_date_of_birth_2i"
@@ -118,7 +118,7 @@ describe "Residence" do
visit account_path
click_link "Verify my account"
fill_in "residence_document_number", with: "12345678Z"
fill_in "Document number", with: "12345678Z"
select "DNI", from: "residence_document_type"
select "1997", from: "residence_date_of_birth_1i"
select "January", from: "residence_date_of_birth_2i"
@@ -139,7 +139,7 @@ describe "Residence" do
click_link "Verify my account"
5.times do
fill_in "residence_document_number", with: "12345678Z"
fill_in "Document number", with: "12345678Z"
select "DNI", from: "residence_document_type"
select "1997", from: "residence_date_of_birth_1i"
select "January", from: "residence_date_of_birth_2i"