Merge branch 'master' into 1647-locale_site_customization

This commit is contained in:
María Checa
2017-07-02 23:19:40 +02:00
committed by GitHub
160 changed files with 593 additions and 637 deletions

View File

@@ -12,7 +12,7 @@ class Admin::BudgetHeadingsController < Admin::BaseController
private
def budget_heading_params
params.require(:budget_heading).permit(:name, :price, :geozone_id)
params.require(:budget_heading).permit(:name, :price, :population)
end
end
end

View File

@@ -49,7 +49,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
:debate_phase_enabled,
:allegations_phase_enabled,
:draft_publication_enabled,
:result_publication_enabled
:result_publication_enabled,
:published
)
end
end

View File

@@ -60,7 +60,7 @@ class Admin::Poll::PollsController < Admin::BaseController
end
def search_questions
@questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search({search: @search}).order(title: :asc)
@questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search(search: @search).order(title: :asc)
respond_to do |format|
format.js
end

View File

@@ -1,7 +1,7 @@
class Admin::SettingsController < Admin::BaseController
def index
all_settings = (Setting.all).group_by { |s| s.type }
all_settings = (Setting.all).group_by { |s| s.type }
@settings = all_settings['common']
@feature_flags = all_settings['feature']
@banner_styles = all_settings['banner-style']

View File

@@ -4,17 +4,12 @@ class Admin::TagsController < Admin::BaseController
respond_to :html, :js
def index
@tags = ActsAsTaggableOn::Tag.order(featured: :desc).page(params[:page])
@tag = ActsAsTaggableOn::Tag.new
@tags = ActsAsTaggableOn::Tag.category.page(params[:page])
@tag = ActsAsTaggableOn::Tag.category.new
end
def create
ActsAsTaggableOn::Tag.create(tag_params)
redirect_to admin_tags_path
end
def update
@tag.update(tag_params)
ActsAsTaggableOn::Tag.category.create(tag_params)
redirect_to admin_tags_path
end
@@ -26,11 +21,11 @@ class Admin::TagsController < Admin::BaseController
private
def tag_params
params.require(:tag).permit(:featured, :name)
params.require(:tag).permit(:name)
end
def find_tag
@tag = ActsAsTaggableOn::Tag.find(params[:id])
@tag = ActsAsTaggableOn::Tag.category.find(params[:id])
end
end

View File

@@ -4,7 +4,7 @@ class Admin::UsersController < Admin::BaseController
def index
if params[:search]
s = params[:search]
@users = User.where("username ILIKE ? OR email ILIKE ? OR document_number ILIKE ?", "%#{s}%","%#{s}%","%#{s}%").page(params[:page])
@users = User.where("username ILIKE ? OR email ILIKE ? OR document_number ILIKE ?", "%#{s}%", "%#{s}%", "%#{s}%").page(params[:page])
else
@users = @users.page(params[:page])
end

View File

@@ -67,7 +67,7 @@ module Budgets
end
def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
@categories = ActsAsTaggableOn::Tag.category.order(:name)
end
def load_ballot_referer

View File

@@ -93,7 +93,7 @@ module Budgets
def set_random_seed
if params[:order] == 'random' || params[:order].blank?
params[:random_seed] ||= rand(99)/100.0
params[:random_seed] ||= rand(99) / 100.0
seed = Float(params[:random_seed]) rescue 0
Budget::Investment.connection.execute("select setseed(#{seed})")
else
@@ -118,7 +118,7 @@ module Budgets
end
def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
@categories = ActsAsTaggableOn::Tag.category.order(:name)
end
def tag_cloud

View File

@@ -92,7 +92,7 @@ module CommentableActions
end
def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
@categories = ActsAsTaggableOn::Tag.category.order(:name)
end
def parse_tag_filter

View File

@@ -36,7 +36,7 @@ class GraphqlController < ApplicationController
def query_string
if request.headers["CONTENT_TYPE"] == 'application/graphql'
request.body.string # request.body.class => StringIO
request.body.string # request.body.class => StringIO
else
params[:query]
end

View File

@@ -19,7 +19,7 @@ class Legislation::AnswersController < Legislation::BaseController
end
else
respond_to do |format|
format.js { render json: {} , status: :not_found }
format.js { render json: {}, status: :not_found }
format.html { redirect_to legislation_process_question_path(@process, @question), alert: t('legislation.questions.participation.phase_not_open') }
end
end

View File

@@ -4,7 +4,7 @@ class Legislation::ProcessesController < Legislation::BaseController
def index
@current_filter ||= 'open'
@processes = ::Legislation::Process.send(@current_filter).page(params[:page])
@processes = ::Legislation::Process.send(@current_filter).published.page(params[:page])
end
def show
@@ -13,9 +13,9 @@ class Legislation::ProcessesController < Legislation::BaseController
if @process.allegations_phase.enabled? && @process.allegations_phase.started? && draft_version.present?
redirect_to legislation_process_draft_version_path(@process, draft_version)
elsif @process.debate_phase.enabled?
redirect_to legislation_process_debate_path(@process)
redirect_to debate_legislation_process_path(@process)
else
redirect_to legislation_process_allegations_path(@process)
redirect_to allegations_legislation_process_path(@process)
end
end

View File

@@ -20,7 +20,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
@investment.author = managed_user
if @investment.save
notice= t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1)
notice = t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1)
redirect_to management_budget_investment_path(@budget, @investment), notice: notice
else
render :new
@@ -64,7 +64,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
end
def load_categories
@categories = ActsAsTaggableOn::Tag.where("kind = 'category'").order(:name)
@categories = ActsAsTaggableOn::Tag.category.order(:name)
end
end

View File

@@ -14,10 +14,10 @@ class SandboxController < ApplicationController
def show
if params[:template].index('.') # CVE-2014-0130
render :action => "index"
render action: "index"
elsif lookup_context.exists?("sandbox/#{params[:template]}")
if params[:template] == "index"
render :action => "index"
render action: "index"
else
render "sandbox/#{params[:template]}"
end
@@ -25,7 +25,7 @@ class SandboxController < ApplicationController
elsif lookup_context.exists?("sandbox/#{params[:template]}/index")
render "sandbox/#{params[:template]}/index"
else
render :action => "index"
render action: "index"
end
end

View File

@@ -23,6 +23,6 @@ class StatsController < ApplicationController
private
def daily_cache(key, &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime('%Y-%m-%d')}/#{key}", &block)
end
end

View File

@@ -25,7 +25,7 @@ class UsersController < ApplicationController
when "proposals" then load_proposals
when "debates" then load_debates
when "budget_investments" then load_budget_investments
when "comments" then load_comments
when "comments" then load_comments
else load_available_activity
end
end

View File

@@ -58,7 +58,7 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
end
def params_for_current_valuator
params.merge({valuator_id: current_user.valuator.id})
params.merge(valuator_id: current_user.valuator.id)
end
def restrict_access_to_assigned_items