diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 513975a38..f33e0a3d5 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 5b7147026..0e2cbfc26 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -4,8 +4,6 @@ class Admin::SettingsController < Admin::BaseController 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 @@ class Admin::SettingsController < Admin::BaseController params.require(:setting).permit(:value) end -end \ No newline at end of file +end diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 5358571de..66db140b0 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -64,12 +64,6 @@ class ProposalsController < ApplicationController 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/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2da2186cf..a56ea7fd5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,10 +7,6 @@ module ApplicationHelper 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/models/setting.rb b/app/models/setting.rb index 34c45aeed..c3d9768e6 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 @@ class Setting < ActiveRecord::Base 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 a852f20b1..000000000 --- a/app/views/admin/settings/_banner_images.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<% if @banner_imgs.present?%> -
| - <%= 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 %> - | -
| - <%= 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 %> - | -
<%= t("proposals.proposal.improve_info") %>
- <%= link_to t("proposals.proposal.improve_info_link"), @proposal_improvement_path, class: "button" %> -#{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 @@ end 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 @@ section "Winner Investments" do 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 79b3b871d..03bb9bbe0 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 e53992782..009e28a72 100644 --- a/db/dev_seeds/debates.rb +++ b/db/dev_seeds/debates.rb @@ -3,25 +3,25 @@ section "Creating Debates" do 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 029d936a9..d0d342f57 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 e309dd28c..def1b6535 100644 --- a/db/dev_seeds/legislation_proposals.rb +++ b/db/dev_seeds/legislation_proposals.rb @@ -6,7 +6,7 @@ section "Creating legislation proposals" do 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 54ed1e997..42b0df0b7 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 08eda5301..02f93d1be 100644 --- a/db/dev_seeds/newsletters.rb +++ b/db/dev_seeds/newsletters.rb @@ -15,7 +15,7 @@ section "Creating Newsletters" do 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 3d7282f4a..e74e9d7e3 100644 --- a/db/dev_seeds/notifications.rb +++ b/db/dev_seeds/notifications.rb @@ -3,7 +3,7 @@ section "Creating comment notifications" do 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 @@ section "Creating comment notifications" do 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 290905032..53eb8dec7 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 @@ end 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 @@ section "Creating Poll Voters" do document_number: user.document_number, user: user, poll: poll, - origin: 'booth', + origin: "booth", officer: Poll::Officer.all.sample) end @@ -128,7 +128,7 @@ section "Creating Poll Voters" do 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 d68c09419..fd03690ab 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 @@ section "Creating Proposals" do 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 @@ section "Creating Archived Proposals" do 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 @@ section "Creating Successful Proposals" do 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 @@ section "Creating Successful Proposals" do 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 @@ section "Creating Successful Proposals" do 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 cc03a4315..0b3fc5d58 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -1,77 +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: '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') + 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: '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) - Setting.create(key: 'featured_proposals_number', 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 103570578..3ee08a1cb 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 61cfbd12f..199b16dfb 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 @@ section "Creating Users" do 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 @@ section "Creating Users" do 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 415e542a2..357d2de59 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 5e5e265de..b5742a292 100644 --- a/db/dev_seeds/widgets.rb +++ b/db/dev_seeds/widgets.rb @@ -9,74 +9,88 @@ section "Creating header and cards for the homepage" do 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 diff --git a/db/seeds.rb b/db/seeds.rb index 7d424fe28..c406325f8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -51,9 +51,6 @@ Setting["facebook_handle"] = nil 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" @@ -61,9 +58,6 @@ Setting["url"] = "http://example.com" # 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 @@ -94,16 +88,6 @@ Setting['feature.help_page'] = true # 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 @@ -119,9 +103,6 @@ Setting['min_age_to_participate'] = 16 # 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/lib/tasks/banners.rake b/lib/tasks/banners.rake deleted file mode 100644 index eb2cc7d9c..000000000 --- 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/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 033b80fbc..8afdf1c05 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -248,34 +248,6 @@ feature "Proposals" do 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) diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index 244e25bf1..77f2d3daf 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -54,28 +54,4 @@ describe Setting do 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