Merge pull request #3370 from consul/double_quoutes_everywhere
Change single quotes to double quotes everywhere
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
language: ruby
|
||||
addons:
|
||||
postgresql: '9.4'
|
||||
postgresql: "9.4"
|
||||
chrome: stable
|
||||
rvm:
|
||||
- 2.3.2
|
||||
|
||||
22
Capfile
22
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 }
|
||||
|
||||
172
Gemfile
172
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"
|
||||
|
||||
2
Rakefile
2
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)
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
//= require ckeditor/init
|
||||
|
||||
CKEDITOR.config.customConfig = '<%= javascript_path 'ckeditor/config.js' %>';
|
||||
CKEDITOR.config.customConfig = "<%= javascript_path 'ckeditor/config.js' %>";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$(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){};
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module DocumentablesHelper
|
||||
|
||||
def documentable_class(documentable)
|
||||
documentable.class.name.parameterize('_')
|
||||
documentable.class.name.parameterize("_")
|
||||
end
|
||||
|
||||
def max_documents_allowed(documentable)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
'<iframe src="' + src + match[2] + '" style="border:0;" allowfullscreen title="' + title + '"></iframe>'
|
||||
else
|
||||
''
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ module FollowablesHelper
|
||||
|
||||
def followable_icon(followable)
|
||||
{
|
||||
proposals: 'Proposal',
|
||||
budget: 'Budget::Investment'
|
||||
proposals: "Proposal",
|
||||
budget: "Budget::Investment"
|
||||
}.invert[followable]
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ 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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ module ValuationHelper
|
||||
valuators.first.name +
|
||||
"</span>".html_safe
|
||||
else
|
||||
"<span title=\"".html_safe + valuators.map(&:name).join(', ') + "\">".html_safe +
|
||||
t('valuation.budget_investments.index.valuators_assigned', count: valuators.size) +
|
||||
"<span title=\"".html_safe + valuators.map(&:name).join(", ") + "\">".html_safe +
|
||||
t("valuation.budget_investments.index.valuators_assigned", count: valuators.size) +
|
||||
"</span>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,7 +15,7 @@ module WelcomeHelper
|
||||
when "Proposal"
|
||||
proposal_path(recommended)
|
||||
else
|
||||
'#'
|
||||
"#"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: '<username>',
|
||||
# password: '<password>',
|
||||
# authentication: 'plain',
|
||||
# domain: "example.com",
|
||||
# user_name: "<username>",
|
||||
# password: "<password>",
|
||||
# authentication: "plain",
|
||||
# enable_starttls_auto: true }
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
|
||||
@@ -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: '<username>',
|
||||
# password: '<password>',
|
||||
# authentication: 'plain',
|
||||
# domain: "example.com",
|
||||
# user_name: "<username>",
|
||||
# password: "<password>",
|
||||
# authentication: "plain",
|
||||
# enable_starttls_auto: true }
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
|
||||
@@ -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: '<username>',
|
||||
# password: '<password>',
|
||||
# authentication: 'plain',
|
||||
# domain: "example.com",
|
||||
# user_name: "<username>",
|
||||
# password: "<password>",
|
||||
# authentication: "plain",
|
||||
# enable_starttls_auto: true }
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
|
||||
@@ -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,7 +54,7 @@ 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1 @@
|
||||
require 'age'
|
||||
require "age"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'))
|
||||
Delayed::Worker.logger = Logger.new(File.join(Rails.root, "log", "delayed_job.log"))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(" ") }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require 'open-uri'
|
||||
require "open-uri"
|
||||
class SMSApi
|
||||
attr_accessor :client
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user