Merge pull request #2993 from consul/clean-format
[Backport] Code format
This commit is contained in:
@@ -36,6 +36,7 @@ class NotificationsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def linkable_resource_path(notification)
|
||||
if notification.linkable_resource.is_a?(AdminNotification)
|
||||
notification.linkable_resource.link || notifications_path
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class SiteCustomization::ContentBlock < ActiveRecord::Base
|
||||
VALID_BLOCKS = %w(top_links footer subnavigation_left subnavigation_right)
|
||||
VALID_BLOCKS = %w[top_links footer subnavigation_left subnavigation_right]
|
||||
|
||||
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
||||
validates :name, presence: true, uniqueness: { scope: :locale }, inclusion: { in: VALID_BLOCKS }
|
||||
|
||||
@@ -4,11 +4,11 @@ section "Creating banners" do
|
||||
description = Faker::Lorem.sentence(word_count = 12)
|
||||
target_url = Rails.application.routes.url_helpers.proposal_path(proposal)
|
||||
banner = Banner.new(title: title,
|
||||
description: description,
|
||||
target_url: target_url,
|
||||
post_started_at: rand((Time.current - 1.week)..(Time.current - 1.day)),
|
||||
post_ended_at: rand((Time.current - 1.day)..(Time.current + 1.week)),
|
||||
created_at: rand((Time.current - 1.week)..Time.current))
|
||||
description: description,
|
||||
target_url: target_url,
|
||||
post_started_at: rand((Time.current - 1.week)..(Time.current - 1.day)),
|
||||
post_ended_at: rand((Time.current - 1.day)..(Time.current + 1.week)),
|
||||
created_at: rand((Time.current - 1.week)..Time.current))
|
||||
I18n.available_locales.map do |locale|
|
||||
Globalize.with_locale(locale) do
|
||||
banner.description = "Description for locale #{locale}"
|
||||
|
||||
@@ -16,6 +16,7 @@ FactoryBot.define do
|
||||
title "A collaborative legislation process"
|
||||
description "Description of the process"
|
||||
summary "Summary of the process"
|
||||
|
||||
start_date { Date.current - 5.days }
|
||||
end_date { Date.current + 5.days }
|
||||
debate_start_date { Date.current - 5.days }
|
||||
@@ -87,8 +88,8 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
trait :open do
|
||||
start_date 1.week.ago
|
||||
end_date 1.week.from_now
|
||||
start_date { 1.week.ago }
|
||||
end_date { 1.week.from_now }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
trait :archived do
|
||||
created_at 25.months.ago
|
||||
created_at { 25.months.ago }
|
||||
end
|
||||
|
||||
trait :with_hot_score do
|
||||
|
||||
@@ -12,7 +12,7 @@ FactoryBot.define do
|
||||
user
|
||||
document_number
|
||||
document_type "1"
|
||||
date_of_birth Time.zone.local(1980, 12, 31).to_date
|
||||
date_of_birth { Time.zone.local(1980, 12, 31).to_date }
|
||||
postal_code "28013"
|
||||
terms_of_service '1'
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ feature "Admin custom content blocks" do
|
||||
|
||||
click_link "Create new content block"
|
||||
|
||||
select I18n.t("admin.site_customization.content_blocks.content_block.names.footer"), from: "site_customization_content_block_name"
|
||||
select I18n.t("admin.site_customization.content_blocks.content_block.names.footer"),
|
||||
from: "site_customization_content_block_name"
|
||||
select "es", from: "site_customization_content_block_locale"
|
||||
fill_in "site_customization_content_block_body", with: "Some custom content"
|
||||
|
||||
@@ -50,7 +51,8 @@ feature "Admin custom content blocks" do
|
||||
|
||||
click_link "Create new content block"
|
||||
|
||||
select I18n.t("admin.site_customization.content_blocks.content_block.names.top_links"), from: "site_customization_content_block_name"
|
||||
select I18n.t("admin.site_customization.content_blocks.content_block.names.top_links"),
|
||||
from: "site_customization_content_block_name"
|
||||
select "en", from: "site_customization_content_block_locale"
|
||||
fill_in "site_customization_content_block_body", with: "Some custom content"
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ feature "Admin custom information texts" do
|
||||
visit admin_site_customization_information_texts_path
|
||||
|
||||
click_link 'Proposals'
|
||||
expect(find("a[href=\"/admin/site_customization/information_texts?tab=proposals\"].is-active")).to have_content "Proposals"
|
||||
expect(find("a[href=\"/admin/site_customization/information_texts?tab=proposals\"].is-active"))
|
||||
.to have_content "Proposals"
|
||||
end
|
||||
|
||||
context "Globalization" do
|
||||
|
||||
@@ -2,8 +2,10 @@ require 'rails_helper'
|
||||
|
||||
feature "Custom content blocks" do
|
||||
scenario "top links" do
|
||||
create(:site_customization_content_block, name: "top_links", locale: "en", body: "content for top links")
|
||||
create(:site_customization_content_block, name: "top_links", locale: "es", body: "contenido para top links")
|
||||
create(:site_customization_content_block, name: "top_links", locale: "en",
|
||||
body: "content for top links")
|
||||
create(:site_customization_content_block, name: "top_links", locale: "es",
|
||||
body: "contenido para top links")
|
||||
|
||||
visit "/?locale=en"
|
||||
|
||||
@@ -17,8 +19,10 @@ feature "Custom content blocks" do
|
||||
end
|
||||
|
||||
scenario "footer" do
|
||||
create(:site_customization_content_block, name: "footer", locale: "en", body: "content for footer")
|
||||
create(:site_customization_content_block, name: "footer", locale: "es", body: "contenido para footer")
|
||||
create(:site_customization_content_block, name: "footer", locale: "en",
|
||||
body: "content for footer")
|
||||
create(:site_customization_content_block, name: "footer", locale: "es",
|
||||
body: "contenido para footer")
|
||||
|
||||
visit "/?locale=en"
|
||||
|
||||
@@ -32,8 +36,10 @@ feature "Custom content blocks" do
|
||||
end
|
||||
|
||||
scenario "main navigation left" do
|
||||
create(:site_customization_content_block, name: "subnavigation_left", locale: "en", body: "content for left links")
|
||||
create(:site_customization_content_block, name: "subnavigation_left", locale: "es", body: "contenido para left links")
|
||||
create(:site_customization_content_block, name: "subnavigation_left", locale: "en",
|
||||
body: "content for left links")
|
||||
create(:site_customization_content_block, name: "subnavigation_left", locale: "es",
|
||||
body: "contenido para left links")
|
||||
|
||||
visit "/?locale=en"
|
||||
|
||||
@@ -47,8 +53,10 @@ feature "Custom content blocks" do
|
||||
end
|
||||
|
||||
scenario "main navigation right" do
|
||||
create(:site_customization_content_block, name: "subnavigation_right", locale: "en", body: "content for right links")
|
||||
create(:site_customization_content_block, name: "subnavigation_right", locale: "es", body: "contenido para right links")
|
||||
create(:site_customization_content_block, name: "subnavigation_right", locale: "en",
|
||||
body: "content for right links")
|
||||
create(:site_customization_content_block, name: "subnavigation_right", locale: "es",
|
||||
body: "contenido para right links")
|
||||
|
||||
visit "/?locale=en"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user