From ccee843da7a158d0e67a6bad447de230510322cf Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 18 Feb 2019 15:40:11 +0100 Subject: [PATCH 1/7] Remove unused settings These settings are customised for Madrid's fork. On CONSUL any user can include new links using site customisation content blocks from admin panel. --- app/helpers/application_helper.rb | 4 ---- app/views/layouts/_footer.html.erb | 9 --------- app/views/shared/_top_links.html.erb | 10 ---------- config/locales/en/general.yml | 2 -- config/locales/en/settings.yml | 3 --- config/locales/es/general.yml | 2 -- config/locales/es/settings.yml | 3 --- config/routes.rb | 1 - db/dev_seeds/settings.rb | 1 - db/seeds.rb | 3 --- 10 files changed, 38 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 486759e03d5..95a77b2d97c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,10 +7,6 @@ def home_page? request.path == '/' end - def opendata_page? - request.path == '/opendata' - end - # if current path is /debates current_path_with_query_params(foo: 'bar') returns /debates?foo=bar # notice: if query_params have a param which also exist in current path, it "overrides" (query_params is merged last) def current_path_with_query_params(query_parameters) diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 5a0a02f5fe4..adf78d06626 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -53,15 +53,6 @@ <% end %> <% end %> - <% if setting['blog_url'] %> -
  • - <%= link_to setting['blog_url'], target: "_blank", - title: t("shared.go_to_page") + t("social.blog", org: setting['org_name']) + t('shared.target_blank_html') do %> - <%= t("social.blog", org: setting['org_name']) %> - - <% end %> -
  • - <% end %> <% if setting['youtube_handle'] %>
  • <%= link_to "https://www.youtube.com/#{setting['youtube_handle']}", target: "_blank", diff --git a/app/views/shared/_top_links.html.erb b/app/views/shared/_top_links.html.erb index 5db6edab5e2..7a5445ffc67 100644 --- a/app/views/shared/_top_links.html.erb +++ b/app/views/shared/_top_links.html.erb @@ -1,13 +1,3 @@ diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index c058527bf3c..fd7260078b6 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -219,7 +219,6 @@ en: available_locales: Available languages collaborative_legislation: Legislation processes debates: Debates - external_link_blog: Blog locale: 'Language:' logo: CONSUL logo management: Management @@ -624,7 +623,6 @@ en: see_more: See more recommendations hide: Hide recommendations social: - blog: "%{org} Blog" facebook: "%{org} Facebook" twitter: "%{org} Twitter" youtube: "%{org} YouTube" diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml index dcf57061344..cadc825e3f4 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -73,9 +73,6 @@ en: min_age_to_participate: Minimum age needed to participate min_age_to_participate_description: "Users over this age can participate in all processes" analytics_url: "Analytics URL" - blog_url: "Blog URL" - transparency_url: "Transparency URL" - opendata_url: "Open Data URL" verification_offices_url: Verification offices URL proposal_improvement_path: Proposal improvement info internal link feature: diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 6e6ac250f59..3e8711e00db 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -219,7 +219,6 @@ es: available_locales: Idiomas disponibles collaborative_legislation: Procesos legislativos debates: Debates - external_link_blog: Blog locale: 'Idioma:' logo: Logo de CONSUL management: Gestión @@ -623,7 +622,6 @@ es: see_more: Ver más recomendaciones hide: Ocultar recomendaciones social: - blog: "Blog de %{org}" facebook: "Facebook de %{org}" twitter: "Twitter de %{org}" youtube: "YouTube de %{org}" diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index 8279478646c..cda0e2b4ae4 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -73,9 +73,6 @@ es: min_age_to_participate: Edad mínima para participar min_age_to_participate_description: "Los usuarios mayores de esta edad podrán participar en todos los procesos" analytics_url: "URL de estadísticas externas" - blog_url: "URL del blog" - transparency_url: "URL de transparencia" - opendata_url: "URL de open data" verification_offices_url: URL oficinas verificación proposal_improvement_path: Link a información para mejorar propuestas feature: diff --git a/config/routes.rb b/config/routes.rb index 2785a3d66f6..9d9a345dca9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,6 +48,5 @@ get 'help/faq', to: 'pages#show', id: 'help/faq/index', as: 'faq' # Static pages - get '/blog' => redirect("http://blog.consul/") resources :pages, path: '/', only: [:show] end diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index cc03a4315fc..9ef35669417 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -23,7 +23,6 @@ Setting.create(key: 'youtube_handle', value: 'CONSUL') Setting.create(key: 'telegram_handle', value: 'CONSUL') Setting.create(key: 'instagram_handle', value: 'CONSUL') - Setting.create(key: 'blog_url', value: '/blog') Setting.create(key: 'url', value: 'http://localhost:3000') Setting.create(key: 'org_name', value: 'CONSUL') Setting.create(key: 'place_name', value: 'City') diff --git a/db/seeds.rb b/db/seeds.rb index 7d424fe28b1..5995515b31c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -51,9 +51,6 @@ Setting["youtube_handle"] = nil Setting["telegram_handle"] = nil Setting["instagram_handle"] = nil -Setting["blog_url"] = nil -Setting["transparency_url"] = nil -Setting["opendata_url"] = "/opendata" # Public-facing URL of the app. Setting["url"] = "http://example.com" From 25c8212e80814fc76ce8f5490034ebcb07cdd742 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 19 Feb 2019 11:07:58 +0100 Subject: [PATCH 2/7] Remove proposal improvement path setting --- app/controllers/proposals_controller.rb | 6 ------ app/views/proposals/share.html.erb | 7 ------- config/locales/en/general.yml | 2 -- config/locales/en/settings.yml | 1 - config/locales/es/general.yml | 2 -- config/locales/es/settings.yml | 1 - db/dev_seeds/settings.rb | 1 - db/seeds.rb | 3 --- spec/features/proposals_spec.rb | 28 ------------------------- 9 files changed, 51 deletions(-) diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 5358571de21..66db140b0e0 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -64,12 +64,6 @@ def retire def retire_form end - def share - if Setting['proposal_improvement_path'].present? - @proposal_improvement_path = Setting['proposal_improvement_path'] - end - end - def vote_featured @proposal.register_vote(current_user, 'yes') set_featured_proposal_votes(@proposal) diff --git a/app/views/proposals/share.html.erb b/app/views/proposals/share.html.erb index b011a4c92a7..21fe337dcf7 100644 --- a/app/views/proposals/share.html.erb +++ b/app/views/proposals/share.html.erb @@ -27,13 +27,6 @@ description: @proposal.summary } %> - <% if @proposal_improvement_path.present? %> -
    -

    <%= t("proposals.proposal.improve_info") %>

    - <%= link_to t("proposals.proposal.improve_info_link"), @proposal_improvement_path, class: "button" %> -
    - <% end %> -
    <%= link_to t("proposals.proposal.share.view_proposal"), proposal_path(@proposal) %>
    diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index fd7260078b6..3cf7cd251df 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -397,8 +397,6 @@ en: guide: "Now you can share it so people can start supporting." edit: "Before it gets shared you'll be able to change the text as you like." view_proposal: Not now, go to my proposal - improve_info: "Improve your campaign and get more supports" - improve_info_link: "See more information" already_supported: You have already supported this proposal. Share it! comments: one: 1 comment diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml index cadc825e3f4..70ed4b26aef 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -74,7 +74,6 @@ en: min_age_to_participate_description: "Users over this age can participate in all processes" analytics_url: "Analytics URL" verification_offices_url: Verification offices URL - proposal_improvement_path: Proposal improvement info internal link feature: budgets: "Participatory budgeting" budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the municipal budget" diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 3e8711e00db..a9e4557423d 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -397,8 +397,6 @@ es: guide: "Compártela para que la gente empiece a apoyarla." edit: "Antes de que se publique podrás modificar el texto a tu gusto." view_proposal: Ahora no, ir a mi propuesta - improve_info: "Mejora tu campaña y consigue más apoyos" - improve_info_link: "Ver más información" already_supported: '¡Ya has apoyado esta propuesta, compártela!' comments: zero: Sin comentarios diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index cda0e2b4ae4..1e95aa41ac0 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -74,7 +74,6 @@ es: min_age_to_participate_description: "Los usuarios mayores de esta edad podrán participar en todos los procesos" analytics_url: "URL de estadísticas externas" verification_offices_url: URL oficinas verificación - proposal_improvement_path: Link a información para mejorar propuestas feature: budgets: "Presupuestos participativos" budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto municipal" diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index 9ef35669417..d38a9a6afbe 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -61,7 +61,6 @@ Setting.create(key: 'meta_keywords', value: 'citizen participation, open government') Setting.create(key: 'verification_offices_url', value: 'http://oficinas-atencion-ciudadano.url/') Setting.create(key: 'min_age_to_participate', value: '16') - Setting.create(key: 'proposal_improvement_path', value: nil) Setting.create(key: 'map_latitude', value: 40.41) Setting.create(key: 'map_longitude', value: -3.7) Setting.create(key: 'map_zoom', value: 10) diff --git a/db/seeds.rb b/db/seeds.rb index 5995515b31c..2d9f340e4ff 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -116,9 +116,6 @@ # Featured proposals Setting['featured_proposals_number'] = 3 -# Proposal improvement url path ('/help/proposal-improvement') -Setting['proposal_improvement_path'] = nil - # City map feature default configuration (Greenwich) Setting['map_latitude'] = 51.48 Setting['map_longitude'] = 0.0 diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 033b80fbc8a..8afdf1c052f 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -248,34 +248,6 @@ expect(page).to have_content I18n.l(Proposal.last.created_at.to_date) end - scenario "Create with proposal improvement info link" do - Setting["proposal_improvement_path"] = "/more-information/proposal-improvement" - author = create(:user) - login_as(author) - - visit new_proposal_path - fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" - fill_in "proposal_summary", with: "In summary, what we want is..." - fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" - fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk" - fill_in "proposal_responsible_name", with: "Isabel Garcia" - fill_in "proposal_tag_list", with: "Refugees, Solidarity" - check "proposal_terms_of_service" - - click_button "Create proposal" - - expect(page).to have_content "Proposal created successfully." - expect(page).to have_content "Improve your campaign and get more supports" - - click_link "Not now, go to my proposal" - - expect(page).to have_content "Help refugees" - - Setting["proposal_improvement_path"] = nil - end - scenario "Create with invisible_captcha honeypot field" do author = create(:user) login_as(author) From 2e135ca3f19ff0c271c60a1a21ebda3379ce1f3f Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 19 Feb 2019 14:08:44 +0100 Subject: [PATCH 3/7] Remove unused place name setting --- config/locales/en/settings.yml | 2 -- config/locales/es/settings.yml | 2 -- db/dev_seeds/settings.rb | 1 - db/seeds.rb | 3 --- 4 files changed, 8 deletions(-) diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml index 70ed4b26aef..740b750b98e 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -48,8 +48,6 @@ en: url_description: "Main URL of your website" org_name: "Organization" org_name_description: "Name of your organization" - place_name: "Place" - place_name_description: "Name of your city" related_content_score_threshold: "Related content score threshold" related_content_score_threshold_description: "Hides content that users mark as unrelated" hot_score_period_in_days: "Period (days) used by the filter 'most active'" diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index 1e95aa41ac0..26790e14b8a 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -48,8 +48,6 @@ es: url_description: "URL principal de tu web" org_name: "Nombre de la organización" org_name_description: "Nombre de tu organización" - place_name: "Nombre del lugar" - place_name_description: "Nombre de tu ciudad" related_content_score_threshold: "Umbral de puntuación de contenido relacionado" related_content_score_threshold_description: "Oculta el contenido que los usuarios marquen como no relacionado" hot_score_period_in_days: "Periodo (días) usado para el filtro 'Más Activos'" diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index d38a9a6afbe..4cd072ce2fd 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -25,7 +25,6 @@ Setting.create(key: 'instagram_handle', value: 'CONSUL') Setting.create(key: 'url', value: 'http://localhost:3000') Setting.create(key: 'org_name', value: 'CONSUL') - Setting.create(key: 'place_name', value: 'City') Setting.create(key: 'feature.debates', value: "true") Setting.create(key: 'feature.proposals', value: "true") diff --git a/db/seeds.rb b/db/seeds.rb index 2d9f340e4ff..76a92a4ca60 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -58,9 +58,6 @@ # CONSUL installation's organization name Setting["org_name"] = "CONSUL" -# CONSUL installation place name (City, Country...) -Setting["place_name"] = "CONSUL-land" - # Meta tags for SEO Setting["meta_title"] = nil Setting["meta_description"] = nil From b68e8bf5d24dfc9b2dc9108e5739c62c39c5c81d Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 19 Feb 2019 15:43:48 +0100 Subject: [PATCH 4/7] Improve i18n for admin settings --- config/locales/en/settings.yml | 12 ++++++------ config/locales/es/settings.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml index 740b750b98e..792111d2ad0 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -46,10 +46,10 @@ en: instagram_handle_description: "If filled in it will appear in the footer" url: "Main URL" url_description: "Main URL of your website" - org_name: "Organization" - org_name_description: "Name of your organization" + org_name: "Site name" + org_name_description: "This name will appear on mailers subject, help pages..." related_content_score_threshold: "Related content score threshold" - related_content_score_threshold_description: "Hides content that users mark as unrelated" + related_content_score_threshold_description: "According to the rating of votes in a related content, hides content that users mark as unrelated" hot_score_period_in_days: "Period (days) used by the filter 'most active'" hot_score_period_in_days_description: "The filter 'most active' used in multiple sections will be based on the votes during the last X days" map_latitude: "Latitude" @@ -59,7 +59,7 @@ en: map_zoom: "Zoom" map_zoom_description: "Zoom to show the map position" mailer_from_name: "Sender email name" - mailer_from_name_description: "This name will appear in emails sent from the application" + mailer_from_name_description: "This name will appear as sender name in emails sent from the application" mailer_from_address: "Sender email address" mailer_from_address_description: "This email address will appear in emails sent from the application" meta_title: "Site title (SEO)" @@ -69,7 +69,7 @@ en: meta_keywords: "Keywords (SEO)" meta_keywords_description: 'Keywords , used to improve SEO' min_age_to_participate: Minimum age needed to participate - min_age_to_participate_description: "Users over this age can participate in all processes" + min_age_to_participate_description: "Users over this age can participate in all processes where a user verified account is needed" analytics_url: "Analytics URL" verification_offices_url: Verification offices URL feature: @@ -120,4 +120,4 @@ en: public_stats: "Public stats" public_stats_description: "Display public stats in the Administration panel" help_page: "Help page" - help_page_description: "Displays a Help menu that contains a page with an info section about each enabled feature" + help_page_description: 'Displays a Help menu that contains a page with an info section about each enabled feature. Also custom pages and menus can be created in the "Custom pages" and "Custom content blocks" sections' diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index 26790e14b8a..453e2ed226a 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -46,10 +46,10 @@ es: instagram_handle_description: "Si está rellenado aparecerá en el pie de página" url: "URL general de la web" url_description: "URL principal de tu web" - org_name: "Nombre de la organización" - org_name_description: "Nombre de tu organización" + org_name: "Nombre del sitio" + org_name_description: "Este nombre aparecerá en el asunto de emails, páginas de ayuda..." related_content_score_threshold: "Umbral de puntuación de contenido relacionado" - related_content_score_threshold_description: "Oculta el contenido que los usuarios marquen como no relacionado" + related_content_score_threshold_description: "Según la puntuación de votos en un contenido relacionado, oculta el contenido que los usuarios marquen como no relacionado" hot_score_period_in_days: "Periodo (días) usado para el filtro 'Más Activos'" hot_score_period_in_days_description: "El filtro 'Más Activos' usado en diferentes secciones se basará en los votos de los últimos X días" map_latitude: "Latitud" @@ -59,7 +59,7 @@ es: map_zoom: "Zoom" map_zoom_description: "Zoom para mostrar la posición del mapa" mailer_from_name: "Nombre email remitente" - mailer_from_name_description: "Este nombre aparecerá en los emails enviados desde la aplicación" + mailer_from_name_description: "Este nombre aparecerá como nombre del remitente en los emails enviados desde la aplicación" mailer_from_address: "Dirección email remitente" mailer_from_address_description: "Esta dirección de email aparecerá en los emails enviados desde la aplicación" meta_title: "Título del sitio (SEO)" @@ -69,7 +69,7 @@ es: meta_keywords: "Palabras clave (SEO)" meta_keywords_description: 'Palabras clave , utilizadas para mejorar el SEO' min_age_to_participate: Edad mínima para participar - min_age_to_participate_description: "Los usuarios mayores de esta edad podrán participar en todos los procesos" + min_age_to_participate_description: "Los usuarios mayores de esta edad podrán participar en todos los procesos donde se necesite una cueta verificada" analytics_url: "URL de estadísticas externas" verification_offices_url: URL oficinas verificación feature: @@ -120,4 +120,4 @@ es: public_stats: "Estadísticas públicas" public_stats_description: "Muestra las estadísticas públicas en el panel de Administración" help_page: "Página de ayuda" - help_page_description: "Muestra un menú Ayuda que contiene una página con una sección de información sobre cada funcionalidad habilitada" + help_page_description: 'Muestra un menú Ayuda que contiene una página con una sección de información sobre cada funcionalidad habilitada. También se pueden crear páginas y menús personalizados en las secciones "Personalizar páginas" y "Personalizar bloques"' From 6fd13c1701b4d33a3e36e8c6fa2bd2ea5a7347ed Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 25 Feb 2019 14:59:03 +0100 Subject: [PATCH 5/7] Add missing settings to dev seeds --- config/locales/en/settings.yml | 4 ++++ config/locales/es/settings.yml | 4 ++++ db/dev_seeds/settings.rb | 2 ++ 3 files changed, 10 insertions(+) diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml index 792111d2ad0..22f4d66e2f1 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -72,6 +72,10 @@ en: min_age_to_participate_description: "Users over this age can participate in all processes where a user verified account is needed" analytics_url: "Analytics URL" verification_offices_url: Verification offices URL + proposal_notification_minimum_interval_in_days: "Minimum interval (in days) for authors of proposals to send new proposal notifications" + proposal_notification_minimum_interval_in_days_description: "The number of days user can send a notification for all supporters of their proposal" + direct_message_max_per_day: "Direct Message max number per day" + direct_message_max_per_day_description: "Number max of direct messages one user can send per day" feature: budgets: "Participatory budgeting" budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the municipal budget" diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index 453e2ed226a..c4e8921a6f2 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -72,6 +72,10 @@ es: min_age_to_participate_description: "Los usuarios mayores de esta edad podrán participar en todos los procesos donde se necesite una cueta verificada" analytics_url: "URL de estadísticas externas" verification_offices_url: URL oficinas verificación + proposal_notification_minimum_interval_in_days: "Intervalo mínimo (en días) para que los autores de propuestas puedan enviar nuevas notificaciones de propuesta" + proposal_notification_minimum_interval_in_days_description: "El número de días en los que un usuario puede enviar una notificación a todos los que apoyan su propuesta" + direct_message_max_per_day: "Mensajes directos máximos por día" + direct_message_max_per_day_description: "Número de mensajes directos máximos que un usuario puede enviar por día" feature: budgets: "Presupuestos participativos" budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto municipal" diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index 4cd072ce2fd..af71c6ccc04 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -64,6 +64,8 @@ Setting.create(key: 'map_longitude', value: -3.7) Setting.create(key: 'map_zoom', value: 10) Setting.create(key: 'featured_proposals_number', value: 3) + Setting.create(key: 'proposal_notification_minimum_interval_in_days', value: 0) + Setting.create(key: 'direct_message_max_per_day', value: 3) Setting.create(key: 'related_content_score_threshold', value: -0.3) Setting.create(key: 'hot_score_period_in_days', value: 31) From 8066b96fe3acc1b6508d5837d70a18540980a283 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 25 Feb 2019 14:59:38 +0100 Subject: [PATCH 6/7] Remove legacy banner images and banner styles settings --- app/assets/stylesheets/layout.scss | 70 ------------------- app/controllers/admin/settings_controller.rb | 4 +- app/models/setting.rb | 14 ---- .../admin/settings/_banner_images.html.erb | 24 ------- .../admin/settings/_banner_styles.html.erb | 24 ------- .../admin/settings/_filter_subnav.html.erb | 12 ---- app/views/admin/settings/index.html.erb | 8 --- config/locales/en/admin.yml | 4 -- config/locales/es/admin.yml | 4 -- db/seeds.rb | 10 --- lib/tasks/banners.rake | 20 ------ spec/models/setting_spec.rb | 24 ------- 12 files changed, 1 insertion(+), 217 deletions(-) delete mode 100644 app/views/admin/settings/_banner_images.html.erb delete mode 100644 app/views/admin/settings/_banner_styles.html.erb delete mode 100644 lib/tasks/banners.rake diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 513975a382a..f33e0a3d565 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2245,76 +2245,6 @@ table { // 18. Banners // ----------- -.banner-style-one { - background-color: $brand; -} - -.banner-style-two { - background-color: $budget; -} - -.banner-style-three { - background-color: #33dadf; -} - -@include breakpoint(large) { - - .banner-img-one { - background-image: image-url("banners/banner1.png"); - } - - .banner-img-two { - background-image: image-url("banners/banner2.png"); - } - - .banner-img-three { - background-image: image-url("banners/banner3.png"); - } -} - -.banner-img-one, -.banner-img-two, -.banner-img-three { - background-position: bottom right; - background-repeat: no-repeat; -} - -.banner-style-one, -.banner-style-two, -.banner-style-three, -.banner { - margin: 0; - margin-bottom: $line-height; - - @include breakpoint(large) { - - h3 { - width: 80%; - } - } - - h2, - h3, - a { - color: #eaeaf2; - } - - h2 { - padding: $line-height / 2; - padding-bottom: 0; - } - - h3 { - padding: $line-height / 2; - padding-top: 0; - } - - a:hover h2, - a:hover h3 { - color: #eaeaf2 !important; - text-decoration: none; - } -} // 19. Recommendations // ------------------- diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index 5b714702682..0e2cbfc26fc 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -4,8 +4,6 @@ def index all_settings = Setting.all.group_by { |s| s.type } @settings = all_settings['common'] @feature_flags = all_settings['feature'] - @banner_styles = all_settings['banner-style'] - @banner_imgs = all_settings['banner-img'] end def update @@ -27,4 +25,4 @@ def settings_params params.require(:setting).permit(:value) end -end \ No newline at end of file +end diff --git a/app/models/setting.rb b/app/models/setting.rb index 34c45aeede5..c3d9768e6a3 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -2,16 +2,10 @@ class Setting < ActiveRecord::Base validates :key, presence: true, uniqueness: true default_scope { order(id: :asc) } - scope :banner_style, -> { where("key ilike ?", "banner-style.%")} - scope :banner_img, -> { where("key ilike ?", "banner-img.%")} def type if feature_flag? 'feature' - elsif banner_style? - 'banner-style' - elsif banner_img? - 'banner-img' else 'common' end @@ -25,14 +19,6 @@ def enabled? feature_flag? && value.present? end - def banner_style? - key.start_with?('banner-style.') - end - - def banner_img? - key.start_with?('banner-img.') - end - class << self def [](key) where(key: key).pluck(:value).first.presence diff --git a/app/views/admin/settings/_banner_images.html.erb b/app/views/admin/settings/_banner_images.html.erb deleted file mode 100644 index a852f20b162..00000000000 --- a/app/views/admin/settings/_banner_images.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<% if @banner_imgs.present?%> -

    <%= t("admin.settings.index.banner_imgs") %>

    - - - - <% @banner_imgs.each do |setting| %> - - - - - - <% end %> - -
    - <%= t("settings.#{setting.key}") %> - - <%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %> - <%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %> - <%= f.submit(t('admin.settings.index.update_setting'), class: "button small success") %> - <% end %> -
    -<% else %> -

    <%= t("admin.settings.index.no_banners_images") %>

    -<% end %> diff --git a/app/views/admin/settings/_banner_styles.html.erb b/app/views/admin/settings/_banner_styles.html.erb deleted file mode 100644 index 5477ce438c1..00000000000 --- a/app/views/admin/settings/_banner_styles.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<% if @banner_styles.present? %> -

    <%= t("admin.settings.index.banners") %>

    - - - - <% @banner_styles.each do |setting| %> - - - - - - <% end %> - -
    - <%= t("settings.#{setting.key}") %> - - <%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %> - <%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %> - <%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow") %> - <% end %> -
    -<% else %> -

    <%= t("admin.settings.index.no_banners_styles") %>

    -<% end %> diff --git a/app/views/admin/settings/_filter_subnav.html.erb b/app/views/admin/settings/_filter_subnav.html.erb index 635a8075859..71894ec4302 100644 --- a/app/views/admin/settings/_filter_subnav.html.erb +++ b/app/views/admin/settings/_filter_subnav.html.erb @@ -17,18 +17,6 @@ <% end %>
  • -
  • - <%= link_to "#tab-banner-styles" do %> - <%= t("admin.settings.index.banners") %> - <% end %> -
  • - -
  • - <%= link_to "#tab-banner-images" do %> - <%= t("admin.settings.index.banner_imgs") %> - <% end %> -
  • -
  • <%= link_to "#tab-map-configuration" do %> <%= t("admin.settings.index.map.title") %> diff --git a/app/views/admin/settings/index.html.erb b/app/views/admin/settings/index.html.erb index 7c03d77a577..4316bdce282 100644 --- a/app/views/admin/settings/index.html.erb +++ b/app/views/admin/settings/index.html.erb @@ -10,14 +10,6 @@ <%= render "feature_flags" %> -
    - <%= render "banner_styles" %> -
    - -
    - <%= render "banner_images" %> -
    -
    <%= render "map_configuration" %>
    diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 21fa2981f95..011be44fc26 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -1126,10 +1126,6 @@ en: flash: updated: Value updated index: - banners: Banner styles - banner_imgs: Banner images - no_banners_images: No banner images - no_banners_styles: No banner styles title: Configuration settings update_setting: Update feature_flags: Features diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 9d22c369771..998e0f39722 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -1125,10 +1125,6 @@ es: flash: updated: Valor actualizado index: - banners: Estilo del banner - banner_imgs: Imagenes del banner - no_banners_images: No hay imagenes de banner - no_banners_styles: No hay estilos de banner title: Configuración global update_setting: Actualizar feature_flags: Funcionalidades diff --git a/db/seeds.rb b/db/seeds.rb index 76a92a4ca60..c406325f87f 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -88,16 +88,6 @@ # Spending proposals feature flags Setting['feature.spending_proposal_features.voting_allowed'] = nil -# Banner styles -Setting['banner-style.banner-style-one'] = "Banner style 1" -Setting['banner-style.banner-style-two'] = "Banner style 2" -Setting['banner-style.banner-style-three'] = "Banner style 3" - -# Banner images -Setting['banner-img.banner-img-one'] = "Banner image 1" -Setting['banner-img.banner-img-two'] = "Banner image 2" -Setting['banner-img.banner-img-three'] = "Banner image 3" - # Proposal notifications Setting['proposal_notification_minimum_interval_in_days'] = 3 Setting['direct_message_max_per_day'] = 3 diff --git a/lib/tasks/banners.rake b/lib/tasks/banners.rake deleted file mode 100644 index eb2cc7d9c39..00000000000 --- a/lib/tasks/banners.rake +++ /dev/null @@ -1,20 +0,0 @@ -namespace :banners do - - desc "Migrate styles to background_color and font_color" - task migrate_style: :environment do - - Banner.all.each do |banner| - banner.font_color = '#FFFFFF' - case banner.style - when "banner-style banner-style-one" - banner.background_color = '#004a83' - when "banner-style banner-style-two" - banner.background_color = '#7e328a' - when "banner-style banner-style-three" - banner.background_color = '#33dadf' - end - banner.save - end - end - -end diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index 244e25bf14b..77f2d3daf1e 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -54,28 +54,4 @@ expect(setting.enabled?).to eq false end end - - describe "#banner_style?" do - it "is true if key starts with 'banner-style.'" do - setting = described_class.create(key: "banner-style.whatever") - expect(setting.banner_style?).to eq true - end - - it "is false if key does not start with 'banner-style.'" do - setting = described_class.create(key: "whatever") - expect(setting.banner_style?).to eq false - end - end - - describe "#banner_img?" do - it "is true if key starts with 'banner-img.'" do - setting = described_class.create(key: "banner-img.whatever") - expect(setting.banner_img?).to eq true - end - - it "is false if key does not start with 'banner-img.'" do - setting = described_class.create(key: "whatever") - expect(setting.banner_img?).to eq false - end - end end From abdeafc2dd6067ad5bdcba445d3e8a79e8201f34 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 25 Feb 2019 15:34:15 +0100 Subject: [PATCH 7/7] Fix hound warnings on dev_seeds --- db/dev_seeds.rb | 48 ++++----- db/dev_seeds/admin_notifications.rb | 47 +++++---- db/dev_seeds/banners.rb | 14 +-- db/dev_seeds/budgets.rb | 16 +-- db/dev_seeds/comments.rb | 2 +- db/dev_seeds/debates.rb | 30 +++--- db/dev_seeds/geozones.rb | 8 +- db/dev_seeds/legislation_proposals.rb | 2 +- db/dev_seeds/milestones.rb | 8 +- db/dev_seeds/newsletters.rb | 2 +- db/dev_seeds/notifications.rb | 4 +- db/dev_seeds/polls.rb | 16 +-- db/dev_seeds/proposals.rb | 16 +-- db/dev_seeds/settings.rb | 138 +++++++++++++------------- db/dev_seeds/tags_categories.rb | 30 +++--- db/dev_seeds/users.rb | 30 +++--- db/dev_seeds/votes.rb | 2 +- db/dev_seeds/widgets.rb | 94 ++++++++++-------- 18 files changed, 262 insertions(+), 245 deletions(-) diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 8b2671b44cc..939a7c4aa14 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -1,4 +1,4 @@ -require 'database_cleaner' +require "database_cleaner" DatabaseCleaner.clean_with :truncation @logger = Logger.new(STDOUT) @logger.formatter = proc do |_severity, _datetime, _progname, msg| @@ -8,7 +8,7 @@ def section(section_title) @logger.info section_title yield - log(' ✅') + log(" ✅") end def log(msg) @@ -19,27 +19,27 @@ def random_locales [I18n.default_locale, *I18n.available_locales.sample(4)].uniq end -require_relative 'dev_seeds/settings' -require_relative 'dev_seeds/geozones' -require_relative 'dev_seeds/users' -require_relative 'dev_seeds/tags_categories' -require_relative 'dev_seeds/debates' -require_relative 'dev_seeds/proposals' -require_relative 'dev_seeds/budgets' -require_relative 'dev_seeds/spending_proposals' -require_relative 'dev_seeds/comments' -require_relative 'dev_seeds/votes' -require_relative 'dev_seeds/flags' -require_relative 'dev_seeds/hiddings' -require_relative 'dev_seeds/banners' -require_relative 'dev_seeds/polls' -require_relative 'dev_seeds/communities' -require_relative 'dev_seeds/legislation_processes' -require_relative 'dev_seeds/newsletters' -require_relative 'dev_seeds/notifications' -require_relative 'dev_seeds/widgets' -require_relative 'dev_seeds/admin_notifications' -require_relative 'dev_seeds/legislation_proposals' -require_relative 'dev_seeds/milestones' +require_relative "dev_seeds/settings" +require_relative "dev_seeds/geozones" +require_relative "dev_seeds/users" +require_relative "dev_seeds/tags_categories" +require_relative "dev_seeds/debates" +require_relative "dev_seeds/proposals" +require_relative "dev_seeds/budgets" +require_relative "dev_seeds/spending_proposals" +require_relative "dev_seeds/comments" +require_relative "dev_seeds/votes" +require_relative "dev_seeds/flags" +require_relative "dev_seeds/hiddings" +require_relative "dev_seeds/banners" +require_relative "dev_seeds/polls" +require_relative "dev_seeds/communities" +require_relative "dev_seeds/legislation_processes" +require_relative "dev_seeds/newsletters" +require_relative "dev_seeds/notifications" +require_relative "dev_seeds/widgets" +require_relative "dev_seeds/admin_notifications" +require_relative "dev_seeds/legislation_proposals" +require_relative "dev_seeds/milestones" log "All dev seeds created successfuly 👍" diff --git a/db/dev_seeds/admin_notifications.rb b/db/dev_seeds/admin_notifications.rb index 799fdf04c3b..308928d53f4 100644 --- a/db/dev_seeds/admin_notifications.rb +++ b/db/dev_seeds/admin_notifications.rb @@ -1,44 +1,47 @@ section "Creating Admin Notifications & Templates" do AdminNotification.create!( - title_en: 'Do you have a proposal?', - title_es: 'Tienes una propuesta?', + title_en: "Do you have a proposal?", + title_es: "Tienes una propuesta?", - body_en: 'Remember you can create a proposal with your ideas and people will discuss & support it.', - body_es: 'Recuerda que puedes crear propuestas y los ciudadanos las debatirán y apoyarán.', + body_en: "Remember you can create a proposal with your ideas and "\ + "people will discuss & support it.", + body_es: "Recuerda que puedes crear propuestas y los ciudadanos las debatirán y apoyarán.", - link: Setting['url'] + '/proposals', - segment_recipient: 'administrators' + link: Setting["url"] + "/proposals", + segment_recipient: "administrators" ).deliver AdminNotification.create!( - title_en: 'Help us translate consul', - title_es: 'Ayúdanos a traducir CONSUL', + title_en: "Help us translate consul", + title_es: "Ayúdanos a traducir CONSUL", - body_en: 'If you are proficient in a language, please help us translate consul!.', - body_es: 'Si dominas un idioma, ayúdanos a completar su traducción en CONSUL.', + body_en: "If you are proficient in a language, please help us translate consul!.", + body_es: "Si dominas un idioma, ayúdanos a completar su traducción en CONSUL.", - link: 'https://crwd.in/consul', - segment_recipient: 'administrators' + link: "https://crwd.in/consul", + segment_recipient: "administrators" ).deliver AdminNotification.create!( - title_en: 'You can now geolocate proposals & investments', - title_es: 'Ahora puedes geolocalizar propuestas y proyectos de inversión', + title_en: "You can now geolocate proposals & investments", + title_es: "Ahora puedes geolocalizar propuestas y proyectos de inversión", - body_en: 'When you create a proposal or investment you now can specify a point on a map', - body_es: 'Cuando crees una propuesta o proyecto de inversión podrás especificar su localización en el mapa', + body_en: "When you create a proposal or investment you now can specify a point on a map", + body_es: "Cuando crees una propuesta o proyecto de inversión podrás especificar "\ + "su localización en el mapa", - segment_recipient: 'administrators' + segment_recipient: "administrators" ).deliver AdminNotification.create!( - title_en: 'We are closing the Participatory Budget!!', - title_es: 'Últimos días para crear proyectos de Presupuestos Participativos', + title_en: "We are closing the Participatory Budget!!", + title_es: "Últimos días para crear proyectos de Presupuestos Participativos", - body_en: 'Hurry up and create a last proposal before it ends next in few days!', - body_es: 'Quedan pocos dias para que se cierre el plazo de presentación de proyectos de inversión para los presupuestos participativos!', + body_en: "Hurry up and create a last proposal before it ends next in few days!", + body_es: "Quedan pocos dias para que se cierre el plazo de presentación de proyectos de "\ + "inversión para los presupuestos participativos!", - segment_recipient: 'administrators', + segment_recipient: "administrators", sent_at: nil ) end diff --git a/db/dev_seeds/banners.rb b/db/dev_seeds/banners.rb index 641f519942e..90f435978b3 100644 --- a/db/dev_seeds/banners.rb +++ b/db/dev_seeds/banners.rb @@ -1,7 +1,7 @@ section "Creating banners" do Proposal.last(3).each do |proposal| - title = Faker::Lorem.sentence(word_count = 3) - description = Faker::Lorem.sentence(word_count = 12) + title = Faker::Lorem.sentence(3) + description = Faker::Lorem.sentence(12) target_url = Rails.application.routes.url_helpers.proposal_path(proposal) banner = Banner.new(title: title, description: description, @@ -20,9 +20,9 @@ end section "Creating web sections" do - WebSection.create(name: 'homepage') - WebSection.create(name: 'debates') - WebSection.create(name: 'proposals') - WebSection.create(name: 'budgets') - WebSection.create(name: 'help_page') + WebSection.create(name: "homepage") + WebSection.create(name: "debates") + WebSection.create(name: "proposals") + WebSection.create(name: "budgets") + WebSection.create(name: "help_page") end diff --git a/db/dev_seeds/budgets.rb b/db/dev_seeds/budgets.rb index cb763c29410..f0f842d739e 100644 --- a/db/dev_seeds/budgets.rb +++ b/db/dev_seeds/budgets.rb @@ -1,11 +1,11 @@ -INVESTMENT_IMAGE_FILES = %w{ +INVESTMENT_IMAGE_FILES = %w[ brennan-ehrhardt-25066-unsplash_713x513.jpg carl-nenzen-loven-381554-unsplash_713x475.jpg carlos-zurita-215387-unsplash_713x475.jpg hector-arguello-canals-79584-unsplash_713x475.jpg olesya-grichina-218176-unsplash_713x475.jpg sole-d-alessandro-340443-unsplash_713x475.jpg -}.map do |filename| +].map do |filename| File.new(Rails.root.join("db", "dev_seeds", "images", @@ -129,10 +129,10 @@ def add_image_to(imageable) title: Faker::Lorem.sentence(3).truncate(60), description: "

    #{Faker::Lorem.paragraphs.join('

    ')}

    ", created_at: rand((Time.current - 1.week)..Time.current), - feasibility: %w{undecided unfeasible feasible feasible feasible feasible}.sample, + feasibility: %w[undecided unfeasible feasible feasible feasible feasible].sample, unfeasibility_explanation: Faker::Lorem.paragraph, valuation_finished: [false, true].sample, - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), price: rand(1..100) * 100000, skip_map: "1", terms_of_service: "1" @@ -151,9 +151,9 @@ def add_image_to(imageable) section "Geolocating Investments" do Budget.find_each do |budget| budget.investments.each do |investment| - MapLocation.create(latitude: Setting['map_latitude'].to_f + rand(-10..10)/100.to_f, - longitude: Setting['map_longitude'].to_f + rand(-10..10)/100.to_f, - zoom: Setting['map_zoom'], + MapLocation.create(latitude: Setting["map_latitude"].to_f + rand(-10..10)/100.to_f, + longitude: Setting["map_longitude"].to_f + rand(-10..10)/100.to_f, + zoom: Setting["map_zoom"], investment_id: investment.id) end end @@ -175,7 +175,7 @@ def add_image_to(imageable) group: heading.group, budget: heading.group.budget, title: Faker::Lorem.sentence(3).truncate(60), - description: "

    #{Faker::Lorem.paragraphs.join('

    ')}

    ", + description: "

    #{Faker::Lorem.paragraphs.join("

    ")}

    ", created_at: rand((Time.current - 1.week)..Time.current), feasibility: "feasible", valuation_finished: true, diff --git a/db/dev_seeds/comments.rb b/db/dev_seeds/comments.rb index 79b3b871d05..03bb9bbe023 100644 --- a/db/dev_seeds/comments.rb +++ b/db/dev_seeds/comments.rb @@ -1,5 +1,5 @@ section "Commenting Investments, Debates & Proposals" do - %w(Budget::Investment Debate Proposal).each do |commentable_class| + %w[Budget::Investment Debate Proposal].each do |commentable_class| 100.times do commentable = commentable_class.constantize.all.sample Comment.create!(user: User.all.sample, diff --git a/db/dev_seeds/debates.rb b/db/dev_seeds/debates.rb index e53992782e6..009e28a726a 100644 --- a/db/dev_seeds/debates.rb +++ b/db/dev_seeds/debates.rb @@ -3,25 +3,25 @@ 30.times do author = User.all.sample description = "

    #{Faker::Lorem.paragraphs.join('

    ')}

    " - debate = Debate.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - created_at: rand((Time.current - 1.week)..Time.current), - description: description, - tag_list: tags.sample(3).join(','), - geozone: Geozone.all.sample, - terms_of_service: "1") + Debate.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + created_at: rand((Time.current - 1.week)..Time.current), + description: description, + tag_list: tags.sample(3).join(","), + geozone: Geozone.all.sample, + terms_of_service: "1") end - tags = ActsAsTaggableOn::Tag.where(kind: 'category') + tags = ActsAsTaggableOn::Tag.where(kind: "category") 30.times do author = User.all.sample description = "

    #{Faker::Lorem.paragraphs.join('

    ')}

    " - debate = Debate.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - created_at: rand((Time.current - 1.week)..Time.current), - description: description, - tag_list: tags.sample(3).join(','), - geozone: Geozone.all.sample, - terms_of_service: "1") + Debate.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + created_at: rand((Time.current - 1.week)..Time.current), + description: description, + tag_list: tags.sample(3).join(","), + geozone: Geozone.all.sample, + terms_of_service: "1") end end diff --git a/db/dev_seeds/geozones.rb b/db/dev_seeds/geozones.rb index 029d936a936..d0d342f5717 100644 --- a/db/dev_seeds/geozones.rb +++ b/db/dev_seeds/geozones.rb @@ -1,22 +1,22 @@ section "Creating Geozones" do - Geozone.create(name: I18n.t('seeds.geozones.north_district'), + Geozone.create(name: I18n.t("seeds.geozones.north_district"), external_code: "001", census_code: "01", html_map_coordinates: "30,139,45,153,77,148,107,165,138,201,146,218,186,198,216,"\ "196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320,"\ "66,286,73,258,65,265,57,249,47,207,58,159,84,108,85,72,101,51,114") - Geozone.create(name: I18n.t('seeds.geozones.west_district'), + Geozone.create(name: I18n.t("seeds.geozones.west_district"), external_code: "002", census_code: "02", html_map_coordinates: "42,153,31,176,24,202,20,221,44,235,59,249,55,320,30,354,"\ "31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228,"\ "327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140,"\ "268,138,246,135,236,139,222,151,214,136,197,120,179,99,159,85,149,65,149,56,149") - Geozone.create(name: I18n.t('seeds.geozones.east_district'), + Geozone.create(name: I18n.t("seeds.geozones.east_district"), external_code: "003", census_code: "03", html_map_coordinates: "175,353,162,378,161,407,153,416,167,432,184,447,225,426,"\ "250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188,"\ "281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277,"\ "267,294,249,312,219,333,198,346,184,353") - Geozone.create(name: I18n.t('seeds.geozones.central_district'), + Geozone.create(name: I18n.t("seeds.geozones.central_district"), external_code: "004", census_code: "04", html_map_coordinates: "152,308,137,258,133,235,147,216,152,214,186,194,210,196,"\ "228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296,"\ diff --git a/db/dev_seeds/legislation_proposals.rb b/db/dev_seeds/legislation_proposals.rb index e309dd28c17..def1b653598 100644 --- a/db/dev_seeds/legislation_proposals.rb +++ b/db/dev_seeds/legislation_proposals.rb @@ -6,7 +6,7 @@ summary: Faker::Lorem.paragraph, author: User.all.sample, process: Legislation::Process.all.sample, - terms_of_service: '1', + terms_of_service: "1", selected: rand <= 1.0 / 3) end end diff --git a/db/dev_seeds/milestones.rb b/db/dev_seeds/milestones.rb index 54ed1e99798..42b0df0b79d 100644 --- a/db/dev_seeds/milestones.rb +++ b/db/dev_seeds/milestones.rb @@ -1,8 +1,8 @@ section "Creating default Milestone Statuses" do - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.studying_project')) - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.bidding')) - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executing_project')) - Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executed')) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.studying_project")) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.bidding")) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.executing_project")) + Milestone::Status.create(name: I18n.t("seeds.budgets.statuses.executed")) end section "Creating investment milestones" do diff --git a/db/dev_seeds/newsletters.rb b/db/dev_seeds/newsletters.rb index 08eda5301c7..02f93d1becc 100644 --- a/db/dev_seeds/newsletters.rb +++ b/db/dev_seeds/newsletters.rb @@ -15,7 +15,7 @@ Newsletter.create!( subject: "Newsletter subject #{n}", segment_recipient: UserSegments::SEGMENTS.sample, - from: 'no-reply@consul.dev', + from: "no-reply@consul.dev", body: newsletter_body.sample, sent_at: [Time.now, nil].sample ) diff --git a/db/dev_seeds/notifications.rb b/db/dev_seeds/notifications.rb index 3d7282f4ad4..e74e9d7e35a 100644 --- a/db/dev_seeds/notifications.rb +++ b/db/dev_seeds/notifications.rb @@ -3,7 +3,7 @@ debate = Debate.create!(author: user, title: Faker::Lorem.sentence(3).truncate(60), description: "

    #{Faker::Lorem.paragraphs.join('

    ')}

    ", - tag_list: ActsAsTaggableOn::Tag.all.sample(3).join(','), + tag_list: ActsAsTaggableOn::Tag.all.sample(3).join(","), geozone: Geozone.reorder("RANDOM()").first, terms_of_service: "1") @@ -13,4 +13,4 @@ Notification.add(user, comment) end -end \ No newline at end of file +end diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index 290905032d6..53eb8dec7c7 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -1,25 +1,25 @@ section "Creating polls" do - Poll.create(name: I18n.t('seeds.polls.current_poll'), + Poll.create(name: I18n.t("seeds.polls.current_poll"), starts_at: 7.days.ago, ends_at: 7.days.from_now, geozone_restricted: false) - Poll.create(name: I18n.t('seeds.polls.current_poll_geozone_restricted'), + Poll.create(name: I18n.t("seeds.polls.current_poll_geozone_restricted"), starts_at: 5.days.ago, ends_at: 5.days.from_now, geozone_restricted: true, geozones: Geozone.reorder("RANDOM()").limit(3)) - Poll.create(name: I18n.t('seeds.polls.recounting_poll'), + Poll.create(name: I18n.t("seeds.polls.recounting_poll"), starts_at: 15.days.ago, ends_at: 2.days.ago) - Poll.create(name: I18n.t('seeds.polls.expired_poll_without_stats'), + Poll.create(name: I18n.t("seeds.polls.expired_poll_without_stats"), starts_at: 2.months.ago, ends_at: 1.month.ago) - Poll.create(name: I18n.t('seeds.polls.expired_poll_with_stats'), + Poll.create(name: I18n.t("seeds.polls.expired_poll_with_stats"), starts_at: 2.months.ago, ends_at: 1.month.ago, results_enabled: true, @@ -42,7 +42,7 @@ section "Creating Poll Questions & Answers" do Poll.find_each do |poll| (1..4).to_a.sample.times do - title = Faker::Lorem.sentence(3).truncate(60) + '?' + title = Faker::Lorem.sentence(3).truncate(60) + "?" question = Poll::Question.new(author: User.all.sample, title: title, poll: poll) @@ -118,7 +118,7 @@ def vote_poll_on_booth(user, poll) document_number: user.document_number, user: user, poll: poll, - origin: 'booth', + origin: "booth", officer: Poll::Officer.all.sample) end @@ -128,7 +128,7 @@ def vote_poll_on_web(user, poll) document_number: user.document_number, user: user, poll: poll, - origin: 'web', + origin: "web", token: SecureRandom.hex(32)) end diff --git a/db/dev_seeds/proposals.rb b/db/dev_seeds/proposals.rb index d68c0941994..fd03690abed 100644 --- a/db/dev_seeds/proposals.rb +++ b/db/dev_seeds/proposals.rb @@ -1,9 +1,9 @@ -IMAGE_FILES = %w{ +IMAGE_FILES = %w[ firdouss-ross-414668-unsplash_846x475.jpg nathan-dumlao-496190-unsplash_713x475.jpg steve-harvey-597760-unsplash_713x475.jpg tim-mossholder-302931-unsplash_713x475.jpg -}.map do |filename| +].map do |filename| File.new(Rails.root.join("db", "dev_seeds", "images", @@ -34,7 +34,7 @@ def add_image_to(imageable) external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1") @@ -54,7 +54,7 @@ def add_image_to(imageable) responsible_name: Faker::Name.name, external_url: Faker::Internet.url, description: description, - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1", @@ -76,7 +76,7 @@ def add_image_to(imageable) external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1", @@ -84,10 +84,10 @@ def add_image_to(imageable) add_image_to proposal end - tags = ActsAsTaggableOn::Tag.where(kind: 'category') + tags = ActsAsTaggableOn::Tag.where(kind: "category") 30.times do author = User.all.sample - description = "

    #{Faker::Lorem.paragraphs.join('

    ')}

    " + description = "

    #{Faker::Lorem.paragraphs.join("

    ")}

    " proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(4).truncate(60), question: Faker::Lorem.sentence(6) + "?", @@ -96,7 +96,7 @@ def add_image_to(imageable) external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1") diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index af71c6ccc04..0b3fc5d58d9 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -1,76 +1,76 @@ section "Creating Settings" do - Setting.create(key: 'official_level_1_name', - value: I18n.t('seeds.settings.official_level_1_name')) - Setting.create(key: 'official_level_2_name', - value: I18n.t('seeds.settings.official_level_2_name')) - Setting.create(key: 'official_level_3_name', - value: I18n.t('seeds.settings.official_level_3_name')) - Setting.create(key: 'official_level_4_name', - value: I18n.t('seeds.settings.official_level_4_name')) - Setting.create(key: 'official_level_5_name', - value: I18n.t('seeds.settings.official_level_5_name')) - Setting.create(key: 'max_ratio_anon_votes_on_debates', value: '50') - Setting.create(key: 'max_votes_for_debate_edit', value: '1000') - Setting.create(key: 'max_votes_for_proposal_edit', value: '1000') - Setting.create(key: 'proposal_code_prefix', value: 'MAD') - Setting.create(key: 'votes_for_proposal_success', value: '100') - Setting.create(key: 'months_to_archive_proposals', value: '12') - Setting.create(key: 'comments_body_max_length', value: '1000') + Setting.create(key: "official_level_1_name", + value: I18n.t("seeds.settings.official_level_1_name")) + Setting.create(key: "official_level_2_name", + value: I18n.t("seeds.settings.official_level_2_name")) + Setting.create(key: "official_level_3_name", + value: I18n.t("seeds.settings.official_level_3_name")) + Setting.create(key: "official_level_4_name", + value: I18n.t("seeds.settings.official_level_4_name")) + Setting.create(key: "official_level_5_name", + value: I18n.t("seeds.settings.official_level_5_name")) + Setting.create(key: "max_ratio_anon_votes_on_debates", value: "50") + Setting.create(key: "max_votes_for_debate_edit", value: "1000") + Setting.create(key: "max_votes_for_proposal_edit", value: "1000") + Setting.create(key: "proposal_code_prefix", value: "MAD") + Setting.create(key: "votes_for_proposal_success", value: "100") + Setting.create(key: "months_to_archive_proposals", value: "12") + Setting.create(key: "comments_body_max_length", value: "1000") - Setting.create(key: 'twitter_handle', value: '@consul_dev') - Setting.create(key: 'twitter_hashtag', value: '#consul_dev') - Setting.create(key: 'facebook_handle', value: 'CONSUL') - Setting.create(key: 'youtube_handle', value: 'CONSUL') - Setting.create(key: 'telegram_handle', value: 'CONSUL') - Setting.create(key: 'instagram_handle', value: 'CONSUL') - Setting.create(key: 'url', value: 'http://localhost:3000') - Setting.create(key: 'org_name', value: 'CONSUL') + Setting.create(key: "twitter_handle", value: "@consul_dev") + Setting.create(key: "twitter_hashtag", value: "#consul_dev") + Setting.create(key: "facebook_handle", value: "CONSUL") + Setting.create(key: "youtube_handle", value: "CONSUL") + Setting.create(key: "telegram_handle", value: "CONSUL") + Setting.create(key: "instagram_handle", value: "CONSUL") + Setting.create(key: "url", value: "http://localhost:3000") + Setting.create(key: "org_name", value: "CONSUL") - Setting.create(key: 'feature.debates', value: "true") - Setting.create(key: 'feature.proposals', value: "true") - Setting.create(key: 'feature.featured_proposals', value: "true") - Setting.create(key: 'feature.polls', value: "true") - Setting.create(key: 'feature.spending_proposals', value: nil) - Setting.create(key: 'feature.spending_proposal_features.voting_allowed', value: nil) - Setting.create(key: 'feature.budgets', value: "true") - Setting.create(key: 'feature.twitter_login', value: "true") - Setting.create(key: 'feature.facebook_login', value: "true") - Setting.create(key: 'feature.google_login', value: "true") - Setting.create(key: 'feature.signature_sheets', value: "true") - Setting.create(key: 'feature.legislation', value: "true") - Setting.create(key: 'feature.user.recommendations', value: "true") - Setting.create(key: 'feature.user.recommendations_on_debates', value: "true") - Setting.create(key: 'feature.user.recommendations_on_proposals', value: "true") - Setting.create(key: 'feature.community', value: "true") - Setting.create(key: 'feature.map', value: "true") - Setting.create(key: 'feature.allow_images', value: "true") - Setting.create(key: 'feature.allow_attached_documents', value: "true") - Setting.create(key: 'feature.public_stats', value: "true") - Setting.create(key: 'feature.user.skip_verification', value: "true") - Setting.create(key: 'feature.help_page', value: "true") + Setting.create(key: "feature.debates", value: "true") + Setting.create(key: "feature.proposals", value: "true") + Setting.create(key: "feature.featured_proposals", value: "true") + Setting.create(key: "feature.polls", value: "true") + Setting.create(key: "feature.spending_proposals", value: nil) + Setting.create(key: "feature.spending_proposal_features.voting_allowed", value: nil) + Setting.create(key: "feature.budgets", value: "true") + Setting.create(key: "feature.twitter_login", value: "true") + Setting.create(key: "feature.facebook_login", value: "true") + Setting.create(key: "feature.google_login", value: "true") + Setting.create(key: "feature.signature_sheets", value: "true") + Setting.create(key: "feature.legislation", value: "true") + Setting.create(key: "feature.user.recommendations", value: "true") + Setting.create(key: "feature.user.recommendations_on_debates", value: "true") + Setting.create(key: "feature.user.recommendations_on_proposals", value: "true") + Setting.create(key: "feature.community", value: "true") + Setting.create(key: "feature.map", value: "true") + Setting.create(key: "feature.allow_images", value: "true") + Setting.create(key: "feature.allow_attached_documents", value: "true") + Setting.create(key: "feature.public_stats", value: "true") + Setting.create(key: "feature.user.skip_verification", value: "true") + Setting.create(key: "feature.help_page", value: "true") - Setting.create(key: 'per_page_code_head', value: "") - Setting.create(key: 'per_page_code_body', value: "") - Setting.create(key: 'comments_body_max_length', value: '1000') - Setting.create(key: 'mailer_from_name', value: 'CONSUL') - Setting.create(key: 'mailer_from_address', value: 'noreply@consul.dev') - Setting.create(key: 'meta_title', value: 'CONSUL') - Setting.create(key: 'meta_description', value: 'Citizen participation tool for an open, '\ - 'transparent and democratic government') - Setting.create(key: 'meta_keywords', value: 'citizen participation, open government') - Setting.create(key: 'verification_offices_url', value: 'http://oficinas-atencion-ciudadano.url/') - Setting.create(key: 'min_age_to_participate', value: '16') - Setting.create(key: 'map_latitude', value: 40.41) - Setting.create(key: 'map_longitude', value: -3.7) - Setting.create(key: 'map_zoom', value: 10) - Setting.create(key: 'featured_proposals_number', value: 3) - Setting.create(key: 'proposal_notification_minimum_interval_in_days', value: 0) - Setting.create(key: 'direct_message_max_per_day', value: 3) + Setting.create(key: "per_page_code_head", value: "") + Setting.create(key: "per_page_code_body", value: "") + Setting.create(key: "comments_body_max_length", value: "1000") + Setting.create(key: "mailer_from_name", value: "CONSUL") + Setting.create(key: "mailer_from_address", value: "noreply@consul.dev") + Setting.create(key: "meta_title", value: "CONSUL") + Setting.create(key: "meta_description", value: "Citizen participation tool for an open, "\ + "transparent and democratic government") + Setting.create(key: "meta_keywords", value: "citizen participation, open government") + Setting.create(key: "verification_offices_url", value: "http://oficinas-atencion-ciudadano.url/") + Setting.create(key: "min_age_to_participate", value: "16") + Setting.create(key: "map_latitude", value: 40.41) + Setting.create(key: "map_longitude", value: -3.7) + Setting.create(key: "map_zoom", value: 10) + Setting.create(key: "featured_proposals_number", value: 3) + Setting.create(key: "proposal_notification_minimum_interval_in_days", value: 0) + Setting.create(key: "direct_message_max_per_day", value: 3) - Setting.create(key: 'related_content_score_threshold', value: -0.3) - Setting.create(key: 'hot_score_period_in_days', value: 31) + Setting.create(key: "related_content_score_threshold", value: -0.3) + Setting.create(key: "hot_score_period_in_days", value: 31) - Setting['feature.homepage.widgets.feeds.proposals'] = true - Setting['feature.homepage.widgets.feeds.debates'] = true - Setting['feature.homepage.widgets.feeds.processes'] = true + Setting["feature.homepage.widgets.feeds.proposals"] = true + Setting["feature.homepage.widgets.feeds.debates"] = true + Setting["feature.homepage.widgets.feeds.processes"] = true end diff --git a/db/dev_seeds/tags_categories.rb b/db/dev_seeds/tags_categories.rb index 103570578e8..3ee08a1cb00 100644 --- a/db/dev_seeds/tags_categories.rb +++ b/db/dev_seeds/tags_categories.rb @@ -1,17 +1,17 @@ section "Creating Tags Categories" do - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.associations')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.culture')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.sports')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.social_rights')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.economy')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.employment')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.equity')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.sustainability')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.participation')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.mobility')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.media')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.health')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.transparency')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.security_emergencies')) - ActsAsTaggableOn::Tag.category.create!(name: I18n.t('seeds.categories.environment')) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.associations")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.culture")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.sports")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.social_rights")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.economy")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.employment")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.equity")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.sustainability")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.participation")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.mobility")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.media")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.health")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.transparency")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.security_emergencies")) + ActsAsTaggableOn::Tag.category.create!(name: I18n.t("seeds.categories.environment")) end diff --git a/db/dev_seeds/users.rb b/db/dev_seeds/users.rb index 61cfbd12f93..199b16dfb92 100644 --- a/db/dev_seeds/users.rb +++ b/db/dev_seeds/users.rb @@ -1,6 +1,6 @@ section "Creating Users" do def create_user(email, username = Faker::Name.name) - password = '12345678' + password = "12345678" User.create!( username: username, email: email, @@ -8,7 +8,7 @@ def create_user(email, username = Faker::Name.name) password_confirmation: password, confirmed_at: Time.current, terms_of_service: "1", - gender: ['Male', 'Female'].sample, + gender: ["Male", "Female"].sample, date_of_birth: rand((Time.current - 80.years)..(Time.current - 16.years)), public_activity: (rand(1..100) > 30) ) @@ -17,61 +17,61 @@ def create_user(email, username = Faker::Name.name) def unique_document_number @document_number ||= 12345678 @document_number += 1 - "#{@document_number}#{[*'A'..'Z'].sample}" + "#{@document_number}#{[*"A".."Z"].sample}" end - admin = create_user('admin@consul.dev', 'admin') + admin = create_user("admin@consul.dev", "admin") admin.create_administrator admin.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", 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.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", 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.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_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.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_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.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_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.update(residence_verified_at: Time.current, confirmed_phone: Faker::PhoneNumber.phone_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, confirmed_phone: Faker::PhoneNumber.phone_number, 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, confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", verified_at: Time.current, document_number: unique_document_number) [ - I18n.t('seeds.organizations.neighborhood_association'), - I18n.t('seeds.organizations.human_rights'), - 'Greenpeace' + I18n.t("seeds.organizations.neighborhood_association"), + I18n.t("seeds.organizations.human_rights"), + "Greenpeace" ].each do |organization_name| org_user = create_user("#{organization_name.parameterize}@consul.dev", organization_name) org = org_user.create_organization(name: organization_name, responsible_name: Faker::Name.name) diff --git a/db/dev_seeds/votes.rb b/db/dev_seeds/votes.rb index 415e542a223..357d2de5999 100644 --- a/db/dev_seeds/votes.rb +++ b/db/dev_seeds/votes.rb @@ -1,5 +1,5 @@ section "Voting Debates, Proposals & Comments" do - not_org_users = User.where(['users.id NOT IN(?)', User.organizations.pluck(:id)]) + not_org_users = User.where(["users.id NOT IN(?)", User.organizations.pluck(:id)]) 100.times do voter = not_org_users.level_two_or_three_verified.all.sample vote = [true, false].sample diff --git a/db/dev_seeds/widgets.rb b/db/dev_seeds/widgets.rb index 5e5e265de95..b5742a29238 100644 --- a/db/dev_seeds/widgets.rb +++ b/db/dev_seeds/widgets.rb @@ -9,74 +9,88 @@ def create_image_attachment(type) end Widget::Card.create!( - title_en: 'CONSUL', - title_es: 'CONSUL', + title_en: "CONSUL", + title_es: "CONSUL", - description_en: 'Free software for citizen participation.', - description_es: 'Software libre para la participación ciudadana.', + description_en: "Free software for citizen participation.", + description_es: "Software libre para la participación ciudadana.", - link_text_en: 'More information', - link_text_es: 'Más información', + link_text_en: "More information", + link_text_es: "Más información", - label_en: 'Welcome to', - label_es: 'Bienvenido a', + label_en: "Welcome to", + label_es: "Bienvenido a", - link_url: 'http://consulproject.org/', + link_url: "http://consulproject.org/", header: true, - image_attributes: create_image_attachment('header') + image_attributes: create_image_attachment("header") ) Widget::Card.create!( - title_en: 'How do debates work?', - title_es: '¿Cómo funcionan los debates?', + title_en: "How do debates work?", + title_es: "¿Cómo funcionan los debates?", - description_en: 'Anyone can open threads on any subject, creating separate spaces where people can discuss the proposed topic. Debates are valued by everybody, to highlight the most important issues.', - description_es: 'Cualquiera puede iniciar un debate sobre cualquier tema, creando un espacio separado donde compartir puntos de vista con otras personas. Los debates son valorados por todos para destacar los temas más importantes.', + description_en: "Anyone can open threads on any subject, creating separate spaces "\ + "where people can discuss the proposed topic. Debates are valued by "\ + "everybody, to highlight the most important issues.", + description_es: "Cualquiera puede iniciar un debate sobre cualquier tema, creando un espacio "\ + "separado donde compartir puntos de vista con otras personas. Los debates son "\ + "valorados por todos para destacar los temas más importantes.", - link_text_en: 'More about debates', - link_text_es: 'Más sobre debates', + link_text_en: "More about debates", + link_text_es: "Más sobre debates", - label_en: 'Debates', - label_es: 'Debates', + label_en: "Debates", + label_es: "Debates", - link_url: 'https://youtu.be/zU_0UN4VajY', + link_url: "https://youtu.be/zU_0UN4VajY", header: false, - image_attributes: create_image_attachment('debate') + image_attributes: create_image_attachment("debate") ) Widget::Card.create!( - title_en: 'How do citizen proposals work?', - title_es: '¿Cómo funcionan las propuestas ciudadanas?', + title_en: "How do citizen proposals work?", + title_es: "¿Cómo funcionan las propuestas ciudadanas?", - description_en: "A space for everyone to create a citizens' proposal and seek supports. Proposals which reach to enough supports will be voted and so, together we can decide the issues that matter to us.", - description_es: 'Un espacio para que el ciudadano cree una propuesta y busque apoyo. Las propuestas que obtengan el apoyo necesario serán votadas. Así juntos podemos decidir sobre los temas que nos importan.', + description_en: "A space for everyone to create a citizen's proposal and seek supports. "\ + "Proposals which reach to enough supports will be voted and so, together we "\ + "can decide the issues that matter to us.", + description_es: "Un espacio para que el ciudadano cree una propuesta y busque apoyo. "\ + "Las propuestas que obtengan el apoyo necesario serán votadas. Así juntos "\ + "podemos decidir sobre los temas que nos importan.", - link_text_en: 'More about proposals', - link_text_es: 'Más sobre propuestas', + link_text_en: "More about proposals", + link_text_es: "Más sobre propuestas", - label_en: 'Citizen proposals', - label_es: 'Propuestas ciudadanas', + label_en: "Citizen proposals", + label_es: "Propuestas ciudadanas", - link_url: 'https://youtu.be/ZHqBpT4uCoM', + link_url: "https://youtu.be/ZHqBpT4uCoM", header: false, - image_attributes: create_image_attachment('proposal') + image_attributes: create_image_attachment("proposal") ) Widget::Card.create!( - title_en: 'How do participatory budgets work?', - title_es: '¿Cómo funcionan los propuestos participativos?', + title_en: "How do participatory budgets work?", + title_es: "¿Cómo funcionan los propuestos participativos?", - description_en: " Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution. Maximum effectiveness and control with satisfaction for everyone.", - description_es: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan directamente cómo gastar parte del presupuesto, con la supervisión y valoración de la institución. Máxima eficacia y control para la satisfacción de todos", + description_en: "Participatory budgets allow citizens to propose and decide directly "\ + "how to spend part of the budget, with monitoring and rigorous evaluation "\ + "of proposals by the institution. Maximum effectiveness and control with "\ + "satisfaction for everyone.", + description_es: "Los presupuestos participativos permiten que los ciudadanos propongan y "\ + "decidan directamente cómo gastar parte del presupuesto, con la supervisión "\ + "y valoración de la institución. Máxima eficacia y control para la "\ + "satisfacción de todos", - link_text_en: 'More about Participatory budgets', - link_text_es: 'Más sobre presupuestos participativos', + link_text_en: "More about Participatory budgets", + link_text_es: "Más sobre presupuestos participativos", - label_en: 'Participatory budgets', - label_es: 'Presupuestos participativos', + label_en: "Participatory budgets", + label_es: "Presupuestos participativos", - link_url: 'https://youtu.be/igQ8KGZdk9c', + link_url: "https://youtu.be/igQ8KGZdk9c", header: false, - image_attributes: create_image_attachment('budget') + image_attributes: create_image_attachment("budget") ) end