Merge branch 'master' into issue#1575-tag-administration
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
class Admin::BudgetInvestmentMilestonesController < Admin::BaseController
|
||||
|
||||
before_action :load_budget_investment, only: [:index, :new, :create, :edit, :update, :destroy]
|
||||
before_action :load_budget_investment_milestone, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def new
|
||||
@milestone = Budget::Investment::Milestone.new
|
||||
end
|
||||
|
||||
def create
|
||||
@milestone = Budget::Investment::Milestone.new(milestone_params)
|
||||
@milestone.investment = @investment
|
||||
if @milestone.save
|
||||
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment), notice: t('admin.milestones.create.notice')
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @milestone.update(milestone_params)
|
||||
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment), notice: t('admin.milestones.update.notice')
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@milestone.destroy
|
||||
redirect_to admin_budget_budget_investment_path(@investment.budget, @investment), notice: t('admin.milestones.delete.notice')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def milestone_params
|
||||
params.require(:budget_investment_milestone)
|
||||
.permit(:title, :description, :budget_investment_id)
|
||||
end
|
||||
|
||||
def load_budget_investment
|
||||
@investment = Budget::Investment.find params[:budget_investment_id]
|
||||
end
|
||||
|
||||
def load_budget_investment_milestone
|
||||
@milestone = Budget::Investment::Milestone.find params[:id]
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -14,10 +14,15 @@ class Admin::BudgetsController < Admin::BaseController
|
||||
@budget = Budget.includes(groups: :headings).find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
def new; end
|
||||
|
||||
def edit
|
||||
def edit; end
|
||||
|
||||
def calculate_winners
|
||||
return unless @budget.balloting_process?
|
||||
@budget.headings.each { |heading| Budget::Result.new(@budget, heading).calculate_winners }
|
||||
redirect_to admin_budget_budget_investments_path(budget_id: @budget.id, filter: 'winners'),
|
||||
notice: I18n.t("admin.budgets.winners.calculated")
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -60,13 +60,14 @@ 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
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_geozones
|
||||
@geozones = Geozone.all.order(:name)
|
||||
end
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,13 +19,14 @@ 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
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def answer_params
|
||||
params.require(:legislation_answer).permit(
|
||||
:legislation_question_option_id,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,6 +28,7 @@ class Officing::FinalRecountsController < Officing::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_poll
|
||||
@poll = Poll.expired.find(params[:poll_id])
|
||||
end
|
||||
|
||||
@@ -27,6 +27,7 @@ class Officing::RecountsController < Officing::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_poll
|
||||
@poll = Poll.find(params[:poll_id])
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -30,7 +30,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
identity = Identity.first_or_create_from_oauth(auth)
|
||||
@user = current_user || identity.user || User.first_or_initialize_for_oauth(auth)
|
||||
|
||||
if save_user(@user)
|
||||
if save_user
|
||||
identity.update(user: @user)
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
|
||||
@@ -40,8 +40,8 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
end
|
||||
end
|
||||
|
||||
def save_user(user)
|
||||
def save_user
|
||||
@user.save || @user.save_requiring_finish_signup
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_activity_counts
|
||||
@activity_counts = HashWithIndifferentAccess.new(
|
||||
proposals: Proposal.where(author_id: @user.id).count,
|
||||
@@ -24,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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user