From d0b8fef6b3fca52a0049d9f3a4bce44e2881ead3 Mon Sep 17 00:00:00 2001 From: voodoorai2000 Date: Thu, 21 Mar 2019 21:39:21 +0100 Subject: [PATCH] Delete spending proposals --- app/controllers/admin/api/stats_controller.rb | 5 - .../admin/budget_investments_controller.rb | 2 +- .../admin/spending_proposals_controller.rb | 70 --------- app/controllers/admin/stats_controller.rb | 4 +- app/controllers/application_controller.rb | 4 - .../spending_proposals_controller.rb | 79 ---------- .../spending_proposals_controller.rb | 76 --------- app/helpers/admin_helper.rb | 4 - app/helpers/geozones_helper.rb | 5 - app/helpers/settings_helper.rb | 2 +- app/helpers/spending_proposals_helper.rb | 25 --- app/mailers/mailer.rb | 10 -- app/models/abilities/common.rb | 2 - app/models/abilities/everyone.rb | 3 +- app/models/geozone.rb | 1 - app/models/signature_sheet.rb | 2 +- app/models/spending_proposal.rb | 146 ------------------ app/models/user.rb | 6 - app/views/admin/_menu.html.erb | 14 -- .../admin/budget_investments/edit.html.erb | 7 +- .../shared/_spending_proposal_search.html.erb | 10 -- .../_summary_table.html.erb | 35 ----- .../_written_by_author.html.erb | 42 ----- .../admin/spending_proposals/index.html.erb | 85 ---------- app/views/admin/stats/show.html.erb | 8 - app/views/budgets/investments/_form.html.erb | 10 +- .../budgets/results/_results_table.html.erb | 2 +- .../unfeasible_spending_proposal.html.erb | 24 --- app/views/management/_menu.html.erb | 24 --- .../_spending_proposal.html.erb | 1 - .../spending_proposals/_votes.html.erb | 2 - .../spending_proposals/index.html.erb | 25 --- .../spending_proposals/new.html.erb | 12 -- .../spending_proposals/print.html.erb | 33 ---- .../spending_proposals/show.html.erb | 3 - .../management/spending_proposals/vote.js.erb | 1 - app/views/shared/_admin_login_items.html.erb | 2 +- app/views/shared/_subnavigation.html.erb | 8 - app/views/spending_proposals/_form.html.erb | 49 ------ .../spending_proposals/_sidebar.html.erb | 15 -- .../_spending_proposal.html.erb | 59 ------- app/views/spending_proposals/_votes.html.erb | 45 ------ app/views/spending_proposals/index.html.erb | 39 ----- app/views/spending_proposals/new.html.erb | 25 --- app/views/spending_proposals/show.html.erb | 52 ------- app/views/spending_proposals/vote.js.erb | 1 - config/i18n-tasks.yml | 6 - config/initializers/acts_as_taggable_on.rb | 9 +- config/initializers/vote_extensions.rb | 4 - config/locales/en/activerecord.yml | 10 -- config/locales/en/admin.yml | 52 ------- config/locales/en/budgets.yml | 6 +- config/locales/en/general.yml | 58 ------- config/locales/en/mailers.yml | 7 - config/locales/en/management.yml | 16 -- config/locales/en/responders.yml | 3 - config/locales/en/settings.yml | 5 - config/locales/es/activerecord.yml | 10 -- config/locales/es/admin.yml | 63 -------- config/locales/es/budgets.yml | 2 +- config/locales/es/general.yml | 58 ------- config/locales/es/mailers.yml | 7 - config/locales/es/management.yml | 16 -- config/locales/es/responders.yml | 3 - config/locales/es/settings.yml | 5 - config/routes/admin.rb | 9 -- config/routes/budget.rb | 6 - config/routes/management.rb | 5 - db/dev_seeds.rb | 1 - db/dev_seeds/settings.rb | 3 +- db/dev_seeds/spending_proposals.rb | 24 --- ...190311215516_destroy_spending_proposals.rb | 5 + ..._destroy_spending_proposal_associations.rb | 6 + db/seeds.rb | 4 - lib/tasks/settings.rake | 10 +- lib/tasks/spending_proposals.rake | 22 --- spec/factories/budgets.rb | 9 -- spec/features/admin/feature_flags_spec.rb | 2 +- spec/features/admin/stats_spec.rb | 3 + spec/features/admin_spec.rb | 4 - spec/features/emails_spec.rb | 28 ---- spec/features/notifications_spec.rb | 3 +- spec/features/official_positions_spec.rb | 29 ---- spec/features/votes_spec.rb | 102 ------------ spec/helpers/geozones_helper_spec.rb | 15 -- spec/models/abilities/common_spec.rb | 17 -- spec/models/abilities/everyone_spec.rb | 3 - spec/models/geozone_spec.rb | 5 - spec/models/signature_sheet_spec.rb | 7 - spec/support/common_actions/budgets.rb | 1 + 90 files changed, 52 insertions(+), 1690 deletions(-) delete mode 100644 app/controllers/admin/spending_proposals_controller.rb delete mode 100644 app/controllers/management/spending_proposals_controller.rb delete mode 100644 app/controllers/spending_proposals_controller.rb delete mode 100644 app/helpers/spending_proposals_helper.rb delete mode 100644 app/models/spending_proposal.rb delete mode 100644 app/views/admin/shared/_spending_proposal_search.html.erb delete mode 100644 app/views/admin/spending_proposals/_summary_table.html.erb delete mode 100644 app/views/admin/spending_proposals/_written_by_author.html.erb delete mode 100644 app/views/admin/spending_proposals/index.html.erb delete mode 100644 app/views/mailer/unfeasible_spending_proposal.html.erb delete mode 100644 app/views/management/spending_proposals/_spending_proposal.html.erb delete mode 100644 app/views/management/spending_proposals/_votes.html.erb delete mode 100644 app/views/management/spending_proposals/index.html.erb delete mode 100644 app/views/management/spending_proposals/new.html.erb delete mode 100644 app/views/management/spending_proposals/print.html.erb delete mode 100644 app/views/management/spending_proposals/show.html.erb delete mode 100644 app/views/management/spending_proposals/vote.js.erb delete mode 100644 app/views/spending_proposals/_form.html.erb delete mode 100644 app/views/spending_proposals/_sidebar.html.erb delete mode 100644 app/views/spending_proposals/_spending_proposal.html.erb delete mode 100644 app/views/spending_proposals/_votes.html.erb delete mode 100644 app/views/spending_proposals/index.html.erb delete mode 100644 app/views/spending_proposals/new.html.erb delete mode 100644 app/views/spending_proposals/show.html.erb delete mode 100644 app/views/spending_proposals/vote.js.erb delete mode 100644 db/dev_seeds/spending_proposals.rb create mode 100644 db/migrate/20190311215516_destroy_spending_proposals.rb create mode 100644 db/migrate/20190326211832_destroy_spending_proposal_associations.rb delete mode 100644 lib/tasks/spending_proposals.rake diff --git a/app/controllers/admin/api/stats_controller.rb b/app/controllers/admin/api/stats_controller.rb index 37be264bf..b336965ee 100644 --- a/app/controllers/admin/api/stats_controller.rb +++ b/app/controllers/admin/api/stats_controller.rb @@ -3,7 +3,6 @@ class Admin::Api::StatsController < Admin::Api::BaseController def show unless params[:event].present? || params[:visits].present? || - params[:spending_proposals].present? || params[:budget_investments].present? || params[:user_supported_budgets].present? return render json: {}, status: :bad_request @@ -19,10 +18,6 @@ class Admin::Api::StatsController < Admin::Api::BaseController ds.add "Visits", Visit.group_by_day(:started_at).count end - if params[:spending_proposals].present? - ds.add "Spending proposals", SpendingProposal.group_by_day(:created_at).count - end - if params[:budget_investments].present? ds.add "Budget Investments", Budget::Investment.group_by_day(:created_at).count end diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index 156d74f34..0ab4a4765 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -91,7 +91,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController end def load_investment - @investment = Budget::Investment.by_budget(@budget).find(params[:id]) + @investment = @budget.investments.find(params[:id]) end def load_admins diff --git a/app/controllers/admin/spending_proposals_controller.rb b/app/controllers/admin/spending_proposals_controller.rb deleted file mode 100644 index 4ef96a3c0..000000000 --- a/app/controllers/admin/spending_proposals_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -class Admin::SpendingProposalsController < Admin::BaseController - include FeatureFlags - before_action :load_filter_params - feature_flag :spending_proposals - - has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index - - load_and_authorize_resource - - def index - @spending_proposals = SpendingProposal.scoped_filter(filter_params, @current_filter) - .order(cached_votes_up: :desc, created_at: :desc) - .page(params[:page]) - end - - def show - end - - def edit - load_admins - load_valuators - load_tags - end - - def update - if @spending_proposal.update(spending_proposal_params) - redirect_to admin_spending_proposal_path(@spending_proposal, filter_params), - notice: t("flash.actions.update.spending_proposal") - else - load_admins - load_valuators - load_tags - render :edit - end - end - - def summary - @spending_proposals = SpendingProposal.group(:geozone).sum(:price).sort_by{|geozone, count| geozone.present? ? geozone.name : "z"} - @spending_proposals_with_supports = SpendingProposal.with_supports.group(:geozone).sum(:price) - .sort_by{|geozone, count| geozone.present? ? geozone.name : "z"} - end - - private - - def spending_proposal_params - params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :association_name, - :administrator_id, :tag_list, valuator_ids: []) - end - - def filter_params - params.permit(:geozone_id, :administrator_id, :tag_name, :valuator_id) - end - - def load_filter_params - @filter_params ||= filter_params - end - - def load_admins - @admins = Administrator.includes(:user).all - end - - def load_valuators - @valuators = Valuator.includes(:user).all.order("description ASC").order("users.email ASC") - end - - def load_tags - @tags = ActsAsTaggableOn::Tag.spending_proposal_tags - end - -end diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index b6a926792..9f22010da 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -11,6 +11,7 @@ class Admin::StatsController < Admin::BaseController @debate_votes = Vote.where(votable_type: "Debate").count @proposal_votes = Vote.where(votable_type: "Proposal").count @comment_votes = Vote.where(votable_type: "Comment").count + @votes = Vote.count @user_level_two = User.active.level_two_verified.count @@ -24,8 +25,6 @@ class Admin::StatsController < Admin::BaseController .count(:voter_id) @user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals - - @spending_proposals = SpendingProposal.count budgets_ids = Budget.where.not(phase: "finished").pluck(:id) @budgets = budgets_ids.size @investments = Budget::Investment.where(budget_id: budgets_ids).count @@ -52,7 +51,6 @@ class Admin::StatsController < Admin::BaseController @users_who_have_sent_message = DirectMessage.select(:sender_id).distinct.count end - def budgets @budgets = Budget.all end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09dc42034..56da7330b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -73,10 +73,6 @@ class ApplicationController < ActionController::Base @proposal_votes = current_user ? current_user.proposal_votes(proposals) : {} end - def set_spending_proposal_votes(spending_proposals) - @spending_proposal_votes = current_user ? current_user.spending_proposal_votes(spending_proposals) : {} - end - def set_comment_flags(comments) @comment_flags = current_user ? current_user.comment_flags(comments) : {} end diff --git a/app/controllers/management/spending_proposals_controller.rb b/app/controllers/management/spending_proposals_controller.rb deleted file mode 100644 index 0a6ef4385..000000000 --- a/app/controllers/management/spending_proposals_controller.rb +++ /dev/null @@ -1,79 +0,0 @@ -class Management::SpendingProposalsController < Management::BaseController - - before_action :only_verified_users, except: :print - before_action :set_spending_proposal, only: [:vote, :show] - - def index - @spending_proposals = apply_filters_and_search(SpendingProposal).order(cached_votes_up: :desc).page(params[:page]).for_render - set_spending_proposal_votes(@spending_proposals) - end - - def new - @spending_proposal = SpendingProposal.new - end - - def create - @spending_proposal = SpendingProposal.new(spending_proposal_params) - @spending_proposal.author = managed_user - - if @spending_proposal.save - notice = t("flash.actions.create.notice", resource_name: t("activerecord.models.spending_proposal", count: 1)) - redirect_to management_spending_proposal_path(@spending_proposal), notice: notice - else - render :new - end - end - - def show - set_spending_proposal_votes(@spending_proposal) - end - - def vote - @spending_proposal.register_vote(managed_user, "yes") - set_spending_proposal_votes(@spending_proposal) - end - - def print - params[:geozone] ||= "all" - @spending_proposals = apply_filters_and_search(SpendingProposal).order(cached_votes_up: :desc).for_render.limit(15) - set_spending_proposal_votes(@spending_proposals) - end - - private - - def set_spending_proposal - @spending_proposal = SpendingProposal.find(params[:id]) - end - - def spending_proposal_params - params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :terms_of_service) - end - - def only_verified_users - check_verified_user t("management.spending_proposals.alert.unverified_user") - end - - # This should not be necessary. Maybe we could create a specific show view for managers. - def set_spending_proposal_votes(spending_proposals) - @spending_proposal_votes = managed_user ? managed_user.spending_proposal_votes(spending_proposals) : {} - end - - def set_geozone_name - if params[:geozone] == "all" - @geozone_name = t("geozones.none") - else - @geozone_name = Geozone.find(params[:geozone]).name - end - end - - def apply_filters_and_search(target) - target = params[:unfeasible].present? ? target.unfeasible : target.not_unfeasible - if params[:geozone].present? - target = target.by_geozone(params[:geozone]) - set_geozone_name - end - target = target.search(params[:search]) if params[:search].present? - target - end - -end diff --git a/app/controllers/spending_proposals_controller.rb b/app/controllers/spending_proposals_controller.rb deleted file mode 100644 index e57cdd27c..000000000 --- a/app/controllers/spending_proposals_controller.rb +++ /dev/null @@ -1,76 +0,0 @@ -class SpendingProposalsController < ApplicationController - include FeatureFlags - - before_action :authenticate_user!, except: [:index, :show] - before_action -> { flash.now[:notice] = flash[:notice].html_safe if flash[:html_safe] && flash[:notice] } - - load_and_authorize_resource - - feature_flag :spending_proposals - - invisible_captcha only: [:create, :update], honeypot: :subtitle - - respond_to :html, :js - - def index - @spending_proposals = apply_filters_and_search(SpendingProposal).page(params[:page]).for_render - set_spending_proposal_votes(@spending_proposals) - end - - def new - @spending_proposal = SpendingProposal.new - end - - def show - set_spending_proposal_votes(@spending_proposal) - end - - def create - @spending_proposal = SpendingProposal.new(spending_proposal_params) - @spending_proposal.author = current_user - - if @spending_proposal.save - activity = "#{t('layouts.header.my_activity_link')}" - notice = t("flash.actions.create.spending_proposal", activity: activity) - redirect_to @spending_proposal, notice: notice, flash: { html_safe: true } - else - render :new - end - end - - def destroy - spending_proposal = SpendingProposal.find(params[:id]) - spending_proposal.destroy - redirect_to user_path(current_user, filter: "spending_proposals"), notice: t("flash.actions.destroy.spending_proposal") - end - - def vote - @spending_proposal.register_vote(current_user, "yes") - set_spending_proposal_votes(@spending_proposal) - end - - private - - def spending_proposal_params - params.require(:spending_proposal).permit(:title, :description, :external_url, :geozone_id, :association_name, :terms_of_service) - end - - def set_geozone_name - if params[:geozone] == "all" - @geozone_name = t("geozones.none") - else - @geozone_name = Geozone.find(params[:geozone]).name - end - end - - def apply_filters_and_search(target) - target = params[:unfeasible].present? ? target.unfeasible : target.not_unfeasible - if params[:geozone].present? - target = target.by_geozone(params[:geozone]) - set_geozone_name - end - target = target.search(params[:search]) if params[:search].present? - target - end - -end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 0446aaf73..e0dc3834f 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -33,10 +33,6 @@ module AdminHelper controller_name.starts_with?("budget") end - def menu_budget? - ["spending_proposals"].include?(controller_name) - end - def menu_polls? %w[polls active_polls recounts results questions answers].include?(controller_name) || controller.class.parent == Admin::Poll::Questions::Answers diff --git a/app/helpers/geozones_helper.rb b/app/helpers/geozones_helper.rb index ce03e0579..bfc5f9105 100644 --- a/app/helpers/geozones_helper.rb +++ b/app/helpers/geozones_helper.rb @@ -8,9 +8,4 @@ module GeozonesHelper Geozone.all.order(name: :asc).collect { |g| [ g.name, g.id ] } end - def geozone_name_from_id(g_id) - @all_geozones ||= Geozone.all.collect{ |g| [ g.id, g.name ] }.to_h - @all_geozones[g_id] || t("geozones.none") - end - end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index b7db90beb..0bffd9544 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -8,4 +8,4 @@ module SettingsHelper @all_settings ||= Hash[ Setting.all.map{|s| [s.key, s.value.presence]} ] end -end \ No newline at end of file +end diff --git a/app/helpers/spending_proposals_helper.rb b/app/helpers/spending_proposals_helper.rb deleted file mode 100644 index 81d16e5fd..000000000 --- a/app/helpers/spending_proposals_helper.rb +++ /dev/null @@ -1,25 +0,0 @@ -module SpendingProposalsHelper - - def spending_proposal_tags_select_options - ActsAsTaggableOn::Tag.spending_proposal_tags.pluck(:name) - end - - def namespaced_spending_proposal_path(spending_proposal, options = {}) - @namespace_spending_proposal_path ||= namespace - case @namespace_spending_proposal_path - when "management" - management_spending_proposal_path(spending_proposal, options) - else - spending_proposal_path(spending_proposal, options) - end - end - - def spending_proposal_count_for_geozone(scope, geozone, second_scope) - if geozone.present? - geozone.spending_proposals.send(scope).send(second_scope).count - else - SpendingProposal.where(geozone: nil).send(scope).send(second_scope).count - end - end - -end \ No newline at end of file diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 1e4993ec5..d8fa120a4 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -37,16 +37,6 @@ class Mailer < ApplicationMailer end end - def unfeasible_spending_proposal(spending_proposal) - @spending_proposal = spending_proposal - @author = spending_proposal.author - @email_to = @author.email - - with_user(@author) do - mail(to: @email_to, subject: t("mailers.unfeasible_spending_proposal.subject", code: @spending_proposal.code)) - end - end - def direct_message_for_receiver(direct_message) @direct_message = direct_message @receiver = @direct_message.receiver diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index be8ce7333..b106ebef5 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -89,8 +89,6 @@ module Abilities proposal.published? end can :vote_featured, Proposal - can :vote, SpendingProposal - can :create, SpendingProposal can :vote, Legislation::Proposal can :vote_featured, Legislation::Proposal diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 9eab1e14b..6cdc8b6c9 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -14,9 +14,8 @@ module Abilities poll.expired? && poll.stats_enabled? end can :read, Poll::Question - can [:read, :welcome], Budget - can :read, SpendingProposal can :read, User + can [:read, :welcome], Budget can [:read], Budget can [:read], Budget::Group can [:read, :print, :json_data], Budget::Investment diff --git a/app/models/geozone.rb b/app/models/geozone.rb index f32af5ec6..345e040d1 100644 --- a/app/models/geozone.rb +++ b/app/models/geozone.rb @@ -3,7 +3,6 @@ class Geozone < ApplicationRecord include Graphqlable has_many :proposals - has_many :spending_proposals has_many :debates has_many :users validates :name, presence: true diff --git a/app/models/signature_sheet.rb b/app/models/signature_sheet.rb index 86aaf8f3d..21a9c4cd7 100644 --- a/app/models/signature_sheet.rb +++ b/app/models/signature_sheet.rb @@ -2,7 +2,7 @@ class SignatureSheet < ApplicationRecord belongs_to :signable, polymorphic: true belongs_to :author, class_name: "User", foreign_key: "author_id" - VALID_SIGNABLES = %w(Proposal Budget::Investment SpendingProposal) + VALID_SIGNABLES = %w(Proposal Budget::Investment) has_many :signatures diff --git a/app/models/spending_proposal.rb b/app/models/spending_proposal.rb deleted file mode 100644 index 03fb45e79..000000000 --- a/app/models/spending_proposal.rb +++ /dev/null @@ -1,146 +0,0 @@ -class SpendingProposal < ApplicationRecord - include Measurable - include Sanitizable - include Taggable - include Searchable - - acts_as_votable - - belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" - belongs_to :geozone - belongs_to :administrator - has_many :valuation_assignments, dependent: :destroy - has_many :valuators, through: :valuation_assignments - - validates :title, presence: true - validates :author, presence: true - validates :description, presence: true - validates :feasible_explanation, presence: { if: :feasible_explanation_required? } - - validates :title, length: { in: 4..SpendingProposal.title_max_length } - validates :description, length: { maximum: SpendingProposal.description_max_length } - validates :terms_of_service, acceptance: { allow_nil: false }, on: :create - - scope :valuation_open, -> { where(valuation_finished: false) } - scope :without_admin, -> { valuation_open.where(administrator_id: nil) } - scope :managed, -> { valuation_open.where(valuation_assignments_count: 0).where("administrator_id IS NOT ?", nil) } - scope :valuating, -> { valuation_open.where("valuation_assignments_count > 0 AND valuation_finished = ?", false) } - scope :valuation_finished, -> { where(valuation_finished: true) } - scope :feasible, -> { where(feasible: true) } - scope :unfeasible, -> { where(feasible: false) } - scope :not_unfeasible, -> { where("feasible IS ? OR feasible = ?", nil, true) } - scope :with_supports, -> { where("cached_votes_up > 0") } - - scope :by_admin, ->(admin) { where(administrator_id: admin.presence) } - scope :by_tag, ->(tag_name) { tagged_with(tag_name) } - scope :by_valuator, ->(valuator) { where("valuation_assignments.valuator_id = ?", valuator.presence).joins(:valuation_assignments) } - - scope :for_render, -> { includes(:geozone) } - - before_validation :set_responsible_name - - def description - super.try :html_safe - end - - def self.scoped_filter(params, current_filter) - results = self - results = results.by_geozone(params[:geozone_id]) if params[:geozone_id].present? - results = results.by_admin(params[:administrator_id]) if params[:administrator_id].present? - results = results.by_tag(params[:tag_name]) if params[:tag_name].present? - results = results.by_valuator(params[:valuator_id]) if params[:valuator_id].present? - results = results.send(current_filter) if current_filter.present? - results.includes(:geozone, administrator: :user, valuators: :user) - end - - def searchable_values - { title => "A", - author.username => "B", - geozone.try(:name) => "B", - description => "C" - } - end - - def self.search(terms) - pg_search(terms) - end - - def self.by_geozone(geozone) - if geozone == "all" - where(geozone_id: nil) - else - where(geozone_id: geozone.presence) - end - end - - def feasibility - case feasible - when true - "feasible" - when false - "not_feasible" - else - "undefined" - end - end - - def unfeasible_email_pending? - unfeasible_email_sent_at.blank? && unfeasible? && valuation_finished? - end - - def unfeasible? - feasible == false - end - - def valuation_finished? - valuation_finished - end - - def feasible_explanation_required? - valuation_finished? && unfeasible? - end - - def total_votes - cached_votes_up + physical_votes - end - - def code - "#{created_at.strftime("%Y")}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "") - end - - def send_unfeasible_email - Mailer.unfeasible_spending_proposal(self).deliver_later - update(unfeasible_email_sent_at: Time.current) - end - - def reason_for_not_being_votable_by(user) - return :not_voting_allowed if Setting["feature.spending_proposal_features.voting_allowed"].blank? - return :not_logged_in unless user - return :not_verified unless user.can?(:vote, SpendingProposal) - return :unfeasible if unfeasible? - return :organization if user.organization? - end - - def votable_by?(user) - reason_for_not_being_votable_by(user).blank? - end - - def register_vote(user, vote_value) - if votable_by?(user) - vote_by(voter: user, vote: vote_value) - end - end - - def set_responsible_name - self.responsible_name = author.try(:document_number) if author.try(:document_number).present? - end - - def self.finished_and_feasible - valuation_finished.feasible - end - - def self.finished_and_unfeasible - valuation_finished.unfeasible - end - -end diff --git a/app/models/user.rb b/app/models/user.rb index 3f67b4748..ba9aec3d5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -25,7 +25,6 @@ class User < ApplicationRecord has_many :proposals, -> { with_hidden }, foreign_key: :author_id has_many :budget_investments, -> { with_hidden }, foreign_key: :author_id, class_name: "Budget::Investment" has_many :comments, -> { with_hidden } - has_many :spending_proposals, foreign_key: :author_id has_many :failed_census_calls has_many :notifications has_many :direct_messages_sent, class_name: "DirectMessage", foreign_key: :sender_id @@ -117,11 +116,6 @@ class User < ApplicationRecord voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value } end - def spending_proposal_votes(spending_proposals) - voted = votes.for_spending_proposals(spending_proposals) - voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value } - end - def budget_investment_votes(budget_investments) voted = votes.for_budget_investments(budget_investments) voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value } diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index cb509cf15..7fbf58053 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -74,20 +74,6 @@ <% end %> - <% if feature?(:spending_proposals) %> -
  • - - - <%= t("admin.menu.title_budgets") %> - - -
  • - <% end %> - <% messages_sections = %w(newsletters emails_download admin_notifications system_emails) %> <% messages_menu_active = messages_sections.include?(controller_name) %>
  • > diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index a9c81dd39..20e3c5e56 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -11,11 +11,14 @@
    - <%= f.text_field :title, maxlength: Budget::Investment.title_max_length %> + <%= f.text_field :title, + maxlength: Budget::Investment.title_max_length %>
    - <%= f.cktext_area :description, maxlength: Budget::Investment.description_max_length, ckeditor: { language: I18n.locale } %> + <%= f.cktext_area :description, + maxlength: Budget::Investment.description_max_length, + ckeditor: { language: I18n.locale } %>
    diff --git a/app/views/admin/shared/_spending_proposal_search.html.erb b/app/views/admin/shared/_spending_proposal_search.html.erb deleted file mode 100644 index cfb7e45f9..000000000 --- a/app/views/admin/shared/_spending_proposal_search.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= form_for(SpendingProposal.new, url: url, as: :spending_proposal, method: :get) do |f| %> -
    -
    - <%= text_field_tag :search, "", placeholder: t("admin.shared.spending_proposal_search.placeholder") %> -
    -
    - <%= f.submit t("admin.shared.spending_proposal_search.button"), class: "button" %> -
    -
    -<% end %> \ No newline at end of file diff --git a/app/views/admin/spending_proposals/_summary_table.html.erb b/app/views/admin/spending_proposals/_summary_table.html.erb deleted file mode 100644 index 066febe07..000000000 --- a/app/views/admin/spending_proposals/_summary_table.html.erb +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - <% spending_proposals.each do |geozone, price| %> - "> - - - - - - - - - <% end %> -
    <%= t("admin.spending_proposals.summary.geozone_name") %><%= t("admin.spending_proposals.summary.finished_and_feasible_count") %><%= t("admin.spending_proposals.summary.finished_and_unfeasible_count") %><%= t("admin.spending_proposals.summary.finished_count") %><%= t("admin.spending_proposals.summary.in_evaluation_count") %><%= t("admin.spending_proposals.summary.total_count") %><%= t("admin.spending_proposals.summary.cost_for_geozone") %>
    - <%= geozone.present? ? geozone.name : t("geozones.none") %> - - <%= spending_proposal_count_for_geozone("finished_and_feasible", geozone, second_scope) %> - - <%= spending_proposal_count_for_geozone("finished_and_unfeasible", geozone, second_scope) %> - - <%= spending_proposal_count_for_geozone("valuation_finished", geozone, second_scope) %> - - <%= spending_proposal_count_for_geozone("valuating", geozone, second_scope) %> - - <%= spending_proposal_count_for_geozone("all", geozone, second_scope) %> - - <%= number_to_currency(price) %> -
    \ No newline at end of file diff --git a/app/views/admin/spending_proposals/_written_by_author.html.erb b/app/views/admin/spending_proposals/_written_by_author.html.erb deleted file mode 100644 index acb7db69c..000000000 --- a/app/views/admin/spending_proposals/_written_by_author.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -
    - <%= t "admin.spending_proposals.show.heading", id: @spending_proposal.id %> -
    - -
    -

    <%= @spending_proposal.title %>

    - -
    -
    -

    - <%= t("admin.spending_proposals.show.geozone") %>: - <%= geozone_name(@spending_proposal) %> -

    -
    - -
    -

    - <%= t("admin.spending_proposals.show.by") %>: - <%= link_to @spending_proposal.author.name, admin_hidden_user_path(@spending_proposal.author) %> -

    -
    - -
    -

    - <%= t("admin.spending_proposals.show.sent") %>: - <%= l @spending_proposal.created_at, format: :datetime %> -

    -
    - -
    - -<% if @spending_proposal.association_name.present? %> -

    <%= t("admin.spending_proposals.show.association_name") %>: - <%= @spending_proposal.association_name %> -

    -<% end %> - -<% if @spending_proposal.external_url.present? %> -

    <%= text_with_links @spending_proposal.external_url %> 

    -<% end %> - -<%= safe_html_with_links @spending_proposal.description %> diff --git a/app/views/admin/spending_proposals/index.html.erb b/app/views/admin/spending_proposals/index.html.erb deleted file mode 100644 index a36c19d35..000000000 --- a/app/views/admin/spending_proposals/index.html.erb +++ /dev/null @@ -1,85 +0,0 @@ -<%= link_to t("admin.spending_proposals.index.summary_link"), - summary_admin_spending_proposals_path, - class: "button float-right" %> - -<%= link_to t("admin.spending_proposals.index.valuator_summary_link"), - summary_admin_valuators_path, - class: "button float-right margin-right" %> - -

    <%= t("admin.spending_proposals.index.title") %>

    - -
    - <%= form_tag admin_spending_proposals_path, method: :get, enforce_utf8: false do %> -
    - <%= select_tag :administrator_id, - options_for_select(admin_select_options, params[:administrator_id]), - { prompt: t("admin.spending_proposals.index.administrator_filter_all"), - label: false, - class: "js-submit-on-change" } %> -
    - -
    - <%= select_tag :valuator_id, - options_for_select(valuator_select_options, params[:valuator_id]), - { prompt: t("admin.spending_proposals.index.valuator_filter_all"), - label: false, - class: "js-submit-on-change" } %> -
    - -
    - <%= select_tag :geozone_id, - options_for_select(geozone_select_options.unshift([t("geozones.none"), "all"]), params[:geozone_id]), - { prompt: t("admin.spending_proposals.index.geozone_filter_all"), - label: false, - class: "js-submit-on-change" } %> -
    - -
    - <%= select_tag :tag_name, - options_for_select(spending_proposal_tags_select_options, params[:tag_name]), - { prompt: t("admin.spending_proposals.index.tags_filter_all"), - label: false, - class: "js-submit-on-change" } %> -
    - <% end %> -
    - -<%= render "shared/filter_subnav", i18n_namespace: "admin.spending_proposals.index" %> - -

    <%= page_entries_info @spending_proposals %>

    - - - <% @spending_proposals.each do |spending_proposal| %> - - - - - - - - - <% end %> -
    - <%= spending_proposal.id %> - - <%= link_to spending_proposal.title, - admin_spending_proposal_path(spending_proposal, @filter_params.to_h) %> - - <% if spending_proposal.administrator.present? %> - "><%= spending_proposal.administrator.name %> - <% else %> - <%= t("admin.spending_proposals.index.no_admin_assigned") %> - <% end %> - - <% if spending_proposal.valuators.size == 0 %> - <%= t("admin.spending_proposals.index.no_valuators_assigned") %> - <% else %> - <%= spending_proposal.valuators.collect(&:description_or_name).join(", ") %> - <% end %> - - <%= geozone_name(spending_proposal) %> - - <%= t("admin.spending_proposals.index.feasibility.#{spending_proposal.feasibility}", price: spending_proposal.price) %> -
    - -<%= paginate @spending_proposals %> diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 2c806796d..18c69b304 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -106,14 +106,6 @@

    - <% if feature?(:spending_proposals) %> -
    - -
    - <% end %>
    diff --git a/app/views/budgets/investments/_form.html.erb b/app/views/budgets/investments/_form.html.erb index 62c94fe53..dcc62d92d 100644 --- a/app/views/budgets/investments/_form.html.erb +++ b/app/views/budgets/investments/_form.html.erb @@ -7,14 +7,20 @@
    - <%= f.text_field :title, maxlength: SpendingProposal.title_max_length, data: { js_suggest_result: "js_suggest_result", js_suggest: "#js-suggest", js_url: suggest_budget_investments_path(@budget) }%> + <%= f.text_field :title, + maxlength: Budget::Investment.title_max_length, + data: { js_suggest_result: "js_suggest_result", + js_suggest: "#js-suggest", + js_url: suggest_budget_investments_path(@budget) } %>
    <%= f.invisible_captcha :subtitle %>
    - <%= f.cktext_area :description, maxlength: SpendingProposal.description_max_length, ckeditor: { language: I18n.locale } %> + <%= f.cktext_area :description, + maxlength: Budget::Investment.description_max_length, + ckeditor: { language: I18n.locale } %>
    <% if feature?(:allow_images) %> diff --git a/app/views/budgets/results/_results_table.html.erb b/app/views/budgets/results/_results_table.html.erb index 7420aed7e..0a2dca5e3 100644 --- a/app/views/budgets/results/_results_table.html.erb +++ b/app/views/budgets/results/_results_table.html.erb @@ -8,7 +8,7 @@ - <%= t("budgets.results.spending_proposal") %> + <%= t("budgets.results.investment_title") %> <%= t("budgets.results.ballot_lines_count") %> diff --git a/app/views/mailer/unfeasible_spending_proposal.html.erb b/app/views/mailer/unfeasible_spending_proposal.html.erb deleted file mode 100644 index ac07336cd..000000000 --- a/app/views/mailer/unfeasible_spending_proposal.html.erb +++ /dev/null @@ -1,24 +0,0 @@ - - -

    - <%= t("mailers.unfeasible_spending_proposal.hi") %> -

    - -

    - <%= @spending_proposal.feasible_explanation %> -

    - -

    - <%= t("mailers.unfeasible_spending_proposal.new_html", - url: link_to(t("mailers.unfeasible_spending_proposal.new_href"), - new_spending_proposal_url, style: "color: #2895F1; text-decoration: underline;")) %> -

    - -

    - <%= t("mailers.unfeasible_spending_proposal.sorry") %> -

    - -

    - <%= t("mailers.unfeasible_spending_proposal.sincerely") %> -

    - \ No newline at end of file diff --git a/app/views/management/_menu.html.erb b/app/views/management/_menu.html.erb index 90add29e8..213e0ece4 100644 --- a/app/views/management/_menu.html.erb +++ b/app/views/management/_menu.html.erb @@ -64,29 +64,5 @@ <%= t("management.menu.user_invites") %> <% end %>
  • - - <%# temporarily commenting until obsolete spending_proposals is removed %> - <% if false %> -
  • > - <%= link_to new_management_spending_proposal_path do %> - - <%= t("management.menu.create_spending_proposal") %> - <% end %> -
  • - -
  • > - <%= link_to management_spending_proposals_path do %> - - <%= t("management.menu.support_spending_proposals") %> - <% end %> -
  • - -
  • > - <%= link_to print_management_spending_proposals_path do %> - - <%= t("management.menu.print_spending_proposals") %> - <% end %> -
  • - <% end %> diff --git a/app/views/management/spending_proposals/_spending_proposal.html.erb b/app/views/management/spending_proposals/_spending_proposal.html.erb deleted file mode 100644 index bee9fe2c4..000000000 --- a/app/views/management/spending_proposals/_spending_proposal.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render partial: "spending_proposals/spending_proposal", locals: {spending_proposal: spending_proposal} %> diff --git a/app/views/management/spending_proposals/_votes.html.erb b/app/views/management/spending_proposals/_votes.html.erb deleted file mode 100644 index 7a8b49f55..000000000 --- a/app/views/management/spending_proposals/_votes.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<%= render "spending_proposals/votes", - { spending_proposal: spending_proposal, vote_url: vote_management_spending_proposal_path(spending_proposal, value: "yes") } %> diff --git a/app/views/management/spending_proposals/index.html.erb b/app/views/management/spending_proposals/index.html.erb deleted file mode 100644 index bcdddc9b4..000000000 --- a/app/views/management/spending_proposals/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
    - - <%= render "admin/shared/spending_proposal_search", url: management_spending_proposals_path %> - - -
    -
    - - -
    - <%= content_tag(:h2, t("management.spending_proposals.filters.unfeasible")) if params[:unfeasible].present? %> - <%= content_tag(:h2, t("management.spending_proposals.filters.by_geozone", geozone: @geozone_name)) if @geozone_name.present? %> - <% if params[:search].present? %> -

    - <%= page_entries_info @spending_proposals %> - <%= t("management.spending_proposals.search_results", count: @spending_proposals.size, search_term: params[:search]) %> -

    - <% end %> -
    - - <%= render @spending_proposals %> - <%= paginate @spending_proposals %> -
    -
    -
    diff --git a/app/views/management/spending_proposals/new.html.erb b/app/views/management/spending_proposals/new.html.erb deleted file mode 100644 index fce6ea18e..000000000 --- a/app/views/management/spending_proposals/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
    - -
    - <%= render "/shared/print" %> -
    - -
    -

    <%= t("management.spending_proposals.create") %>

    - <%= render "spending_proposals/form", form_url: management_spending_proposals_url %> -
    - -
    diff --git a/app/views/management/spending_proposals/print.html.erb b/app/views/management/spending_proposals/print.html.erb deleted file mode 100644 index c45ff9688..000000000 --- a/app/views/management/spending_proposals/print.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -
    -
    -
    - -
    - <%= form_tag print_management_spending_proposals_path, method: :get, enforce_utf8: false do %> -
    - <%= select_tag :geozone, - options_for_select(geozone_select_options.unshift([t("geozones.none"), "all"]), params[:geozone]), - { label: false, - class: "js-submit-on-change" } %> -
    - <% end %> - - - <%= t("management.spending_proposals.print.print_button") %> - -
    - -
    - <%= content_tag(:h2, t("management.spending_proposals.filters.unfeasible"), class: "inline-block") if params[:unfeasible].present? %> - <%= content_tag(:h2, t("management.spending_proposals.filters.by_geozone", geozone: @geozone_name), class: "inline-block") if @geozone_name.present? %> - <%= content_tag(:h2, t("management.spending_proposals.search_results", count: @spending_proposals.size, search_term: params[:search]), class: "inline-block") if params[:search].present? %> -
    - - <%= render @spending_proposals %> - -
    -

    <%= t("management.print.spending_proposals_info") %>

    -
    -
    -
    -
    diff --git a/app/views/management/spending_proposals/show.html.erb b/app/views/management/spending_proposals/show.html.erb deleted file mode 100644 index 639a22c91..000000000 --- a/app/views/management/spending_proposals/show.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= render "/shared/print" %> - -<%= render template: "spending_proposals/show" %> diff --git a/app/views/management/spending_proposals/vote.js.erb b/app/views/management/spending_proposals/vote.js.erb deleted file mode 100644 index ebd1ba4e5..000000000 --- a/app/views/management/spending_proposals/vote.js.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render template: "spending_proposals/vote" %> \ No newline at end of file diff --git a/app/views/shared/_admin_login_items.html.erb b/app/views/shared/_admin_login_items.html.erb index df5bc6a8c..2d5aba1b2 100644 --- a/app/views/shared/_admin_login_items.html.erb +++ b/app/views/shared/_admin_login_items.html.erb @@ -14,7 +14,7 @@ <% end %> - <% if (feature?(:spending_proposals) || feature?(:budgets)) && + <% if feature?(:budgets) && (current_user.administrator? || current_user.valuator?) %>
  • <%= link_to t("layouts.header.valuation"), valuation_root_path %> diff --git a/app/views/shared/_subnavigation.html.erb b/app/views/shared/_subnavigation.html.erb index ce448591b..7182e9ca9 100644 --- a/app/views/shared/_subnavigation.html.erb +++ b/app/views/shared/_subnavigation.html.erb @@ -37,14 +37,6 @@ accesskey: "4" %>
  • <% end %> - <% if feature?(:spending_proposals) %> -
  • - <%= layout_menu_link_to t("layouts.header.spending_proposals"), - spending_proposals_path, - controller_name == "spending_proposals", - accesskey: "s" %> -
  • - <% end %> <% if feature?(:budgets) %>
  • <%= layout_menu_link_to t("layouts.header.budgets"), diff --git a/app/views/spending_proposals/_form.html.erb b/app/views/spending_proposals/_form.html.erb deleted file mode 100644 index 2694783b1..000000000 --- a/app/views/spending_proposals/_form.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<%= form_for(@spending_proposal, url: form_url) do |f| %> - <%= render "shared/errors", resource: @spending_proposal %> - -
    -
    - <%= f.label :title, t("spending_proposals.form.title") %> - <%= f.text_field :title, maxlength: SpendingProposal.title_max_length, placeholder: t("spending_proposals.form.title"), label: false %> -
    - - <%= f.invisible_captcha :subtitle %> - -
    - <%= f.label :description, t("spending_proposals.form.description") %> - <%= f.cktext_area :description, maxlength: SpendingProposal.description_max_length, ckeditor: { language: I18n.locale }, label: false %> -
    - -
    - <%= f.label :external_url, t("spending_proposals.form.external_url") %> - <%= f.text_field :external_url, placeholder: t("spending_proposals.form.external_url"), label: false %> -
    - -
    - <%= f.label :geozone_id, t("spending_proposals.form.geozone") %> - <%= f.select :geozone_id, geozone_select_options, {include_blank: t("geozones.none"), label: false} %> -
    - -
    - <%= f.label :association_name, t("spending_proposals.form.association_name_label") %> - <%= f.text_field :association_name, placeholder: t("spending_proposals.form.association_name"), label: false %> -
    - -
    - <% if @spending_proposal.new_record? %> - <%= f.label :terms_of_service do %> - <%= f.check_box :terms_of_service, title: t("form.accept_terms_title"), label: false %> - - <%= t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "blank")).html_safe %> - - <% end %> - <% end %> -
    - -
    - <%= f.submit(class: "button", value: t("spending_proposals.form.submit_buttons.#{action_name}")) %> -
    -
    -<% end %> diff --git a/app/views/spending_proposals/_sidebar.html.erb b/app/views/spending_proposals/_sidebar.html.erb deleted file mode 100644 index cb88e16e7..000000000 --- a/app/views/spending_proposals/_sidebar.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - -
    -
    - <%= link_to t("geozones.all"), spending_proposals_path(geozone: nil) %> - <%= link_to t("geozones.none"), spending_proposals_path(geozone: "all") %> - <% Geozone.all.each do |geozone| %> - <%= link_to geozone.name, spending_proposals_path(geozone: geozone.id) %> - <% end %> -
    - - - -
    -<%= link_to t("spending_proposals.index.sidebar.unfeasible"), spending_proposals_path(unfeasible: "1") %> diff --git a/app/views/spending_proposals/_spending_proposal.html.erb b/app/views/spending_proposals/_spending_proposal.html.erb deleted file mode 100644 index b1530cb40..000000000 --- a/app/views/spending_proposals/_spending_proposal.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -
    -
    -
    - -
    -
    - - <% cache [locale_and_user_status(spending_proposal), "index", spending_proposal, spending_proposal.author] do %> - <%= t("spending_proposals.spending_proposal.spending_proposal") %> - -

    <%= link_to spending_proposal.title, namespaced_spending_proposal_path(spending_proposal) %>

    -

    - - <%= l spending_proposal.created_at.to_date %> - - <% if spending_proposal.author.hidden? || spending_proposal.author.erased? %> -  •  - - <%= t("spending_proposals.show.author_deleted") %> - - <% else %> -  •  - - <%= spending_proposal.author.name %> - - <% if spending_proposal.author.display_official_position_badge? %> -  •  - - <%= spending_proposal.author.official_position %> - - <% end %> - <% end %> - - <% if spending_proposal.author.verified_organization? %> -  •  - - <%= t("shared.collective") %> - - <% end %> - -  •  - <%= geozone_name(spending_proposal) %> -

    -
    -

    <%= link_to spending_proposal.description, namespaced_spending_proposal_path(spending_proposal) %>

    -
    -
    - <% end %> -
    -
    - -
    - <%= render "votes", - { spending_proposal: spending_proposal, vote_url: vote_spending_proposal_path(spending_proposal, value: "yes") } %> -
    - -
    -
    -
    diff --git a/app/views/spending_proposals/_votes.html.erb b/app/views/spending_proposals/_votes.html.erb deleted file mode 100644 index 369a3053c..000000000 --- a/app/views/spending_proposals/_votes.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -
    - - <% reason = spending_proposal.reason_for_not_being_votable_by(current_user) %> - <% voting_allowed = true unless reason.presence == :not_voting_allowed %> - <% user_voted_for = voted_for?(@spending_proposal_votes, spending_proposal) %> - - "> - <%= t("spending_proposals.spending_proposal.supports", count: spending_proposal.total_votes) %> - - -
    - <% if user_voted_for %> -
    - <%= t("spending_proposals.spending_proposal.already_supported") %> -
    - <% elsif voting_allowed %> - <%= link_to vote_url, - class: "button button-support small expanded", - title: t("spending_proposals.spending_proposal.support_title"), method: "post", remote: true, - "aria-hidden" => css_for_aria_hidden(reason) do %> - <%= t("spending_proposals.spending_proposal.support") %> - <% end %> - <% end %> -
    - - <% if reason.present? && !user_voted_for %> - - <% end %> - - <% if user_voted_for && setting["twitter_handle"] %> - <%= render partial: "shared/social_share", locals: { - title: spending_proposal.title, - url: spending_proposal_url(spending_proposal), - description: spending_proposal.title - } %> - <% end %> -
    diff --git a/app/views/spending_proposals/index.html.erb b/app/views/spending_proposals/index.html.erb deleted file mode 100644 index 9431401ca..000000000 --- a/app/views/spending_proposals/index.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<% provide :title do %><%= t("spending_proposals.index.title") %><% end %> -<% content_for :header_addon do %> - <%= render "shared/search_form", - search_path: spending_proposals_path(page: 1), - i18n_namespace: "spending_proposals.index.search_form" %> -<% end %> - -
    -

    <%= t("shared.outline.budget") %>

    - -
    -
    - -
    - <%= content_tag(:h2, t("spending_proposals.index.unfeasible")) if params[:unfeasible].present? %> - <%= content_tag(:h2, t("spending_proposals.index.by_geozone", geozone: @geozone_name)) if @geozone_name.present? %> - <% if params[:search].present? %> -

    - <%= page_entries_info @spending_proposals %> - <%= t("spending_proposals.index.search_results", count: @spending_proposals.size, search_term: params[:search]) %> -

    - <% end %> -
    - -
    - <%= link_to t("spending_proposals.index.start_spending_proposal"), new_spending_proposal_path, class: "button expanded" %> -
    - <%= render partial: "spending_proposals/spending_proposal", collection: @spending_proposals %> - <%= paginate @spending_proposals %> -
    - -
    - -
    - -
    -
    diff --git a/app/views/spending_proposals/new.html.erb b/app/views/spending_proposals/new.html.erb deleted file mode 100644 index 84251d36b..000000000 --- a/app/views/spending_proposals/new.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
    - -
    - <%= back_link_to %> - -

    <%= t("spending_proposals.new.start_new") %>

    -
    - <%= link_to "/spending_proposals_info", title: t("shared.target_blank_html"), target: "_blank" do %> - <%= t("spending_proposals.new.more_info")%> - <% end %> -
    - <%= render "spending_proposals/form", form_url: spending_proposals_url %> -
    - -
    - -

    <%= t("spending_proposals.new.recommendations_title") %>

    -
      -
    • <%= t("spending_proposals.new.recommendation_one") %>
    • -
    • <%= t("spending_proposals.new.recommendation_two") %>
    • -
    • <%= t("spending_proposals.new.recommendation_three") %>
    • -
    -
    - -
    diff --git a/app/views/spending_proposals/show.html.erb b/app/views/spending_proposals/show.html.erb deleted file mode 100644 index 55660b9ae..000000000 --- a/app/views/spending_proposals/show.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -<% provide :title do %><%= @spending_proposal.title %><% end %> - -
    -
    -
    - -

    <%= @spending_proposal.title %>

    - -
    - <%= render "/shared/author_info", resource: @spending_proposal %> - -  •  - <%= l @spending_proposal.created_at.to_date %> -  •  - <%= geozone_name(@spending_proposal) %> -
    - -
    -

    - <%= t("spending_proposals.show.code") %> - <%= @spending_proposal.id %> -

    - - <%= safe_html_with_links @spending_proposal.description.html_safe %> - - <% if @spending_proposal.external_url.present? %> - - <% end %> - -
    - - - -
    -
    diff --git a/app/views/spending_proposals/vote.js.erb b/app/views/spending_proposals/vote.js.erb deleted file mode 100644 index 30e280f86..000000000 --- a/app/views/spending_proposals/vote.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#<%= dom_id(@spending_proposal) %>_votes").html("<%= j render("spending_proposals/votes", spending_proposal: @spending_proposal, vote_url: vote_spending_proposal_path(@spending_proposal, value: "yes")) %>"); \ No newline at end of file diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 0f8a228b9..b0beb1e42 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -111,7 +111,6 @@ search: ignore_missing: - "unauthorized.*" - "activerecord.models.proposal" - - "activerecord.models.spending_proposal" - "activerecord.errors.models.proposal_notification.*" - "activerecord.errors.models.direct_message.*" - "errors.messages.blank" @@ -138,7 +137,6 @@ ignore_unused: - "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*" @@ -181,7 +179,6 @@ ignore_unused: - "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*" @@ -201,9 +198,6 @@ ignore_unused: # - "simple_form.{yes,no}" # - "simple_form.{placeholders,hints,labels}.*" # - "simple_form.{error_notification,required}.:" -#### Review unused keys after merge with Budgest (both en and es) - - users.show.confirm_deletion_spending_proposal - - users.show.delete_spending_proposal - verification.letter.create.flash.offices_url - verification.letter.new.offices_url - votes.budget_investments.different_heading_assigned* diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index d8ebeeec5..23696c1af 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -73,13 +73,6 @@ module ActsAsTaggableOn Tag.category.pluck(:name) end - def self.spending_proposal_tags - ActsAsTaggableOn::Tag.where("taggings.taggable_type" => "SpendingProposal") - .includes(:taggings) - .order(:name) - .distinct - end - def self.graphql_field_name :tag end @@ -97,6 +90,6 @@ module ActsAsTaggableOn def custom_counter_field_name_for(taggable_type) "#{taggable_type.underscore.pluralize}_count" end - end + end end diff --git a/config/initializers/vote_extensions.rb b/config/initializers/vote_extensions.rb index 374013e99..fa0ceb6ca 100644 --- a/config/initializers/vote_extensions.rb +++ b/config/initializers/vote_extensions.rb @@ -25,10 +25,6 @@ ActsAsVotable::Vote.class_eval do where(votable_type: "Legislation::Proposal", votable_id: proposals) end - def self.for_spending_proposals(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) end diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index 142b8ecd4..b2c262eec 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -71,9 +71,6 @@ en: proposal: one: "Citizen proposal" other: "Citizen proposals" - spending_proposal: - one: "Investment project" - other: "Investment projects" site_customization/page: one: Custom page other: Custom pages @@ -203,13 +200,6 @@ en: organization: name: "Name of organisation" responsible_name: "Person responsible for the group" - spending_proposal: - administrator_id: "Administrator" - association_name: "Association name" - description: "Description" - external_url: "Link to additional documentation" - geozone_id: "Scope of operation" - title: "Title" poll: name: "Name" starts_at: "Start Date" diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index b33e5dd84..e3c5c597b 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -690,7 +690,6 @@ en: officials: Officials organizations: Organisations settings: Global settings - spending_proposals: Spending proposals stats: Statistics signature_sheets: Signature Sheets site_customization: @@ -1299,9 +1298,6 @@ en: proposal_search: button: Search placeholder: Search proposals by title, code, description or question - spending_proposal_search: - button: Search - placeholder: Search spending proposals by title or description user_search: button: Search placeholder: Search user by name or email @@ -1322,52 +1318,6 @@ en: color_help: Hexadecimal format show_results_and_stats: "Show results and stats" results_and_stats_reminder: "Marking these checkboxes the results and/or stats will be publicly available and every user will see them." - spending_proposals: - index: - geozone_filter_all: All zones - administrator_filter_all: All administrators - valuator_filter_all: All valuators - tags_filter_all: All tags - filters: - valuation_open: Open - without_admin: Without assigned admin - managed: Managed - valuating: Under valuation - valuation_finished: Valuation finished - all: All - title: Investment projects for participatory budgeting - assigned_admin: Assigned administrator - no_admin_assigned: No admin assigned - no_valuators_assigned: No valuators assigned - summary_link: "Investment project summary" - valuator_summary_link: "Valuator summary" - feasibility: - feasible: "Feasible (%{price})" - not_feasible: "Not feasible" - undefined: "Undefined" - show: - assigned_admin: Assigned administrator - assigned_valuators: Assigned valuators - back: Back - classification: Classification - heading: "Investment project %{id}" - edit: Edit - edit_classification: Edit classification - association_name: Association - by: By - sent: Sent - geozone: Scope - dossier: Dossier - edit_dossier: Edit dossier - tags: Tags - undefined: Undefined - edit: - classification: Classification - assigned_valuators: Valuators - submit_button: Update - tags: Tags - tags_placeholder: "Write the tags you want separated by commas (,)" - undefined: Undefined geozones: index: title: Geozone @@ -1438,7 +1388,6 @@ en: proposals: Proposals budgets: Open budgets budget_investments: Investment projects - spending_proposals: Spending Proposals unverified_users: Unverified users user_level_three: Level three users user_level_two: Level two users @@ -1455,7 +1404,6 @@ en: polls: Polls graph: debate_created: Debates - spending_proposals: Investment projects visit: Visits level_2_user: Level 2 users proposal_created: Citizen proposals diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index d7bd7235d..5f49b1d41 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -165,15 +165,15 @@ en: page_title: "%{budget} - Results" heading: "Participatory budget results" heading_selection_title: "By district" - spending_proposal: Proposal title ballot_lines_count: Votes hide_discarded_link: Hide discarded show_all_link: Show all price: Price amount_available: Available budget - accepted: "Accepted spending proposal: " - discarded: "Discarded spending proposal: " + accepted: "Accepted investment: " + discarded: "Discarded investment: " incompatibles: Incompatibles + investment_title: Project title investment_proyects: List of all investment projects unfeasible_investment_proyects: List of all unfeasible investment projects not_selected_investment_proyects: List of all investment projects not selected for balloting diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index e28656c35..6b9846564 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -179,7 +179,6 @@ en: policy: Privacy Policy proposal: Proposal proposal_notification: "Notification" - spending_proposal: Spending proposal budget/investment: Investment budget/group: Budget Group budget/heading: Budget Heading @@ -193,7 +192,6 @@ en: image: Image geozones: none: All city - all: All scopes layouts: application: chrome: Google Chrome @@ -248,7 +246,6 @@ en: proposals: Proposals poll_questions: Voting budgets: Participatory budgeting - spending_proposals: Spending Proposals notification_item: new_notifications: one: You have a new notification @@ -764,7 +761,6 @@ en: unflag: Unflag unfollow_entity: "Unfollow %{entity}" outline: - budget: Participatory budget searcher: Searcher go_to_page: "Go to page of " share: Share @@ -787,54 +783,6 @@ en: whatsapp: WhatsApp telegram: "%{org} Telegram" instagram: "%{org} Instagram" - spending_proposals: - form: - association_name_label: "If you propose in name of an assocation or collective add the name here" - association_name: "Association name" - description: Description - external_url: Link to additional documentation - geozone: Scope of operation - submit_buttons: - create: Create - new: Create - title: Spending proposal title - index: - title: Participatory budgeting - unfeasible: Unfeasible investment projects - by_geozone: "Investment projects with scope: %{geozone}" - search_form: - button: Search - placeholder: Investment projects... - title: Search - search_results: - one: " containing the term '%{search_term}'" - other: " containing the term '%{search_term}'" - sidebar: - geozones: Scope of operation - feasibility: Feasibility - unfeasible: Unfeasible - start_spending_proposal: Create an investment project - new: - more_info: How do participatory budgeting works? - recommendation_one: It's mandatory that the proposal makes reference to a budgetable action. - recommendation_three: Try to go into details when describing your spending proposal so the reviewing team undertands your points. - recommendation_two: Any proposal or comment suggesting illegal action will be deleted. - recommendations_title: How to create a spending proposal - start_new: Create spending proposal - show: - author_deleted: User deleted - code: "Proposal code:" - share: Share - wrong_price_format: Only integer numbers - spending_proposal: - spending_proposal: Investment project - already_supported: You have already supported this. Share it! - support: Support - support_title: Support this project - supports: - one: 1 support - other: "%{count} supports" - zero: No supports stats: index: visits: Visits @@ -917,12 +865,6 @@ en: unauthenticated: You must %{signin} or %{signup} to continue. verified_only: Only verified users can vote on proposals; %{verify_account}. verify_account: verify your account - spending_proposals: - not_logged_in: You must %{signin} or %{signup} to continue. - not_verified: Only verified users can vote on proposals; %{verify_account}. - organization: Organizations are not permitted to vote - unfeasible: Unfeasible investment projects can not be supported - not_voting_allowed: Voting phase is closed budget_investments: not_logged_in: You must %{signin} or %{signup} to continue. not_verified: Only verified users can vote on investment projects; %{verify_account}. diff --git a/config/locales/en/mailers.yml b/config/locales/en/mailers.yml index fd8131842..c92660de4 100644 --- a/config/locales/en/mailers.yml +++ b/config/locales/en/mailers.yml @@ -20,13 +20,6 @@ en: new_reply_by_html: There is a new response from %{commenter} to your comment on subject: Someone has responded to your comment title: New response to your comment - unfeasible_spending_proposal: - hi: "Dear user," - new_html: "For all these, we invite you to elaborate a new proposal that adjusts to the conditions of this process. You can do it following this link: %{url}." - new_href: "new investment project" - sincerely: "Sincerely" - sorry: "Sorry for the inconvenience and we again thank you for your invaluable participation." - subject: "Your investment project '%{code}' has been marked as unfeasible" proposal_notification_digest: info: "Here are the new notifications that have been published by authors of the proposals that you have supported in %{org_name}." title: "Proposal notifications in %{org_name}" diff --git a/config/locales/en/management.yml b/config/locales/en/management.yml index 8b5863fc4..97b438d1e 100644 --- a/config/locales/en/management.yml +++ b/config/locales/en/management.yml @@ -62,9 +62,6 @@ en: create_proposal: Create proposal print_proposals: Print proposals support_proposals: Support proposals - create_spending_proposal: Create spending proposal - print_spending_proposals: Print spending proposals - support_spending_proposals: Support spending proposals create_budget_investment: Create budget investment print_budget_investments: Print budget investments support_budget_investments: Support budget investments @@ -79,7 +76,6 @@ en: print: proposals_info: Create your proposal on http://url.consul proposals_title: "Proposals:" - spending_proposals_info: Participate at http://url.consul budget_investments_info: Participate at http://url.consul print_info: Print this info proposals: @@ -110,18 +106,6 @@ en: search_results: one: " containing the term '%{search_term}'" other: " containing the term '%{search_term}'" - spending_proposals: - alert: - unverified_user: User is not verified - create: Create spending proposal - filters: - unfeasible: Unfeasible investment projects - by_geozone: "Investment projects with scope: %{geozone}" - print: - print_button: Print - search_results: - one: " containing the term '%{search_term}'" - other: " containing the term '%{search_term}'" sessions: signed_out: Signed out successfully. signed_out_managed_user: User session signed out successfully. diff --git a/config/locales/en/responders.yml b/config/locales/en/responders.yml index 2bf1f68fd..82ee36271 100644 --- a/config/locales/en/responders.yml +++ b/config/locales/en/responders.yml @@ -12,7 +12,6 @@ en: poll_question_answer_image: "Image uploaded successfully" proposal: "Proposal created successfully." proposal_notification: "Your message has been sent correctly." - spending_proposal: "Spending proposal created successfully. You can access it from %{activity}" budget_investment: "Budget Investment created successfully." signature_sheet: "Signature sheet created successfully" topic: "Topic created successfully." @@ -26,13 +25,11 @@ en: poll_booth: "Booth updated successfully." active_poll: "Polls description updated successfully." proposal: "Proposal updated successfully." - spending_proposal: "Investment project updated succesfully." budget_investment: "Investment project updated succesfully." topic: "Topic updated successfully." valuator_group: "Valuator group updated successfully" translation: "Translation updated successfully" destroy: - spending_proposal: "Spending proposal deleted succesfully." budget_investment: "Investment project deleted succesfully." error: "Could not delete" topic: "Topic deleted successfully." diff --git a/config/locales/en/settings.yml b/config/locales/en/settings.yml index 0351ac7b6..a1460204e 100644 --- a/config/locales/en/settings.yml +++ b/config/locales/en/settings.yml @@ -93,11 +93,6 @@ en: featured_proposals_description: "Shows featured proposals on index proposals page" signature_sheets: "Signature sheets" signature_sheets_description: "It allows adding from the Administration panel signatures collected on-site to Proposals and investment projects of the Participative Budgets" - spending_proposals: "Spending proposals" - spending_proposals_description: "⚠️ NOTE: This functionality has been replaced by Participatory Budgeting and will disappear in new versions" - spending_proposal_features: - voting_allowed: Voting on investment projects - Preselection phase - voting_allowed_description: "⚠️ NOTE: This functionality has been replaced by Participatory Budgeting and will disappear in new versions" user: recommendations: "Recommendations" recommendations_description: "Shows users recommendations on the homepage based on the tags of the following items" diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml index ceec2cff8..e3bd118f7 100644 --- a/config/locales/es/activerecord.yml +++ b/config/locales/es/activerecord.yml @@ -71,9 +71,6 @@ es: proposal: one: "Propuesta ciudadana" other: "Propuestas ciudadanas" - spending_proposal: - one: "Propuesta de inversión" - other: "Proyectos de gasto" site_customization/page: one: Página other: Páginas @@ -203,13 +200,6 @@ es: organization: name: "Nombre de la organización" responsible_name: "Persona responsable del colectivo" - spending_proposal: - administrator_id: "Administrador" - association_name: "Nombre de la asociación" - description: "Descripción" - external_url: "Enlace a documentación adicional" - geozone_id: "Ámbito de actuación" - title: "Título" poll: name: "Nombre" starts_at: "Fecha de apertura" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 68f9099b9..34fc7510b 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -689,7 +689,6 @@ es: officials: Cargos públicos organizations: Organizaciones settings: Configuración global - spending_proposals: Propuestas de inversión stats: Estadísticas signature_sheets: Hojas de firmas site_customization: @@ -714,7 +713,6 @@ es: content_block: update: "Actualizar Bloque" title_moderated_content: Contenido moderado - title_budgets: Presupuestos title_profiles: Perfiles title_settings: Configuración title_site_customization: Contenido del sitio @@ -1299,9 +1297,6 @@ es: proposal_search: button: Buscar placeholder: Buscar propuestas por título, código, descripción o pregunta - spending_proposal_search: - button: Buscar - placeholder: Buscar propuestas por título o descripción user_search: button: Buscar placeholder: Buscar usuario por nombre o email @@ -1322,62 +1317,6 @@ es: color_help: Formato hexadecimal show_results_and_stats: "Mostrar resultados y estadísticas" results_and_stats_reminder: "Si marcas estas casillas los resultados y/o estadísticas serán públicos y podrán verlos todos los usuarios." - spending_proposals: - index: - geozone_filter_all: Todos los ámbitos de actuación - administrator_filter_all: Todos los administradores - valuator_filter_all: Todos los evaluadores - tags_filter_all: Todas las etiquetas - filters: - valuation_open: Abiertas - without_admin: Sin administrador - managed: Gestionando - valuating: En evaluación - valuation_finished: Evaluación finalizada - all: Todas - title: Propuestas de inversión para presupuestos participativos - assigned_admin: Administrador asignado - no_admin_assigned: Sin admin asignado - no_valuators_assigned: Sin evaluador - summary_link: "Resumen de propuestas" - valuator_summary_link: "Resumen de evaluadores" - feasibility: - feasible: "Viable (%{price})" - not_feasible: "Inviable" - undefined: "Sin definir" - show: - assigned_admin: Administrador asignado - assigned_valuators: Evaluadores asignados - back: Volver - classification: Clasificación - heading: "Propuesta de inversión %{id}" - edit: Editar - edit_classification: Editar clasificación - association_name: Asociación - by: Autor - sent: Fecha - geozone: Ámbito - dossier: Informe - edit_dossier: Editar informe - tags: Etiquetas - undefined: Sin definir - edit: - classification: Clasificación - assigned_valuators: Evaluadores - submit_button: Actualizar - tags: Etiquetas - tags_placeholder: "Escribe las etiquetas que desees separadas por comas (,)" - undefined: Sin definir - summary: - title: Resumen de propuestas de inversión - title_proposals_with_supports: Resumen para propuestas que han superado la fase de apoyos - geozone_name: Ámbito de ciudad - finished_and_feasible_count: Finalizadas viables - finished_and_unfeasible_count: Finalizadas inviables - finished_count: Finalizadas - in_evaluation_count: En evaluación - total_count: Total - cost_for_geozone: Coste total geozones: index: title: Zonas @@ -1448,7 +1387,6 @@ es: proposals: Propuestas budgets: Presupuestos abiertos budget_investments: Proyectos de gasto - spending_proposals: Propuestas de inversión unverified_users: Usuarios sin verificar user_level_three: Usuarios de nivel tres user_level_two: Usuarios de nivel dos @@ -1465,7 +1403,6 @@ es: polls: Votaciones graph: debate_created: Debates - spending_proposals: Propuestas de inversión visit: Visitas level_2_user: Usuarios nivel 2 proposal_created: Propuestas Ciudadanas diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 982149b5a..cac1f50bd 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -165,7 +165,6 @@ es: page_title: "%{budget} - Resultados" heading: "Resultados presupuestos participativos" heading_selection_title: "Ámbito de actuación" - spending_proposal: Título de la propuesta ballot_lines_count: Votos hide_discarded_link: Ocultar descartados show_all_link: Mostrar todos @@ -174,6 +173,7 @@ es: accepted: "Proyecto de gasto aceptado: " discarded: "Proyecto de gasto descartado: " incompatibles: Incompatibles + investment_title: Título del proyecto de gasto investment_proyects: Ver lista completa de proyectos de gasto unfeasible_investment_proyects: Ver lista de proyectos de gasto inviables not_selected_investment_proyects: Ver lista de proyectos de gasto no seleccionados para la votación final diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 153a50b13..1a3746c31 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -179,7 +179,6 @@ es: policy: Política de privacidad proposal: la propuesta proposal_notification: "la notificación" - spending_proposal: la propuesta de gasto budget/investment: el proyecto de gasto budget/group: el grupo de partidas presupuestarias budget/heading: la partida presupuestaria @@ -193,7 +192,6 @@ es: image: Imagen geozones: none: Toda la ciudad - all: Todos los ámbitos de actuación layouts: application: chrome: Google Chrome @@ -248,7 +246,6 @@ es: proposals: Propuestas poll_questions: Votaciones budgets: Presupuestos participativos - spending_proposals: Propuestas de inversión notification_item: new_notifications: one: Tienes una nueva notificación @@ -762,7 +759,6 @@ es: unflag: Deshacer denuncia unfollow_entity: "Dejar de seguir %{entity}" outline: - budget: Presupuestos participativos searcher: Buscador go_to_page: "Ir a la página de " share: Compartir @@ -785,54 +781,6 @@ es: whatsapp: WhatsApp telegram: "Telegram de %{org}" instagram: "Instagram de %{org}" - spending_proposals: - form: - association_name_label: "Si propones en nombre de una asociación o colectivo añade el nombre aquí" - association_name: "Nombre de la asociación" - description: Descripción detallada - external_url: Enlace a documentación adicional - geozone: Ámbito de actuación - submit_buttons: - create: Crear - new: Crear - title: Título de la propuesta de gasto - index: - title: Presupuestos participativos - unfeasible: Propuestas de inversión no viables - by_geozone: "Propuestas de inversión con ámbito: %{geozone}" - search_form: - button: Buscar - placeholder: Propuestas de inversión... - title: Buscar - search_results: - one: " que contiene '%{search_term}'" - other: " que contienen '%{search_term}'" - sidebar: - geozones: Ámbitos de actuación - feasibility: Viabilidad - unfeasible: No viables - start_spending_proposal: Crea una propuesta de inversión - new: - more_info: '¿Cómo funcionan los presupuestos participativos?' - recommendation_one: Es fundamental que haga referencia a una actuación presupuestable. - recommendation_three: Intenta detallar lo máximo posible la propuesta para que el equipo de gobierno encargado de estudiarla tenga las menor dudas posibles. - recommendation_two: Cualquier propuesta o comentario que implique acciones ilegales será eliminada. - recommendations_title: Cómo crear una propuesta de gasto - start_new: Crear una propuesta de gasto - show: - author_deleted: Usuario eliminado - code: "Código de la propuesta:" - share: Compartir - wrong_price_format: Solo puede incluir caracteres numéricos - spending_proposal: - spending_proposal: Propuesta de inversión - already_supported: Ya has apoyado este proyecto. ¡Compártelo! - support: Apoyar - support_title: Apoyar este proyecto - supports: - zero: Sin apoyos - one: 1 apoyo - other: "%{count} apoyos" stats: index: visits: Visitas @@ -915,12 +863,6 @@ es: unauthenticated: Necesitas %{signin} o %{signup} para continuar. verified_only: Las propuestas sólo pueden ser votadas por usuarios verificados, %{verify_account}. verify_account: verifica tu cuenta - spending_proposals: - not_logged_in: Necesitas %{signin} o %{signup} para continuar. - not_verified: Las propuestas de inversión sólo pueden ser apoyadas por usuarios verificados, %{verify_account}. - organization: Las organizaciones no pueden votar. - unfeasible: No se pueden votar propuestas inviables. - not_voting_allowed: El periodo de votación está cerrado. budget_investments: not_logged_in: Necesitas %{signin} o %{signup} para continuar. not_verified: Los proyectos de gasto sólo pueden ser apoyadas por usuarios verificados, %{verify_account}. diff --git a/config/locales/es/mailers.yml b/config/locales/es/mailers.yml index e2a1439f0..b1d0de74b 100644 --- a/config/locales/es/mailers.yml +++ b/config/locales/es/mailers.yml @@ -20,13 +20,6 @@ es: new_reply_by_html: Hay una nueva respuesta de %{commenter} a tu comentario en subject: Alguien ha respondido a tu comentario title: Nueva respuesta a tu comentario - unfeasible_spending_proposal: - hi: "Estimado/a usuario/a" - new_html: "Por todo ello, te invitamos a que elabores una nueva propuesta que se ajuste a las condiciones de este proceso. Esto lo puedes hacer en este enlace: %{url}." - new_href: "nueva propuesta de inversión" - sincerely: "Atentamente" - sorry: "Sentimos las molestias ocasionadas y volvemos a darte las gracias por tu inestimable participación." - subject: "Tu propuesta de inversión '%{code}' ha sido marcada como inviable" proposal_notification_digest: info: "A continuación te mostramos las nuevas notificaciones que han publicado los autores de las propuestas que estás apoyando en %{org_name}." title: "Notificaciones de propuestas en %{org_name}" diff --git a/config/locales/es/management.yml b/config/locales/es/management.yml index 8573e3fdc..953e2a8a0 100644 --- a/config/locales/es/management.yml +++ b/config/locales/es/management.yml @@ -62,9 +62,6 @@ es: create_proposal: Crear propuesta print_proposals: Imprimir propuestas support_proposals: Apoyar propuestas - create_spending_proposal: Crear una propuesta de gasto - print_spending_proposals: Imprimir propts. de inversión - support_spending_proposals: Apoyar propts. de inversión create_budget_investment: Crear proyectos de gasto print_budget_investments: Imprimir proyectos de gasto support_budget_investments: Apoyar proyectos de gasto @@ -79,7 +76,6 @@ es: print: proposals_info: Haz tu propuesta en http://url.consul proposals_title: "Propuestas:" - spending_proposals_info: Participa en http://url.consul budget_investments_info: Participa en http://url.consul print_info: Imprimir esta información proposals: @@ -110,18 +106,6 @@ es: search_results: one: " que contiene '%{search_term}'" other: " que contienen '%{search_term}'" - spending_proposals: - alert: - unverified_user: Usuario no verificado - create: Crear una propuesta de gasto - filters: - unfeasible: Propuestas de inversión no viables - by_geozone: "Propuestas de inversión con ámbito: %{geozone}" - print: - print_button: Imprimir - search_results: - one: " que contiene '%{search_term}'" - other: " que contienen '%{search_term}'" sessions: signed_out: Has cerrado la sesión correctamente. signed_out_managed_user: Se ha cerrado correctamente la sesión del usuario. diff --git a/config/locales/es/responders.yml b/config/locales/es/responders.yml index e11680cc5..fc12f9961 100644 --- a/config/locales/es/responders.yml +++ b/config/locales/es/responders.yml @@ -12,7 +12,6 @@ es: poll_question_answer_image: "Imagen cargada correctamente" proposal: "Propuesta creada correctamente." proposal_notification: "Tu mensaje ha sido enviado correctamente." - spending_proposal: "Propuesta de inversión creada correctamente. Puedes acceder a ella desde %{activity}" budget_investment: "Proyecto de gasto creado correctamente." signature_sheet: "Hoja de firmas creada correctamente" topic: "Tema creado correctamente." @@ -26,13 +25,11 @@ es: poll_booth: "Urna actualizada correctamente." active_poll: "Descripción general de votaciones actualizada correctamente." proposal: "Propuesta actualizada correctamente." - spending_proposal: "Propuesta de inversión actualizada correctamente." budget_investment: "Proyecto de gasto actualizado correctamente" topic: "Tema actualizado correctamente." valuator_group: "Grupo de evaluadores actualizado correctamente" translation: "Traducción actualizada correctamente" destroy: - spending_proposal: "Propuesta de inversión eliminada." budget_investment: "Proyecto de gasto eliminado." error: "No se pudo borrar" topic: "Tema eliminado." diff --git a/config/locales/es/settings.yml b/config/locales/es/settings.yml index d320a1f8a..06f60e8d0 100644 --- a/config/locales/es/settings.yml +++ b/config/locales/es/settings.yml @@ -93,11 +93,6 @@ es: featured_proposals_description: "Muestra propuestas destacadas en la página principal de propuestas" signature_sheets: "Hojas de firmas" signature_sheets_description: "Permite añadir desde el panel de Administración firmas recogidas de forma presencial a Propuestas y proyectos de gasto de los Presupuestos participativos" - spending_proposals: "Propuestas de inversión" - spending_proposals_description: "⚠️ NOTA: Esta funcionalidad ha sido sustituida por Pesupuestos Participativos y desaparecerá en nuevas versiones" - spending_proposal_features: - voting_allowed: Votaciones de preselección sobre propuestas de inversión. - voting_allowed_description: "⚠️ NOTA: Esta funcionalidad ha sido sustituida por Pesupuestos Participativos y desaparecerá en nuevas versiones" user: recommendations: "Recomendaciones" recommendations_description: "Muestra a los usuarios recomendaciones en la homepage basado en las etiquetas de los elementos que sigue" diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 1e67bcc5e..39ed9b44b 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -42,15 +42,6 @@ namespace :admin do end end - resources :spending_proposals, only: [:index, :show, :edit, :update] do - member do - patch :assign_admin - patch :assign_valuators - end - - get :summary, on: :collection - end - resources :proposal_notifications, only: :index do member do put :restore diff --git a/config/routes/budget.rb b/config/routes/budget.rb index a72a71dfb..143ed7409 100644 --- a/config/routes/budget.rb +++ b/config/routes/budget.rb @@ -19,11 +19,5 @@ resources :budgets, only: [:show, :index] do 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 - 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" diff --git a/config/routes/management.rb b/config/routes/management.rb index ff6cc9621..7b35850b9 100644 --- a/config/routes/management.rb +++ b/config/routes/management.rb @@ -31,11 +31,6 @@ namespace :management do get :print, on: :collection end - resources :spending_proposals, only: [:index, :new, :create, :show] do - post :vote, on: :member - get :print, on: :collection - end - resources :budgets, only: :index do collection do get :create_investments diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 3b0bbc6cb..f3c154b64 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -26,7 +26,6 @@ require_relative "dev_seeds/tags_categories" require_relative "dev_seeds/debates" require_relative "dev_seeds/proposals" require_relative "dev_seeds/budgets" -require_relative "dev_seeds/spending_proposals" require_relative "dev_seeds/comments" require_relative "dev_seeds/votes" require_relative "dev_seeds/flags" diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index 22605d21c..70b6574e2 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -33,8 +33,6 @@ section "Creating Settings" do Setting.create(key: "process.legislation", value: "true") Setting.create(key: "feature.featured_proposals", value: "true") - Setting.create(key: "feature.spending_proposals", value: nil) - Setting.create(key: "feature.spending_proposal_features.voting_allowed", value: nil) Setting.create(key: "feature.twitter_login", value: "true") Setting.create(key: "feature.facebook_login", value: "true") @@ -65,6 +63,7 @@ section "Creating Settings" do Setting.create(key: "map.latitude", value: 40.4332002) Setting.create(key: "map.longitude", value: -3.7009591) Setting.create(key: "map.zoom", value: 10) + Setting.create(key: "featured_proposals_number", value: 3) Setting.create(key: "proposal_notification_minimum_interval_in_days", value: 0) Setting.create(key: "direct_message_max_per_day", value: 3) diff --git a/db/dev_seeds/spending_proposals.rb b/db/dev_seeds/spending_proposals.rb deleted file mode 100644 index 3e140561d..000000000 --- a/db/dev_seeds/spending_proposals.rb +++ /dev/null @@ -1,24 +0,0 @@ -section "Creating Spending Proposals" do - tags = Faker::Lorem.words(10) - 60.times do - geozone = Geozone.all.sample - author = User.all.sample - description = "

    #{Faker::Lorem.paragraphs.join("

    ")}

    " - feasible_explanation = "

    #{Faker::Lorem.paragraphs.join("

    ")}

    " - valuation_finished = [true, false].sample - feasible = [true, false].sample - created_at = rand((Time.current - 1.week)..Time.current) - spending_proposal = SpendingProposal.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - external_url: Faker::Internet.url, - description: description, - created_at: created_at, - geozone: [geozone, nil].sample, - feasible: feasible, - feasible_explanation: feasible_explanation, - valuation_finished: valuation_finished, - tag_list: tags.sample(3).join(","), - price: rand(1000000), - terms_of_service: "1") - end -end diff --git a/db/migrate/20190311215516_destroy_spending_proposals.rb b/db/migrate/20190311215516_destroy_spending_proposals.rb new file mode 100644 index 000000000..bf636e85f --- /dev/null +++ b/db/migrate/20190311215516_destroy_spending_proposals.rb @@ -0,0 +1,5 @@ +class DestroySpendingProposals < ActiveRecord::Migration + def change + drop_table :spending_proposals + end +end diff --git a/db/migrate/20190326211832_destroy_spending_proposal_associations.rb b/db/migrate/20190326211832_destroy_spending_proposal_associations.rb new file mode 100644 index 000000000..efca7826f --- /dev/null +++ b/db/migrate/20190326211832_destroy_spending_proposal_associations.rb @@ -0,0 +1,6 @@ +class DestroySpendingProposalAssociations < ActiveRecord::Migration + def change + remove_column :tags, :spending_proposals_count + remove_column :valuators, :spending_proposals_count + end +end diff --git a/db/seeds.rb b/db/seeds.rb index 4e212606d..20bc74e08 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -74,7 +74,6 @@ Setting["process.legislation"] = true # Feature flags Setting["feature.featured_proposals"] = nil -Setting["feature.spending_proposals"] = nil Setting["feature.twitter_login"] = true Setting["feature.facebook_login"] = true Setting["feature.google_login"] = true @@ -90,9 +89,6 @@ Setting["feature.allow_images"] = true Setting["feature.allow_attached_documents"] = true Setting["feature.help_page"] = true -# Spending proposals feature flags -Setting["feature.spending_proposal_features.voting_allowed"] = nil - # Proposal notifications Setting["proposal_notification_minimum_interval_in_days"] = 3 Setting["direct_message_max_per_day"] = 3 diff --git a/lib/tasks/settings.rake b/lib/tasks/settings.rake index bffddcb51..286c3e85c 100644 --- a/lib/tasks/settings.rake +++ b/lib/tasks/settings.rake @@ -10,7 +10,15 @@ namespace :settings do "banner-img.banner-img-one", "banner-img.banner-img-two", "banner-img.banner-img-three", - "verification_offices_url" + "verification_offices_url", + "feature.spending_proposals", + "feature.spending_proposal_features.phase1", + "feature.spending_proposal_features.phase2", + "feature.spending_proposal_features.phase3", + "feature.spending_proposal_features.voting_allowed", + "feature.spending_proposal_features.final_voting_allowed", + "feature.spending_proposal_features.open_results_page", + "feature.spending_proposal_features.valuation_allowed" ] deprecated_keys.each do |key| diff --git a/lib/tasks/spending_proposals.rake b/lib/tasks/spending_proposals.rake deleted file mode 100644 index 6e5f6fa35..000000000 --- a/lib/tasks/spending_proposals.rake +++ /dev/null @@ -1,22 +0,0 @@ -namespace :spending_proposals do - - desc "Check if there are any spending proposals in DB" - task check: :environment do - if !Rails.env.production? - puts "Please run this rake task in your production environment." - else - if SpendingProposal.any? - puts "WARNING" - puts "You have spending proposals in your database." - puts "This model has been deprecated in favor of budget investments." - puts "In the next CONSUL release spending proposals will be deleted." - puts "If you do not need to keep this data, you don't have to do anything else." - print "If you would like to migrate the data from spending proposals to budget investments " - puts "please check this PR https://github.com/consul/consul/pull/3431." - else - puts "All good!" - end - end - end - -end diff --git a/spec/factories/budgets.rb b/spec/factories/budgets.rb index 66cc1d24f..fc60927cc 100644 --- a/spec/factories/budgets.rb +++ b/spec/factories/budgets.rb @@ -1,13 +1,4 @@ FactoryBot.define do - factory :spending_proposal do - sequence(:title) { |n| "Spending Proposal #{n} title" } - description "Spend money on this" - feasible_explanation "This proposal is not viable because..." - external_url "http://external_documention.org" - terms_of_service "1" - association :author, factory: :user - end - factory :budget do sequence(:name) { |n| "#{Faker::Lorem.word} #{n}" } currency_symbol "€" diff --git a/spec/features/admin/feature_flags_spec.rb b/spec/features/admin/feature_flags_spec.rb index deedb8d6a..1d2b5134b 100644 --- a/spec/features/admin/feature_flags_spec.rb +++ b/spec/features/admin/feature_flags_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" describe "Admin feature flags" do before do - Setting["feature.spending_proposals"] = true + Setting["process.budgets"] = true login_as(create(:administrator).user) end diff --git a/spec/features/admin/stats_spec.rb b/spec/features/admin/stats_spec.rb index ca1b9be20..97443a730 100644 --- a/spec/features/admin/stats_spec.rb +++ b/spec/features/admin/stats_spec.rb @@ -103,6 +103,7 @@ describe "Stats" do end describe "Budget investments" do + context "Supporting phase" do before do @budget = create(:budget) @@ -244,6 +245,7 @@ describe "Stats" do end context "graphs" do + scenario "event graphs", :js do campaign = create(:campaign) @@ -260,6 +262,7 @@ describe "Stats" do expect(page).to have_content event_created_at.strftime("%Y-%m-%d") end end + end context "Proposal notifications" do diff --git a/spec/features/admin_spec.rb b/spec/features/admin_spec.rb index e290b506d..7a6f38e30 100644 --- a/spec/features/admin_spec.rb +++ b/spec/features/admin_spec.rb @@ -65,8 +65,6 @@ describe "Admin" do end scenario "Admin access links" do - Setting["feature.spending_proposals"] = true - login_as(administrator) visit root_path @@ -74,8 +72,6 @@ describe "Admin" do expect(page).to have_link("Moderation") expect(page).to have_link("Valuation") expect(page).to have_link("Management") - - Setting["feature.spending_proposals"] = nil end scenario "Admin dashboard" do diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 852156a08..ce98a6bb2 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -218,34 +218,6 @@ describe "Emails" do expect(email).to have_subject("Instrucciones de confirmación") end - scenario "Email on unfeasible spending proposal" do - Setting["feature.spending_proposals"] = true - - spending_proposal = create(:spending_proposal) - administrator = create(:administrator) - valuator = create(:valuator) - spending_proposal.update(administrator: administrator) - spending_proposal.valuators << valuator - - login_as(valuator.user) - visit edit_valuation_spending_proposal_path(spending_proposal) - - choose "spending_proposal_feasible_false" - fill_in "spending_proposal_feasible_explanation", with: "This is not legal as stated in Article 34.9" - check "spending_proposal_valuation_finished" - click_button "Save changes" - - expect(page).to have_content "Dossier updated" - spending_proposal.reload - - email = open_last_email - expect(email).to have_subject("Your investment project '#{spending_proposal.code}' has been marked as unfeasible") - expect(email).to deliver_to(spending_proposal.author.email) - expect(email).to have_body_text(spending_proposal.feasible_explanation) - - Setting["feature.spending_proposals"] = nil - end - context "Direct Message" do scenario "Receiver email" do diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index a1296409e..c998ac62e 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -129,11 +129,10 @@ describe "Notifications" do end scenario "Notification's notifiable model no longer includes Notifiable module" do - create(:notification, notifiable: create(:spending_proposal), user: user) create(:notification, notifiable: create(:poll_question), user: user) click_notifications_icon - expect(page).to have_content("This resource is not available anymore.", count: 2) + expect(page).to have_content("This resource is not available anymore.", count: 1) end context "Admin Notifications" do diff --git a/spec/features/official_positions_spec.rb b/spec/features/official_positions_spec.rb index bc4aaacef..c7f5bee2b 100644 --- a/spec/features/official_positions_spec.rb +++ b/spec/features/official_positions_spec.rb @@ -69,34 +69,5 @@ describe "Official positions" do end end - - context "Spending proposals" do - - before do - Setting["feature.spending_proposals"] = true - @spending_proposal1 = create(:spending_proposal, author: @user1) - @spending_proposal2 = create(:spending_proposal, author: @user2) - end - - after do - Setting["feature.spending_proposals"] = nil - end - - scenario "Index" do - visit spending_proposals_path - - expect_badge_for("spending_proposal", @spending_proposal1) - expect_no_badge_for("spending_proposal", @spending_proposal2) - end - - scenario "Show" do - visit spending_proposal_path(@spending_proposal1) - expect_badge_for("spending_proposal", @spending_proposal1) - - visit spending_proposal_path(@spending_proposal2) - expect_no_badge_for("spending_proposal", @spending_proposal2) - end - - end end end diff --git a/spec/features/votes_spec.rb b/spec/features/votes_spec.rb index 596f4378b..59449b123 100644 --- a/spec/features/votes_spec.rb +++ b/spec/features/votes_spec.rb @@ -368,106 +368,4 @@ describe "Votes" do end end - describe "Spending Proposals" do - before do - Setting["feature.spending_proposals"] = true - Setting["feature.spending_proposal_features.voting_allowed"] = true - login_as(@manuela) - end - - after do - Setting["feature.spending_proposals"] = nil - end - - describe "Index" do - scenario "Index shows user votes on proposals" do - spending_proposal1 = create(:spending_proposal) - spending_proposal2 = create(:spending_proposal) - spending_proposal3 = create(:spending_proposal) - create(:vote, voter: @manuela, votable: spending_proposal1, vote_flag: true) - - visit spending_proposals_path - - within("#investment-projects") do - within("#spending_proposal_#{spending_proposal1.id}_votes") do - expect(page).to have_content "You have already supported this. Share it!" - end - - within("#spending_proposal_#{spending_proposal2.id}_votes") do - expect(page).not_to have_content "You have already supported this. Share it!" - end - - within("#spending_proposal_#{spending_proposal3.id}_votes") do - expect(page).not_to have_content "You have already supported this. Share it!" - end - end - end - - scenario "Create from spending proposal index", :js do - spending_proposal = create(:spending_proposal) - visit spending_proposals_path - - within(".supports") do - find(".in-favor a").click - - expect(page).to have_content "1 support" - expect(page).to have_content "You have already supported this. Share it!" - end - end - end - - describe "Single spending proposal" do - before do - @proposal = create(:spending_proposal) - end - - scenario "Show no votes" do - visit spending_proposal_path(@proposal) - expect(page).to have_content "No supports" - end - - scenario "Trying to vote multiple times", :js do - visit spending_proposal_path(@proposal) - - within(".supports") do - find(".in-favor a").click - expect(page).to have_content "1 support" - - expect(page).not_to have_selector ".in-favor a" - end - end - - scenario "Create from proposal show", :js do - visit spending_proposal_path(@proposal) - - within(".supports") do - find(".in-favor a").click - - expect(page).to have_content "1 support" - expect(page).to have_content "You have already supported this. Share it!" - end - end - end - - scenario "Disable voting on spending proposals", :js do - login_as(@manuela) - Setting["feature.spending_proposal_features.voting_allowed"] = nil - spending_proposal = create(:spending_proposal) - - visit spending_proposals_path - - within("#spending_proposal_#{spending_proposal.id}") do - find("div.supports").hover - expect_message_voting_not_allowed - end - - visit spending_proposal_path(spending_proposal) - - within("#spending_proposal_#{spending_proposal.id}") do - find("div.supports").hover - expect_message_voting_not_allowed - end - end - end - end diff --git a/spec/helpers/geozones_helper_spec.rb b/spec/helpers/geozones_helper_spec.rb index 366be6c39..cf9f3015a 100644 --- a/spec/helpers/geozones_helper_spec.rb +++ b/spec/helpers/geozones_helper_spec.rb @@ -31,19 +31,4 @@ describe GeozonesHelper do end end - describe "#geozone_name_from_id" do - - it "returns geozone name if present" do - g1 = create(:geozone, name: "AAA") - g2 = create(:geozone, name: "BBB") - - expect(geozone_name_from_id(g1.id)).to eq "AAA" - expect(geozone_name_from_id(g2.id)).to eq "BBB" - end - - it "returns default string for no geozone if geozone is blank" do - expect(geozone_name_from_id(nil)).to eq "All city" - end - end - end diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index 6206085bd..f9fd8fbef 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -73,10 +73,6 @@ describe Abilities::Common do it { should_not be_able_to(:vote, Proposal) } it { should_not be_able_to(:vote_featured, Proposal) } - it { should be_able_to(:index, SpendingProposal) } - it { should_not be_able_to(:create, SpendingProposal) } - it { should_not be_able_to(:destroy, SpendingProposal) } - it { should_not be_able_to(:comment_as_administrator, debate) } it { should_not be_able_to(:comment_as_moderator, debate) } it { should_not be_able_to(:comment_as_administrator, proposal) } @@ -189,8 +185,6 @@ describe Abilities::Common do end describe "when level 2 verified" do - let(:own_spending_proposal) { create(:spending_proposal, author: user) } - let(:own_direct_message) { create(:direct_message, sender: user) } before{ user.update(residence_verified_at: Time.current, confirmed_phone: "1") } @@ -200,12 +194,6 @@ describe Abilities::Common do it { should be_able_to(:vote_featured, Proposal) } end - describe "Spending Proposal" do - it { should be_able_to(:create, SpendingProposal) } - it { should_not be_able_to(:destroy, create(:spending_proposal)) } - it { should_not be_able_to(:destroy, own_spending_proposal) } - end - describe "Direct Message" do it { should be_able_to(:new, DirectMessage) } it { should be_able_to(:create, DirectMessage) } @@ -270,7 +258,6 @@ describe Abilities::Common do end describe "when level 3 verified" do - let(:own_spending_proposal) { create(:spending_proposal, author: user) } let(:own_direct_message) { create(:direct_message, sender: user) } before{ user.update(verified_at: Time.current) } @@ -278,10 +265,6 @@ describe Abilities::Common do it { should be_able_to(:vote, Proposal) } it { should be_able_to(:vote_featured, Proposal) } - it { should be_able_to(:create, SpendingProposal) } - it { should_not be_able_to(:destroy, create(:spending_proposal)) } - it { should_not be_able_to(:destroy, own_spending_proposal) } - it { should be_able_to(:new, DirectMessage) } it { should be_able_to(:create, DirectMessage) } it { should be_able_to(:show, own_direct_message) } diff --git a/spec/models/abilities/everyone_spec.rb b/spec/models/abilities/everyone_spec.rb index 59ba8cdbe..36fc20281 100644 --- a/spec/models/abilities/everyone_spec.rb +++ b/spec/models/abilities/everyone_spec.rb @@ -24,9 +24,6 @@ describe Abilities::Everyone do it { should be_able_to(:show, Comment) } - it { should be_able_to(:index, SpendingProposal) } - it { should_not be_able_to(:create, SpendingProposal) } - it { should be_able_to(:index, Budget) } it { should_not be_able_to(:manage, Dashboard::Action) } diff --git a/spec/models/geozone_spec.rb b/spec/models/geozone_spec.rb index cd2c4aaa8..3f3dfb9df 100644 --- a/spec/models/geozone_spec.rb +++ b/spec/models/geozone_spec.rb @@ -29,11 +29,6 @@ describe Geozone do expect(geozone).not_to be_safe_to_destroy end - it "is false when already linked to spending proposal" do - create(:spending_proposal, geozone: geozone) - expect(geozone).not_to be_safe_to_destroy - end - it "is false when already linked to debate" do create(:debate, geozone: geozone) expect(geozone).not_to be_safe_to_destroy diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb index 263a94216..6110a2ef9 100644 --- a/spec/models/signature_sheet_spec.rb +++ b/spec/models/signature_sheet_spec.rb @@ -47,13 +47,6 @@ describe SignatureSheet do expect(signature_sheet.name).to eq("Citizen proposal #{proposal.id}") end - it "returns name for spending proposal signature sheets" do - spending_proposal = create(:spending_proposal) - signature_sheet.signable = spending_proposal - - expect(signature_sheet.name).to eq("Investment project #{spending_proposal.id}") - end - it "returns name for budget investment signature sheets" do budget_investment = create(:budget_investment) signature_sheet.signable = budget_investment diff --git a/spec/support/common_actions/budgets.rb b/spec/support/common_actions/budgets.rb index 5f3f3c0a3..5e7658fee 100644 --- a/spec/support/common_actions/budgets.rb +++ b/spec/support/common_actions/budgets.rb @@ -10,4 +10,5 @@ module Budgets expect(page).to have_content "Remove" end end + end