Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys are aligned and values aren't) instead of the `table` style (both keys and values are aligned) because, even if we used both in the application, we used the `key` style a lot more. Furthermore, the `table` style looks strange in places where there are both very long and very short keys and sometimes we weren't even consistent with the `table` style, aligning some keys without aligning other keys. Ideally we could align hashes to "either key or table", so developers can decide whether keeping the symmetry of the code is worth it in a case-per-case basis, but Rubocop doesn't allow this option.
This commit is contained in:
13
.rubocop.yml
13
.rubocop.yml
@@ -64,6 +64,13 @@ Layout/FirstArrayElementIndentation:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
EnforcedStyle: consistent
|
EnforcedStyle: consistent
|
||||||
|
|
||||||
|
Layout/FirstHashElementIndentation:
|
||||||
|
Enabled: true
|
||||||
|
EnforcedStyle: consistent
|
||||||
|
|
||||||
|
Layout/HashAlignment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Layout/HeredocIndentation:
|
Layout/HeredocIndentation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@@ -92,6 +99,12 @@ Layout/MultilineArrayBraceLayout:
|
|||||||
Layout/MultilineBlockLayout:
|
Layout/MultilineBlockLayout:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/MultilineHashBraceLayout:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/MultilineHashKeyLineBreaks:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAfterColon:
|
Layout/SpaceAfterColon:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ class Admin::Budgets::ActionsComponent < ApplicationComponent
|
|||||||
balloting_phase = budget.phases.find_by(kind: "balloting")
|
balloting_phase = budget.phases.find_by(kind: "balloting")
|
||||||
|
|
||||||
admin_polls_path(poll: {
|
admin_polls_path(poll: {
|
||||||
name: budget.name,
|
name: budget.name,
|
||||||
budget_id: budget.id,
|
budget_id: budget.id,
|
||||||
starts_at: balloting_phase.starts_at,
|
starts_at: balloting_phase.starts_at,
|
||||||
ends_at: balloting_phase.ends_at
|
ends_at: balloting_phase.ends_at
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,6 @@
|
|||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= f.submit(value: t("admin.geozones.edit.form.submit_button"),
|
<%= f.submit(value: t("admin.geozones.edit.form.submit_button"),
|
||||||
class: "button success") %>
|
class: "button success") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
rows: 5,
|
rows: 5,
|
||||||
class: "js-globalize-attribute",
|
class: "js-globalize-attribute",
|
||||||
style: site_customization_display_translation_style(locale),
|
style: site_customization_display_translation_style(locale),
|
||||||
data: { locale: locale } %>
|
data: { locale: locale } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -51,10 +51,10 @@
|
|||||||
<% if feature?(:map) %>
|
<% if feature?(:map) %>
|
||||||
<div>
|
<div>
|
||||||
<%= render "map_locations/form_fields",
|
<%= render "map_locations/form_fields",
|
||||||
form: f,
|
form: f,
|
||||||
map_location: investment.map_location || MapLocation.new,
|
map_location: investment.map_location || MapLocation.new,
|
||||||
label: t("budgets.investments.form.map_location"),
|
label: t("budgets.investments.form.map_location"),
|
||||||
help: t("budgets.investments.form.map_location_instructions"),
|
help: t("budgets.investments.form.map_location_instructions"),
|
||||||
i18n_namespace: "budgets.investments" %>
|
i18n_namespace: "budgets.investments" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -80,11 +80,11 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<%= f.text_field :tag_list, value: investment.tag_list.to_s,
|
<%= f.text_field :tag_list, value: investment.tag_list.to_s,
|
||||||
label: false,
|
label: false,
|
||||||
placeholder: t("budgets.investments.form.tags_placeholder"),
|
placeholder: t("budgets.investments.form.tags_placeholder"),
|
||||||
aria: { describedby: "tags-list-help-text" },
|
aria: { describedby: "tags-list-help-text" },
|
||||||
class: "js-tag-list tag-autocomplete",
|
class: "js-tag-list tag-autocomplete",
|
||||||
data: { js_url: suggest_tags_path } %>
|
data: { js_url: suggest_tags_path } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render SDG::RelatedListSelectorComponent.new(f) %>
|
<%= render SDG::RelatedListSelectorComponent.new(f) %>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
title: t("budgets.investments.investment.support_title"),
|
title: t("budgets.investments.investment.support_title"),
|
||||||
method: "post",
|
method: "post",
|
||||||
remote: !display_support_alert?,
|
remote: !display_support_alert?,
|
||||||
data: ({ confirm: confirm_vote_message } if display_support_alert?),
|
data: ({ confirm: confirm_vote_message } if display_support_alert?),
|
||||||
"aria-label": support_aria_label %>
|
"aria-label": support_aria_label %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -29,10 +29,10 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= f.text_field :tag_list, value: debate.tag_list.to_s,
|
<%= f.text_field :tag_list, value: debate.tag_list.to_s,
|
||||||
hint: t("debates.form.tags_instructions"),
|
hint: t("debates.form.tags_instructions"),
|
||||||
placeholder: t("debates.form.tags_placeholder"),
|
placeholder: t("debates.form.tags_placeholder"),
|
||||||
data: { js_url: suggest_tags_path },
|
data: { js_url: suggest_tags_path },
|
||||||
class: "tag-autocomplete" %>
|
class: "tag-autocomplete" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render SDG::RelatedListSelectorComponent.new(f) %>
|
<%= render SDG::RelatedListSelectorComponent.new(f) %>
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ class Documents::NestedComponent < ApplicationComponent
|
|||||||
|
|
||||||
def note
|
def note
|
||||||
t "documents.form.note", max_documents_allowed: max_documents_allowed,
|
t "documents.form.note", max_documents_allowed: max_documents_allowed,
|
||||||
accepted_content_types: Document.humanized_accepted_content_types,
|
accepted_content_types: Document.humanized_accepted_content_types,
|
||||||
max_file_size: documentable.class.max_file_size
|
max_file_size: documentable.class.max_file_size
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_documents_allowed?
|
def max_documents_allowed?
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ class Images::NestedComponent < ApplicationComponent
|
|||||||
|
|
||||||
def note
|
def note
|
||||||
t "images.form.note", accepted_content_types: Image.humanized_accepted_content_types,
|
t "images.form.note", accepted_content_types: Image.humanized_accepted_content_types,
|
||||||
max_file_size: Image.max_file_size
|
max_file_size: Image.max_file_size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<p class="info">
|
<p class="info">
|
||||||
<%= sanitize(t("layouts.footer.description",
|
<%= sanitize(t("layouts.footer.description",
|
||||||
open_source: link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "blank", rel: "nofollow"),
|
open_source: link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "blank", rel: "nofollow"),
|
||||||
consul: link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "blank", rel: "nofollow"))) %>
|
consul: link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "blank", rel: "nofollow"))) %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<% if user %>
|
<% if user %>
|
||||||
<li id="notifications">
|
<li id="notifications">
|
||||||
<%= link_to notifications_path, rel: "nofollow", title: text,
|
<%= link_to notifications_path, rel: "nofollow",
|
||||||
class: "notifications #{notifications_class}" do %>
|
title: text,
|
||||||
|
class: "notifications #{notifications_class}" do %>
|
||||||
<span class="show-for-sr">
|
<span class="show-for-sr">
|
||||||
<%= t("layouts.header.notification_item.notifications") %>
|
<%= t("layouts.header.notification_item.notifications") %>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -59,10 +59,10 @@
|
|||||||
<% if feature?(:map) %>
|
<% if feature?(:map) %>
|
||||||
<div>
|
<div>
|
||||||
<%= render "map_locations/form_fields",
|
<%= render "map_locations/form_fields",
|
||||||
form: f,
|
form: f,
|
||||||
map_location: proposal.map_location || MapLocation.new,
|
map_location: proposal.map_location || MapLocation.new,
|
||||||
label: t("proposals.form.map_location"),
|
label: t("proposals.form.map_location"),
|
||||||
help: t("proposals.form.map_location_instructions"),
|
help: t("proposals.form.map_location_instructions"),
|
||||||
i18n_namespace: "proposals" %>
|
i18n_namespace: "proposals" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -80,11 +80,11 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<%= f.text_field :tag_list, value: proposal.tag_list.to_s,
|
<%= f.text_field :tag_list, value: proposal.tag_list.to_s,
|
||||||
label: false,
|
label: false,
|
||||||
placeholder: t("proposals.form.tags_placeholder"),
|
placeholder: t("proposals.form.tags_placeholder"),
|
||||||
class: "js-tag-list tag-autocomplete",
|
class: "js-tag-list tag-autocomplete",
|
||||||
aria: { describedby: "tag-list-help-text" },
|
aria: { describedby: "tag-list-help-text" },
|
||||||
data: { js_url: suggest_tags_path } %>
|
data: { js_url: suggest_tags_path } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if current_user.unverified? %>
|
<% if current_user.unverified? %>
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ class Admin::BudgetsWizard::BudgetsController < Admin::BudgetsWizard::BaseContro
|
|||||||
end
|
end
|
||||||
|
|
||||||
def allowed_params
|
def allowed_params
|
||||||
valid_attributes = [:currency_symbol, :voting_style, :hide_money, administrator_ids: [],
|
valid_attributes = [:currency_symbol, :voting_style, :hide_money,
|
||||||
valuator_ids: [], image_attributes: image_attributes]
|
administrator_ids: [],
|
||||||
|
valuator_ids: [],
|
||||||
|
image_attributes: image_attributes]
|
||||||
|
|
||||||
[*valid_attributes, translation_params(Budget)]
|
[*valid_attributes, translation_params(Budget)]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomization::BaseController
|
class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomization::BaseController
|
||||||
load_and_authorize_resource :content_block, class: "SiteCustomization::ContentBlock",
|
load_and_authorize_resource :content_block, class: "SiteCustomization::ContentBlock",
|
||||||
except: [
|
except: [
|
||||||
:delete_heading_content_block,
|
:delete_heading_content_block,
|
||||||
:edit_heading_content_block,
|
:edit_heading_content_block,
|
||||||
:update_heading_content_block
|
:update_heading_content_block
|
||||||
]
|
]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@content_blocks = SiteCustomization::ContentBlock.order(:name, :locale)
|
@content_blocks = SiteCustomization::ContentBlock.order(:name, :locale)
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ class Admin::SystemEmailsController < Admin::BaseController
|
|||||||
def index
|
def index
|
||||||
@system_emails = {
|
@system_emails = {
|
||||||
proposal_notification_digest: %w[view preview_pending],
|
proposal_notification_digest: %w[view preview_pending],
|
||||||
budget_investment_created: %w[view edit_info],
|
budget_investment_created: %w[view edit_info],
|
||||||
budget_investment_selected: %w[view edit_info],
|
budget_investment_selected: %w[view edit_info],
|
||||||
budget_investment_unfeasible: %w[view edit_info],
|
budget_investment_unfeasible: %w[view edit_info],
|
||||||
budget_investment_unselected: %w[view edit_info],
|
budget_investment_unselected: %w[view edit_info],
|
||||||
comment: %w[view edit_info],
|
comment: %w[view edit_info],
|
||||||
reply: %w[view edit_info],
|
reply: %w[view edit_info],
|
||||||
direct_message_for_receiver: %w[view edit_info],
|
direct_message_for_receiver: %w[view edit_info],
|
||||||
direct_message_for_sender: %w[view edit_info],
|
direct_message_for_sender: %w[view edit_info],
|
||||||
email_verification: %w[view edit_info],
|
email_verification: %w[view edit_info],
|
||||||
user_invite: %w[view edit_info],
|
user_invite: %w[view edit_info],
|
||||||
evaluation_comment: %w[view edit_info]
|
evaluation_comment: %w[view edit_info]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ class Dashboard::ActionsController < Dashboard::BaseController
|
|||||||
def execute
|
def execute
|
||||||
authorize! :dashboard, proposal
|
authorize! :dashboard, proposal
|
||||||
|
|
||||||
Dashboard::ExecutedAction.create(proposal: proposal, action: dashboard_action,
|
Dashboard::ExecutedAction.create(proposal: proposal,
|
||||||
executed_at: Time.current)
|
action: dashboard_action,
|
||||||
|
executed_at: Time.current)
|
||||||
redirect_to request.referer
|
redirect_to request.referer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Dashboard::PosterController < Dashboard::BaseController
|
|||||||
dpi: 300,
|
dpi: 300,
|
||||||
zoom: 0.32,
|
zoom: 0.32,
|
||||||
show_as_html: Rails.env.test? || params.key?("debug"),
|
show_as_html: Rails.env.test? || params.key?("debug"),
|
||||||
margin: { top: 0 }
|
margin: { top: 0 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Officing::VotersController < Officing::BaseController
|
|||||||
def create
|
def create
|
||||||
@poll = Poll.find(voter_params[:poll_id])
|
@poll = Poll.find(voter_params[:poll_id])
|
||||||
@user = User.find(voter_params[:user_id])
|
@user = User.find(voter_params[:user_id])
|
||||||
@voter = Poll::Voter.new(document_type: @user.document_type,
|
@voter = Poll::Voter.new(document_type: @user.document_type,
|
||||||
document_number: @user.document_number,
|
document_number: @user.document_number,
|
||||||
user: @user,
|
user: @user,
|
||||||
poll: @poll,
|
poll: @poll,
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
|
|
||||||
investment_headings.reduce(all_headings_filter) do |filters, heading|
|
investment_headings.reduce(all_headings_filter) do |filters, heading|
|
||||||
filters << {
|
filters << {
|
||||||
name: heading.name,
|
name: heading.name,
|
||||||
id: heading.id,
|
id: heading.id,
|
||||||
count: investments.count { |i| i.heading_id == heading.id }
|
count: investments.count { |i| i.heading_id == heading.id }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ module BudgetsHelper
|
|||||||
|
|
||||||
def budget_subnav_items_for(budget)
|
def budget_subnav_items_for(budget)
|
||||||
{
|
{
|
||||||
results: t("budgets.results.link"),
|
results: t("budgets.results.link"),
|
||||||
stats: t("stats.budgets.link"),
|
stats: t("stats.budgets.link"),
|
||||||
executions: t("budgets.executions.link")
|
executions: t("budgets.executions.link")
|
||||||
}.select { |section, _| can?(:"read_#{section}", budget) }.map do |section, text|
|
}.select { |section, _| can?(:"read_#{section}", budget) }.map do |section, text|
|
||||||
{
|
{
|
||||||
text: text,
|
text: text,
|
||||||
url: send("budget_#{section}_path", budget),
|
url: send("budget_#{section}_path", budget),
|
||||||
active: controller_name == section.to_s
|
active: controller_name == section.to_s
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ module LegislationHelper
|
|||||||
|
|
||||||
def legislation_process_tabs(process)
|
def legislation_process_tabs(process)
|
||||||
{
|
{
|
||||||
"info" => edit_admin_legislation_process_path(process),
|
"info" => edit_admin_legislation_process_path(process),
|
||||||
"homepage" => edit_admin_legislation_process_homepage_path(process),
|
"homepage" => edit_admin_legislation_process_homepage_path(process),
|
||||||
"questions" => admin_legislation_process_questions_path(process),
|
"questions" => admin_legislation_process_questions_path(process),
|
||||||
"proposals" => admin_legislation_process_proposals_path(process),
|
"proposals" => admin_legislation_process_proposals_path(process),
|
||||||
"draft_versions" => admin_legislation_process_draft_versions_path(process),
|
"draft_versions" => admin_legislation_process_draft_versions_path(process),
|
||||||
"milestones" => admin_legislation_process_milestones_path(process)
|
"milestones" => admin_legislation_process_milestones_path(process)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module MilestonesHelper
|
|||||||
text = number_to_percentage(progress_bar.percentage, precision: 0)
|
text = number_to_percentage(progress_bar.percentage, precision: 0)
|
||||||
|
|
||||||
tag.div class: "progress",
|
tag.div class: "progress",
|
||||||
role: "progressbar",
|
role: "progressbar",
|
||||||
"aria-valuenow": progress_bar.percentage,
|
"aria-valuenow": progress_bar.percentage,
|
||||||
"aria-valuetext": "#{progress_bar.percentage}%",
|
"aria-valuetext": "#{progress_bar.percentage}%",
|
||||||
"aria-valuemax": ProgressBar::RANGE.max,
|
"aria-valuemax": ProgressBar::RANGE.max,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ module TranslatableFormHelper
|
|||||||
{
|
{
|
||||||
class: "translatable-fields js-globalize-attribute #{highlight_translation_html_class}",
|
class: "translatable-fields js-globalize-attribute #{highlight_translation_html_class}",
|
||||||
style: @template.display_translation_style(resource.globalized_model, locale),
|
style: @template.display_translation_style(resource.globalized_model, locale),
|
||||||
data: { locale: locale }
|
data: { locale: locale }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ class Budget
|
|||||||
validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/
|
validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/
|
||||||
validates :population, numericality: { greater_than: 0 }, allow_nil: true
|
validates :population, numericality: { greater_than: 0 }, allow_nil: true
|
||||||
validates :latitude, length: { maximum: 22 }, allow_blank: true, \
|
validates :latitude, length: { maximum: 22 }, allow_blank: true, \
|
||||||
format: /\A(-|\+)?([1-8]?\d(?:\.\d{1,})?|90(?:\.0{1,6})?)\z/
|
format: /\A(-|\+)?([1-8]?\d(?:\.\d{1,})?|90(?:\.0{1,6})?)\z/
|
||||||
validates :longitude, length: { maximum: 22 }, allow_blank: true, \
|
validates :longitude, length: { maximum: 22 }, allow_blank: true, \
|
||||||
format: /\A(-|\+)?((?:1[0-7]|[1-9])?\d(?:\.\d{1,})?|180(?:\.0{1,})?)\z/
|
format: /\A(-|\+)?((?:1[0-7]|[1-9])?\d(?:\.\d{1,})?|180(?:\.0{1,})?)\z/
|
||||||
validates :max_ballot_lines, numericality: { greater_than_or_equal_to: 1 }
|
validates :max_ballot_lines, numericality: { greater_than_or_equal_to: 1 }
|
||||||
|
|
||||||
delegate :budget, :budget_id, to: :group, allow_nil: true
|
delegate :budget, :budget_id, to: :group, allow_nil: true
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class Budget
|
|||||||
has_many :comments, -> { where(valuation: false) }, as: :commentable, inverse_of: :commentable
|
has_many :comments, -> { where(valuation: false) }, as: :commentable, inverse_of: :commentable
|
||||||
has_one :summary_comment, as: :commentable, class_name: "MlSummaryComment", dependent: :destroy
|
has_one :summary_comment, as: :commentable, class_name: "MlSummaryComment", dependent: :destroy
|
||||||
has_many :valuations, -> { where(valuation: true) },
|
has_many :valuations, -> { where(valuation: true) },
|
||||||
as: :commentable,
|
as: :commentable,
|
||||||
inverse_of: :commentable,
|
inverse_of: :commentable,
|
||||||
class_name: "Comment"
|
class_name: "Comment"
|
||||||
|
|
||||||
@@ -203,8 +203,9 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def searchable_values
|
def searchable_values
|
||||||
{ author.username => "B",
|
{
|
||||||
heading.name => "B",
|
author.username => "B",
|
||||||
|
heading.name => "B",
|
||||||
tag_list.join(" ") => "B"
|
tag_list.join(" ") => "B"
|
||||||
}.merge(searchable_globalized_values)
|
}.merge(searchable_globalized_values)
|
||||||
end
|
end
|
||||||
@@ -394,7 +395,7 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def searchable_translations_definitions
|
def searchable_translations_definitions
|
||||||
{ title => "A",
|
{ title => "A",
|
||||||
description => "D" }
|
description => "D" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ class Comment < ApplicationRecord
|
|||||||
|
|
||||||
def self.build(commentable, user, body, p_id = nil, valuation = false)
|
def self.build(commentable, user, body, p_id = nil, valuation = false)
|
||||||
new(commentable: commentable,
|
new(commentable: commentable,
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
body: body,
|
body: body,
|
||||||
parent_id: p_id,
|
parent_id: p_id,
|
||||||
valuation: valuation)
|
valuation: valuation)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_commentable(c_type, c_id)
|
def self.find_commentable(c_type, c_id)
|
||||||
@@ -134,7 +134,7 @@ class Comment < ApplicationRecord
|
|||||||
|
|
||||||
def searchable_values
|
def searchable_values
|
||||||
{
|
{
|
||||||
body => "A",
|
body => "A",
|
||||||
commentable&.title => "B"
|
commentable&.title => "B"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ module Relationable
|
|||||||
|
|
||||||
included do
|
included do
|
||||||
has_many :related_contents,
|
has_many :related_contents,
|
||||||
as: :parent_relationable,
|
as: :parent_relationable,
|
||||||
inverse_of: :parent_relationable,
|
inverse_of: :parent_relationable,
|
||||||
dependent: :destroy
|
dependent: :destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_related_content(relationable)
|
def find_related_content(relationable)
|
||||||
|
|||||||
@@ -57,15 +57,15 @@ class Debate < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def searchable_translations_definitions
|
def searchable_translations_definitions
|
||||||
{ title => "A",
|
{ title => "A",
|
||||||
description => "D" }
|
description => "D" }
|
||||||
end
|
end
|
||||||
|
|
||||||
def searchable_values
|
def searchable_values
|
||||||
{
|
{
|
||||||
author.username => "B",
|
author.username => "B",
|
||||||
tag_list.join(" ") => "B",
|
tag_list.join(" ") => "B",
|
||||||
geozone&.name => "B"
|
geozone&.name => "B"
|
||||||
}.merge!(searchable_globalized_values)
|
}.merge!(searchable_globalized_values)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ class Legislation::DraftVersion < ApplicationRecord
|
|||||||
belongs_to :process, foreign_key: "legislation_process_id", inverse_of: :draft_versions
|
belongs_to :process, foreign_key: "legislation_process_id", inverse_of: :draft_versions
|
||||||
has_many :annotations,
|
has_many :annotations,
|
||||||
foreign_key: "legislation_draft_version_id",
|
foreign_key: "legislation_draft_version_id",
|
||||||
inverse_of: :draft_version,
|
inverse_of: :draft_version,
|
||||||
dependent: :destroy
|
dependent: :destroy
|
||||||
|
|
||||||
validates_translation :title, presence: true
|
validates_translation :title, presence: true
|
||||||
validates_translation :body, presence: true
|
validates_translation :body, presence: true
|
||||||
|
|||||||
@@ -28,20 +28,20 @@ class Legislation::Process < ApplicationRecord
|
|||||||
|
|
||||||
has_many :draft_versions, -> { order(:id) },
|
has_many :draft_versions, -> { order(:id) },
|
||||||
foreign_key: "legislation_process_id",
|
foreign_key: "legislation_process_id",
|
||||||
inverse_of: :process,
|
inverse_of: :process,
|
||||||
dependent: :destroy
|
dependent: :destroy
|
||||||
has_one :final_draft_version, -> { where final_version: true, status: "published" },
|
has_one :final_draft_version, -> { where final_version: true, status: "published" },
|
||||||
class_name: "Legislation::DraftVersion",
|
class_name: "Legislation::DraftVersion",
|
||||||
foreign_key: "legislation_process_id",
|
foreign_key: "legislation_process_id",
|
||||||
inverse_of: :process
|
inverse_of: :process
|
||||||
has_many :questions, -> { order(:id) },
|
has_many :questions, -> { order(:id) },
|
||||||
foreign_key: "legislation_process_id",
|
foreign_key: "legislation_process_id",
|
||||||
inverse_of: :process,
|
inverse_of: :process,
|
||||||
dependent: :destroy
|
dependent: :destroy
|
||||||
has_many :proposals, -> { order(:id) },
|
has_many :proposals, -> { order(:id) },
|
||||||
foreign_key: "legislation_process_id",
|
foreign_key: "legislation_process_id",
|
||||||
inverse_of: :process,
|
inverse_of: :process,
|
||||||
dependent: :destroy
|
dependent: :destroy
|
||||||
|
|
||||||
validates_translation :title, presence: true
|
validates_translation :title, presence: true
|
||||||
validates :start_date, presence: true
|
validates :start_date, presence: true
|
||||||
@@ -127,8 +127,8 @@ class Legislation::Process < ApplicationRecord
|
|||||||
|
|
||||||
def searchable_translations_definitions
|
def searchable_translations_definitions
|
||||||
{
|
{
|
||||||
title => "A",
|
title => "A",
|
||||||
summary => "C",
|
summary => "C",
|
||||||
description => "D"
|
description => "D"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ class Legislation::Proposal < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def searchable_values
|
def searchable_values
|
||||||
{ title => "A",
|
{ title => "A",
|
||||||
author.username => "B",
|
author.username => "B",
|
||||||
tag_list.join(" ") => "B",
|
tag_list.join(" ") => "B",
|
||||||
geozone&.name => "B",
|
geozone&.name => "B",
|
||||||
summary => "C",
|
summary => "C",
|
||||||
description => "D" }
|
description => "D" }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search(terms)
|
def self.search(terms)
|
||||||
|
|||||||
@@ -32,17 +32,17 @@ class Officing::Residence
|
|||||||
user.update!(verified_at: Time.current)
|
user.update!(verified_at: Time.current)
|
||||||
else
|
else
|
||||||
user_params = {
|
user_params = {
|
||||||
document_number: document_number,
|
document_number: document_number,
|
||||||
document_type: document_type,
|
document_type: document_type,
|
||||||
geozone: geozone,
|
geozone: geozone,
|
||||||
date_of_birth: response_date_of_birth.in_time_zone.to_datetime,
|
date_of_birth: response_date_of_birth.in_time_zone.to_datetime,
|
||||||
gender: gender,
|
gender: gender,
|
||||||
residence_verified_at: Time.current,
|
residence_verified_at: Time.current,
|
||||||
verified_at: Time.current,
|
verified_at: Time.current,
|
||||||
erased_at: Time.current,
|
erased_at: Time.current,
|
||||||
password: random_password,
|
password: random_password,
|
||||||
terms_of_service: "1",
|
terms_of_service: "1",
|
||||||
email: nil
|
email: nil
|
||||||
}
|
}
|
||||||
self.user = User.create!(user_params)
|
self.user = User.create!(user_params)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -205,8 +205,8 @@ class Poll < ApplicationRecord
|
|||||||
|
|
||||||
def searchable_translations_definitions
|
def searchable_translations_definitions
|
||||||
{
|
{
|
||||||
name => "A",
|
name => "A",
|
||||||
summary => "C",
|
summary => "C",
|
||||||
description => "D"
|
description => "D"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ class Poll::BallotSheet < ApplicationRecord
|
|||||||
|
|
||||||
def create_ballot(poll_ballot)
|
def create_ballot(poll_ballot)
|
||||||
Budget::Ballot.where(physical: true,
|
Budget::Ballot.where(physical: true,
|
||||||
user: nil,
|
user: nil,
|
||||||
poll_ballot: poll_ballot,
|
poll_ballot: poll_ballot,
|
||||||
budget: poll.budget).first_or_create!
|
budget: poll.budget).first_or_create!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Poll::Question < ApplicationRecord
|
|||||||
has_many :question_answers, -> { order "given_order asc" },
|
has_many :question_answers, -> { order "given_order asc" },
|
||||||
class_name: "Poll::Question::Answer",
|
class_name: "Poll::Question::Answer",
|
||||||
inverse_of: :question,
|
inverse_of: :question,
|
||||||
dependent: :destroy
|
dependent: :destroy
|
||||||
has_many :partial_results
|
has_many :partial_results
|
||||||
belongs_to :proposal
|
belongs_to :proposal
|
||||||
|
|
||||||
@@ -40,9 +40,9 @@ class Poll::Question < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def searchable_values
|
def searchable_values
|
||||||
{ title => "A",
|
{ title => "A",
|
||||||
proposal&.title => "A",
|
proposal&.title => "A",
|
||||||
author.username => "C",
|
author.username => "C",
|
||||||
author_visible_name => "C" }
|
author_visible_name => "C" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ class Poll
|
|||||||
def create_officer_assignments
|
def create_officer_assignments
|
||||||
booth.booth_assignments.order(:id).each do |booth_assignment|
|
booth.booth_assignments.order(:id).each do |booth_assignment|
|
||||||
attrs = {
|
attrs = {
|
||||||
officer_id: officer_id,
|
officer_id: officer_id,
|
||||||
date: date,
|
date: date,
|
||||||
booth_assignment_id: booth_assignment.id,
|
booth_assignment_id: booth_assignment.id,
|
||||||
final: recount_scrutiny?
|
final: recount_scrutiny?
|
||||||
}
|
}
|
||||||
Poll::OfficerAssignment.create!(attrs)
|
Poll::OfficerAssignment.create!(attrs)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ class ProgressBar < ApplicationRecord
|
|||||||
|
|
||||||
validates :progressable, presence: true
|
validates :progressable, presence: true
|
||||||
validates :kind, presence: true,
|
validates :kind, presence: true,
|
||||||
uniqueness: {
|
uniqueness: {
|
||||||
scope: [:progressable_type, :progressable_id],
|
scope: [:progressable_type, :progressable_id],
|
||||||
conditions: -> { primary }
|
conditions: -> { primary }
|
||||||
}
|
}
|
||||||
validates :percentage, presence: true, inclusion: { in: ->(*) { RANGE }}, numericality: { only_integer: true }
|
validates :percentage, presence: true, inclusion: { in: ->(*) { RANGE }}, numericality: { only_integer: true }
|
||||||
|
|
||||||
validates_translation :title, presence: true, unless: :primary?
|
validates_translation :title, presence: true, unless: :primary?
|
||||||
|
|||||||
@@ -118,16 +118,16 @@ class Proposal < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def searchable_translations_definitions
|
def searchable_translations_definitions
|
||||||
{ title => "A",
|
{ title => "A",
|
||||||
summary => "C",
|
summary => "C",
|
||||||
description => "D" }
|
description => "D" }
|
||||||
end
|
end
|
||||||
|
|
||||||
def searchable_values
|
def searchable_values
|
||||||
{
|
{
|
||||||
author.username => "B",
|
author.username => "B",
|
||||||
tag_list.join(" ") => "B",
|
tag_list.join(" ") => "B",
|
||||||
geozone&.name => "B"
|
geozone&.name => "B"
|
||||||
}.merge!(searchable_globalized_values)
|
}.merge!(searchable_globalized_values)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class ProposalNotification < ApplicationRecord
|
|||||||
def searchable_values
|
def searchable_values
|
||||||
{
|
{
|
||||||
title => "A",
|
title => "A",
|
||||||
body => "B"
|
body => "B"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class SDG::LocalTarget < ApplicationRecord
|
|||||||
validates_translation :description, presence: true
|
validates_translation :description, presence: true
|
||||||
|
|
||||||
validates :code, presence: true, uniqueness: true,
|
validates :code, presence: true, uniqueness: true,
|
||||||
format: ->(local_target) { /\A#{local_target.target&.code}\.\d+/ }
|
format: ->(local_target) { /\A#{local_target.target&.code}\.\d+/ }
|
||||||
validates :target, presence: true
|
validates :target, presence: true
|
||||||
validates :goal, presence: true
|
validates :goal, presence: true
|
||||||
|
|
||||||
|
|||||||
@@ -61,18 +61,18 @@ class Setting < ApplicationRecord
|
|||||||
def mime_types
|
def mime_types
|
||||||
{
|
{
|
||||||
"images" => {
|
"images" => {
|
||||||
"jpg" => "image/jpeg",
|
"jpg" => "image/jpeg",
|
||||||
"png" => "image/png",
|
"png" => "image/png",
|
||||||
"gif" => "image/gif"
|
"gif" => "image/gif"
|
||||||
},
|
},
|
||||||
"documents" => {
|
"documents" => {
|
||||||
"pdf" => "application/pdf",
|
"pdf" => "application/pdf",
|
||||||
"doc" => "application/msword",
|
"doc" => "application/msword",
|
||||||
"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
"xls" => "application/x-ole-storage",
|
"xls" => "application/x-ole-storage",
|
||||||
"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
"csv" => "text/plain",
|
"csv" => "text/plain",
|
||||||
"zip" => "application/zip"
|
"zip" => "application/zip"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,55 +26,55 @@ class User < ApplicationRecord
|
|||||||
has_many :proposals, -> { with_hidden }, foreign_key: :author_id, inverse_of: :author
|
has_many :proposals, -> { with_hidden }, foreign_key: :author_id, inverse_of: :author
|
||||||
has_many :activities
|
has_many :activities
|
||||||
has_many :budget_investments, -> { with_hidden },
|
has_many :budget_investments, -> { with_hidden },
|
||||||
class_name: "Budget::Investment",
|
class_name: "Budget::Investment",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :comments, -> { with_hidden }, inverse_of: :user
|
has_many :comments, -> { with_hidden }, inverse_of: :user
|
||||||
has_many :failed_census_calls
|
has_many :failed_census_calls
|
||||||
has_many :notifications
|
has_many :notifications
|
||||||
has_many :direct_messages_sent,
|
has_many :direct_messages_sent,
|
||||||
class_name: "DirectMessage",
|
class_name: "DirectMessage",
|
||||||
foreign_key: :sender_id,
|
foreign_key: :sender_id,
|
||||||
inverse_of: :sender
|
inverse_of: :sender
|
||||||
has_many :direct_messages_received,
|
has_many :direct_messages_received,
|
||||||
class_name: "DirectMessage",
|
class_name: "DirectMessage",
|
||||||
foreign_key: :receiver_id,
|
foreign_key: :receiver_id,
|
||||||
inverse_of: :receiver
|
inverse_of: :receiver
|
||||||
has_many :legislation_answers, class_name: "Legislation::Answer", dependent: :destroy, inverse_of: :user
|
has_many :legislation_answers, class_name: "Legislation::Answer", dependent: :destroy, inverse_of: :user
|
||||||
has_many :follows
|
has_many :follows
|
||||||
has_many :legislation_annotations,
|
has_many :legislation_annotations,
|
||||||
class_name: "Legislation::Annotation",
|
class_name: "Legislation::Annotation",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :legislation_proposals,
|
has_many :legislation_proposals,
|
||||||
class_name: "Legislation::Proposal",
|
class_name: "Legislation::Proposal",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :legislation_questions,
|
has_many :legislation_questions,
|
||||||
class_name: "Legislation::Question",
|
class_name: "Legislation::Question",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :polls, foreign_key: :author_id, inverse_of: :author
|
has_many :polls, foreign_key: :author_id, inverse_of: :author
|
||||||
has_many :poll_answers,
|
has_many :poll_answers,
|
||||||
class_name: "Poll::Answer",
|
class_name: "Poll::Answer",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :poll_pair_answers,
|
has_many :poll_pair_answers,
|
||||||
class_name: "Poll::PairAnswer",
|
class_name: "Poll::PairAnswer",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :poll_partial_results,
|
has_many :poll_partial_results,
|
||||||
class_name: "Poll::PartialResult",
|
class_name: "Poll::PartialResult",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :poll_questions,
|
has_many :poll_questions,
|
||||||
class_name: "Poll::Question",
|
class_name: "Poll::Question",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :poll_recounts,
|
has_many :poll_recounts,
|
||||||
class_name: "Poll::Recount",
|
class_name: "Poll::Recount",
|
||||||
foreign_key: :author_id,
|
foreign_key: :author_id,
|
||||||
inverse_of: :author
|
inverse_of: :author
|
||||||
has_many :related_contents, foreign_key: :author_id, inverse_of: :author, dependent: nil
|
has_many :related_contents, foreign_key: :author_id, inverse_of: :author, dependent: nil
|
||||||
has_many :topics, foreign_key: :author_id, inverse_of: :author
|
has_many :topics, foreign_key: :author_id, inverse_of: :author
|
||||||
belongs_to :geozone
|
belongs_to :geozone
|
||||||
@@ -136,7 +136,7 @@ class User < ApplicationRecord
|
|||||||
oauth_user = User.find_by(email: oauth_email) if oauth_email_confirmed
|
oauth_user = User.find_by(email: oauth_email) if oauth_email_confirmed
|
||||||
|
|
||||||
oauth_user || User.new(
|
oauth_user || User.new(
|
||||||
username: auth.info.name || auth.uid,
|
username: auth.info.name || auth.uid,
|
||||||
email: oauth_email,
|
email: oauth_email,
|
||||||
oauth_email: oauth_email,
|
oauth_email: oauth_email,
|
||||||
password: Devise.friendly_token[0, 20],
|
password: Devise.friendly_token[0, 20],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class Verification::Management::ManagedUser
|
|||||||
|
|
||||||
def self.find(document_type, document_number)
|
def self.find(document_type, document_number)
|
||||||
User.where.not(document_number: nil)
|
User.where.not(document_number: nil)
|
||||||
.find_or_initialize_by(document_type: document_type,
|
.find_or_initialize_by(document_type: document_type,
|
||||||
document_number: document_number)
|
document_number: document_number)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ class Verification::Residence
|
|||||||
|
|
||||||
user.take_votes_if_erased_document(document_number, document_type)
|
user.take_votes_if_erased_document(document_number, document_type)
|
||||||
|
|
||||||
user.update(document_number: document_number,
|
user.update(document_number: document_number,
|
||||||
document_type: document_type,
|
document_type: document_type,
|
||||||
geozone: geozone,
|
geozone: geozone,
|
||||||
date_of_birth: date_of_birth.in_time_zone.to_datetime,
|
date_of_birth: date_of_birth.in_time_zone.to_datetime,
|
||||||
gender: gender,
|
gender: gender,
|
||||||
residence_verified_at: Time.current)
|
residence_verified_at: Time.current)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,18 +44,21 @@
|
|||||||
|
|
||||||
<div class="row expanded margin-top">
|
<div class="row expanded margin-top">
|
||||||
<div class="small-12 medium-4 column">
|
<div class="small-12 medium-4 column">
|
||||||
<%= f.number_field :day_offset, step: 1, min: 0,
|
<%= f.number_field :day_offset, step: 1,
|
||||||
hint: t("admin.dashboard.actions.form.help_text") %>
|
min: 0,
|
||||||
|
hint: t("admin.dashboard.actions.form.help_text") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-4 column">
|
<div class="small-12 medium-4 column">
|
||||||
<%= f.number_field :required_supports, step: 1, min: 0,
|
<%= f.number_field :required_supports, step: 1,
|
||||||
hint: t("admin.dashboard.actions.form.help_text") %>
|
min: 0,
|
||||||
|
hint: t("admin.dashboard.actions.form.help_text") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-4 column">
|
<div class="small-12 medium-4 column">
|
||||||
<%= f.number_field :order, step: 1, min: 0,
|
<%= f.number_field :order, step: 1,
|
||||||
hint: t("admin.dashboard.actions.form.help_text") %>
|
min: 0,
|
||||||
|
hint: t("admin.dashboard.actions.form.help_text") %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<%= render "shared/globalize_locales", resource: @draft_version %>
|
<%= render "shared/globalize_locales", resource: @draft_version %>
|
||||||
|
|
||||||
<%= translatable_form_for [:admin, @process, @draft_version], url: url,
|
<%= translatable_form_for [:admin, @process, @draft_version], url: url,
|
||||||
html: { data: { markdown_changes_message: I18n.t("admin.legislation.draft_versions.edit.markdown_changes_message") }} do |f| %>
|
html: {
|
||||||
|
data: {
|
||||||
|
markdown_changes_message: I18n.t("admin.legislation.draft_versions.edit.markdown_changes_message")
|
||||||
|
}
|
||||||
|
} do |f| %>
|
||||||
<%= render "shared/errors", resource: @draft_version %>
|
<%= render "shared/errors", resource: @draft_version %>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -50,8 +53,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-6 column markdown-area">
|
<div class="small-12 medium-6 column markdown-area">
|
||||||
<%= translations_form.text_area :body, label: false, rows: 10,
|
<%= translations_form.text_area :body, label: false,
|
||||||
class: "legislation-draft-version-body" %>
|
rows: 10,
|
||||||
|
class: "legislation-draft-version-body" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-6 column markdown-preview">
|
<div class="small-12 medium-6 column markdown-preview">
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
<div class="small-12 medium-8 column">
|
<div class="small-12 medium-8 column">
|
||||||
<%= f.text_field :custom_list, value: @process.tag_list_on(:customs).sort.join(", "),
|
<%= f.text_field :custom_list, value: @process.tag_list_on(:customs).sort.join(", "),
|
||||||
label: t("admin.legislation.proposals.form.custom_categories"),
|
label: t("admin.legislation.proposals.form.custom_categories"),
|
||||||
hint: t("admin.legislation.proposals.form.custom_categories_description"),
|
hint: t("admin.legislation.proposals.form.custom_categories_description"),
|
||||||
placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"),
|
placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"),
|
||||||
class: "js-tag-list",
|
class: "js-tag-list",
|
||||||
aria: { describedby: "tag-list-help-text" } %>
|
aria: { describedby: "tag-list-help-text" } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-3 column clear end">
|
<div class="small-12 medium-3 column clear end">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<div class="column">
|
<div class="column">
|
||||||
<span class="help-text"><%= t("admin.active_polls.form.description.help_text") %></span>
|
<span class="help-text"><%= t("admin.active_polls.form.description.help_text") %></span>
|
||||||
<%= translations_form.text_area :description, class: "html-area",
|
<%= translations_form.text_area :description, class: "html-area",
|
||||||
maxlength: ActivePoll.description_max_length %>
|
maxlength: ActivePoll.description_max_length %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= f.text_area :required_fields_to_verify, rows: "6",
|
<%= f.text_area :required_fields_to_verify, rows: "6",
|
||||||
hint: sanitize("#{required_fields_to_verify_text_help}<br/>#{example_text_help}") %>
|
hint: sanitize("#{required_fields_to_verify_text_help}<br/>#{example_text_help}") %>
|
||||||
|
|
||||||
<%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %>
|
<%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -21,8 +21,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-6 column">
|
<div class="small-12 medium-6 column">
|
||||||
<%= f.text_field :slug, size: 80, maxlength: 80,
|
<%= f.text_field :slug, size: 80,
|
||||||
hint: sanitize(t("admin.site_customization.pages.new.slug_help")) %>
|
maxlength: 80,
|
||||||
|
hint: sanitize(t("admin.site_customization.pages.new.slug_help")) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<%= link_to t("admin.system_emails.preview_pending.moderate_pending"),
|
<%= link_to t("admin.system_emails.preview_pending.moderate_pending"),
|
||||||
admin_system_email_moderate_pending_path(system_email_id: "proposal_notification_digest",
|
admin_system_email_moderate_pending_path(system_email_id: "proposal_notification_digest",
|
||||||
id: preview.id),
|
id: preview.id),
|
||||||
method: :put,
|
method: :put,
|
||||||
class: "button hollow float-right" %>
|
class: "button hollow float-right" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,8 +100,8 @@
|
|||||||
|
|
||||||
<% if !valuation || can?(:comment_valuation, comment.commentable) %>
|
<% if !valuation || can?(:comment_valuation, comment.commentable) %>
|
||||||
<%= render "comments/form", { commentable: comment.commentable,
|
<%= render "comments/form", { commentable: comment.commentable,
|
||||||
parent_id: comment.id,
|
parent_id: comment.id,
|
||||||
valuation: valuation } %>
|
valuation: valuation } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
<%= link_to proposal_url(@proposal, anchor: "social-share") do %>
|
<%= link_to proposal_url(@proposal, anchor: "social-share") do %>
|
||||||
<%= image_tag("social_buttons_mailer.png", alt: t("dashboard.mailer.forward.share_in"),
|
<%= image_tag("social_buttons_mailer.png", alt: t("dashboard.mailer.forward.share_in"),
|
||||||
style: "max-width: 100%;") %>
|
style: "max-width: 100%;") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
border-radius: 6px; color: #fff !important; font-weight: bold;
|
border-radius: 6px; color: #fff !important; font-weight: bold;
|
||||||
padding: 17px 20px; text-align: center; text-decoration: none;
|
padding: 17px 20px; text-align: center; text-decoration: none;
|
||||||
font-size: 20px; min-width: 200px; display: inline-block;",
|
font-size: 20px; min-width: 200px; display: inline-block;",
|
||||||
target: "_blank" do %>
|
target: "_blank" do %>
|
||||||
<%= t("mailers.new_actions_notification_on_published.dashboard_button") %>
|
<%= t("mailers.new_actions_notification_on_published.dashboard_button") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -24,8 +24,9 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= form_for poll, remote: true, data: { type: :json },
|
<%= form_for poll, remote: true,
|
||||||
url: proposal_dashboard_poll_path(proposal, poll) do |f| %>
|
data: { type: :json },
|
||||||
|
url: proposal_dashboard_poll_path(proposal, poll) do |f| %>
|
||||||
<%= f.check_box :results_enabled, class: "js-submit-on-change" %>
|
<%= f.check_box :results_enabled, class: "js-submit-on-change" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="help-text"><%= t("dashboard.polls.poll.show_results_help") %></p>
|
<p class="help-text"><%= t("dashboard.polls.poll.show_results_help") %></p>
|
||||||
|
|||||||
@@ -6,13 +6,14 @@
|
|||||||
<%= f.hidden_field :reset_password_token %>
|
<%= f.hidden_field :reset_password_token %>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.password_field :password, autofocus: true, autocomplete: "off",
|
<%= f.password_field :password, autofocus: true,
|
||||||
label: t("devise_views.passwords.edit.password_label") %>
|
autocomplete: "off",
|
||||||
|
label: t("devise_views.passwords.edit.password_label") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.password_field :password_confirmation, autocomplete: "off",
|
<%= f.password_field :password_confirmation, autocomplete: "off",
|
||||||
label: t("devise_views.passwords.edit.password_confirmation_label") %>
|
label: t("devise_views.passwords.edit.password_confirmation_label") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.email_field :email, autofocus: true,
|
<%= f.email_field :email, autofocus: true,
|
||||||
label: t("devise_views.unlocks.new.email_label") %>
|
label: t("devise_views.unlocks.new.email_label") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<li id="<%= dom_id(document) %>">
|
<li id="<%= dom_id(document) %>">
|
||||||
<%= link_to t("documents.buttons.download_document"),
|
<%= link_to t("documents.buttons.download_document"),
|
||||||
document.attachment, target: "_blank",
|
document.attachment,
|
||||||
rel: "nofollow", class: "button hollow medium float-right" %>
|
target: "_blank",
|
||||||
|
rel: "nofollow",
|
||||||
|
class: "button hollow medium float-right" %>
|
||||||
|
|
||||||
<strong><%= document.title %></strong>
|
<strong><%= document.title %></strong>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<div class="small-12 medium-4 column">
|
<div class="small-12 medium-4 column">
|
||||||
<%= link_to process, class: "button hollow big expanded",
|
<%= link_to process, class: "button hollow big expanded",
|
||||||
title: t("legislation.processes.process.see_latest_comments_title") do %>
|
title: t("legislation.processes.process.see_latest_comments_title") do %>
|
||||||
<span class="icon-comments"></span>
|
<span class="icon-comments"></span>
|
||||||
<%= t("legislation.processes.process.see_latest_comments") %>
|
<%= t("legislation.processes.process.see_latest_comments") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= f.text_area :summary, rows: 4, maxlength: 200,
|
<%= f.text_area :summary, rows: 4, maxlength: 200,
|
||||||
hint: t("proposals.form.proposal_summary_note") %>
|
hint: t("proposals.form.proposal_summary_note") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
@@ -54,10 +54,10 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<%= f.text_field :tag_list, value: @proposal.tag_list.to_s,
|
<%= f.text_field :tag_list, value: @proposal.tag_list.to_s,
|
||||||
label: false,
|
label: false,
|
||||||
placeholder: t("proposals.form.tags_placeholder"),
|
placeholder: t("proposals.form.tags_placeholder"),
|
||||||
class: "js-tag-list",
|
class: "js-tag-list",
|
||||||
aria: { describedby: "tag-list-help-text" } %>
|
aria: { describedby: "tag-list-help-text" } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
|
|||||||
@@ -23,8 +23,9 @@
|
|||||||
<p class="margin-top">
|
<p class="margin-top">
|
||||||
<%= link_to t("management.users.create_user"),
|
<%= link_to t("management.users.create_user"),
|
||||||
new_management_user_path(user: {
|
new_management_user_path(user: {
|
||||||
document_number: @email_verification.document_number,
|
document_number: @email_verification.document_number,
|
||||||
document_type: @email_verification.document_type }),
|
document_type: @email_verification.document_type
|
||||||
|
}),
|
||||||
class: "button success" %>
|
class: "button success" %>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<label><%= t("management.user_invites.new.label") %></label>
|
<label><%= t("management.user_invites.new.label") %></label>
|
||||||
<p class="help-text" id="emails-help-text"><%= t("management.user_invites.new.info") %></p>
|
<p class="help-text" id="emails-help-text"><%= t("management.user_invites.new.info") %></p>
|
||||||
<%= text_area_tag "emails", nil, rows: 5,
|
<%= text_area_tag "emails", nil, rows: 5,
|
||||||
aria: { describedby: "emails-help-text" } %>
|
aria: { describedby: "emails-help-text" } %>
|
||||||
<div class="small-12 medium-6 large-3">
|
<div class="small-12 medium-6 large-3">
|
||||||
<input type="submit" name="" value="<%= t("management.user_invites.new.submit") %>" class="button expanded">
|
<input type="submit" name="" value="<%= t("management.user_invites.new.submit") %>" class="button expanded">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<%= link_to t("notifications.index.mark_all_as_read"),
|
<%= link_to t("notifications.index.mark_all_as_read"),
|
||||||
mark_all_as_read_notifications_path, method: :put,
|
mark_all_as_read_notifications_path,
|
||||||
|
method: :put,
|
||||||
class: "button hollow float-right-medium" %>
|
class: "button hollow float-right-medium" %>
|
||||||
|
|
||||||
<ul class="menu simple clear">
|
<ul class="menu simple clear">
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td id="actions" class="text-center">
|
<td id="actions" class="text-center">
|
||||||
<%= form_for @user, as: :voter, url: officing_voters_path,
|
<%= form_for @user, as: :voter,
|
||||||
method: :post, remote: true,
|
url: officing_voters_path,
|
||||||
html: { id: "new_officing_voter" } do |f| %>
|
method: :post,
|
||||||
|
remote: true,
|
||||||
|
html: { id: "new_officing_voter" } do |f| %>
|
||||||
<%= f.hidden_field :poll_id, value: poll.id %>
|
<%= f.hidden_field :poll_id, value: poll.id %>
|
||||||
<%= f.hidden_field :user_id, value: @user.id %>
|
<%= f.hidden_field :user_id, value: @user.id %>
|
||||||
<%= f.submit t("officing.voters.show.submit"),
|
<%= f.submit t("officing.voters.show.submit"),
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<%= f.password_field :password, autocomplete: "off" %>
|
<%= f.password_field :password, autocomplete: "off" %>
|
||||||
|
|
||||||
<%= f.password_field :password_confirmation, autocomplete: "off",
|
<%= f.password_field :password_confirmation, autocomplete: "off",
|
||||||
label: t("devise_views.organizations.registrations.new.password_confirmation_label") %>
|
label: t("devise_views.organizations.registrations.new.password_confirmation_label") %>
|
||||||
|
|
||||||
<%= f.check_box :terms_of_service,
|
<%= f.check_box :terms_of_service,
|
||||||
title: t("devise_views.users.registrations.new.terms_title"),
|
title: t("devise_views.users.registrations.new.terms_title"),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
social_url: poll_url,
|
social_url: poll_url,
|
||||||
social_title: t("social_share.polls_show.title_#{@poll.id}", default: @poll.title),
|
social_title: t("social_share.polls_show.title_#{@poll.id}", default: @poll.title),
|
||||||
social_description: t("social_share.polls_show.facebook_#{@poll.id}", default: @poll.title),
|
social_description: t("social_share.polls_show.facebook_#{@poll.id}", default: @poll.title),
|
||||||
twitter_image_url: "social_media_polls_twitter.jpg",
|
twitter_image_url: "social_media_polls_twitter.jpg",
|
||||||
og_image_url: "social_media_polls.jpg" %>
|
og_image_url: "social_media_polls.jpg" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
class: "button hollow expanded" %>
|
class: "button hollow expanded" %>
|
||||||
|
|
||||||
<%= link_to t("community.show.topic.destroy"),
|
<%= link_to t("community.show.topic.destroy"),
|
||||||
community_topic_path(@community.id, @topic), method: :delete,
|
community_topic_path(@community.id, @topic),
|
||||||
|
method: :delete,
|
||||||
class: "button hollow expanded alert" %>
|
class: "button hollow expanded alert" %>
|
||||||
</aside>
|
</aside>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<h2><%= t("devise_views.users.registrations.delete_form.title") %></h2>
|
<h2><%= t("devise_views.users.registrations.delete_form.title") %></h2>
|
||||||
|
|
||||||
<%= form_for(resource, as: resource_name,
|
<%= form_for(resource, as: resource_name,
|
||||||
url: users_registrations_path,
|
url: users_registrations_path,
|
||||||
html: { method: :delete }) do |f| %>
|
html: { method: :delete }) do |f| %>
|
||||||
<%= render "shared/errors", resource: resource %>
|
<%= render "shared/errors", resource: resource %>
|
||||||
|
|
||||||
<div data-alert class="callout alert">
|
<div data-alert class="callout alert">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<%= f.password_field :password, autocomplete: "off" %>
|
<%= f.password_field :password, autocomplete: "off" %>
|
||||||
|
|
||||||
<%= f.password_field :password_confirmation, autocomplete: "off",
|
<%= f.password_field :password_confirmation, autocomplete: "off",
|
||||||
label: t("devise_views.users.registrations.new.password_confirmation_label") %>
|
label: t("devise_views.users.registrations.new.password_confirmation_label") %>
|
||||||
|
|
||||||
<% if resource.use_redeemable_code %>
|
<% if resource.use_redeemable_code %>
|
||||||
<%= f.text_field :redeemable_code %>
|
<%= f.text_field :redeemable_code %>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<h2><%= t("valuation.budget_investments.valuation_comments") %></h2>
|
<h2><%= t("valuation.budget_investments.valuation_comments") %></h2>
|
||||||
<% unless @comment_tree.nil? %>
|
<% unless @comment_tree.nil? %>
|
||||||
<%= render "/comments/comment_tree", comment_tree: @comment_tree,
|
<%= render "/comments/comment_tree", comment_tree: @comment_tree,
|
||||||
display_comments_count: false,
|
display_comments_count: false,
|
||||||
valuation: true %>
|
valuation: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -101,15 +101,15 @@ module Consul
|
|||||||
]
|
]
|
||||||
config.i18n.available_locales = available_locales
|
config.i18n.available_locales = available_locales
|
||||||
config.i18n.fallbacks = [I18n.default_locale, {
|
config.i18n.fallbacks = [I18n.default_locale, {
|
||||||
"ca" => "es",
|
"ca" => "es",
|
||||||
"es-PE" => "es",
|
"es-PE" => "es",
|
||||||
"eu" => "es",
|
"eu" => "es",
|
||||||
"fr" => "es",
|
"fr" => "es",
|
||||||
"gl" => "es",
|
"gl" => "es",
|
||||||
"it" => "es",
|
"it" => "es",
|
||||||
"oc" => "fr",
|
"oc" => "fr",
|
||||||
"pt-BR" => "es",
|
"pt-BR" => "es",
|
||||||
"val" => "es"
|
"val" => "es"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**[^custom]*", "*.{rb,yml}")]
|
config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**[^custom]*", "*.{rb,yml}")]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
devise_for :users, controllers: {
|
devise_for :users, controllers: {
|
||||||
registrations: "users/registrations",
|
registrations: "users/registrations",
|
||||||
sessions: "users/sessions",
|
sessions: "users/sessions",
|
||||||
confirmations: "users/confirmations",
|
confirmations: "users/confirmations",
|
||||||
omniauth_callbacks: "users/omniauth_callbacks"
|
omniauth_callbacks: "users/omniauth_callbacks"
|
||||||
}
|
}
|
||||||
|
|
||||||
devise_scope :user do
|
devise_scope :user do
|
||||||
patch "/user/confirmation", to: "users/confirmations#update", as: :update_user_confirmation
|
patch "/user/confirmation", to: "users/confirmations#update", as: :update_user_confirmation
|
||||||
@@ -16,11 +16,11 @@ devise_scope :user do
|
|||||||
end
|
end
|
||||||
|
|
||||||
devise_for :organizations, class_name: "User",
|
devise_for :organizations, class_name: "User",
|
||||||
controllers: {
|
controllers: {
|
||||||
registrations: "organizations/registrations",
|
registrations: "organizations/registrations",
|
||||||
sessions: "devise/sessions"
|
sessions: "devise/sessions"
|
||||||
},
|
},
|
||||||
skip: [:omniauth_callbacks]
|
skip: [:omniauth_callbacks]
|
||||||
|
|
||||||
devise_scope :organization do
|
devise_scope :organization do
|
||||||
get "organizations/sign_up/success", to: "organizations/registrations#success"
|
get "organizations/sign_up/success", to: "organizations/registrations#success"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ section "Creating banners" do
|
|||||||
description: description,
|
description: description,
|
||||||
target_url: target_url,
|
target_url: target_url,
|
||||||
post_started_at: rand((1.week.ago)..(1.day.ago)),
|
post_started_at: rand((1.week.ago)..(1.day.ago)),
|
||||||
post_ended_at: rand((1.day.ago)..(1.week.from_now)),
|
post_ended_at: rand((1.day.ago)..(1.week.from_now)),
|
||||||
created_at: rand((1.week.ago)..Time.current))
|
created_at: rand((1.week.ago)..Time.current))
|
||||||
I18n.available_locales.map do |locale|
|
I18n.available_locales.map do |locale|
|
||||||
Globalize.with_locale(locale) do
|
Globalize.with_locale(locale) do
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ section "Creating investment milestones" do
|
|||||||
|
|
||||||
rand(0..3).times do
|
rand(0..3).times do
|
||||||
progress_bar = record.progress_bars.build(
|
progress_bar = record.progress_bars.build(
|
||||||
kind: :secondary,
|
kind: :secondary,
|
||||||
percentage: rand(ProgressBar::RANGE)
|
percentage: rand(ProgressBar::RANGE)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -13,30 +13,30 @@ section "Creating polls" do
|
|||||||
create_poll!(name: I18n.t("seeds.polls.current_poll"),
|
create_poll!(name: I18n.t("seeds.polls.current_poll"),
|
||||||
slug: I18n.t("seeds.polls.current_poll").parameterize,
|
slug: I18n.t("seeds.polls.current_poll").parameterize,
|
||||||
starts_at: 7.days.ago,
|
starts_at: 7.days.ago,
|
||||||
ends_at: 7.days.from_now,
|
ends_at: 7.days.from_now,
|
||||||
geozone_restricted: false)
|
geozone_restricted: false)
|
||||||
|
|
||||||
create_poll!(name: I18n.t("seeds.polls.current_poll_geozone_restricted"),
|
create_poll!(name: I18n.t("seeds.polls.current_poll_geozone_restricted"),
|
||||||
slug: I18n.t("seeds.polls.current_poll_geozone_restricted").parameterize,
|
slug: I18n.t("seeds.polls.current_poll_geozone_restricted").parameterize,
|
||||||
starts_at: 5.days.ago,
|
starts_at: 5.days.ago,
|
||||||
ends_at: 5.days.from_now,
|
ends_at: 5.days.from_now,
|
||||||
geozone_restricted: true,
|
geozone_restricted: true,
|
||||||
geozones: Geozone.sample(3))
|
geozones: Geozone.sample(3))
|
||||||
|
|
||||||
create_poll!(name: I18n.t("seeds.polls.recounting_poll"),
|
create_poll!(name: I18n.t("seeds.polls.recounting_poll"),
|
||||||
slug: I18n.t("seeds.polls.recounting_poll").parameterize,
|
slug: I18n.t("seeds.polls.recounting_poll").parameterize,
|
||||||
starts_at: 15.days.ago,
|
starts_at: 15.days.ago,
|
||||||
ends_at: 2.days.ago)
|
ends_at: 2.days.ago)
|
||||||
|
|
||||||
create_poll!(name: I18n.t("seeds.polls.expired_poll_without_stats"),
|
create_poll!(name: I18n.t("seeds.polls.expired_poll_without_stats"),
|
||||||
slug: I18n.t("seeds.polls.expired_poll_without_stats").parameterize,
|
slug: I18n.t("seeds.polls.expired_poll_without_stats").parameterize,
|
||||||
starts_at: 2.months.ago,
|
starts_at: 2.months.ago,
|
||||||
ends_at: 1.month.ago)
|
ends_at: 1.month.ago)
|
||||||
|
|
||||||
create_poll!(name: I18n.t("seeds.polls.expired_poll_with_stats"),
|
create_poll!(name: I18n.t("seeds.polls.expired_poll_with_stats"),
|
||||||
slug: I18n.t("seeds.polls.expired_poll_with_stats").parameterize,
|
slug: I18n.t("seeds.polls.expired_poll_with_stats").parameterize,
|
||||||
starts_at: 2.months.ago,
|
starts_at: 2.months.ago,
|
||||||
ends_at: 1.month.ago,
|
ends_at: 1.month.ago,
|
||||||
results_enabled: true,
|
results_enabled: true,
|
||||||
stats_enabled: true)
|
stats_enabled: true)
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,6 @@ end
|
|||||||
section "Creating SDG homepage cards" do
|
section "Creating SDG homepage cards" do
|
||||||
SDG::Phase.all.each do |phase|
|
SDG::Phase.all.each do |phase|
|
||||||
Widget::Card.create!(cardable: phase, title: "#{phase.title} card",
|
Widget::Card.create!(cardable: phase, title: "#{phase.title} card",
|
||||||
link_text: "Link Text", link_url: "/any_path")
|
link_text: "Link Text", link_url: "/any_path")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ section "Creating Users" do
|
|||||||
def create_user(email, username)
|
def create_user(email, username)
|
||||||
password = "12345678"
|
password = "12345678"
|
||||||
User.create!(
|
User.create!(
|
||||||
username: username,
|
username: username,
|
||||||
email: email,
|
email: email,
|
||||||
password: password,
|
password: password,
|
||||||
password_confirmation: password,
|
password_confirmation: password,
|
||||||
confirmed_at: Time.current,
|
confirmed_at: Time.current,
|
||||||
terms_of_service: "1",
|
terms_of_service: "1",
|
||||||
gender: %w[male female].sample,
|
gender: %w[male female].sample,
|
||||||
date_of_birth: rand((80.years.ago)..(16.years.ago)),
|
date_of_birth: rand((80.years.ago)..(16.years.ago)),
|
||||||
public_activity: (rand(1..100) > 30)
|
public_activity: (rand(1..100) > 30)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -23,56 +23,69 @@ section "Creating Users" do
|
|||||||
admin = create_user("admin@consul.dev", "admin")
|
admin = create_user("admin@consul.dev", "admin")
|
||||||
admin.create_administrator
|
admin.create_administrator
|
||||||
admin.update!(residence_verified_at: Time.current,
|
admin.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
verified_at: Time.current, document_number: unique_document_number)
|
||||||
|
|
||||||
moderator = create_user("mod@consul.dev", "moderator")
|
moderator = create_user("mod@consul.dev", "moderator")
|
||||||
moderator.create_moderator
|
moderator.create_moderator
|
||||||
moderator.update!(residence_verified_at: Time.current,
|
moderator.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
verified_at: Time.current, document_number: unique_document_number)
|
||||||
|
|
||||||
manager = create_user("manager@consul.dev", "manager")
|
manager = create_user("manager@consul.dev", "manager")
|
||||||
manager.create_manager
|
manager.create_manager
|
||||||
manager.update!(residence_verified_at: Time.current,
|
manager.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
document_type: "1",
|
||||||
|
verified_at: Time.current,
|
||||||
|
document_number: unique_document_number)
|
||||||
|
|
||||||
valuator = create_user("valuator@consul.dev", "valuator")
|
valuator = create_user("valuator@consul.dev", "valuator")
|
||||||
valuator.create_valuator
|
valuator.create_valuator
|
||||||
valuator.update!(residence_verified_at: Time.current,
|
valuator.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
document_type: "1",
|
||||||
|
verified_at: Time.current,
|
||||||
|
document_number: unique_document_number)
|
||||||
|
|
||||||
poll_officer = create_user("poll_officer@consul.dev", "Paul O. Fisher")
|
poll_officer = create_user("poll_officer@consul.dev", "Paul O. Fisher")
|
||||||
poll_officer.create_poll_officer
|
poll_officer.create_poll_officer
|
||||||
poll_officer.update!(residence_verified_at: Time.current,
|
poll_officer.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
document_type: "1",
|
||||||
|
verified_at: Time.current,
|
||||||
|
document_number: unique_document_number)
|
||||||
|
|
||||||
poll_officer2 = create_user("poll_officer2@consul.dev", "Pauline M. Espinosa")
|
poll_officer2 = create_user("poll_officer2@consul.dev", "Pauline M. Espinosa")
|
||||||
poll_officer2.create_poll_officer
|
poll_officer2.create_poll_officer
|
||||||
poll_officer2.update!(residence_verified_at: Time.current,
|
poll_officer2.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
document_type: "1",
|
||||||
|
verified_at: Time.current,
|
||||||
|
document_number: unique_document_number)
|
||||||
|
|
||||||
sdg_manager = create_user("sdg_manager@consul.dev", "SDG manager")
|
sdg_manager = create_user("sdg_manager@consul.dev", "SDG manager")
|
||||||
sdg_manager.create_sdg_manager
|
sdg_manager.create_sdg_manager
|
||||||
sdg_manager.update!(residence_verified_at: Time.current,
|
sdg_manager.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
document_type: "1",
|
||||||
|
verified_at: Time.current,
|
||||||
|
document_number: unique_document_number)
|
||||||
|
|
||||||
create_user("unverified@consul.dev", "unverified")
|
create_user("unverified@consul.dev", "unverified")
|
||||||
|
|
||||||
level_2 = create_user("leveltwo@consul.dev", "level 2")
|
level_2 = create_user("leveltwo@consul.dev", "level 2")
|
||||||
level_2.update!(residence_verified_at: Time.current,
|
level_2.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number,
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
document_number: unique_document_number, document_type: "1")
|
document_number: unique_document_number,
|
||||||
|
document_type: "1")
|
||||||
|
|
||||||
verified = create_user("verified@consul.dev", "verified")
|
verified = create_user("verified@consul.dev", "verified")
|
||||||
verified.update!(residence_verified_at: Time.current,
|
verified.update!(residence_verified_at: Time.current,
|
||||||
confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1",
|
confirmed_phone: Faker::PhoneNumber.phone_number,
|
||||||
verified_at: Time.current, document_number: unique_document_number)
|
document_type: "1",
|
||||||
|
verified_at: Time.current,
|
||||||
|
document_number: unique_document_number)
|
||||||
|
|
||||||
[
|
[
|
||||||
I18n.t("seeds.organizations.neighborhood_association"),
|
I18n.t("seeds.organizations.neighborhood_association"),
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ class AddTimeZoneToDefaultDatetimes < ActiveRecord::Migration[4.2]
|
|||||||
def change
|
def change
|
||||||
change_column_default :users, :password_changed_at,
|
change_column_default :users, :password_changed_at,
|
||||||
from: Time.zone.local(2015, 1, 1, 1, 1, 1),
|
from: Time.zone.local(2015, 1, 1, 1, 1, 1),
|
||||||
to: DateTime.new(2015, 1, 1, 1, 1, 1, "+00:00")
|
to: DateTime.new(2015, 1, 1, 1, 1, 1, "+00:00")
|
||||||
|
|
||||||
change_column_default :locks, :locked_until,
|
change_column_default :locks, :locked_until,
|
||||||
from: Time.zone.local(2000, 1, 1, 1, 1, 1),
|
from: Time.zone.local(2000, 1, 1, 1, 1, 1),
|
||||||
to: DateTime.new(2000, 1, 1, 1, 1, 1, "+00:00")
|
to: DateTime.new(2000, 1, 1, 1, 1, 1, "+00:00")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ class CensusApi
|
|||||||
def request(document_type, document_number)
|
def request(document_type, document_number)
|
||||||
{ request:
|
{ request:
|
||||||
{ codigo_institucion: Rails.application.secrets.census_api_institution_code,
|
{ codigo_institucion: Rails.application.secrets.census_api_institution_code,
|
||||||
codigo_portal: Rails.application.secrets.census_api_portal_name,
|
codigo_portal: Rails.application.secrets.census_api_portal_name,
|
||||||
codigo_usuario: Rails.application.secrets.census_api_user_code,
|
codigo_usuario: Rails.application.secrets.census_api_user_code,
|
||||||
documento: document_number,
|
documento: document_number,
|
||||||
tipo_documento: document_type,
|
tipo_documento: document_type,
|
||||||
codigo_idioma: 102,
|
codigo_idioma: 102,
|
||||||
nivel: 3 }}
|
nivel: 3 }}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -28,21 +28,21 @@ class MarkdownConverter
|
|||||||
|
|
||||||
def default_render_options
|
def default_render_options
|
||||||
{
|
{
|
||||||
filter_html: false,
|
filter_html: false,
|
||||||
hard_wrap: true,
|
hard_wrap: true,
|
||||||
link_attributes: { target: "_blank" }
|
link_attributes: { target: "_blank" }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def extensions
|
def extensions
|
||||||
{
|
{
|
||||||
autolink: true,
|
autolink: true,
|
||||||
fenced_code_blocks: true,
|
fenced_code_blocks: true,
|
||||||
lax_spacing: true,
|
lax_spacing: true,
|
||||||
no_intra_emphasis: true,
|
no_intra_emphasis: true,
|
||||||
strikethrough: true,
|
strikethrough: true,
|
||||||
superscript: true,
|
superscript: true,
|
||||||
tables: true
|
tables: true
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ module OmniAuth
|
|||||||
|
|
||||||
info do
|
info do
|
||||||
{
|
{
|
||||||
name: raw_info["display_name"],
|
name: raw_info["display_name"],
|
||||||
email: raw_info["user_email"],
|
email: raw_info["user_email"],
|
||||||
nickname: raw_info["user_nicename"],
|
nickname: raw_info["user_nicename"],
|
||||||
urls: { "Website" => raw_info["user_url"] }
|
urls: { "Website" => raw_info["user_url"] }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class SMSApi
|
|||||||
end
|
end
|
||||||
|
|
||||||
def request(phone, code)
|
def request(phone, code)
|
||||||
{ autorizacion: authorization,
|
{ autorizacion: authorization,
|
||||||
destinatarios: { destinatario: phone },
|
destinatarios: { destinatario: phone },
|
||||||
texto_mensaje: "Clave para verificarte: #{code}. Gobierno Abierto",
|
texto_mensaje: "Clave para verificarte: #{code}. Gobierno Abierto",
|
||||||
solicita_notificacion: "All" }
|
solicita_notificacion: "All" }
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ describe Relationable::RelatedListComponent do
|
|||||||
|
|
||||||
create(:related_content, parent_relationable: proposal, child_relationable: user_proposal)
|
create(:related_content, parent_relationable: proposal, child_relationable: user_proposal)
|
||||||
create(:related_content, parent_relationable: proposal,
|
create(:related_content, parent_relationable: proposal,
|
||||||
child_relationable: machine_proposal,
|
child_relationable: machine_proposal,
|
||||||
machine_learning: true)
|
machine_learning: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "displays machine learning and user content when machine learning is enabled" do
|
it "displays machine learning and user content when machine learning is enabled" do
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ describe Shared::BannerComponent do
|
|||||||
banner = create(:banner,
|
banner = create(:banner,
|
||||||
title: "Vote now!",
|
title: "Vote now!",
|
||||||
description: "Banner description",
|
description: "Banner description",
|
||||||
target_url: "http://www.url.com",
|
target_url: "http://www.url.com",
|
||||||
post_started_at: (Date.current - 4.days),
|
post_started_at: (Date.current - 4.days),
|
||||||
post_ended_at: (Date.current + 10.days),
|
post_ended_at: (Date.current + 10.days),
|
||||||
background_color: "#FF0000",
|
background_color: "#FF0000",
|
||||||
font_color: "#FFFFFF"
|
font_color: "#FFFFFF"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do
|
|||||||
it "is not possible for an already started poll" do
|
it "is not possible for an already started poll" do
|
||||||
post :create, params: {
|
post :create, params: {
|
||||||
poll_question_answer_video: {
|
poll_question_answer_video: {
|
||||||
title: "Video from started poll",
|
title: "Video from started poll",
|
||||||
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
||||||
},
|
},
|
||||||
answer_id: current_answer
|
answer_id: current_answer
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(flash[:alert]).to eq "You do not have permission to carry out the action 'create' on Video."
|
expect(flash[:alert]).to eq "You do not have permission to carry out the action 'create' on Video."
|
||||||
@@ -21,8 +21,8 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do
|
|||||||
it "is possible for a not started poll" do
|
it "is possible for a not started poll" do
|
||||||
post :create, params: {
|
post :create, params: {
|
||||||
poll_question_answer_video: {
|
poll_question_answer_video: {
|
||||||
title: "Video from not started poll",
|
title: "Video from not started poll",
|
||||||
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
url: "https://www.youtube.com/watch?v=-JMf43st-1A"
|
||||||
},
|
},
|
||||||
answer_id: future_answer
|
answer_id: future_answer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe CommentsController do
|
|||||||
describe "POST create" do
|
describe "POST create" do
|
||||||
let(:legal_process) do
|
let(:legal_process) do
|
||||||
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
||||||
debate_end_date: Date.current + 2.days)
|
debate_end_date: Date.current + 2.days)
|
||||||
end
|
end
|
||||||
let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") }
|
let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") }
|
||||||
let(:user) { create(:user, :level_two) }
|
let(:user) { create(:user, :level_two) }
|
||||||
@@ -53,13 +53,13 @@ describe CommentsController do
|
|||||||
|
|
||||||
expect do
|
expect do
|
||||||
post :create, xhr: true,
|
post :create, xhr: true,
|
||||||
params: {
|
params: {
|
||||||
comment: {
|
comment: {
|
||||||
commentable_id: annotation.id,
|
commentable_id: annotation.id,
|
||||||
commentable_type: "Legislation::Annotation",
|
commentable_type: "Legislation::Annotation",
|
||||||
body: "a comment"
|
body: "a comment"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end.not_to change { annotation.reload.comments_count }
|
end.not_to change { annotation.reload.comments_count }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe Legislation::AnnotationsController do
|
|||||||
describe "POST create" do
|
describe "POST create" do
|
||||||
let(:legal_process) do
|
let(:legal_process) do
|
||||||
create(:legislation_process, allegations_start_date: Date.current - 3.days,
|
create(:legislation_process, allegations_start_date: Date.current - 3.days,
|
||||||
allegations_end_date: Date.current + 2.days)
|
allegations_end_date: Date.current + 2.days)
|
||||||
end
|
end
|
||||||
let(:draft_version) do
|
let(:draft_version) do
|
||||||
create(:legislation_draft_version, :published, process: legal_process, title: "Version 1")
|
create(:legislation_draft_version, :published, process: legal_process, title: "Version 1")
|
||||||
@@ -40,19 +40,19 @@ describe Legislation::AnnotationsController do
|
|||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
post :create, params: {
|
post :create, params: {
|
||||||
process_id: legal_process.id,
|
process_id: legal_process.id,
|
||||||
draft_version_id: draft_version.id,
|
draft_version_id: draft_version.id,
|
||||||
legislation_annotation: {
|
legislation_annotation: {
|
||||||
"quote" => "ipsum",
|
"quote" => "ipsum",
|
||||||
"ranges" => [{
|
"ranges" => [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}],
|
}],
|
||||||
"text" => "una anotacion"
|
"text" => "una anotacion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect(Ahoy::Event.where(name: :legislation_annotation_created).count).to eq 1
|
expect(Ahoy::Event.where(name: :legislation_annotation_created).count).to eq 1
|
||||||
expect(Ahoy::Event.last.properties["legislation_annotation_id"]).to eq Legislation::Annotation.last.id
|
expect(Ahoy::Event.last.properties["legislation_annotation_id"]).to eq Legislation::Annotation.last.id
|
||||||
end
|
end
|
||||||
@@ -61,19 +61,19 @@ describe Legislation::AnnotationsController do
|
|||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
post :create, params: {
|
post :create, params: {
|
||||||
process_id: legal_process.id,
|
process_id: legal_process.id,
|
||||||
draft_version_id: final_version.id,
|
draft_version_id: final_version.id,
|
||||||
legislation_annotation: {
|
legislation_annotation: {
|
||||||
"quote" => "ipsum",
|
"quote" => "ipsum",
|
||||||
"ranges" => [{
|
"ranges" => [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}],
|
}],
|
||||||
"text" => "una anotacion"
|
"text" => "una anotacion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(response).to have_http_status(:not_found)
|
expect(response).to have_http_status(:not_found)
|
||||||
end
|
end
|
||||||
@@ -87,14 +87,14 @@ describe Legislation::AnnotationsController do
|
|||||||
process_id: legal_process.id,
|
process_id: legal_process.id,
|
||||||
draft_version_id: draft_version.id,
|
draft_version_id: draft_version.id,
|
||||||
legislation_annotation: {
|
legislation_annotation: {
|
||||||
"quote" => "ipsum",
|
"quote" => "ipsum",
|
||||||
"ranges" => [{
|
"ranges" => [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}],
|
}],
|
||||||
"text" => "una anotacion"
|
"text" => "una anotacion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end.to change { draft_version.annotations.count }.by(1)
|
end.to change { draft_version.annotations.count }.by(1)
|
||||||
@@ -112,11 +112,11 @@ describe Legislation::AnnotationsController do
|
|||||||
legislation_annotation: {
|
legislation_annotation: {
|
||||||
"quote" => "ipsum",
|
"quote" => "ipsum",
|
||||||
"ranges" => [{
|
"ranges" => [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}],
|
}],
|
||||||
"text" => "una anotacion"
|
"text" => "una anotacion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,14 +132,14 @@ describe Legislation::AnnotationsController do
|
|||||||
process_id: legal_process.id,
|
process_id: legal_process.id,
|
||||||
draft_version_id: draft_version.id,
|
draft_version_id: draft_version.id,
|
||||||
legislation_annotation: {
|
legislation_annotation: {
|
||||||
"quote" => "ipsum",
|
"quote" => "ipsum",
|
||||||
"ranges" => [{
|
"ranges" => [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}].to_json,
|
}].to_json,
|
||||||
"text" => "una anotacion"
|
"text" => "una anotacion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end.to change { draft_version.annotations.count }.by(1)
|
end.to change { draft_version.annotations.count }.by(1)
|
||||||
@@ -149,15 +149,15 @@ describe Legislation::AnnotationsController do
|
|||||||
annotation = create(:legislation_annotation, draft_version: draft_version,
|
annotation = create(:legislation_annotation, draft_version: draft_version,
|
||||||
text: "my annotation",
|
text: "my annotation",
|
||||||
ranges: [{
|
ranges: [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}],
|
}],
|
||||||
range_start: "/p[1]",
|
range_start: "/p[1]",
|
||||||
range_start_offset: 6,
|
range_start_offset: 6,
|
||||||
range_end: "/p[1]",
|
range_end: "/p[1]",
|
||||||
range_end_offset: 11)
|
range_end_offset: 11)
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
@@ -166,14 +166,14 @@ describe Legislation::AnnotationsController do
|
|||||||
process_id: legal_process.id,
|
process_id: legal_process.id,
|
||||||
draft_version_id: draft_version.id,
|
draft_version_id: draft_version.id,
|
||||||
legislation_annotation: {
|
legislation_annotation: {
|
||||||
"quote" => "ipsum",
|
"quote" => "ipsum",
|
||||||
"ranges" => [{
|
"ranges" => [{
|
||||||
"start" => "/p[1]",
|
"start" => "/p[1]",
|
||||||
"startOffset" => 6,
|
"startOffset" => 6,
|
||||||
"end" => "/p[1]",
|
"end" => "/p[1]",
|
||||||
"endOffset" => 11
|
"endOffset" => 11
|
||||||
}],
|
}],
|
||||||
"text" => "una anotacion"
|
"text" => "una anotacion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end.not_to change { draft_version.annotations.count }
|
end.not_to change { draft_version.annotations.count }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe Legislation::AnswersController do
|
|||||||
describe "POST create" do
|
describe "POST create" do
|
||||||
let(:legal_process) do
|
let(:legal_process) do
|
||||||
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
create(:legislation_process, debate_start_date: Date.current - 3.days,
|
||||||
debate_end_date: Date.current + 2.days)
|
debate_end_date: Date.current + 2.days)
|
||||||
end
|
end
|
||||||
let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") }
|
let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") }
|
||||||
let(:question_option) { create(:legislation_question_option, question: question, value: "Yes") }
|
let(:question_option) { create(:legislation_question_option, question: question, value: "Yes") }
|
||||||
@@ -14,12 +14,12 @@ describe Legislation::AnswersController do
|
|||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
post :create, params: {
|
post :create, params: {
|
||||||
process_id: legal_process.id,
|
process_id: legal_process.id,
|
||||||
question_id: question.id,
|
question_id: question.id,
|
||||||
legislation_answer: {
|
legislation_answer: {
|
||||||
legislation_question_option_id: question_option.id
|
legislation_question_option_id: question_option.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect(Ahoy::Event.where(name: :legislation_answer_created).count).to eq 1
|
expect(Ahoy::Event.where(name: :legislation_answer_created).count).to eq 1
|
||||||
expect(Ahoy::Event.last.properties["legislation_answer_id"]).to eq Legislation::Answer.last.id
|
expect(Ahoy::Event.last.properties["legislation_answer_id"]).to eq Legislation::Answer.last.id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ describe Management::SessionsController do
|
|||||||
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager)
|
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager)
|
||||||
|
|
||||||
get :create, params: {
|
get :create, params: {
|
||||||
login: "JJB033",
|
login: "JJB033",
|
||||||
clave_usuario: "31415926",
|
clave_usuario: "31415926",
|
||||||
fecha_conexion: "20151031135905"
|
fecha_conexion: "20151031135905"
|
||||||
}
|
}
|
||||||
expect(response).to be_redirect
|
expect(response).to be_redirect
|
||||||
expect(session[:manager][:login]).to eq "JJB033"
|
expect(session[:manager][:login]).to eq "JJB033"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ describe RemoteCensusApi do
|
|||||||
params = {
|
params = {
|
||||||
"document_type" => "1",
|
"document_type" => "1",
|
||||||
"date_of_birth" => "1980-12-31",
|
"date_of_birth" => "1980-12-31",
|
||||||
"postal_code" => "28013"
|
"postal_code" => "28013"
|
||||||
}
|
}
|
||||||
|
|
||||||
savon.expects(:verify_residence)
|
savon.expects(:verify_residence)
|
||||||
@@ -79,8 +79,8 @@ describe RemoteCensusApi do
|
|||||||
params = {
|
params = {
|
||||||
"document_type" => "1",
|
"document_type" => "1",
|
||||||
"date_of_birth" => "1980-12-31",
|
"date_of_birth" => "1980-12-31",
|
||||||
"postal_code" => "28013",
|
"postal_code" => "28013",
|
||||||
"api_key" => "your_api_key"
|
"api_key" => "your_api_key"
|
||||||
}
|
}
|
||||||
|
|
||||||
savon.expects(:verify_residence)
|
savon.expects(:verify_residence)
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ describe "rake db:seed" do
|
|||||||
SiteCustomization::Page.destroy_all
|
SiteCustomization::Page.destroy_all
|
||||||
load Rails.root.join("db", "pages.rb")
|
load Rails.root.join("db", "pages.rb")
|
||||||
|
|
||||||
paths = { accessibility: "pages.accessibility.title", conditions: "pages.conditions.title",
|
paths = { accessibility: "pages.accessibility.title",
|
||||||
faq: "pages.help.faq.page.title", privacy: "pages.privacy.title",
|
conditions: "pages.conditions.title",
|
||||||
|
faq: "pages.help.faq.page.title",
|
||||||
|
privacy: "pages.privacy.title",
|
||||||
welcome_not_verified: "welcome.welcome.title",
|
welcome_not_verified: "welcome.welcome.title",
|
||||||
welcome_level_two_verified: "welcome.welcome.title",
|
welcome_level_two_verified: "welcome.welcome.title",
|
||||||
welcome_level_three_verified: "welcome.welcome.title" }
|
welcome_level_three_verified: "welcome.welcome.title" }
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ describe Budget::Ballot::Line do
|
|||||||
|
|
||||||
it "is not valid if there are no votes left" do
|
it "is not valid if there are no votes left" do
|
||||||
create(:budget_ballot_line, ballot: ballot,
|
create(:budget_ballot_line, ballot: ballot,
|
||||||
investment: create(:budget_investment, :selected, heading: heading))
|
investment: create(:budget_investment, :selected, heading: heading))
|
||||||
|
|
||||||
expect(ballot_line).not_to be_valid
|
expect(ballot_line).not_to be_valid
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ describe Budget::Heading do
|
|||||||
|
|
||||||
it "Allows longitude inside [-180,180] interval" do
|
it "Allows longitude inside [-180,180] interval" do
|
||||||
heading = create(:budget_heading, group: group,
|
heading = create(:budget_heading, group: group,
|
||||||
name: "Longitude is inside [-180,180] interval")
|
name: "Longitude is inside [-180,180] interval")
|
||||||
|
|
||||||
heading.longitude = "180"
|
heading.longitude = "180"
|
||||||
expect(heading).to be_valid
|
expect(heading).to be_valid
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ describe Budget::Phase do
|
|||||||
describe "when being enabled" do
|
describe "when being enabled" do
|
||||||
before do
|
before do
|
||||||
accepting_phase.update!(enabled: false,
|
accepting_phase.update!(enabled: false,
|
||||||
starts_at: Date.current,
|
starts_at: Date.current,
|
||||||
ends_at: Date.current + 2.days)
|
ends_at: Date.current + 2.days)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adjusts previous enabled phase end date to its own start date" do
|
it "adjusts previous enabled phase end date to its own start date" do
|
||||||
@@ -211,16 +211,16 @@ describe Budget::Phase do
|
|||||||
it "doesn't adjust previous enabled phase end date to its own start date" do
|
it "doesn't adjust previous enabled phase end date to its own start date" do
|
||||||
expect do
|
expect do
|
||||||
accepting_phase.update(enabled: false,
|
accepting_phase.update(enabled: false,
|
||||||
starts_at: Date.current,
|
starts_at: Date.current,
|
||||||
ends_at: Date.current + 2.days)
|
ends_at: Date.current + 2.days)
|
||||||
end.not_to change { prev_enabled_phase.ends_at }
|
end.not_to change { prev_enabled_phase.ends_at }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adjusts next enabled phase start date to its own start date" do
|
it "adjusts next enabled phase start date to its own start date" do
|
||||||
expect do
|
expect do
|
||||||
accepting_phase.update(enabled: false,
|
accepting_phase.update(enabled: false,
|
||||||
starts_at: Date.current,
|
starts_at: Date.current,
|
||||||
ends_at: Date.current + 2.days)
|
ends_at: Date.current + 2.days)
|
||||||
end.to change { next_enabled_phase.starts_at.to_date }.to(Date.current)
|
end.to change { next_enabled_phase.starts_at.to_date }.to(Date.current)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ describe Budget::Stats do
|
|||||||
|
|
||||||
it "doesn't count nil user ids" do
|
it "doesn't count nil user ids" do
|
||||||
create(:budget_ballot_line, investment: investment,
|
create(:budget_ballot_line, investment: investment,
|
||||||
ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true)
|
ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true)
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(stats.total_participants_vote_phase).to be 0
|
expect(stats.total_participants_vote_phase).to be 0
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ RSpec.describe Legislation::Process::Phase, type: :model do
|
|||||||
|
|
||||||
# started
|
# started
|
||||||
process.update!(debate_start_date: Date.current - 2.days,
|
process.update!(debate_start_date: Date.current - 2.days,
|
||||||
debate_end_date: Date.current + 1.day)
|
debate_end_date: Date.current + 1.day)
|
||||||
expect(process.debate_phase.started?).to be true
|
expect(process.debate_phase.started?).to be true
|
||||||
|
|
||||||
# starts today
|
# starts today
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ describe Legislation::Process do
|
|||||||
|
|
||||||
it "is valid if allegations_end_date is the same as allegations_start_date" do
|
it "is valid if allegations_end_date is the same as allegations_start_date" do
|
||||||
process = build(:legislation_process, allegations_start_date: Date.current - 1.day,
|
process = build(:legislation_process, allegations_start_date: Date.current - 1.day,
|
||||||
allegations_end_date: Date.current - 1.day)
|
allegations_end_date: Date.current - 1.day)
|
||||||
expect(process).to be_valid
|
expect(process).to be_valid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ describe LocalCensusRecord do
|
|||||||
it "is not valid when a record already exists with same document_number and document_type" do
|
it "is not valid when a record already exists with same document_number and document_type" do
|
||||||
create(:local_census_record, document_number: "#DOC_NUMBER", document_type: "1")
|
create(:local_census_record, document_number: "#DOC_NUMBER", document_type: "1")
|
||||||
local_census_record = build(:local_census_record, document_number: "#DOC_NUMBER",
|
local_census_record = build(:local_census_record, document_number: "#DOC_NUMBER",
|
||||||
document_type: "1")
|
document_type: "1")
|
||||||
|
|
||||||
expect(local_census_record).not_to be_valid
|
expect(local_census_record).not_to be_valid
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -522,17 +522,23 @@ describe MachineLearning do
|
|||||||
machine_learning = MachineLearning.new(job)
|
machine_learning = MachineLearning.new(job)
|
||||||
|
|
||||||
tags_data = [
|
tags_data = [
|
||||||
{ id: 0,
|
{
|
||||||
name: "Existing tag" },
|
id: 0,
|
||||||
{ id: 1,
|
name: "Existing tag"
|
||||||
name: "Machine learning tag" }
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "Machine learning tag"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
taggings_data = [
|
taggings_data = [
|
||||||
{ tag_id: 0,
|
{
|
||||||
|
tag_id: 0,
|
||||||
taggable_id: proposal.id
|
taggable_id: proposal.id
|
||||||
},
|
},
|
||||||
{ tag_id: 1,
|
{
|
||||||
|
tag_id: 1,
|
||||||
taggable_id: proposal.id
|
taggable_id: proposal.id
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -564,17 +570,23 @@ describe MachineLearning do
|
|||||||
machine_learning = MachineLearning.new(job)
|
machine_learning = MachineLearning.new(job)
|
||||||
|
|
||||||
tags_data = [
|
tags_data = [
|
||||||
{ id: 0,
|
{
|
||||||
name: "Existing tag" },
|
id: 0,
|
||||||
{ id: 1,
|
name: "Existing tag"
|
||||||
name: "Machine learning tag" }
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "Machine learning tag"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
taggings_data = [
|
taggings_data = [
|
||||||
{ tag_id: 0,
|
{
|
||||||
|
tag_id: 0,
|
||||||
taggable_id: investment.id
|
taggable_id: investment.id
|
||||||
},
|
},
|
||||||
{ tag_id: 1,
|
{
|
||||||
|
tag_id: 1,
|
||||||
taggable_id: investment.id
|
taggable_id: investment.id
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ describe Officing::Residence do
|
|||||||
describe "dates" do
|
describe "dates" do
|
||||||
it "is not valid but not because date of birth" do
|
it "is not valid but not because date of birth" do
|
||||||
custom_residence = Officing::Residence.new("date_of_birth(3i)" => "1",
|
custom_residence = Officing::Residence.new("date_of_birth(3i)" => "1",
|
||||||
"date_of_birth(2i)" => "1",
|
"date_of_birth(2i)" => "1",
|
||||||
"date_of_birth(1i)" => "1980")
|
"date_of_birth(1i)" => "1980")
|
||||||
|
|
||||||
expect(custom_residence).not_to be_valid
|
expect(custom_residence).not_to be_valid
|
||||||
expect(custom_residence.errors[:date_of_birth]).to be_empty
|
expect(custom_residence.errors[:date_of_birth]).to be_empty
|
||||||
@@ -94,8 +94,8 @@ describe Officing::Residence do
|
|||||||
|
|
||||||
it "is not valid without a date of birth" do
|
it "is not valid without a date of birth" do
|
||||||
custom_residence = Officing::Residence.new("date_of_birth(3i)" => "",
|
custom_residence = Officing::Residence.new("date_of_birth(3i)" => "",
|
||||||
"date_of_birth(2i)" => "",
|
"date_of_birth(2i)" => "",
|
||||||
"date_of_birth(1i)" => "")
|
"date_of_birth(1i)" => "")
|
||||||
expect(custom_residence).not_to be_valid
|
expect(custom_residence).not_to be_valid
|
||||||
expect(custom_residence.errors[:date_of_birth]).to include("can't be blank")
|
expect(custom_residence.errors[:date_of_birth]).to include("can't be blank")
|
||||||
end
|
end
|
||||||
@@ -117,10 +117,10 @@ describe Officing::Residence do
|
|||||||
|
|
||||||
expect(FailedCensusCall.count).to eq(1)
|
expect(FailedCensusCall.count).to eq(1)
|
||||||
expect(FailedCensusCall.first).to have_attributes(
|
expect(FailedCensusCall.first).to have_attributes(
|
||||||
user_id: residence.user.id,
|
user_id: residence.user.id,
|
||||||
poll_officer_id: residence.officer.id,
|
poll_officer_id: residence.officer.id,
|
||||||
document_number: "12345678Z",
|
document_number: "12345678Z",
|
||||||
document_type: "1",
|
document_type: "1",
|
||||||
date_of_birth: nil,
|
date_of_birth: nil,
|
||||||
postal_code: "00001",
|
postal_code: "00001",
|
||||||
year_of_birth: Time.current.year
|
year_of_birth: Time.current.year
|
||||||
@@ -209,13 +209,13 @@ describe Officing::Residence do
|
|||||||
|
|
||||||
expect(FailedCensusCall.count).to eq(1)
|
expect(FailedCensusCall.count).to eq(1)
|
||||||
expect(FailedCensusCall.first).to have_attributes(
|
expect(FailedCensusCall.first).to have_attributes(
|
||||||
user_id: residence.user.id,
|
user_id: residence.user.id,
|
||||||
poll_officer_id: residence.officer.id,
|
poll_officer_id: residence.officer.id,
|
||||||
document_number: "12345678Z",
|
document_number: "12345678Z",
|
||||||
document_type: "1",
|
document_type: "1",
|
||||||
date_of_birth: nil,
|
date_of_birth: nil,
|
||||||
postal_code: nil,
|
postal_code: nil,
|
||||||
year_of_birth: Time.current.year
|
year_of_birth: Time.current.year
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user