diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 97a02fd21..981aca200 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -4,12 +4,12 @@ AllCops: DisplayCopNames: true DisplayStyleGuide: true Include: - - '**/Rakefile' - - '**/config.ru' + - "**/Rakefile" + - "**/config.ru" Exclude: - - 'db/**/*' - - 'config/**/*' - - 'script/**/*' + - "db/**/*" + - "config/**/*" + - "script/**/*" TargetRubyVersion: 2.3 # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop # to ignore them, so only the ones explicitly set in this file are enabled. diff --git a/.travis.yml b/.travis.yml index cb4ffd0ac..0aa683c04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby addons: - postgresql: '9.4' + postgresql: "9.4" chrome: stable rvm: - 2.3.2 diff --git a/Capfile b/Capfile index ea11eb9b6..cef760291 100644 --- a/Capfile +++ b/Capfile @@ -1,22 +1,22 @@ # Load DSL and set up stages -require 'capistrano/setup' +require "capistrano/setup" # Include default deployment tasks -require 'capistrano/deploy' +require "capistrano/deploy" require "capistrano/bundler" -require 'capistrano/rails/assets' -require 'capistrano/rails/migrations' -#require 'capistrano/passenger' -require 'capistrano/delayed_job' -require 'whenever/capistrano' -require 'rvm1/capistrano3' +require "capistrano/rails/assets" +require "capistrano/rails/migrations" +#require "capistrano/passenger" +require "capistrano/delayed_job" +require "whenever/capistrano" +require "rvm1/capistrano3" #SCM: Git require "capistrano/scm/git" install_plugin Capistrano::SCM::Git # Load custom tasks from `lib/capistrano/tasks` if you have any defined -Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } -Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } -Dir.glob('lib/capistrano/**/*.rb').each { |r| import r } +Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } +Dir.glob("lib/capistrano/tasks/*.cap").each { |r| import r } +Dir.glob("lib/capistrano/**/*.rb").each { |r| import r } diff --git a/Gemfile b/Gemfile index 07ec1353a..318f0a2ce 100644 --- a/Gemfile +++ b/Gemfile @@ -1,100 +1,100 @@ -source 'https://rubygems.org' +source "https://rubygems.org" -gem 'rails', '4.2.11.1' +gem "rails", "4.2.11.1" -gem 'acts-as-taggable-on', '~> 5.0.0' -gem 'acts_as_votable', '~> 0.11.1' -gem 'ahoy_matey', '~> 1.6.0' -gem 'ancestry', '~> 3.0.2' -gem 'autoprefixer-rails', '~> 8.2.0' -gem 'browser', '~> 2.5.3' -gem 'cancancan', '~> 2.3.0' -gem 'ckeditor', '~> 4.2.3' -gem 'cocoon', '~> 1.2.9' -gem 'coffee-rails', '~> 4.2.2' -gem 'daemons', '~> 1.2.4' -gem 'dalli', '~> 2.7.6' -gem 'delayed_job_active_record', '~> 4.1.3' -gem 'devise', '~> 3.5.7' -gem 'devise-async', '~> 0.10.2' -gem 'devise_security_extension', '~> 0.10.0' -gem 'foundation-rails', '~> 6.4.3.0' -gem 'foundation_rails_helper', '~> 2.0.0' -gem 'graphiql-rails', '~> 1.4.1' -gem 'graphql', '~> 1.7.8' -gem 'groupdate', '~> 3.2.0' -gem 'initialjs-rails', '~> 0.2.0.5' -gem 'invisible_captcha', '~> 0.10.0' -gem 'jquery-fileupload-rails' -gem 'jquery-rails', '~> 4.3.3' -gem 'jquery-ui-rails', '~> 6.0.1' -gem 'kaminari', '~> 1.1.1' -gem 'newrelic_rpm', '~> 4.1.0.333' -gem 'omniauth', '~> 1.8.1' -gem 'omniauth-facebook', '~> 4.0.0' -gem 'omniauth-google-oauth2', '~> 0.4.0' -gem 'omniauth-twitter', '~> 1.4.0' -gem 'paperclip', '~> 5.2.1' -gem 'paranoia', '~> 2.4.1' -gem 'pg', '~> 0.21.0' -gem 'pg_search', '~> 2.0.1' -gem 'redcarpet', '~> 3.4.0' -gem 'responders', '~> 2.4.0' -gem 'rinku', '~> 2.0.2', require: 'rails_rinku' -gem 'rollbar', '~> 2.18.0' -gem 'sass-rails', '~> 5.0', '>= 5.0.4' -gem 'savon', '~> 2.12.0' -gem 'sitemap_generator', '~> 6.0.1' -gem 'social-share-button', '~> 1.1' -gem 'sprockets', '~> 3.7.2' -gem 'turbolinks', '~> 2.5.3' -gem 'turnout', '~> 2.4.0' -gem 'uglifier', '~> 4.1.19' -gem 'unicorn', '~> 5.4.1' -gem 'whenever', '~> 0.10.0', require: false -gem 'globalize', '~> 5.0.0' -gem 'globalize-accessors', '~> 0.2.1' -gem 'recipient_interceptor', '~> 0.2.0' +gem "acts-as-taggable-on", "~> 5.0.0" +gem "acts_as_votable", "~> 0.11.1" +gem "ahoy_matey", "~> 1.6.0" +gem "ancestry", "~> 3.0.2" +gem "autoprefixer-rails", "~> 8.2.0" +gem "browser", "~> 2.5.3" +gem "cancancan", "~> 2.3.0" +gem "ckeditor", "~> 4.2.3" +gem "cocoon", "~> 1.2.9" +gem "coffee-rails", "~> 4.2.2" +gem "daemons", "~> 1.2.4" +gem "dalli", "~> 2.7.6" +gem "delayed_job_active_record", "~> 4.1.3" +gem "devise", "~> 3.5.7" +gem "devise-async", "~> 0.10.2" +gem "devise_security_extension", "~> 0.10.0" +gem "foundation-rails", "~> 6.4.3.0" +gem "foundation_rails_helper", "~> 2.0.0" +gem "graphiql-rails", "~> 1.4.1" +gem "graphql", "~> 1.7.8" +gem "groupdate", "~> 3.2.0" +gem "initialjs-rails", "~> 0.2.0.5" +gem "invisible_captcha", "~> 0.10.0" +gem "jquery-fileupload-rails" +gem "jquery-rails", "~> 4.3.3" +gem "jquery-ui-rails", "~> 6.0.1" +gem "kaminari", "~> 1.1.1" +gem "newrelic_rpm", "~> 4.1.0.333" +gem "omniauth", "~> 1.8.1" +gem "omniauth-facebook", "~> 4.0.0" +gem "omniauth-google-oauth2", "~> 0.4.0" +gem "omniauth-twitter", "~> 1.4.0" +gem "paperclip", "~> 5.2.1" +gem "paranoia", "~> 2.4.1" +gem "pg", "~> 0.21.0" +gem "pg_search", "~> 2.0.1" +gem "redcarpet", "~> 3.4.0" +gem "responders", "~> 2.4.0" +gem "rinku", "~> 2.0.2", require: "rails_rinku" +gem "rollbar", "~> 2.18.0" +gem "sass-rails", "~> 5.0", ">= 5.0.4" +gem "savon", "~> 2.12.0" +gem "sitemap_generator", "~> 6.0.1" +gem "social-share-button", "~> 1.1" +gem "sprockets", "~> 3.7.2" +gem "turbolinks", "~> 2.5.3" +gem "turnout", "~> 2.4.0" +gem "uglifier", "~> 4.1.19" +gem "unicorn", "~> 5.4.1" +gem "whenever", "~> 0.10.0", require: false +gem "globalize", "~> 5.0.0" +gem "globalize-accessors", "~> 0.2.1" +gem "recipient_interceptor", "~> 0.2.0" -source 'https://rails-assets.org' do - gem 'rails-assets-leaflet' - gem 'rails-assets-markdown-it', '~> 8.2.1' +source "https://rails-assets.org" do + gem "rails-assets-leaflet" + gem "rails-assets-markdown-it", "~> 8.2.1" end group :development, :test do - gem 'bullet', '~> 5.7.0' - gem 'byebug', '~> 10.0.0' - gem 'factory_bot_rails', '~> 4.8.2' - gem 'faker', '~> 1.8.7' - gem 'i18n-tasks', '~> 0.9.25' - gem 'knapsack_pro', '~> 1.1.0' - gem 'launchy', '~> 2.4.3' - gem 'letter_opener_web', '~> 1.3.4' - gem 'quiet_assets', '~> 1.1.0' - gem 'spring', '~> 2.0.1' - gem 'spring-commands-rspec', '~> 1.0.4' + gem "bullet", "~> 5.7.0" + gem "byebug", "~> 10.0.0" + gem "factory_bot_rails", "~> 4.8.2" + gem "faker", "~> 1.8.7" + gem "i18n-tasks", "~> 0.9.25" + gem "knapsack_pro", "~> 1.1.0" + gem "launchy", "~> 2.4.3" + gem "letter_opener_web", "~> 1.3.4" + gem "quiet_assets", "~> 1.1.0" + gem "spring", "~> 2.0.1" + gem "spring-commands-rspec", "~> 1.0.4" end group :test do - gem 'capybara', '~> 2.17.0' - gem 'coveralls', '~> 0.8.22', require: false - gem 'database_cleaner', '~> 1.7.0' - gem 'email_spec', '~> 2.1.0' - gem 'rspec-rails', '~> 3.8' - gem 'selenium-webdriver', '~> 3.10' + gem "capybara", "~> 2.17.0" + gem "coveralls", "~> 0.8.22", require: false + gem "database_cleaner", "~> 1.7.0" + gem "email_spec", "~> 2.1.0" + gem "rspec-rails", "~> 3.8" + gem "selenium-webdriver", "~> 3.10" end group :development do - gem 'capistrano', '~> 3.10.1', require: false - gem 'capistrano-bundler', '~> 1.2', require: false - gem 'capistrano-rails', '~> 1.4.0', require: false - gem 'capistrano3-delayed-job', '~> 1.7.3' - gem 'mdl', '~> 0.5.0', require: false - gem 'rubocop', '~> 0.54.0', require: false - gem 'rubocop-rspec', '~> 1.26.0', require: false - gem 'rvm1-capistrano3', '~> 1.4.0', require: false - gem 'scss_lint', '~> 0.55.0', require: false - gem 'web-console', '~> 3.3.0' + gem "capistrano", "~> 3.10.1", require: false + gem "capistrano-bundler", "~> 1.2", require: false + gem "capistrano-rails", "~> 1.4.0", require: false + gem "capistrano3-delayed-job", "~> 1.7.3" + gem "mdl", "~> 0.5.0", require: false + gem "rubocop", "~> 0.54.0", require: false + gem "rubocop-rspec", "~> 1.26.0", require: false + gem "rvm1-capistrano3", "~> 1.4.0", require: false + gem "scss_lint", "~> 0.55.0", require: false + gem "web-console", "~> 3.3.0" end -eval_gemfile './Gemfile_custom' +eval_gemfile "./Gemfile_custom" diff --git a/Rakefile b/Rakefile index c4d34f626..b99dafeef 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require File.expand_path("../config/application", __FILE__) Rails.application.load_tasks if Rake::Task.tasks.empty? KnapsackPro.load_tasks if defined?(KnapsackPro) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0d5b962c1..d07c64fb1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -133,6 +133,6 @@ $(function(){ Turbolinks.enableProgressBar(); $(document).ready(initialize_modules); - $(document).on('page:load', initialize_modules); - $(document).on('ajax:complete', initialize_modules); + $(document).on("page:load", initialize_modules); + $(document).on("ajax:complete", initialize_modules); }); diff --git a/app/assets/javascripts/ckeditor/config.js b/app/assets/javascripts/ckeditor/config.js index 631cad7d7..04539f94e 100644 --- a/app/assets/javascripts/ckeditor/config.js +++ b/app/assets/javascripts/ckeditor/config.js @@ -19,7 +19,7 @@ CKEDITOR.editorConfig = function( config ) // Rails CSRF token config.filebrowserParams = function(){ var csrf_token, csrf_param, meta, - metas = document.getElementsByTagName('meta'), + metas = document.getElementsByTagName("meta"), params = new Object(); for ( var i = 0 ; i < metas.length ; i++ ){ @@ -58,47 +58,47 @@ CKEDITOR.editorConfig = function( config ) }; // Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash) - CKEDITOR.on( 'dialogDefinition', function( ev ){ + CKEDITOR.on( "dialogDefinition", function( ev ){ // Take the dialog name and its definition from the event data. var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; var content, upload; - if (CKEDITOR.tools.indexOf(['link', 'image', 'attachment', 'flash'], dialogName) > -1) { - content = (dialogDefinition.getContents('Upload') || dialogDefinition.getContents('upload')); - upload = (content == null ? null : content.get('upload')); + if (CKEDITOR.tools.indexOf(["link", "image", "attachment", "flash"], dialogName) > -1) { + content = (dialogDefinition.getContents("Upload") || dialogDefinition.getContents("upload")); + upload = (content == null ? null : content.get("upload")); - if (upload && upload.filebrowser && upload.filebrowser['params'] === undefined) { - upload.filebrowser['params'] = config.filebrowserParams(); - upload.action = config.addQueryString(upload.action, upload.filebrowser['params']); + if (upload && upload.filebrowser && upload.filebrowser["params"] === undefined) { + upload.filebrowser["params"] = config.filebrowserParams(); + upload.action = config.addQueryString(upload.action, upload.filebrowser["params"]); } } }); // Toolbar groups configuration. config.toolbar = [ - { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source'] }, - { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] }, - // { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] }, - // { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, - { name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] }, - { name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar' ] }, - { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }, - '/', - { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] }, - { name: 'colors', items: [ 'TextColor', 'BGColor' ] }, - { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] } + { name: "document", groups: [ "mode", "document", "doctools" ], items: [ "Source"] }, + { name: "clipboard", groups: [ "clipboard", "undo" ], items: [ "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Undo", "Redo" ] }, + // { name: "editing", groups: [ "find", "selection", "spellchecker" ], items: [ "Find", "Replace", "-", "SelectAll", "-", "Scayt" ] }, + // { name: "forms", items: [ "Form", "Checkbox", "Radio", "TextField", "Textarea", "Select", "Button", "ImageButton", "HiddenField" ] }, + { name: "links", items: [ "Link", "Unlink", "Anchor" ] }, + { name: "insert", items: [ "Image", "Flash", "Table", "HorizontalRule", "SpecialChar" ] }, + { name: "paragraph", groups: [ "list", "indent", "blocks", "align", "bidi" ], items: [ "NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote", "CreateDiv", "-", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" ] }, + "/", + { name: "styles", items: [ "Styles", "Format", "Font", "FontSize" ] }, + { name: "colors", items: [ "TextColor", "BGColor" ] }, + { name: "basicstyles", groups: [ "basicstyles", "cleanup" ], items: [ "Bold", "Italic", "Underline", "Strike", "Subscript", "Superscript", "-", "RemoveFormat" ] } ]; config.toolbar_mini = [ - { name: 'paragraph', groups: [ 'list' ], items: [ 'NumberedList', 'BulletedList' ] }, - { name: 'links', items: [ 'Link', 'Unlink' ] }, - { name: 'styles', items: [ 'Format' ] }, - { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike' ] } + { name: "paragraph", groups: [ "list" ], items: [ "NumberedList", "BulletedList" ] }, + { name: "links", items: [ "Link", "Unlink" ] }, + { name: "styles", items: [ "Format" ] }, + { name: "basicstyles", groups: [ "basicstyles", "cleanup" ], items: [ "Bold", "Italic", "Underline", "Strike" ] } ]; config.toolbar_admin = config.toolbar_mini.concat([ - { name: 'insert', items: [ 'Image', 'Table' ] } + { name: "insert", items: [ "Image", "Table" ] } ]); config.toolbar = "mini"; diff --git a/app/assets/javascripts/ckeditor/loader.js.erb b/app/assets/javascripts/ckeditor/loader.js.erb index 66e1d8347..a01df8811 100644 --- a/app/assets/javascripts/ckeditor/loader.js.erb +++ b/app/assets/javascripts/ckeditor/loader.js.erb @@ -1,3 +1,3 @@ //= require ckeditor/init -CKEDITOR.config.customConfig = '<%= javascript_path 'ckeditor/config.js' %>'; +CKEDITOR.config.customConfig = "<%= javascript_path 'ckeditor/config.js' %>"; diff --git a/app/assets/javascripts/ckeditor/reinit.js b/app/assets/javascripts/ckeditor/reinit.js index fe8e8cff3..7d2d4233c 100644 --- a/app/assets/javascripts/ckeditor/reinit.js +++ b/app/assets/javascripts/ckeditor/reinit.js @@ -1,7 +1,7 @@ -$(document).bind('page:change', function() { +$(document).bind("page:change", function() { if (typeof(CKEDITOR) != "undefined"){ for(name in CKEDITOR.instances){ try{CKEDITOR.replace(name);}catch(err){}; } } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/stat_graphs.js b/app/assets/javascripts/stat_graphs.js index c5bc5b538..256078a85 100644 --- a/app/assets/javascripts/stat_graphs.js +++ b/app/assets/javascripts/stat_graphs.js @@ -9,6 +9,6 @@ var initialize_stats_modules = function() { $(function(){ $(document).ready(initialize_stats_modules); - $(document).on('page:load', initialize_stats_modules); - $(document).on('ajax:complete', initialize_stats_modules); + $(document).on("page:load", initialize_stats_modules); + $(document).on("ajax:complete", initialize_stats_modules); }); diff --git a/app/helpers/admin_budget_investments_helper.rb b/app/helpers/admin_budget_investments_helper.rb index 492225e35..5c2dc479e 100644 --- a/app/helpers/admin_budget_investments_helper.rb +++ b/app/helpers/admin_budget_investments_helper.rb @@ -1,7 +1,7 @@ module AdminBudgetInvestmentsHelper def advanced_menu_visibility - (params[:advanced_filters].empty? && params["min_total_supports"].blank?) ? 'hide' : '' + (params[:advanced_filters].empty? && params["min_total_supports"].blank?) ? "hide" : "" end def init_advanced_menu diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index f5c442ba5..452d58937 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -1,7 +1,7 @@ module AdminHelper def side_menu - if namespace == 'moderation/budgets' + if namespace == "moderation/budgets" render "/moderation/menu" else render "/#{namespace}/menu" @@ -13,7 +13,7 @@ module AdminHelper end def namespaced_header_title - if namespace == 'moderation/budgets' + if namespace == "moderation/budgets" t("moderation.header.title") else t("#{namespace}.header.title") @@ -71,13 +71,13 @@ module AdminHelper def official_level_options options = [["", 0]] (1..5).each do |i| - options << [[t("admin.officials.level_#{i}"), setting["official_level_#{i}_name"]].compact.join(': '), i] + options << [[t("admin.officials.level_#{i}"), setting["official_level_#{i}_name"]].compact.join(": "), i] end options end def admin_select_options - Administrator.all.order('users.username asc').includes(:user).collect { |v| [ v.name, v.id ] } + Administrator.all.order("users.username asc").includes(:user).collect { |v| [ v.name, v.id ] } end def admin_submit_action(resource) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a56ea7fd5..0a934ac9e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,10 +4,10 @@ module ApplicationHelper return false if user_signed_in? # Using path because fullpath yields false negatives since it contains # parameters too - request.path == '/' + request.path == "/" end - # if current path is /debates current_path_with_query_params(foo: 'bar') returns /debates?foo=bar + # 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) url_for(request.query_parameters.merge(query_parameters)) diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index 8611fc652..df48a08fa 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -1,12 +1,12 @@ module BudgetsHelper def show_links_to_budget_investments(budget) - ['balloting', 'reviewing_ballots', 'finished'].include? budget.phase + ["balloting", "reviewing_ballots", "finished"].include? budget.phase end def heading_name_and_price_html(heading, budget) content_tag :div do - concat(heading.name + ' ') + concat(heading.name + " ") concat(content_tag(:span, budget.formatted_heading_price(heading))) end end diff --git a/app/helpers/debates_helper.rb b/app/helpers/debates_helper.rb index f81d69809..7771a2561 100644 --- a/app/helpers/debates_helper.rb +++ b/app/helpers/debates_helper.rb @@ -6,9 +6,9 @@ module DebatesHelper def empty_recommended_debates_message_text(user) if user.interests.any? - t('debates.index.recommendations.without_results') + t("debates.index.recommendations.without_results") else - t('debates.index.recommendations.without_interests') + t("debates.index.recommendations.without_interests") end end diff --git a/app/helpers/documentables_helper.rb b/app/helpers/documentables_helper.rb index 5c3181c95..b277ae3eb 100644 --- a/app/helpers/documentables_helper.rb +++ b/app/helpers/documentables_helper.rb @@ -1,7 +1,7 @@ module DocumentablesHelper def documentable_class(documentable) - documentable.class.name.parameterize('_') + documentable.class.name.parameterize("_") end def max_documents_allowed(documentable) diff --git a/app/helpers/documents_helper.rb b/app/helpers/documents_helper.rb index 4766de0aa..b0facdacc 100644 --- a/app/helpers/documents_helper.rb +++ b/app/helpers/documents_helper.rb @@ -5,7 +5,7 @@ module DocumentsHelper end def document_errors_on_attachment(document) - document.errors[:attachment].join(', ') if document.errors.key?(:attachment) + document.errors[:attachment].join(", ") if document.errors.key?(:attachment) end def bytes_to_mega(bytes) @@ -18,7 +18,7 @@ module DocumentsHelper def render_destroy_document_link(builder, document) if !document.persisted? && document.cached_attachment.present? - link_to t('documents.form.delete_button'), + link_to t("documents.form.delete_button"), direct_upload_destroy_url("direct_upload[resource_type]": document.documentable_type, "direct_upload[resource_id]": document.documentable_id, "direct_upload[resource_relation]": "documents", @@ -27,7 +27,7 @@ module DocumentsHelper remote: true, class: "delete remove-cached-attachment" else - link_to_remove_association document.new_record? ? t('documents.form.cancel_button') : t('documents.form.delete_button') , builder, class: "delete remove-document" + link_to_remove_association document.new_record? ? t("documents.form.cancel_button") : t("documents.form.delete_button") , builder, class: "delete remove-document" end end @@ -40,7 +40,7 @@ module DocumentsHelper html += builder.file_field :attachment, label: false, accept: accepted_content_types_extensions(document.documentable_type.constantize), - class: 'js-document-attachment', + class: "js-document-attachment", data: { url: document_direct_upload_url(document), nested_document: true diff --git a/app/helpers/embed_videos_helper.rb b/app/helpers/embed_videos_helper.rb index 823659cca..645376525 100644 --- a/app/helpers/embed_videos_helper.rb +++ b/app/helpers/embed_videos_helper.rb @@ -5,7 +5,7 @@ module EmbedVideosHelper def embedded_video_code link = @proposal.video_url - title = t('proposals.show.embed_video_title', proposal: @proposal.title) + title = t("proposals.show.embed_video_title", proposal: @proposal.title) if link =~ /vimeo.*/ server = "Vimeo" elsif link =~ /youtu*.*/ @@ -27,7 +27,7 @@ module EmbedVideosHelper if match && match[2] '' else - '' + "" end end diff --git a/app/helpers/followables_helper.rb b/app/helpers/followables_helper.rb index f7dd4a7a0..48dd761ce 100644 --- a/app/helpers/followables_helper.rb +++ b/app/helpers/followables_helper.rb @@ -6,8 +6,8 @@ module FollowablesHelper def followable_icon(followable) { - proposals: 'Proposal', - budget: 'Budget::Investment' + proposals: "Proposal", + budget: "Budget::Investment" }.invert[followable] end diff --git a/app/helpers/follows_helper.rb b/app/helpers/follows_helper.rb index b3426df12..1508e4c25 100644 --- a/app/helpers/follows_helper.rb +++ b/app/helpers/follows_helper.rb @@ -2,12 +2,12 @@ module FollowsHelper def follow_text(followable) entity = followable.class.name.underscore - t('shared.follow_entity', entity: t("activerecord.models.#{entity}.one").downcase) + t("shared.follow_entity", entity: t("activerecord.models.#{entity}.one").downcase) end def unfollow_text(followable) entity = followable.class.name.underscore - t('shared.unfollow_entity', entity: t("activerecord.models.#{entity}.one").downcase) + t("shared.unfollow_entity", entity: t("activerecord.models.#{entity}.one").downcase) end end diff --git a/app/helpers/imageables_helper.rb b/app/helpers/imageables_helper.rb index 8cae1b989..04c48d6c3 100644 --- a/app/helpers/imageables_helper.rb +++ b/app/helpers/imageables_helper.rb @@ -5,7 +5,7 @@ module ImageablesHelper end def imageable_class(imageable) - imageable.class.name.parameterize('_') + imageable.class.name.parameterize("_") end def imageable_max_file_size diff --git a/app/helpers/images_helper.rb b/app/helpers/images_helper.rb index 208ccf5ab..1998e63f5 100644 --- a/app/helpers/images_helper.rb +++ b/app/helpers/images_helper.rb @@ -19,7 +19,7 @@ module ImagesHelper end def image_errors_on_attachment(image) - image.errors[:attachment].join(', ') if image.errors.key?(:attachment) + image.errors[:attachment].join(", ") if image.errors.key?(:attachment) end def image_bytes_to_megabytes(bytes) @@ -32,7 +32,7 @@ module ImagesHelper def render_destroy_image_link(builder, image) if !image.persisted? && image.cached_attachment.present? - link_to t('images.form.delete_button'), + link_to t("images.form.delete_button"), direct_upload_destroy_url("direct_upload[resource_type]": image.imageable_type, "direct_upload[resource_id]": image.imageable_id, "direct_upload[resource_relation]": "image", @@ -41,7 +41,7 @@ module ImagesHelper remote: true, class: "delete remove-cached-attachment" else - link_to_remove_association t('images.form.delete_button'), builder, class: "delete remove-image" + link_to_remove_association t("images.form.delete_button"), builder, class: "delete remove-image" end end @@ -54,7 +54,7 @@ module ImagesHelper html += builder.file_field :attachment, label: false, accept: imageable_accepted_content_types_extensions, - class: 'js-image-attachment', + class: "js-image-attachment", data: { url: image_direct_upload_url(imageable), nested_image: true diff --git a/app/helpers/layouts_helper.rb b/app/helpers/layouts_helper.rb index 782d9c639..b88547d8a 100644 --- a/app/helpers/layouts_helper.rb +++ b/app/helpers/layouts_helper.rb @@ -2,7 +2,7 @@ module LayoutsHelper def layout_menu_link_to(text, path, is_active, options) if is_active - content_tag(:span, t('shared.you_are_in'), class: 'show-for-sr') + ' ' + + content_tag(:span, t("shared.you_are_in"), class: "show-for-sr") + " " + link_to(text, path, options.merge(class: "is-active")) else link_to(text, path, options) diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index 2f5eac13f..415de8e74 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -14,10 +14,10 @@ module LegislationHelper def link_to_toggle_legislation_proposal_selection(proposal) if proposal.selected? button_text = t("admin.legislation.proposals.index.selected") - html_class = 'button expanded' + html_class = "button expanded" else button_text = t("admin.legislation.proposals.index.select") - html_class = 'button hollow expanded' + html_class = "button hollow expanded" end link_to button_text, diff --git a/app/helpers/officers_helper.rb b/app/helpers/officers_helper.rb index 31c0a6ad4..e069cb9aa 100644 --- a/app/helpers/officers_helper.rb +++ b/app/helpers/officers_helper.rb @@ -1,7 +1,7 @@ module OfficersHelper def officer_label(officer) - truncate([officer.name, officer.email].compact.join(' - '), length: 100) + truncate([officer.name, officer.email].compact.join(" - "), length: 100) end def vote_collection_shift? diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index 8135e8ab8..06d2f78f7 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -42,7 +42,7 @@ module PollsHelper end def poll_voter_token(poll, user) - Poll::Voter.where(poll: poll, user: user, origin: "web").first&.token || '' + Poll::Voter.where(poll: poll, user: user, origin: "web").first&.token || "" end def voted_before_sign_in(question) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index ebde2a954..b38048fb1 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -11,12 +11,12 @@ module SearchHelper [t("shared.advanced_search.date_2"), 2], [t("shared.advanced_search.date_3"), 3], [t("shared.advanced_search.date_4"), 4], - [t("shared.advanced_search.date_5"), 'custom']], + [t("shared.advanced_search.date_5"), "custom"]], selected_date_range) end def selected_date_range - custom_date_range? ? 'custom' : params[:advanced_search].try(:[], :date_min) + custom_date_range? ? "custom" : params[:advanced_search].try(:[], :date_min) end def custom_date_range? diff --git a/app/helpers/settings.rb b/app/helpers/settings.rb index d308535ab..209237f99 100644 --- a/app/helpers/settings.rb +++ b/app/helpers/settings.rb @@ -1,7 +1,7 @@ module SettingsHelper def setting_for_widget(widget) - Setting.where(key: 'feature.user.recommendations').first + Setting.where(key: "feature.user.recommendations").first end -end \ No newline at end of file +end diff --git a/app/helpers/stats_helper.rb b/app/helpers/stats_helper.rb index 19b54a5a2..b36977b3e 100644 --- a/app/helpers/stats_helper.rb +++ b/app/helpers/stats_helper.rb @@ -1,28 +1,28 @@ module StatsHelper def events_chart_tag(events, opt = {}) - events = events.join(',') if events.is_a? Array + events = events.join(",") if events.is_a? Array opt[:data] ||= {} opt[:data][:graph] = admin_api_stats_path(events: events) content_tag :div, "", opt end def visits_chart_tag(opt = {}) - events = events.join(',') if events.is_a? Array + events = events.join(",") if events.is_a? Array opt[:data] ||= {} opt[:data][:graph] = admin_api_stats_path(visits: true) content_tag :div, "", opt end def spending_proposals_chart_tag(opt = {}) - events = events.join(',') if events.is_a? Array + events = events.join(",") if events.is_a? Array opt[:data] ||= {} opt[:data][:graph] = admin_api_stats_path(spending_proposals: true) content_tag :div, "", opt end def budget_investments_chart_tag(opt = {}) - events = events.join(',') if events.is_a? Array + events = events.join(",") if events.is_a? Array opt[:data] ||= {} opt[:data][:graph] = admin_api_stats_path(budget_investments: true) content_tag :div, "", opt diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index b31f3167f..ce0445092 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -2,32 +2,32 @@ module TagsHelper def taggables_path(taggable_type, tag_name) case taggable_type - when 'debate' + when "debate" debates_path(search: tag_name) - when 'proposal' + when "proposal" proposals_path(search: tag_name) - when 'budget/investment' + when "budget/investment" budget_investments_path(@budget, search: tag_name) - when 'legislation/proposal' + when "legislation/proposal" legislation_process_proposals_path(@process, search: tag_name) else - '#' + "#" end end def taggable_path(taggable) taggable_type = taggable.class.name.underscore case taggable_type - when 'debate' + when "debate" debate_path(taggable) - when 'proposal' + when "proposal" proposal_path(taggable) - when 'budget/investment' + when "budget/investment" budget_investment_path(taggable.budget_id, taggable) - when 'legislation/proposal' + when "legislation/proposal" legislation_process_proposal_path(@process, taggable) else - '#' + "#" end end diff --git a/app/helpers/tracks_helper.rb b/app/helpers/tracks_helper.rb index 0d6793e08..f63fe7852 100644 --- a/app/helpers/tracks_helper.rb +++ b/app/helpers/tracks_helper.rb @@ -4,11 +4,11 @@ module TracksHelper track_data = "" prefix = " data-track-event-" data.each do |key, value| - track_data = track_data + prefix + key.to_s + '=' + value + " " + track_data = track_data + prefix + key.to_s + "=" + value + " " end content_for :track_event do track_data end end -end \ No newline at end of file +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 4098b535e..13e537835 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -16,8 +16,8 @@ module UsersHelper if commentable.nil? deleted_commentable_text(comment) elsif commentable.hidden? - content_tag(:del, commentable.title) + ' ' + - content_tag(:span, '(' + deleted_commentable_text(comment) + ')', class: 'small') + content_tag(:del, commentable.title) + " " + + content_tag(:span, "(" + deleted_commentable_text(comment) + ")", class: "small") else link_to(commentable.title, comment) end @@ -58,9 +58,9 @@ module UsersHelper def interests_title_text(user) if current_user == user - t('account.show.public_interests_my_title_list') + t("account.show.public_interests_my_title_list") else - t('account.show.public_interests_user_title_list') + t("account.show.public_interests_user_title_list") end end diff --git a/app/helpers/valuation_helper.rb b/app/helpers/valuation_helper.rb index 1c11cb90b..56b1dd079 100644 --- a/app/helpers/valuation_helper.rb +++ b/app/helpers/valuation_helper.rb @@ -22,8 +22,8 @@ module ValuationHelper valuators.first.name + "".html_safe else - "".html_safe + - t('valuation.budget_investments.index.valuators_assigned', count: valuators.size) + + "".html_safe + + t("valuation.budget_investments.index.valuators_assigned", count: valuators.size) + "".html_safe end end diff --git a/app/helpers/valuators_helper.rb b/app/helpers/valuators_helper.rb index 752713ed3..17dd7fc24 100644 --- a/app/helpers/valuators_helper.rb +++ b/app/helpers/valuators_helper.rb @@ -1,7 +1,7 @@ module ValuatorsHelper def valuator_label(valuator) - truncate([valuator.name, valuator.email, valuator.description].compact.join(' - '), length: 100) + truncate([valuator.name, valuator.email, valuator.description].compact.join(" - "), length: 100) end -end \ No newline at end of file +end diff --git a/app/helpers/verification_helper.rb b/app/helpers/verification_helper.rb index 44f921264..121a3e903 100644 --- a/app/helpers/verification_helper.rb +++ b/app/helpers/verification_helper.rb @@ -1,9 +1,9 @@ module VerificationHelper def document_types - [[t('verification.residence.new.document_type.spanish_id'), 1], - [t('verification.residence.new.document_type.passport'), 2], - [t('verification.residence.new.document_type.residence_card'), 3]] + [[t("verification.residence.new.document_type.spanish_id"), 1], + [t("verification.residence.new.document_type.passport"), 2], + [t("verification.residence.new.document_type.residence_card"), 3]] end def mask_phone(number) diff --git a/app/helpers/votes_helper.rb b/app/helpers/votes_helper.rb index dc1df0396..4255b7656 100644 --- a/app/helpers/votes_helper.rb +++ b/app/helpers/votes_helper.rb @@ -6,9 +6,9 @@ module VotesHelper def votes_percentage(vote, debate) return "0%" if debate.total_votes == 0 - if vote == 'likes' + if vote == "likes" debate_percentage_of_likes(debate).to_s + "%" - elsif vote == 'dislikes' + elsif vote == "dislikes" (100 - debate_percentage_of_likes(debate)).to_s + "%" end end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 07d7b380a..fa729492e 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -15,7 +15,7 @@ module WelcomeHelper when "Proposal" proposal_path(recommended) else - '#' + "#" end end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index ea1d4fa40..eded65fb8 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,5 @@ class ApplicationMailer < ActionMailer::Base helper :settings default from: "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>" - layout 'mailer' + layout "mailer" end diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb index a914477fe..9f1bb6f4e 100644 --- a/app/mailers/devise_mailer.rb +++ b/app/mailers/devise_mailer.rb @@ -1,7 +1,7 @@ class DeviseMailer < Devise::Mailer helper :application, :settings include Devise::Controllers::UrlHelpers - default template_path: 'devise/mailer' + default template_path: "devise/mailer" protected diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 7013130cd..1e4993ec5 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -11,7 +11,7 @@ class Mailer < ApplicationMailer @email_to = @commentable.author.email with_user(@commentable.author) do - subject = t('mailers.comment.subject', commentable: t("activerecord.models.#{@commentable.class.name.underscore}", count: 1).downcase) + subject = t("mailers.comment.subject", commentable: t("activerecord.models.#{@commentable.class.name.underscore}", count: 1).downcase) mail(to: @email_to, subject: subject) if @commentable.present? && @commentable.author.present? end end @@ -33,7 +33,7 @@ class Mailer < ApplicationMailer @document_number = document_number with_user(user) do - mail(to: @email_to, subject: t('mailers.email_verification.subject')) + mail(to: @email_to, subject: t("mailers.email_verification.subject")) end end @@ -43,7 +43,7 @@ class Mailer < ApplicationMailer @email_to = @author.email with_user(@author) do - mail(to: @email_to, subject: t('mailers.unfeasible_spending_proposal.subject', code: @spending_proposal.code)) + mail(to: @email_to, subject: t("mailers.unfeasible_spending_proposal.subject", code: @spending_proposal.code)) end end @@ -53,7 +53,7 @@ class Mailer < ApplicationMailer @email_to = @receiver.email with_user(@receiver) do - mail(to: @email_to, subject: t('mailers.direct_message_for_receiver.subject')) + mail(to: @email_to, subject: t("mailers.direct_message_for_receiver.subject")) end end @@ -63,7 +63,7 @@ class Mailer < ApplicationMailer @email_to = @sender.email with_user(@sender) do - mail(to: @email_to, subject: t('mailers.direct_message_for_sender.subject')) + mail(to: @email_to, subject: t("mailers.direct_message_for_sender.subject")) end end @@ -72,7 +72,7 @@ class Mailer < ApplicationMailer @email_to = user.email with_user(user) do - mail(to: @email_to, subject: t('mailers.proposal_notification_digest.title', org_name: Setting['org_name'])) + mail(to: @email_to, subject: t("mailers.proposal_notification_digest.title", org_name: Setting["org_name"])) end end @@ -80,7 +80,7 @@ class Mailer < ApplicationMailer @email_to = email I18n.with_locale(I18n.default_locale) do - mail(to: @email_to, subject: t('mailers.user_invite.subject', org_name: Setting["org_name"])) + mail(to: @email_to, subject: t("mailers.user_invite.subject", org_name: Setting["org_name"])) end end @@ -89,7 +89,7 @@ class Mailer < ApplicationMailer @email_to = @investment.author.email with_user(@investment.author) do - mail(to: @email_to, subject: t('mailers.budget_investment_created.subject')) + mail(to: @email_to, subject: t("mailers.budget_investment_created.subject")) end end @@ -99,7 +99,7 @@ class Mailer < ApplicationMailer @email_to = @author.email with_user(@author) do - mail(to: @email_to, subject: t('mailers.budget_investment_unfeasible.subject', code: @investment.code)) + mail(to: @email_to, subject: t("mailers.budget_investment_unfeasible.subject", code: @investment.code)) end end @@ -109,7 +109,7 @@ class Mailer < ApplicationMailer @email_to = @author.email with_user(@author) do - mail(to: @email_to, subject: t('mailers.budget_investment_selected.subject', code: @investment.code)) + mail(to: @email_to, subject: t("mailers.budget_investment_selected.subject", code: @investment.code)) end end @@ -119,7 +119,7 @@ class Mailer < ApplicationMailer @email_to = @author.email with_user(@author) do - mail(to: @email_to, subject: t('mailers.budget_investment_unselected.subject', code: @investment.code)) + mail(to: @email_to, subject: t("mailers.budget_investment_unselected.subject", code: @investment.code)) end end diff --git a/config.ru b/config.ru index bd83b2541..193e5fed8 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,4 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path("../config/environment", __FILE__) run Rails.application diff --git a/config/application.rb b/config/application.rb index 54afdcb4a..22eceee59 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,7 +1,6 @@ +require File.expand_path("../boot", __FILE__) -require File.expand_path('../boot', __FILE__) - -require 'rails/all' +require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -44,13 +43,13 @@ module Consul "zh-TW"] config.i18n.available_locales = available_locales config.i18n.fallbacks = { - 'fr' => 'es', - 'gl' => 'es', - 'it' => 'es', - 'pt-BR' => 'es' + "fr" => "es", + "gl" => "es", + "it" => "es", + "pt-BR" => "es" } - config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] - config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'custom', '**', '*.{rb,yml}')] + config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml}")] + config.i18n.load_path += Dir[Rails.root.join("config", "locales", "custom", "**", "*.{rb,yml}")] config.after_initialize { Globalize.set_fallbacks_to_all_available_locales } @@ -60,8 +59,8 @@ module Consul config.active_record.raise_in_transactional_callbacks = true # Add lib to the autoload path - config.autoload_paths << Rails.root.join('lib') - config.time_zone = 'Madrid' + config.autoload_paths << Rails.root.join("lib") + config.time_zone = "Madrid" config.active_job.queue_adapter = :delayed_job # CONSUL specific custom overrides @@ -71,7 +70,7 @@ module Consul # config.autoload_paths << "#{Rails.root}/app/controllers/custom" config.autoload_paths << "#{Rails.root}/app/models/custom" - config.paths['app/views'].unshift(Rails.root.join('app', 'views', 'custom')) + config.paths["app/views"].unshift(Rails.root.join("app", "views", "custom")) end end diff --git a/config/boot.rb b/config/boot.rb index 6b750f00b..fb24cf2ed 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,3 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) -require 'bundler/setup' # Set up gems listed in the Gemfile. +require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/deploy.rb b/config/deploy.rb index 08f4a5875..dc6639ac1 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,19 +1,19 @@ # config valid only for current version of Capistrano -lock '~> 3.10.1' +lock "~> 3.10.1" def deploysecret(key) - @deploy_secrets_yml ||= YAML.load_file('config/deploy-secrets.yml')[fetch(:stage).to_s] - @deploy_secrets_yml.fetch(key.to_s, 'undefined') + @deploy_secrets_yml ||= YAML.load_file("config/deploy-secrets.yml")[fetch(:stage).to_s] + @deploy_secrets_yml.fetch(key.to_s, "undefined") end set :rails_env, fetch(:stage) -set :rvm1_ruby_version, '2.3.2' +set :rvm1_ruby_version, "2.3.2" -set :application, 'consul' +set :application, "consul" set :full_app_name, deploysecret(:full_app_name) set :server_name, deploysecret(:server_name) -set :repo_url, 'https://github.com/consul/consul.git' +set :repo_url, "https://github.com/consul/consul.git" set :revision, `git rev-parse --short #{fetch(:branch)}`.strip @@ -26,7 +26,7 @@ set :linked_dirs, %w{log tmp public/system public/assets public/ckeditor_assets} set :keep_releases, 5 -set :local_user, ENV['USER'] +set :local_user, ENV["USER"] set :delayed_job_workers, 2 set :delayed_job_roles, :background @@ -41,15 +41,15 @@ set(:config_files, %w( set :whenever_roles, -> { :app } namespace :deploy do - #before :starting, 'rvm1:install:rvm' # install/update RVM - #before :starting, 'rvm1:install:ruby' # install Ruby and create gemset - #before :starting, 'install_bundler_gem' # install bundler gem + #before :starting, "rvm1:install:rvm" # install/update RVM + #before :starting, "rvm1:install:ruby" # install Ruby and create gemset + #before :starting, "install_bundler_gem" # install bundler gem - after :publishing, 'deploy:restart' - after :published, 'delayed_job:restart' - after :published, 'refresh_sitemap' + after :publishing, "deploy:restart" + after :published, "delayed_job:restart" + after :published, "refresh_sitemap" - after :finishing, 'deploy:cleanup' + after :finishing, "deploy:cleanup" end task :install_bundler_gem do @@ -62,7 +62,7 @@ task :refresh_sitemap do on roles(:app) do within release_path do with rails_env: fetch(:rails_env) do - execute :rake, 'sitemap:refresh:no_ping' + execute :rake, "sitemap:refresh:no_ping" end end end diff --git a/config/deploy/preproduction.rb b/config/deploy/preproduction.rb index 74c96871e..27fdf021d 100644 --- a/config/deploy/preproduction.rb +++ b/config/deploy/preproduction.rb @@ -1,7 +1,7 @@ set :deploy_to, deploysecret(:deploy_to) set :server_name, deploysecret(:server_name) set :db_server, deploysecret(:db_server) -set :branch, ENV['branch'] || :master +set :branch, ENV["branch"] || :master set :ssh_options, port: deploysecret(:ssh_port) set :stage, :preproduction set :rails_env, :preproduction diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index c97bb9a7f..c9093c13a 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,7 +1,7 @@ set :deploy_to, deploysecret(:deploy_to) set :server_name, deploysecret(:server_name) set :db_server, deploysecret(:db_server) -set :branch, ENV['branch'] || :master +set :branch, ENV["branch"] || :master set :ssh_options, port: deploysecret(:ssh_port) set :stage, :staging set :rails_env, :staging diff --git a/config/environment.rb b/config/environment.rb index ee8d90dc6..171198560 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require File.expand_path("../application", __FILE__) # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 1b401544a..49c9ab830 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -15,7 +15,7 @@ Rails.application.configure do # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } + config.action_mailer.default_url_options = { host: "localhost", port: 3000 } config.action_mailer.asset_host = "http://localhost:3000" # Deliver emails to a development mailbox at /letter_opener @@ -49,7 +49,7 @@ Rails.application.configure do config.after_initialize do Bullet.enable = true Bullet.bullet_logger = true - if ENV['BULLET'] + if ENV["BULLET"] Bullet.rails_logger = true Bullet.add_footer = true end diff --git a/config/environments/preproduction.rb b/config/environments/preproduction.rb index 06f210c82..7eb169ce1 100644 --- a/config/environments/preproduction.rb +++ b/config/environments/preproduction.rb @@ -22,7 +22,7 @@ Rails.application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -38,8 +38,8 @@ Rails.application.configure do # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true @@ -58,7 +58,7 @@ Rails.application.configure do config.cache_store = :dalli_store, { value_max_bytes: 2000000 } # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # config.action_controller.asset_host = "http://assets.example.com" # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -70,12 +70,12 @@ Rails.application.configure do # Uncomment the following block of code and add your SMTP service credentials # config.action_mailer.delivery_method = :smtp # config.action_mailer.smtp_settings = { - # address: 'smtp.example.com', + # address: "smtp.example.com", # port: 587, - # domain: 'example.com', - # user_name: '', - # password: '', - # authentication: 'plain', + # domain: "example.com", + # user_name: "", + # password: "", + # authentication: "plain", # enable_starttls_auto: true } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to @@ -90,4 +90,4 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false -end \ No newline at end of file +end diff --git a/config/environments/production.rb b/config/environments/production.rb index e7ddfd86a..ff3d9d2ad 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,7 +22,7 @@ Rails.application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -38,8 +38,8 @@ Rails.application.configure do # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true @@ -58,7 +58,7 @@ Rails.application.configure do config.cache_store = :dalli_store, { value_max_bytes: 2000000 } # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # config.action_controller.asset_host = "http://assets.example.com" # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -70,12 +70,12 @@ Rails.application.configure do # Uncomment the following block of code and add your SMTP service credentials # config.action_mailer.delivery_method = :smtp # config.action_mailer.smtp_settings = { - # address: 'smtp.example.com', + # address: "smtp.example.com", # port: 587, - # domain: 'example.com', - # user_name: '', - # password: '', - # authentication: 'plain', + # domain: "example.com", + # user_name: "", + # password: "", + # authentication: "plain", # enable_starttls_auto: true } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 162b574fb..de8f707c7 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -22,7 +22,7 @@ Rails.application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -38,8 +38,8 @@ Rails.application.configure do # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true @@ -58,7 +58,7 @@ Rails.application.configure do config.cache_store = :dalli_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # config.action_controller.asset_host = "http://assets.example.com" # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -70,12 +70,12 @@ Rails.application.configure do # Uncomment the following block of code and add your SMTP service credentials # config.action_mailer.delivery_method = :smtp # config.action_mailer.smtp_settings = { - # address: 'smtp.example.com', + # address: "smtp.example.com", # port: 587, - # domain: 'example.com', - # user_name: '', - # password: '', - # authentication: 'plain', + # domain: "example.com", + # user_name: "", + # password: "", + # authentication: "plain", # enable_starttls_auto: true } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to diff --git a/config/environments/test.rb b/config/environments/test.rb index 30e282fec..a237b95de 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -19,7 +19,7 @@ Rails.application.configure do # Configure static file server for tests with Cache-Control for performance. config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + config.static_cache_control = "public, max-age=3600" # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -36,9 +36,9 @@ Rails.application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test config.action_mailer.default_url_options = { - host: 'test' + host: "test" } - config.action_mailer.asset_host = 'http://consul.test' + config.action_mailer.asset_host = "http://consul.test" # Randomize the order test cases are executed. config.active_support.test_order = :random @@ -54,9 +54,9 @@ Rails.application.configure do config.after_initialize do Bullet.enable = true Bullet.bullet_logger = true - if ENV['BULLET'] + if ENV["BULLET"] Bullet.raise = true # raise an error if n+1 query occurs end end -end \ No newline at end of file +end diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 8377deb4f..61702232b 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -108,95 +108,95 @@ search: # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}' # - '{devise,simple_form}.*' ignore_missing: - - 'unauthorized.*' - - 'activerecord.models.proposal' - - 'activerecord.models.spending_proposal' - - 'activerecord.errors.models.proposal_notification.*' - - 'activerecord.errors.models.direct_message.*' - - 'errors.messages.blank' - - 'errors.messages.taken' - - 'devise.failure.invalid' - - 'devise.registrations.destroyed' - - 'devise.password_expired.*' + - "unauthorized.*" + - "activerecord.models.proposal" + - "activerecord.models.spending_proposal" + - "activerecord.errors.models.proposal_notification.*" + - "activerecord.errors.models.direct_message.*" + - "errors.messages.blank" + - "errors.messages.taken" + - "devise.failure.invalid" + - "devise.registrations.destroyed" + - "devise.password_expired.*" ## Consider these keys used: ignore_unused: - - 'budgets.phase.*' - - 'budgets.investments.index.orders.*' - - 'budgets.index.section_header.*' - - 'activerecord.*' - - 'activemodel.*' - - 'date.order' - - 'unauthorized.*' - - 'admin.officials.level_*' - - 'admin.comments.index.filter*' - - 'admin.banners.index.filters.*' - - 'admin.debates.index.filter*' - - 'admin.hidden_proposals.index.filter*' - - 'admin.proposal_notifications.index.filter*' - - 'admin.budgets.index.filter*' - - 'admin.budget_investments.index.filter*' - - 'admin.spending_proposals.index.filter*' - - 'admin.organizations.index.filter*' - - 'admin.hidden_users.index.filter*' - - 'admin.hidden_budget_investments.index.filter*' - - 'admin.activity.show.filter*' - - 'admin.legislation.processes.index.filter*' - - 'admin.legislation.processes.*.submit_button' - - 'admin.legislation.processes.proposals.orders.*' - - 'admin.legislation.processes.proposals.select_order' - - 'admin.legislation.draft_versions.*.submit_button' - - 'admin.legislation.questions.*.submit_button' - - 'admin.comments.index.hidden_*' - - 'admin.settings.index.features.*' - - 'admin.polls.*.submit_button' - - 'admin.booths.*.submit_button' - - 'admin.admin_notifications.*.submit_button' - - 'admin.homepage.*' - - 'moderation.comments.index.filter*' - - 'moderation.comments.index.order*' - - 'moderation.debates.index.filter*' - - 'moderation.proposals.index.filter*' - - 'moderation.proposals.index.order*' - - 'moderation.debates.index.filter*' - - 'moderation.debates.index.order*' - - 'moderation.budget_investments.index.filter*' - - 'moderation.budget_investments.index.order*' - - 'moderation.proposal_notifications.index.filter*' - - 'moderation.proposal_notifications.index.order*' - - 'valuation.spending_proposals.index.filter*' - - 'valuation.budgets.index.filter*' - - 'valuation.budget_investments.index.filter*' - - 'users.show.filters.*' - - 'polls.index.filters.*' - - 'polls.index.section_header.*' - - 'polls.index.orders.*' - - 'debates.index.select_order' - - 'debates.index.orders.*' - - 'debates.index.section_header.*' - - 'proposals.index.select_order' - - 'proposals.index.orders.*' - - 'proposals.index.section_header.*' - - 'spending_proposals.index.search_form.*' - - '*.index.search_form.*' - - 'notifications.notification.action.*' - - 'legislation.processes.index.filter*' - - 'legislation.processes.index.section_header.*' - - 'legislation.processes.proposals.filters.*' - - 'helpers.page_entries_info.*' # kaminari - - 'views.pagination.*' # kaminari - - 'shared.suggest.*' - - 'invisible_captcha.*' - - 'admin.site_customization.pages.page.status_*' - - 'admin.legislation.processes.process.*' - - 'legislation.processes.index.*' - - 'votes.budget_investments.different_heading_assigned*' - - '*.form.map_skip_checkbox' -# - '{devise,kaminari,will_paginate}.*' -# - 'simple_form.{yes,no}' -# - 'simple_form.{placeholders,hints,labels}.*' -# - 'simple_form.{error_notification,required}.:' -## Exclude these keys from the `i18n-tasks eq-base' report: + - "budgets.phase.*" + - "budgets.investments.index.orders.*" + - "budgets.index.section_header.*" + - "activerecord.*" + - "activemodel.*" + - "date.order" + - "unauthorized.*" + - "admin.officials.level_*" + - "admin.comments.index.filter*" + - "admin.banners.index.filters.*" + - "admin.debates.index.filter*" + - "admin.hidden_proposals.index.filter*" + - "admin.proposal_notifications.index.filter*" + - "admin.budgets.index.filter*" + - "admin.budget_investments.index.filter*" + - "admin.spending_proposals.index.filter*" + - "admin.organizations.index.filter*" + - "admin.hidden_users.index.filter*" + - "admin.hidden_budget_investments.index.filter*" + - "admin.activity.show.filter*" + - "admin.legislation.processes.index.filter*" + - "admin.legislation.processes.*.submit_button" + - "admin.legislation.processes.proposals.orders.*" + - "admin.legislation.processes.proposals.select_order" + - "admin.legislation.draft_versions.*.submit_button" + - "admin.legislation.questions.*.submit_button" + - "admin.comments.index.hidden_*" + - "admin.settings.index.features.*" + - "admin.polls.*.submit_button" + - "admin.booths.*.submit_button" + - "admin.admin_notifications.*.submit_button" + - "admin.homepage.*" + - "moderation.comments.index.filter*" + - "moderation.comments.index.order*" + - "moderation.debates.index.filter*" + - "moderation.proposals.index.filter*" + - "moderation.proposals.index.order*" + - "moderation.debates.index.filter*" + - "moderation.debates.index.order*" + - "moderation.budget_investments.index.filter*" + - "moderation.budget_investments.index.order*" + - "moderation.proposal_notifications.index.filter*" + - "moderation.proposal_notifications.index.order*" + - "valuation.spending_proposals.index.filter*" + - "valuation.budgets.index.filter*" + - "valuation.budget_investments.index.filter*" + - "users.show.filters.*" + - "polls.index.filters.*" + - "polls.index.section_header.*" + - "polls.index.orders.*" + - "debates.index.select_order" + - "debates.index.orders.*" + - "debates.index.section_header.*" + - "proposals.index.select_order" + - "proposals.index.orders.*" + - "proposals.index.section_header.*" + - "spending_proposals.index.search_form.*" + - "*.index.search_form.*" + - "notifications.notification.action.*" + - "legislation.processes.index.filter*" + - "legislation.processes.index.section_header.*" + - "legislation.processes.proposals.filters.*" + - "helpers.page_entries_info.*" # kaminari + - "views.pagination.*" # kaminari + - "shared.suggest.*" + - "invisible_captcha.*" + - "admin.site_customization.pages.page.status_*" + - "admin.legislation.processes.process.*" + - "legislation.processes.index.*" + - "votes.budget_investments.different_heading_assigned*" + - "*.form.map_skip_checkbox" +# - "{devise,kaminari,will_paginate}.*" +# - "simple_form.{yes,no}" +# - "simple_form.{placeholders,hints,labels}.*" +# - "simple_form.{error_notification,required}.:" +## Exclude these keys from the `i18n-tasks eq-base" report: # ignore_eq_base: # all: # - common.ok diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index 018319442..d19b6181f 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -9,7 +9,7 @@ module ActsAsTaggableOn where(%{taggings.tag_id in (?) and (taggings.taggable_type = 'Debate' and taggings.taggable_id in (?)) or (taggings.taggable_type = 'Proposal' and taggings.taggable_id in (?))}, - Tag.where('kind IS NULL or kind = ?', 'category').pluck(:id), + Tag.where("kind IS NULL or kind = ?", "category").pluck(:id), Debate.public_for_api.pluck(:id), Proposal.public_for_api.pluck(:id)) end @@ -38,9 +38,9 @@ module ActsAsTaggableOn include Graphqlable scope :public_for_api, -> do - where('(tags.kind IS NULL or tags.kind = ?) and tags.id in (?)', - 'category', - Tagging.public_for_api.pluck('DISTINCT taggings.tag_id')) + where("(tags.kind IS NULL or tags.kind = ?) and tags.id in (?)", + "category", + Tagging.public_for_api.pluck("DISTINCT taggings.tag_id")) end include PgSearch @@ -64,7 +64,7 @@ module ActsAsTaggableOn end def recalculate_custom_counter_for(taggable_type) - visible_taggables = taggable_type.constantize.includes(:taggings).where('taggings.taggable_type' => taggable_type, 'taggings.tag_id' => id) + visible_taggables = taggable_type.constantize.includes(:taggings).where("taggings.taggable_type" => taggable_type, "taggings.tag_id" => id) update(custom_counter_field_name_for(taggable_type) => visible_taggables.count) end @@ -74,7 +74,7 @@ module ActsAsTaggableOn end def self.spending_proposal_tags - ActsAsTaggableOn::Tag.where('taggings.taggable_type' => 'SpendingProposal').includes(:taggings).order(:name).uniq + ActsAsTaggableOn::Tag.where("taggings.taggable_type" => "SpendingProposal").includes(:taggings).order(:name).uniq end def self.graphql_field_name @@ -86,7 +86,7 @@ module ActsAsTaggableOn end def self.graphql_type_name - 'Tag' + "Tag" end private diff --git a/config/initializers/age.rb b/config/initializers/age.rb index 2e90c0a3b..d0928527e 100644 --- a/config/initializers/age.rb +++ b/config/initializers/age.rb @@ -1 +1 @@ -require 'age' +require "age" diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ec70e4973..cbd07efbf 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path diff --git a/config/initializers/delayed_job_config.rb b/config/initializers/delayed_job_config.rb index 325d3561d..151511dc6 100644 --- a/config/initializers/delayed_job_config.rb +++ b/config/initializers/delayed_job_config.rb @@ -8,6 +8,6 @@ Delayed::Worker.sleep_delay = 2 Delayed::Worker.max_attempts = 3 Delayed::Worker.max_run_time = 1500.minutes Delayed::Worker.read_ahead = 10 -Delayed::Worker.default_queue_name = 'default' +Delayed::Worker.default_queue_name = "default" Delayed::Worker.raise_signal_exceptions = :term -Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log')) \ No newline at end of file +Delayed::Worker.logger = Logger.new(File.join(Rails.root, "log", "delayed_job.log")) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 6acce5068..94a4f4de0 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -12,20 +12,20 @@ Devise.setup do |config| # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - if Rails.env.test? || !ActiveRecord::Base.connection.table_exists?('settings') + if Rails.env.test? || !ActiveRecord::Base.connection.table_exists?("settings") config.mailer_sender = "noreply@consul.dev" else config.mailer_sender = "'#{Setting['mailer_from_name']}' <#{Setting['mailer_from_address']}>" end # Configure the class responsible to send e-mails. - config.mailer = 'DeviseMailer' + config.mailer = "DeviseMailer" # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. - require 'devise/orm/active_record' + require "devise/orm/active_record" # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is @@ -244,7 +244,7 @@ Devise.setup do |config| # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' config.omniauth :twitter, Rails.application.secrets.twitter_key, Rails.application.secrets.twitter_secret - config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret, scope: 'email', info_fields: 'email,name,verified' + config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret, scope: "email", info_fields: "email,name,verified" config.omniauth :google_oauth2, Rails.application.secrets.google_oauth2_key, Rails.application.secrets.google_oauth2_secret # ==> Warden configuration diff --git a/config/initializers/graphql.rb b/config/initializers/graphql.rb index 2731e1887..15a5a95cf 100644 --- a/config/initializers/graphql.rb +++ b/config/initializers/graphql.rb @@ -1,4 +1,4 @@ if ActiveRecord::Base.connection.tables.any? - api_config = YAML.load_file('./config/api.yml') + api_config = YAML.load_file("./config/api.yml") API_TYPE_DEFINITIONS = GraphQL::ApiTypesCreator::parse_api_config_file(api_config) end diff --git a/config/initializers/i18n_translation.rb b/config/initializers/i18n_translation.rb index c01199a08..702c2f5e3 100644 --- a/config/initializers/i18n_translation.rb +++ b/config/initializers/i18n_translation.rb @@ -1,5 +1,5 @@ -require 'i18n/exceptions' -require 'action_view/helpers/tag_helper' +require "i18n/exceptions" +require "action_view/helpers/tag_helper" module ActionView module Helpers diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index c1a3057a3..f17a84b39 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -17,5 +17,5 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.plural(/^(\d+)$/i, '\1') - inflect.irregular 'organización', 'organizaciones' + inflect.irregular "organización", "organizaciones" end diff --git a/config/initializers/rollbar.rb b/config/initializers/rollbar.rb index b88cb27a2..95ebb341c 100644 --- a/config/initializers/rollbar.rb +++ b/config/initializers/rollbar.rb @@ -1,4 +1,4 @@ -require 'rollbar/rails' +require "rollbar/rails" Rollbar.configure do |config| # Without configuration, Rollbar is enabled in all environments. # To disable in specific environments, set config.enabled=false. diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 82ae5c8cf..26b4a9cad 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_consul_session' +Rails.application.config.session_store :cookie_store, key: "_consul_session" diff --git a/config/initializers/vote_extensions.rb b/config/initializers/vote_extensions.rb index 87fa34c4e..548d75350 100644 --- a/config/initializers/vote_extensions.rb +++ b/config/initializers/vote_extensions.rb @@ -13,23 +13,23 @@ ActsAsVotable::Vote.class_eval do end def self.for_debates(debates) - where(votable_type: 'Debate', votable_id: debates) + where(votable_type: "Debate", votable_id: debates) end def self.for_proposals(proposals) - where(votable_type: 'Proposal', votable_id: proposals) + where(votable_type: "Proposal", votable_id: proposals) end def self.for_legislation_proposals(proposals) - where(votable_type: 'Legislation::Proposal', votable_id: proposals) + where(votable_type: "Legislation::Proposal", votable_id: proposals) end def self.for_spending_proposals(spending_proposals) - where(votable_type: 'SpendingProposal', votable_id: spending_proposals) + where(votable_type: "SpendingProposal", votable_id: spending_proposals) end def self.for_budget_investments(budget_investments=Budget::Investment.all) - where(votable_type: 'Budget::Investment', votable_id: budget_investments) + where(votable_type: "Budget::Investment", votable_id: budget_investments) end def value diff --git a/config/maintenance.yml.example b/config/maintenance.yml.example index 540bc8bb7..b1bca6a7a 100644 --- a/config/maintenance.yml.example +++ b/config/maintenance.yml.example @@ -1,5 +1,5 @@ --- -app_root: '.' +app_root: "." allowed_ips: - 127.0.0.1 - x.x.x.x @@ -7,6 +7,6 @@ allowed_ips: allowed_paths: - your/custom/route -reason: 'Website down for maintenance' +reason: "Website down for maintenance" response_code: 503 retry_after: 3600 diff --git a/config/routes.rb b/config/routes.rb index 386f6044e..b2155a02b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,10 @@ Rails.application.routes.draw do - mount Ckeditor::Engine => '/ckeditor' + mount Ckeditor::Engine => "/ckeditor" if Rails.env.development? || Rails.env.staging? - get '/sandbox' => 'sandbox#index' - get '/sandbox/*template' => 'sandbox#show' + get "/sandbox" => "sandbox#index" + get "/sandbox/*template" => "sandbox#show" end mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? @@ -33,9 +33,9 @@ Rails.application.routes.draw do draw :valuation draw :verification - root 'welcome#index' - get '/welcome', to: 'welcome#welcome' - get '/consul.json', to: "installation#details" + root "welcome#index" + get "/welcome", to: "welcome#welcome" + get "/consul.json", to: "installation#details" resources :stats, only: [:index] resources :images, only: [:destroy] @@ -43,10 +43,10 @@ Rails.application.routes.draw do resources :follows, only: [:create, :destroy] # More info pages - get 'help', to: 'pages#show', id: 'help/index', as: 'help' - get 'help/how-to-use', to: 'pages#show', id: 'help/how_to_use/index', as: 'how_to_use' + get "help", to: "pages#show", id: "help/index", as: "help" + get "help/how-to-use", to: "pages#show", id: "help/how_to_use/index", as: "how_to_use" get "help/faq", to: "pages#show", id: "faq", as: "faq" # Static pages - resources :pages, path: '/', only: [:show] + resources :pages, path: "/", only: [:show] end diff --git a/config/routes/admin.rb b/config/routes/admin.rb index e12975663..fb3564bc2 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -67,7 +67,7 @@ namespace :admin do end resources :budget_investments, only: [:index, :show, :edit, :update] do - resources :milestones, controller: 'budget_investment_milestones' + resources :milestones, controller: "budget_investment_milestones" resources :progress_bars, except: :show, controller: "budget_investment_progress_bars" member { patch :toggle_selection } end @@ -152,12 +152,12 @@ namespace :admin do end resources :questions, shallow: true do - resources :answers, except: [:index, :destroy], controller: 'questions/answers' do - resources :images, controller: 'questions/answers/images' - resources :videos, controller: 'questions/answers/videos' - get :documents, to: 'questions/answers#documents' + resources :answers, except: [:index, :destroy], controller: "questions/answers" do + resources :images, controller: "questions/answers/images" + resources :videos, controller: "questions/answers/videos" + get :documents, to: "questions/answers#documents" end - post '/answers/order_answers', to: 'questions/answers#order_answers' + post "/answers/order_answers", to: "questions/answers#order_answers" end resource :active_polls, only: [:create, :edit, :update] @@ -224,9 +224,9 @@ namespace :admin do end resources :images, only: [:index, :update, :destroy] resources :content_blocks, except: [:show] - delete '/heading_content_blocks/:id', to: 'content_blocks#delete_heading_content_block', as: 'delete_heading_content_block' - get '/edit_heading_content_blocks/:id', to: 'content_blocks#edit_heading_content_block', as: 'edit_heading_content_block' - put '/update_heading_content_blocks/:id', to: 'content_blocks#update_heading_content_block', as: 'update_heading_content_block' + delete "/heading_content_blocks/:id", to: "content_blocks#delete_heading_content_block", as: "delete_heading_content_block" + get "/edit_heading_content_blocks/:id", to: "content_blocks#edit_heading_content_block", as: "edit_heading_content_block" + put "/update_heading_content_blocks/:id", to: "content_blocks#update_heading_content_block", as: "update_heading_content_block" resources :information_texts, only: [:index] do post :update, on: :collection end diff --git a/config/routes/budget.rb b/config/routes/budget.rb index 0159b946a..215b0bc75 100644 --- a/config/routes/budget.rb +++ b/config/routes/budget.rb @@ -15,14 +15,14 @@ resources :budgets, only: [:show, :index] do end resource :results, only: :show, controller: "budgets/results" - resource :executions, only: :show, controller: 'budgets/executions' + resource :executions, only: :show, controller: "budgets/executions" end -scope '/participatory_budget' do - resources :spending_proposals, only: [:index, :new, :create, :show, :destroy], path: 'investment_projects' do +scope "/participatory_budget" do + resources :spending_proposals, only: [:index, :new, :create, :show, :destroy], path: "investment_projects" do post :vote, on: :member end end -get 'investments/:id/json_data', action: :json_data, controller: 'budgets/investments' -get '/budgets/:budget_id/investments/:id/json_data', action: :json_data, controller: 'budgets/investments' +get "investments/:id/json_data", action: :json_data, controller: "budgets/investments" +get "/budgets/:budget_id/investments/:id/json_data", action: :json_data, controller: "budgets/investments" diff --git a/config/routes/debate.rb b/config/routes/debate.rb index 4167ed68c..eeb3b6afe 100644 --- a/config/routes/debate.rb +++ b/config/routes/debate.rb @@ -10,6 +10,6 @@ resources :debates do collection do get :map get :suggest - put 'recommendations/disable', only: :index, controller: 'debates', action: :disable_recommendations + put "recommendations/disable", only: :index, controller: "debates", action: :disable_recommendations end end diff --git a/config/routes/devise.rb b/config/routes/devise.rb index e789aec52..cb60483e4 100644 --- a/config/routes/devise.rb +++ b/config/routes/devise.rb @@ -1,27 +1,27 @@ devise_for :users, controllers: { - registrations: 'users/registrations', - sessions: 'users/sessions', - confirmations: 'users/confirmations', - omniauth_callbacks: 'users/omniauth_callbacks' + registrations: "users/registrations", + sessions: "users/sessions", + confirmations: "users/confirmations", + omniauth_callbacks: "users/omniauth_callbacks" } devise_scope :user do - patch '/user/confirmation', to: 'users/confirmations#update', as: :update_user_confirmation - get '/user/registrations/check_username', to: 'users/registrations#check_username' - get 'users/sign_up/success', to: 'users/registrations#success' - get 'users/registrations/delete_form', to: 'users/registrations#delete_form' - delete 'users/registrations', to: 'users/registrations#delete' - get :finish_signup, to: 'users/registrations#finish_signup' - patch :do_finish_signup, to: 'users/registrations#do_finish_signup' + patch "/user/confirmation", to: "users/confirmations#update", as: :update_user_confirmation + get "/user/registrations/check_username", to: "users/registrations#check_username" + get "users/sign_up/success", to: "users/registrations#success" + get "users/registrations/delete_form", to: "users/registrations#delete_form" + delete "users/registrations", to: "users/registrations#delete" + get :finish_signup, to: "users/registrations#finish_signup" + patch :do_finish_signup, to: "users/registrations#do_finish_signup" end -devise_for :organizations, class_name: 'User', +devise_for :organizations, class_name: "User", controllers: { - registrations: 'organizations/registrations', - sessions: 'devise/sessions', + registrations: "organizations/registrations", + sessions: "devise/sessions", }, skip: [:omniauth_callbacks] devise_scope :organization do - get 'organizations/sign_up/success', to: 'organizations/registrations#success' + get "organizations/sign_up/success", to: "organizations/registrations#success" end diff --git a/config/routes/graphql.rb b/config/routes/graphql.rb index d41efc54a..83e4594fc 100644 --- a/config/routes/graphql.rb +++ b/config/routes/graphql.rb @@ -1,3 +1,3 @@ -get '/graphql', to: 'graphql#query' -post '/graphql', to: 'graphql#query' -mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql' +get "/graphql", to: "graphql#query" +post "/graphql", to: "graphql#query" +mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql" diff --git a/config/routes/management.rb b/config/routes/management.rb index 167fbfbe4..ff6cc9621 100644 --- a/config/routes/management.rb +++ b/config/routes/management.rb @@ -24,7 +24,7 @@ namespace :management do end resource :session, only: [:create, :destroy] - get 'sign_in', to: 'sessions#create', as: :sign_in + get "sign_in", to: "sessions#create", as: :sign_in resources :proposals, only: [:index, :new, :create, :show] do post :vote, on: :member @@ -43,7 +43,7 @@ namespace :management do get :print_investments end - resources :investments, only: [:index, :new, :create, :show, :destroy], controller: 'budgets/investments' do + resources :investments, only: [:index, :new, :create, :show, :destroy], controller: "budgets/investments" do post :vote, on: :member get :print, on: :collection end diff --git a/config/routes/moderation.rb b/config/routes/moderation.rb index e6b0020cd..1b0eadc09 100644 --- a/config/routes/moderation.rb +++ b/config/routes/moderation.rb @@ -28,7 +28,7 @@ namespace :moderation do put :moderate, on: :collection end - resources :budget_investments, only: :index, controller: 'budgets/investments' do + resources :budget_investments, only: :index, controller: "budgets/investments" do put :hide, on: :member put :moderate, on: :collection end diff --git a/config/routes/poll.rb b/config/routes/poll.rb index 2e9502745..96c43f856 100644 --- a/config/routes/poll.rb +++ b/config/routes/poll.rb @@ -4,7 +4,7 @@ resources :polls, only: [:show, :index] do get :results end - resources :questions, controller: 'polls/questions', shallow: true do + resources :questions, controller: "polls/questions", shallow: true do post :answer, on: :member end end diff --git a/config/routes/proposal.rb b/config/routes/proposal.rb index b0736ec0e..b44d30487 100644 --- a/config/routes/proposal.rb +++ b/config/routes/proposal.rb @@ -13,6 +13,6 @@ resources :proposals do get :map get :suggest get :summary - put 'recommendations/disable', only: :index, controller: 'proposals', action: :disable_recommendations + put "recommendations/disable", only: :index, controller: "proposals", action: :disable_recommendations end end diff --git a/config/schedule.rb b/config/schedule.rb index c3dafe8eb..6f0e1eb30 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -23,10 +23,10 @@ every 1.minute do command "date > ~/cron-test.txt" end -every 1.day, at: '5:00 am' do +every 1.day, at: "5:00 am" do rake "-s sitemap:refresh" end -every 1.day, at: '3:00 am', roles: [:cron] do +every 1.day, at: "3:00 am", roles: [:cron] do rake "votes:reset_hot_score" end diff --git a/config/sitemap.rb b/config/sitemap.rb index 85aeee2a2..7a840a1ed 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -2,7 +2,7 @@ class SitemapGenerator::FileAdapter def gzip(stream, data); stream.write(data); stream.close end end -SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, extension: '.xml') +SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, extension: ".xml") # default host SitemapGenerator::Sitemap.verbose = false if Rails.env.test? diff --git a/db/dev_seeds/spending_proposals.rb b/db/dev_seeds/spending_proposals.rb index f4af7aa96..44c519a16 100644 --- a/db/dev_seeds/spending_proposals.rb +++ b/db/dev_seeds/spending_proposals.rb @@ -17,7 +17,7 @@ section "Creating Spending Proposals" do feasible: feasible, feasible_explanation: feasible_explanation, valuation_finished: valuation_finished, - tag_list: tags.sample(3).join(','), + tag_list: tags.sample(3).join(","), price: rand(1000000), terms_of_service: "1") end diff --git a/doc/api/examples/ruby/example_1.rb b/doc/api/examples/ruby/example_1.rb index 2dd36e766..4362e0f4f 100644 --- a/doc/api/examples/ruby/example_1.rb +++ b/doc/api/examples/ruby/example_1.rb @@ -1,9 +1,9 @@ -require 'http' +require "http" -API_ENDPOINT = 'https://decide.madrid.es/graphql'.freeze +API_ENDPOINT = "https://decide.madrid.es/graphql".freeze def make_request(query_string) - HTTP.headers('User-Agent' => 'Mozilla/5.0', accept: 'application/json') + HTTP.headers("User-Agent" => "Mozilla/5.0", accept: "application/json") .get( API_ENDPOINT, params: { query: query_string.delete("\n").delete(" ") } diff --git a/doc/api/examples/ruby/example_2.rb b/doc/api/examples/ruby/example_2.rb index 9a2e77493..9309eca88 100644 --- a/doc/api/examples/ruby/example_2.rb +++ b/doc/api/examples/ruby/example_2.rb @@ -1,9 +1,9 @@ -require 'http' +require "http" -API_ENDPOINT = 'https://decide.madrid.es/graphql'.freeze +API_ENDPOINT = "https://decide.madrid.es/graphql".freeze def make_request(query_string) - HTTP.headers('User-Agent' => 'Mozilla/5.0', accept: 'application/json') + HTTP.headers("User-Agent" => "Mozilla/5.0", accept: "application/json") .get( API_ENDPOINT, params: { query: query_string.delete("\n").delete(" ") } @@ -48,15 +48,15 @@ loop do response = make_request(query) response_hash = JSON.parse(response.body) - page_info = response_hash['data']['proposals']['pageInfo'] - has_next_page = page_info['hasNextPage'] - next_cursor = page_info['endCursor'] - proposal_edges = response_hash['data']['proposals']['edges'] + page_info = response_hash["data"]["proposals"]["pageInfo"] + has_next_page = page_info["hasNextPage"] + next_cursor = page_info["endCursor"] + proposal_edges = response_hash["data"]["proposals"]["edges"] puts "\tHTTP code: #{response.code}" proposal_edges.each do |edge| - proposals << edge['node'] + proposals << edge["node"] end page_number += 1 diff --git a/docker-compose.yml b/docker-compose.yml index 5c03e071b..81d1f6684 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: "3" services: # service configuration for our database database: @@ -17,7 +17,7 @@ services: # use the Dockerfile next to this file build: . entrypoint: /usr/local/bin/entrypoint.sh - command: bundle exec rails s -p 3000 -b '0.0.0.0' + command: bundle exec rails s -p 3000 -b "0.0.0.0" working_dir: /var/www/consul # rely on the RAILS_ENV value of the host machine diff --git a/lib/capistrano/tasks/restart.cap b/lib/capistrano/tasks/restart.cap index 30740e3a7..17e1e57db 100644 --- a/lib/capistrano/tasks/restart.cap +++ b/lib/capistrano/tasks/restart.cap @@ -1,5 +1,5 @@ namespace :deploy do - desc 'Restart Unicorn' + desc "Restart Unicorn" task :restart do on roles(:app) do execute "kill -QUIT `cat /home/deploy/consul/pids/unicorn.pid`; true" diff --git a/lib/comment_tree.rb b/lib/comment_tree.rb index a67a0ccc3..f43ab7e40 100644 --- a/lib/comment_tree.rb +++ b/lib/comment_tree.rb @@ -4,7 +4,7 @@ class CommentTree attr_accessor :root_comments, :comments, :commentable, :page, :order - def initialize(commentable, page, order = 'confidence_score', valuations: false) + def initialize(commentable, page, order = "confidence_score", valuations: false) @commentable = commentable @page = page @order = order @@ -17,7 +17,7 @@ class CommentTree end def base_comments - if @valuations && commentable.respond_to?('valuations') + if @valuations && commentable.respond_to?("valuations") commentable.valuations else commentable.comments diff --git a/lib/document_parser.rb b/lib/document_parser.rb index 9e59c6b75..8e043dd20 100644 --- a/lib/document_parser.rb +++ b/lib/document_parser.rb @@ -2,7 +2,7 @@ module DocumentParser def get_document_number_variants(document_type, document_number) # Delete all non-alphanumerics - document_number = document_number.to_s.gsub(/[^0-9A-Za-z]/i, '') + document_number = document_number.to_s.gsub(/[^0-9A-Za-z]/i, "") variants = [] if dni?(document_type) @@ -34,7 +34,7 @@ module DocumentParser # ['1234', '01234', '001234', '0001234'] def get_number_variants_with_leading_zeroes_from(document_number, digits = 8) document_number = document_number.to_s.last(digits) # Keep only the last x digits - document_number = document_number.gsub(/^0+/, '') # Removes leading zeros + document_number = document_number.gsub(/^0+/, "") # Removes leading zeros variants = [] variants << document_number if document_number.present? diff --git a/lib/graph_ql/api_types_creator.rb b/lib/graph_ql/api_types_creator.rb index 9f55be3cc..b7cb6c369 100644 --- a/lib/graph_ql/api_types_creator.rb +++ b/lib/graph_ql/api_types_creator.rb @@ -1,4 +1,4 @@ -require 'graphql' +require "graphql" module GraphQL class ApiTypesCreator @@ -65,7 +65,7 @@ module GraphQL model = api_type_model.constantize fields = {} - api_type_info['fields'].each do |field_name, field_type| + api_type_info["fields"].each do |field_name, field_type| if field_type.is_a?(Array) # paginated association fields[field_name.to_sym] = [field_type.first.constantize] elsif SCALAR_TYPES[field_type.to_sym] diff --git a/lib/graph_ql/query_type_creator.rb b/lib/graph_ql/query_type_creator.rb index 8f4a497ef..d0c216bcf 100644 --- a/lib/graph_ql/query_type_creator.rb +++ b/lib/graph_ql/query_type_creator.rb @@ -1,20 +1,20 @@ -require 'graphql' +require "graphql" module GraphQL class QueryTypeCreator def self.create(api_types) GraphQL::ObjectType.define do - name 'QueryType' - description 'The root query for the schema' + name "QueryType" + description "The root query for the schema" api_types.each do |model, created_type| - if created_type.fields['id'] + if created_type.fields["id"] field model.graphql_field_name do type created_type description model.graphql_field_description argument :id, !types.ID - resolve ->(object, arguments, context) { model.public_for_api.find_by(id: arguments['id'])} + resolve ->(object, arguments, context) { model.public_for_api.find_by(id: arguments["id"])} end end diff --git a/lib/merged_comment_tree.rb b/lib/merged_comment_tree.rb index b6a1c97aa..30bacbaf8 100644 --- a/lib/merged_comment_tree.rb +++ b/lib/merged_comment_tree.rb @@ -1,7 +1,7 @@ class MergedCommentTree < CommentTree attr_accessor :commentables, :array_order - def initialize(commentables, page, order = 'confidence_score') + def initialize(commentables, page, order = "confidence_score") @commentables = commentables @commentable = commentables.first @page = page @@ -25,4 +25,4 @@ class MergedCommentTree < CommentTree end end -end \ No newline at end of file +end diff --git a/lib/migrate_spending_proposals_to_investments.rb b/lib/migrate_spending_proposals_to_investments.rb index 7983c547e..f8261ade2 100644 --- a/lib/migrate_spending_proposals_to_investments.rb +++ b/lib/migrate_spending_proposals_to_investments.rb @@ -9,20 +9,20 @@ class MigrateSpendingProposalsToInvestments if sp.geozone_id.present? group = budget.groups.find_or_create_by!(name: "Barrios") heading = group.headings.find_or_create_by!(name: sp.geozone.name, price: 10000000, - latitude: '40.416775', longitude: '-3.703790') + latitude: "40.416775", longitude: "-3.703790") else group = budget.groups.find_or_create_by!(name: "Toda la ciudad") heading = group.headings.find_or_create_by!(name: "Toda la ciudad", price: 10000000, - latitude: '40.416775', longitude: '-3.703790') + latitude: "40.416775", longitude: "-3.703790") end feasibility = case sp.feasible when FalseClass - 'unfeasible' + "unfeasible" when TrueClass - 'feasible' + "feasible" else - 'undecided' + "undecided" end investment = Budget::Investment.create!( @@ -49,14 +49,14 @@ class MigrateSpendingProposalsToInvestments investment.valuators = sp.valuation_assignments.map(&:valuator) - votes = ActsAsVotable::Vote.where(votable_type: 'SpendingProposal', votable_id: sp.id) + votes = ActsAsVotable::Vote.where(votable_type: "SpendingProposal", votable_id: sp.id) - votes.each {|v| investment.vote_by(voter: v.voter, vote: 'yes') } + votes.each {|v| investment.vote_by(voter: v.voter, vote: "yes") } # Spending proposals are not commentable in Consul so we can not test this # - # Comment.where(commentable_type: 'SpendingProposal', commentable_id: sp.id).update_all( - # commentable_type: 'Budget::Investment', commentable_id: investment.id + # Comment.where(commentable_type: "SpendingProposal", commentable_id: sp.id).update_all( + # commentable_type: "Budget::Investment", commentable_id: investment.id # ) # Budget::Investment.reset_counters(investment.id, :comments) diff --git a/lib/score_calculator.rb b/lib/score_calculator.rb index df40428f8..bfe91c29c 100644 --- a/lib/score_calculator.rb +++ b/lib/score_calculator.rb @@ -4,7 +4,7 @@ module ScoreCalculator return 0 unless resource.created_at period = [ - Setting['hot_score_period_in_days'].to_i, + Setting["hot_score_period_in_days"].to_i, ((Time.current - resource.created_at) / 1.day).ceil ].min diff --git a/lib/sms_api.rb b/lib/sms_api.rb index 252d0749e..69a0d93a1 100644 --- a/lib/sms_api.rb +++ b/lib/sms_api.rb @@ -1,4 +1,4 @@ -require 'open-uri' +require "open-uri" class SMSApi attr_accessor :client diff --git a/lib/tasks/homepage.rake b/lib/tasks/homepage.rake index f48bd71ff..0a479adf0 100644 --- a/lib/tasks/homepage.rake +++ b/lib/tasks/homepage.rake @@ -5,9 +5,9 @@ namespace :homepage do %w(proposals debates processes).each do |kind| Widget::Feed.create(kind: kind) - 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 end end diff --git a/lib/tasks/locales.rake b/lib/tasks/locales.rake index 8448b4003..e7983df42 100644 --- a/lib/tasks/locales.rake +++ b/lib/tasks/locales.rake @@ -1,5 +1,5 @@ namespace :locales do - desc 'Migrate all localization files to new structure for a given locale name as argument' + desc "Migrate all localization files to new structure for a given locale name as argument" task :migrate_structure, [:locale] => [:environment] do |_t, args| locale = args[:locale] puts "Moving files for locale: #{locale}" diff --git a/lib/tasks/map_locations.rake b/lib/tasks/map_locations.rake index b204be2c7..63dc5d0d0 100644 --- a/lib/tasks/map_locations.rake +++ b/lib/tasks/map_locations.rake @@ -1,5 +1,5 @@ namespace :map_locations do - desc 'Destroy all empty MapLocation instances found in the database' + desc "Destroy all empty MapLocation instances found in the database" task destroy: :environment do MapLocation.where(longitude: nil, latitude: nil, zoom: nil).each do |map_location| map_location.destroy diff --git a/lib/tasks/migrate_milestones_and_statuses.rake b/lib/tasks/migrate_milestones_and_statuses.rake index d01418e6b..6b95f860c 100644 --- a/lib/tasks/migrate_milestones_and_statuses.rake +++ b/lib/tasks/migrate_milestones_and_statuses.rake @@ -1,11 +1,11 @@ namespace :milestones do def generate_table_migration_sql(new_table:, old_table:, columns:) - from_cols = ['id', *columns.keys] - to_cols = ['id', *columns.values] + from_cols = ["id", *columns.keys] + to_cols = ["id", *columns.values] <<~SQL - INSERT INTO #{new_table} (#{to_cols.join(', ')}) - SELECT #{from_cols.join(', ')} FROM #{old_table}; + INSERT INTO #{new_table} (#{to_cols.join(", ")}) + SELECT #{from_cols.join(", ")} FROM #{old_table}; SQL end @@ -48,36 +48,36 @@ namespace :milestones do start = Time.now ActiveRecord::Base.transaction do - migrate_table! old_table: 'budget_investment_statuses', - new_table: 'milestone_statuses', - columns: {'name' => 'name', - 'description' => 'description', - 'hidden_at' => 'hidden_at', - 'created_at' => 'created_at', - 'updated_at' => 'updated_at'} + migrate_table! old_table: "budget_investment_statuses", + new_table: "milestone_statuses", + columns: {"name" => "name", + "description" => "description", + "hidden_at" => "hidden_at", + "created_at" => "created_at", + "updated_at" => "updated_at"} - migrate_table! old_table: 'budget_investment_milestones', - new_table: 'milestones', - columns: {'investment_id' => 'milestoneable_id', - 'title' => 'title', - 'description' => 'description', - 'created_at' => 'created_at', - 'updated_at' => 'updated_at', - 'publication_date' => 'publication_date', - 'status_id' => 'status_id'} + migrate_table! old_table: "budget_investment_milestones", + new_table: "milestones", + columns: {"investment_id" => "milestoneable_id", + "title" => "title", + "description" => "description", + "created_at" => "created_at", + "updated_at" => "updated_at", + "publication_date" => "publication_date", + "status_id" => "status_id"} - populate_column! table: 'milestones', - column: 'milestoneable_type', - value: 'Budget::Investment' + populate_column! table: "milestones", + column: "milestoneable_type", + value: "Budget::Investment" - migrate_table! old_table: 'budget_investment_milestone_translations', - new_table: 'milestone_translations', - columns: {'budget_investment_milestone_id' => 'milestone_id', - 'locale' => 'locale', - 'created_at' => 'created_at', - 'updated_at' => 'updated_at', - 'title' => 'title', - 'description' => 'description'} + migrate_table! old_table: "budget_investment_milestone_translations", + new_table: "milestone_translations", + columns: {"budget_investment_milestone_id" => "milestone_id", + "locale" => "locale", + "created_at" => "created_at", + "updated_at" => "updated_at", + "title" => "title", + "description" => "description"} Image.where(imageable_type: "Budget::Investment::Milestone"). update_all(imageable_type: "Milestone") diff --git a/lib/tasks/web_sections.rake b/lib/tasks/web_sections.rake index a3e5a4b25..159be63e1 100644 --- a/lib/tasks/web_sections.rake +++ b/lib/tasks/web_sections.rake @@ -1,10 +1,10 @@ namespace :web_sections do desc "Generate web sections for banners" task generate: :environment 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 end diff --git a/lib/user_segments.rb b/lib/user_segments.rb index 7bbc8668c..045f558a0 100644 --- a/lib/user_segments.rb +++ b/lib/user_segments.rb @@ -41,9 +41,9 @@ class UserSegments def self.not_supported_on_current_budget author_ids( User.where( - 'id NOT IN (SELECT DISTINCT(voter_id) FROM votes'\ - ' WHERE votable_type = ? AND votes.votable_id IN (?))', - 'Budget::Investment', + "id NOT IN (SELECT DISTINCT(voter_id) FROM votes"\ + " WHERE votable_type = ? AND votes.votable_id IN (?))", + "Budget::Investment", current_budget_investments.pluck(:id) ) )