diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index dbfcfea65..1efdc69b7 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -49,7 +49,6 @@ //= require forms //= require tracks //= require valuation_budget_investment_form -//= require valuation_spending_proposal_form //= require embed_video //= require fixed_bar //= require banners @@ -105,7 +104,6 @@ var initialize_modules = function() { App.Forms.initialize(); App.Tracks.initialize(); App.ValuationBudgetInvestmentForm.initialize(); - App.ValuationSpendingProposalForm.initialize(); App.EmbedVideo.initialize(); App.FixedBar.initialize(); App.Banners.initialize(); diff --git a/app/assets/javascripts/valuation_spending_proposal_form.js.coffee b/app/assets/javascripts/valuation_spending_proposal_form.js.coffee deleted file mode 100644 index 804077287..000000000 --- a/app/assets/javascripts/valuation_spending_proposal_form.js.coffee +++ /dev/null @@ -1,32 +0,0 @@ -App.ValuationSpendingProposalForm = - - showFeasibleFields: -> - $("#valuation_spending_proposal_edit_form #not_feasible_fields").hide("down") - $("#valuation_spending_proposal_edit_form #feasible_fields").show() - - showNotFeasibleFields: -> - $("#valuation_spending_proposal_edit_form #feasible_fields").hide("down") - $("#valuation_spending_proposal_edit_form #not_feasible_fields").show() - - showAllFields: -> - $("#valuation_spending_proposal_edit_form #feasible_fields").show("down") - $("#valuation_spending_proposal_edit_form #not_feasible_fields").show("down") - - showFeasibilityFields: -> - feasible = $("#valuation_spending_proposal_edit_form input[type=radio][name='spending_proposal[feasible]']:checked").val() - if feasible == "true" - App.ValuationSpendingProposalForm.showFeasibleFields() - else if feasible == "false" - App.ValuationSpendingProposalForm.showNotFeasibleFields() - - - showFeasibilityFieldsOnChange: -> - $("#valuation_spending_proposal_edit_form input[type=radio][name='spending_proposal[feasible]']").change -> - App.ValuationSpendingProposalForm.showAllFields() - App.ValuationSpendingProposalForm.showFeasibilityFields() - - - initialize: -> - App.ValuationSpendingProposalForm.showFeasibilityFields() - App.ValuationSpendingProposalForm.showFeasibilityFieldsOnChange() - false diff --git a/app/controllers/admin/valuators_controller.rb b/app/controllers/admin/valuators_controller.rb index cb1960529..10a5c6fdd 100644 --- a/app/controllers/admin/valuators_controller.rb +++ b/app/controllers/admin/valuators_controller.rb @@ -43,10 +43,6 @@ class Admin::ValuatorsController < Admin::BaseController redirect_to admin_valuators_path end - def summary - @valuators = Valuator.order(spending_proposals_count: :desc) - end - private def valuator_params diff --git a/app/controllers/valuation/spending_proposals_controller.rb b/app/controllers/valuation/spending_proposals_controller.rb deleted file mode 100644 index 04000f8f8..000000000 --- a/app/controllers/valuation/spending_proposals_controller.rb +++ /dev/null @@ -1,85 +0,0 @@ -class Valuation::SpendingProposalsController < Valuation::BaseController - include FeatureFlags - feature_flag :spending_proposals - - before_action :restrict_access_to_assigned_items, only: [:show, :edit, :valuate] - - has_filters %w{valuating valuation_finished}, only: :index - - load_and_authorize_resource - - def index - @geozone_filters = geozone_filters - @spending_proposals = if current_user.valuator? - SpendingProposal.scoped_filter(params_for_current_valuator, @current_filter) - .order(cached_votes_up: :desc) - .page(params[:page]) - else - SpendingProposal.none.page(params[:page]) - end - end - - def valuate - if valid_price_params? && @spending_proposal.update(valuation_params) - - if @spending_proposal.unfeasible_email_pending? - @spending_proposal.send_unfeasible_email - end - - redirect_to valuation_spending_proposal_path(@spending_proposal), notice: t("valuation.spending_proposals.notice.valuate") - else - render action: :edit - end - end - - private - - def geozone_filters - spending_proposals = SpendingProposal.by_valuator(current_user.valuator.try(:id)).valuation_open.all.to_a - - [ { name: t("valuation.spending_proposals.index.geozone_filter_all"), - id: nil, - pending_count: spending_proposals.size - }, - { name: t("geozones.none"), - id: "all", - pending_count: spending_proposals.count{|x| x.geozone_id.nil?} - } - ] + Geozone.all.order(name: :asc).collect do |g| - { name: g.name, - id: g.id, - pending_count: spending_proposals.count{|x| x.geozone_id == g.id} - } - end.select{ |x| x[:pending_count] > 0 } - end - - def valuation_params - params[:spending_proposal][:feasible] = nil if params[:spending_proposal][:feasible] == "nil" - - params.require(:spending_proposal).permit(:price, :price_first_year, :price_explanation, :feasible, :feasible_explanation, - :time_scope, :valuation_finished, :internal_comments) - end - - def params_for_current_valuator - params.merge(valuator_id: current_user.valuator.id) - end - - def restrict_access_to_assigned_items - return if current_user.administrator? || - ValuationAssignment.exists?(spending_proposal_id: params[:id], valuator_id: current_user.valuator.id) - raise ActionController::RoutingError.new("Not Found") - end - - def valid_price_params? - if /\D/.match params[:spending_proposal][:price] - @spending_proposal.errors.add(:price, I18n.t("spending_proposals.wrong_price_format")) - end - - if /\D/.match params[:spending_proposal][:price_first_year] - @spending_proposal.errors.add(:price_first_year, I18n.t("spending_proposals.wrong_price_format")) - end - - @spending_proposal.errors.empty? - end - -end diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index a72997dbf..c37e06f65 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -59,7 +59,6 @@ module Abilities can :manage, Dashboard::Action - can [:read, :update, :valuate, :destroy, :summary], SpendingProposal can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget can [:read, :create, :update, :destroy], Budget::Group can [:read, :create, :update, :destroy], Budget::Heading diff --git a/app/models/abilities/valuator.rb b/app/models/abilities/valuator.rb index 0e1213070..fcfa0a0c7 100644 --- a/app/models/abilities/valuator.rb +++ b/app/models/abilities/valuator.rb @@ -5,7 +5,6 @@ module Abilities def initialize(user) valuator = user.valuator - can [:read, :update, :valuate], SpendingProposal can [:read, :update, :comment_valuation], Budget::Investment, id: valuator.assigned_investment_ids can [:valuate], Budget::Investment, { id: valuator.assigned_investment_ids, valuation_finished: false } cannot [:update, :valuate, :comment_valuation], Budget::Investment, budget: { phase: "finished" } diff --git a/app/models/valuation_assignment.rb b/app/models/valuation_assignment.rb deleted file mode 100644 index 2aaea14fb..000000000 --- a/app/models/valuation_assignment.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ValuationAssignment < ApplicationRecord - belongs_to :valuator, counter_cache: :spending_proposals_count - belongs_to :spending_proposal, counter_cache: true -end diff --git a/app/models/valuator.rb b/app/models/valuator.rb index 70c0a8201..985984a78 100644 --- a/app/models/valuator.rb +++ b/app/models/valuator.rb @@ -4,8 +4,6 @@ class Valuator < ApplicationRecord delegate :name, :email, :name_and_email, to: :user - has_many :valuation_assignments, dependent: :destroy - has_many :spending_proposals, through: :valuation_assignments has_many :valuator_assignments, dependent: :destroy, class_name: "Budget::ValuatorAssignment" has_many :investments, through: :valuator_assignments, class_name: "Budget::Investment" diff --git a/app/views/admin/spending_proposals/_assigned_valuators.html.erb b/app/views/admin/spending_proposals/_assigned_valuators.html.erb deleted file mode 100644 index 09e144dcd..000000000 --- a/app/views/admin/spending_proposals/_assigned_valuators.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admin/spending_proposals/edit.html.erb b/app/views/admin/spending_proposals/edit.html.erb deleted file mode 100644 index 29438f28b..000000000 --- a/app/views/admin/spending_proposals/edit.html.erb +++ /dev/null @@ -1,75 +0,0 @@ -<%= link_to admin_spending_proposal_path(@spending_proposal, @filter_params.to_h), class: 'back' do %> - <%= t("admin.spending_proposals.show.back") %> -<% end %> - -<%= form_for @spending_proposal, - url: admin_spending_proposal_path(@spending_proposal) do |f| %> - - <% @filter_params.to_h.each do |filter_name, filter_value| %> - <%= hidden_field_tag filter_name, filter_value %> - <% end %> - -
-
- <%= f.text_field :title, maxlength: SpendingProposal.title_max_length %> -
- -
- <%= f.cktext_area :description, - maxlength: SpendingProposal.description_max_length, - ckeditor: { language: I18n.locale } %> -
- -
- <%= f.text_field :external_url %> -
- -
- <%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %> -
- -
- <%= f.text_field :association_name, placeholder: t("spending_proposals.form.association_name") %> -
-
- -

<%= t("admin.spending_proposals.edit.classification") %>

- -
- -
- <%= f.select(:administrator_id, - @admins.collect{ |a| [a.name_and_email, a.id ] }, - { include_blank: t("admin.spending_proposals.edit.undefined") }) %> -
- - -
- <%= f.label :tag_list, t("admin.spending_proposals.edit.tags") %> -
- <% @tags.each do |tag| %> - <%= tag.name %> - <% end %> -
- <%= f.text_field :tag_list, value: @spending_proposal.tag_list.to_s, - label: false, - placeholder: t("admin.spending_proposals.edit.tags_placeholder"), - class: "js-tag-list" %> -
- -
- <%= f.label :valuator_ids, t("admin.spending_proposals.edit.assigned_valuators") %> - - <%= f.collection_check_boxes :valuator_ids, @valuators, :id, :email do |b| %> - <%= b.label(title: valuator_label(b.object)) { b.check_box + truncate(b.object.description_or_email, length: 60) } %> - <% end %> -
-
- -

- <%= f.submit(class: "button", value: t("admin.spending_proposals.edit.submit_button")) %> -

-<% end %> - -
-<%= render "valuation/spending_proposals/written_by_valuators" %> diff --git a/app/views/admin/spending_proposals/show.html.erb b/app/views/admin/spending_proposals/show.html.erb deleted file mode 100644 index 6569a0036..000000000 --- a/app/views/admin/spending_proposals/show.html.erb +++ /dev/null @@ -1,50 +0,0 @@ -<%= link_to admin_spending_proposals_path(@filter_params.to_h), data: {no_turbolink: true} do %> - <%= t("admin.spending_proposals.show.back") %> -<% end %> - -<%= render "written_by_author" %> - -<%= link_to t("admin.spending_proposals.show.edit"), - edit_admin_spending_proposal_path(@spending_proposal, - @filter_params.to_h) %> - -
- -

<%= t("admin.spending_proposals.show.classification") %>

- -

<%= t("admin.spending_proposals.show.assigned_admin") %>: - <%= @spending_proposal.administrator.try(:name_and_email) || t("admin.spending_proposals.show.undefined") %> -

- -

- <%= t("admin.spending_proposals.show.tags") %>: - - <%= @spending_proposal.tags.pluck(:name).join(", ") %> -

- -

- <%= t("admin.spending_proposals.show.assigned_valuators") %>: - <% if @spending_proposal.valuators.any? %> - <%= @spending_proposal.valuators.collect(&:name_and_email).join(", ") %> - <% else %> - <%= t("admin.spending_proposals.show.undefined") %> - <% end %> -

- -

- <%= link_to t("admin.spending_proposals.show.edit_classification"), - edit_admin_spending_proposal_path(@spending_proposal, - {anchor: 'classification'}.merge(@filter_params.to_h)) %> -

- -
- -

<%= t("admin.spending_proposals.show.dossier") %>

- -<%= render "valuation/spending_proposals/written_by_valuators" %> - -

- <%= link_to t("admin.spending_proposals.show.edit_dossier"), - edit_valuation_spending_proposal_path(@spending_proposal) %> -

- diff --git a/app/views/admin/spending_proposals/summary.html.erb b/app/views/admin/spending_proposals/summary.html.erb deleted file mode 100644 index 3bd1da060..000000000 --- a/app/views/admin/spending_proposals/summary.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%= link_to admin_spending_proposals_path, class: "back" do %> - - <%= t("shared.back") %> -<% end %> - -

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

-
- <%= render "summary_table", - spending_proposals: @spending_proposals, - second_scope: "all" %> -
- -
-

<%= t("admin.spending_proposals.summary.title_proposals_with_supports") %>

- <%= render "summary_table", - spending_proposals: @spending_proposals_with_supports, - second_scope: "with_supports" %> -
diff --git a/app/views/admin/valuators/summary.html.erb b/app/views/admin/valuators/summary.html.erb deleted file mode 100644 index 19d1dde20..000000000 --- a/app/views/admin/valuators/summary.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<%= back_link_to %> - -

<%= t("admin.valuators.summary.title") %>

- - - - - - - - - - - <% @valuators.each do |valuator| %> - - - - - - - - - - <% end %> -
<%= t("admin.valuators.summary.valuator_name") %><%= t("admin.valuators.summary.finished_and_feasible_count") %><%= t("admin.valuators.summary.finished_and_unfeasible_count") %><%= t("admin.valuators.summary.finished_count") %><%= t("admin.valuators.summary.in_evaluation_count") %><%= t("admin.valuators.summary.total_count") %><%= t("admin.valuators.summary.cost") %>
- <%= valuator.description_or_email %> - - <%= valuator.spending_proposals.finished_and_feasible.count %> - - <%= valuator.spending_proposals.finished_and_unfeasible.count %> - - <%= valuator.spending_proposals.valuation_finished.count %> - - <%= valuator.spending_proposals.valuating.count %> - - <%= valuator.spending_proposals.count %> - - <%= number_to_currency(valuator.spending_proposals.sum(:price)) %> -
\ No newline at end of file diff --git a/app/views/valuation/_menu.html.erb b/app/views/valuation/_menu.html.erb index c8ff25700..e813a0dde 100644 --- a/app/views/valuation/_menu.html.erb +++ b/app/views/valuation/_menu.html.erb @@ -4,15 +4,6 @@ <%= link_to t("valuation.menu.title"), valuation_root_path %> - <% if feature?(:spending_proposals) %> -
  • > - <%= link_to valuation_spending_proposals_path do %> - - <%= t("valuation.menu.spending_proposals") %> - <% end %> -
  • - <% end %> - <% if feature?(:budgets) %>
  • > <%= link_to valuation_budgets_path do %> diff --git a/app/views/valuation/spending_proposals/_written_by_valuators.html.erb b/app/views/valuation/spending_proposals/_written_by_valuators.html.erb deleted file mode 100644 index 8b704950e..000000000 --- a/app/views/valuation/spending_proposals/_written_by_valuators.html.erb +++ /dev/null @@ -1,53 +0,0 @@ -

    - - <%= t("valuation.spending_proposals.show.price") %> - (<%= t("valuation.spending_proposals.show.currency") %>): - - <% if @spending_proposal.price.present? %> - <%= @spending_proposal.price %> - <% else %> - <%= t("valuation.spending_proposals.show.undefined") %> - <% end %> -

    - -

    - - <%= t("valuation.spending_proposals.show.price_first_year") %> - (<%= t("valuation.spending_proposals.show.currency") %>): - - - <% if @spending_proposal.price_first_year.present? %> - <%= @spending_proposal.price_first_year %> - <% else %> - <%= t("valuation.spending_proposals.show.undefined") %> - <% end %> -

    - -<%= explanation_field @spending_proposal.price_explanation %> - -

    - <%= t("valuation.spending_proposals.show.time_scope") %>: - <% if @spending_proposal.time_scope.present? %> - <%= @spending_proposal.time_scope %> - <% else %> - <%= t("valuation.spending_proposals.show.undefined") %> - <% end %> -

    - -

    - <%= t("valuation.spending_proposals.show.feasibility") %>: - <%= t("valuation.spending_proposals.show.#{@spending_proposal.feasibility}") %> -

    - -<%= explanation_field @spending_proposal.feasible_explanation %> - -<% if @spending_proposal.valuation_finished %> -

    - <%= t("valuation.spending_proposals.show.valuation_finished") %> -

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

    <%= t("valuation.spending_proposals.show.internal_comments") %>

    - <%= explanation_field @spending_proposal.internal_comments %> -<% end %> diff --git a/app/views/valuation/spending_proposals/edit.html.erb b/app/views/valuation/spending_proposals/edit.html.erb deleted file mode 100644 index a3b6bb603..000000000 --- a/app/views/valuation/spending_proposals/edit.html.erb +++ /dev/null @@ -1,147 +0,0 @@ -<%= link_to "#{t("valuation.spending_proposals.show.heading")} #{@spending_proposal.id}", valuation_spending_proposal_path(@spending_proposal), class: "back" %> -

    <%= t("valuation.spending_proposals.edit.dossier") %>

    - -<%= form_for(@spending_proposal, url: valuate_valuation_spending_proposal_path(@spending_proposal), html: {id: "valuation_spending_proposal_edit_form"}) do |f| %> - <%= render "shared/errors", resource: @spending_proposal %> -
    -
    -
    - <%= t("valuation.spending_proposals.edit.feasibility") %> -
    - - <%= f.radio_button :feasible, :nil, label: false, checked: @spending_proposal.feasible.nil? %> - <%= f.label :feasible_nil, t("valuation.spending_proposals.edit.undefined_feasible") %> - -
    - -
    - - <%= f.radio_button :feasible, true, value: true, label: false %> - <%= f.label :feasible_true, t("valuation.spending_proposals.edit.feasible") %> - -
    - -
    - - <%= f.radio_button :feasible, false, value: false, label: false %> - <%= f.label :feasible_false, t("valuation.spending_proposals.edit.not_feasible") %> - -
    -
    -
    -
    - -
    - -
    -
    - <%= f.label :feasible_explanation, t("valuation.spending_proposals.edit.feasible_explanation_html") %> - <%= f.text_area :feasible_explanation, label: false, rows: 3 %> -
    -
    - -
    - -
    - -
    -
    - <%= f.label :price, "#{t("valuation.spending_proposals.edit.price_html", currency: t("valuation.spending_proposals.edit.currency"))}" %> - <%= f.number_field :price, label: false, max: 1000000000000000 %> -
    - -
    - <%= f.label :price_first_year, "#{t("valuation.spending_proposals.edit.price_first_year_html", currency: t("valuation.spending_proposals.edit.currency"))}" %> - <%= f.number_field :price_first_year, label: false, max: 1000000000000000 %> -
    -
    - -
    -
    - <%= f.label :price_explanation, t("valuation.spending_proposals.edit.price_explanation_html") %> - <%= f.text_area :price_explanation, label: false, rows: 3 %> -
    -
    - -
    -
    - <%= f.label :time_scope, t("valuation.spending_proposals.edit.time_scope_html") %> - <%= f.text_field :time_scope, label: false %> -
    -
    - -
    - -
    -
    - <%= f.label :valuation_finished do %> - <%= f.check_box :valuation_finished, title: t("valuation.spending_proposals.edit.valuation_finished"), label: false %> - <%= t("valuation.spending_proposals.edit.valuation_finished") %> - <% end %> -
    -
    - -
    -
    - <%= f.label :internal_comments, t("valuation.spending_proposals.edit.internal_comments_html") %> - <%= f.text_area :internal_comments, label: false, rows: 3 %> -
    -
    - -
    -
    - <%= f.submit(class: "button expanded large", value: t("valuation.spending_proposals.edit.save")) %> -
    -
    -<% end %> - -

    <%= @spending_proposal.title %>

    - -<%= safe_html_with_links @spending_proposal.description %> - -<% if @spending_proposal.external_url.present? %> -

    <%= text_with_links @spending_proposal.external_url %>

    -<% end %> - -

    <%= t("valuation.spending_proposals.show.info") %>

    - -

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

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

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

    -<% end %> - -

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

    - -

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

    - -

    <%= t("valuation.spending_proposals.show.responsibles") %>

    - -

    <%= t("valuation.spending_proposals.show.assigned_admin") %>: - <% if @spending_proposal.administrator.present? %> - <%= @spending_proposal.administrator.name %> (<%= @spending_proposal.administrator.email %>) - <% else %> - <%= t("valuation.spending_proposals.show.undefined") %> - <% end %> -

    - -

    <%= t("valuation.spending_proposals.show.assigned_valuators") %>:

    -
    - -
    diff --git a/app/views/valuation/spending_proposals/index.html.erb b/app/views/valuation/spending_proposals/index.html.erb deleted file mode 100644 index b4ff03a0f..000000000 --- a/app/views/valuation/spending_proposals/index.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -

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

    - -
    - <% @geozone_filters.each_slice(8) do |slice| %> -
    - <% slice.each do |filter| %> - <%= link_to valuation_spending_proposals_path(geozone_id: filter[:id]), - class: "#{"is-active" if params[:geozone_id].to_s == filter[:id].to_s}" do %> - <%= filter[:name] %> (<%= filter[:pending_count] %>) - <% end %> - <% end %> -
    - <% end %> -
    - -<%= render "shared/filter_subnav", i18n_namespace: "valuation.spending_proposals.index" %> - -

    <%= page_entries_info @spending_proposals %>

    - - - <% @spending_proposals.each do |spending_proposal| %> - - - - - - - - <% end %> -
    - <%= spending_proposal.id %> - - <%= link_to spending_proposal.title, valuation_spending_proposal_path(spending_proposal) %> - - <%= link_to t("valuation.spending_proposals.index.edit"), edit_valuation_spending_proposal_path(spending_proposal) %> - - <%= assigned_valuators_info(spending_proposal.valuators) %> - - <%= geozone_name(spending_proposal) %> -
    - -<%= paginate @spending_proposals %> diff --git a/app/views/valuation/spending_proposals/show.html.erb b/app/views/valuation/spending_proposals/show.html.erb deleted file mode 100644 index 4456432e6..000000000 --- a/app/views/valuation/spending_proposals/show.html.erb +++ /dev/null @@ -1,61 +0,0 @@ -<%= back_link_to %> - -

    <%= t("valuation.spending_proposals.show.heading") %> <%= @spending_proposal.id %>

    -

    <%= @spending_proposal.title %>

    - -<%= safe_html_with_links @spending_proposal.description %> - -<% if @spending_proposal.external_url.present? %> -

    <%= text_with_links @spending_proposal.external_url %>

    -<% end %> - -

    <%= t("valuation.spending_proposals.show.info") %>

    - -

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

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

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

    -<% end %> - -

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

    - -

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

    - -

    <%= t("valuation.spending_proposals.show.responsibles") %>

    - -

    <%= t("valuation.spending_proposals.show.assigned_admin") %>: - <% if @spending_proposal.administrator.present? %> - <%= @spending_proposal.administrator.name_and_email %> - <% else %> - <%= t("valuation.spending_proposals.show.undefined") %> - <% end %> -

    - -

    <%= t("valuation.spending_proposals.show.assigned_valuators") %>:

    -
    - -
    - -

    <%= t("valuation.spending_proposals.show.dossier") %>

    - -

    - <%= link_to t("valuation.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %> -

    - -<%= render "written_by_valuators" %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index c4c4b55e6..0f8a228b9 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -168,7 +168,6 @@ ignore_unused: - "moderation.budget_investments.index.order*" - "moderation.proposal_notifications.index.filter*" - "moderation.proposal_notifications.index.order*" - - "valuation.spending_proposals.index.filter*" - "valuation.budgets.index.filter*" - "valuation.budget_investments.index.filter*" - "users.show.filters.*" diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 5653a0712..b33e5dd84 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -715,7 +715,6 @@ en: content_block: update: "Update Block" title_moderated_content: Moderated content - title_budgets: Budgets title_profiles: Profiles title_settings: Settings title_site_customization: Site content @@ -906,15 +905,6 @@ en: delete: Delete search: title: "Valuators: User search" - summary: - title: Valuator summary for investment projects - valuator_name: Valuator - finished_and_feasible_count: Finished and feasible - finished_and_unfeasible_count: Finished and unfeasible - finished_count: Finished - in_evaluation_count: In evaluation - total_count: Total - cost: Cost form: edit_title: "Valuators: Edit valuator" update: "Update valuator" @@ -1378,16 +1368,6 @@ en: tags: Tags tags_placeholder: "Write the tags you want separated by commas (,)" undefined: Undefined - summary: - title: Summary for investment projects - title_proposals_with_supports: Summary for investment projects with supports - geozone_name: Scope - finished_and_feasible_count: Finished and feasible - finished_and_unfeasible_count: Finished and unfeasible - finished_count: Finished - in_evaluation_count: In evaluation - total_count: Total - cost_for_geozone: Cost geozones: index: title: Geozone diff --git a/config/locales/en/valuation.yml b/config/locales/en/valuation.yml index b918020af..fbf8c9359 100644 --- a/config/locales/en/valuation.yml +++ b/config/locales/en/valuation.yml @@ -5,7 +5,6 @@ en: menu: title: Valuation budgets: Participatory budgets - spending_proposals: Spending proposals budgets: index: title: Participatory budgets @@ -77,52 +76,3 @@ en: valuate: "Dossier updated" valuation_comments: Valuation comments not_in_valuating_phase: Investments can only be valuated when Budget is in valuating phase - spending_proposals: - index: - geozone_filter_all: All zones - filters: - valuation_open: Open - valuating: Under valuation - valuation_finished: Valuation finished - title: Investment projects for participatory budgeting - edit: Edit - show: - back: Back - heading: Investment project - info: Author info - association_name: Association - by: Sent by - sent: Sent at - geozone: Scope - dossier: Dossier - edit_dossier: Edit dossier - price: Price - price_first_year: Cost during the first year - currency: "€" - feasibility: Feasibility - feasible: Feasible - not_feasible: Not feasible - undefined: Undefined - valuation_finished: Valuation finished - time_scope: Time scope - internal_comments: Internal comments - responsibles: Responsibles - assigned_admin: Assigned admin - assigned_valuators: Assigned valuators - edit: - dossier: Dossier - price_html: "Price (%{currency})" - price_first_year_html: "Cost during the first year (%{currency})" - currency: "€" - price_explanation_html: Price explanation - feasibility: Feasibility - feasible: Feasible - not_feasible: Not feasible - undefined_feasible: Pending - feasible_explanation_html: Feasibility explanation - valuation_finished: Valuation finished - time_scope_html: Time scope - internal_comments_html: Internal comments - save: Save changes - notice: - valuate: "Dossier updated" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 05183ebc6..68f9099b9 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -905,15 +905,6 @@ es: delete: Borrar search: title: "Evaluadores: Búsqueda de usuarios" - summary: - title: Resumen de evaluación de proyectos de gasto - valuator_name: Evaluador - 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: Coste total form: edit_title: "Evaluadores: Editar evaluador" update: "Actualizar evaluador" diff --git a/config/locales/es/valuation.yml b/config/locales/es/valuation.yml index 9d33bea2b..5117c43c9 100644 --- a/config/locales/es/valuation.yml +++ b/config/locales/es/valuation.yml @@ -5,7 +5,6 @@ es: menu: title: Evaluación budgets: Presupuestos participativos - spending_proposals: Propuestas de inversión budgets: index: title: Presupuestos participativos @@ -77,52 +76,3 @@ es: valuate: "Dossier actualizado" valuation_comments: Comentarios de evaluación not_in_valuating_phase: Los proyectos sólo pueden ser evaluados cuando el Presupuesto esté en fase de evaluación - spending_proposals: - index: - geozone_filter_all: Todos los ámbitos de actuación - filters: - valuation_open: Abiertas - valuating: En evaluación - valuation_finished: Evaluación finalizada - title: Propuestas de inversión para presupuestos participativos - edit: Editar - show: - back: Volver - heading: Propuesta de inversión - info: Datos de envío - association_name: Asociación - by: Enviada por - sent: Fecha de creación - geozone: Ámbito de actuación - dossier: Informe - edit_dossier: Editar informe - price: Coste - price_first_year: Coste en el primer año - currency: "€" - feasibility: Viabilidad - feasible: Viable - not_feasible: No viable - undefined: Sin definir - valuation_finished: Informe finalizado - time_scope: Plazo de ejecución - internal_comments: Comentarios internos - responsibles: Responsables - assigned_admin: Administrador asignado - assigned_valuators: Evaluadores asignados - edit: - dossier: Informe - price_html: "Coste (%{currency}) (dato público)" - price_first_year_html: "Coste en el primer año (%{currency}) (opcional, privado)" - currency: "€" - price_explanation_html: Informe de coste (opcional, dato público) - feasibility: Viabilidad - feasible: Viable - not_feasible: Inviable - undefined_feasible: Sin decidir - feasible_explanation_html: Informe de inviabilidad (en caso de que lo sea, dato público) - valuation_finished: Informe finalizado - time_scope_html: Plazo de ejecución (opcional, dato no público) - internal_comments_html: Comentarios y observaciones (para responsables internos, dato no público) - save: Guardar cambios - notice: - valuate: "Informe actualizado" diff --git a/config/routes/valuation.rb b/config/routes/valuation.rb index 743bc1c72..560e26bef 100644 --- a/config/routes/valuation.rb +++ b/config/routes/valuation.rb @@ -1,10 +1,6 @@ namespace :valuation do root to: "budgets#index" - resources :spending_proposals, only: [:index, :show, :edit] do - patch :valuate, on: :member - end - resources :budgets, only: :index do resources :budget_investments, only: [:index, :show, :edit] do patch :valuate, on: :member diff --git a/db/dev_seeds/spending_proposals.rb b/db/dev_seeds/spending_proposals.rb index 149b56ee5..3e140561d 100644 --- a/db/dev_seeds/spending_proposals.rb +++ b/db/dev_seeds/spending_proposals.rb @@ -22,9 +22,3 @@ section "Creating Spending Proposals" do terms_of_service: "1") end end - -section "Creating Valuation Assignments" do - (1..17).to_a.sample.times do - SpendingProposal.all.sample.valuators << Valuator.first - end -end diff --git a/db/migrate/20190311220711_destroy_spending_proposal_valuations.rb b/db/migrate/20190311220711_destroy_spending_proposal_valuations.rb new file mode 100644 index 000000000..5f58e8469 --- /dev/null +++ b/db/migrate/20190311220711_destroy_spending_proposal_valuations.rb @@ -0,0 +1,5 @@ +class DestroySpendingProposalValuations < ActiveRecord::Migration + def change + drop_table :valuation_assignments + end +end diff --git a/spec/models/abilities/administrator_spec.rb b/spec/models/abilities/administrator_spec.rb index ab15b8956..1d1acb222 100644 --- a/spec/models/abilities/administrator_spec.rb +++ b/spec/models/abilities/administrator_spec.rb @@ -67,11 +67,6 @@ describe Abilities::Administrator do it { should be_able_to(:comment_as_administrator, legislation_question) } it { should_not be_able_to(:comment_as_moderator, legislation_question) } - it { should be_able_to(:read, SpendingProposal) } - it { should be_able_to(:update, SpendingProposal) } - it { should be_able_to(:valuate, SpendingProposal) } - it { should be_able_to(:destroy, SpendingProposal) } - it { should be_able_to(:create, Budget) } it { should be_able_to(:update, Budget) } it { should be_able_to(:read_results, Budget) } diff --git a/spec/models/abilities/valuator_spec.rb b/spec/models/abilities/valuator_spec.rb index c9764c831..096206389 100644 --- a/spec/models/abilities/valuator_spec.rb +++ b/spec/models/abilities/valuator_spec.rb @@ -21,9 +21,11 @@ describe Abilities::Valuator do finished_assigned_investment.valuators << valuator end - it { should be_able_to(:read, SpendingProposal) } - it { should be_able_to(:update, SpendingProposal) } - it { should be_able_to(:valuate, SpendingProposal) } + it "cannot valuate an assigned investment with a finished valuation" do + assigned_investment.update(valuation_finished: true) + + should_not be_able_to(:valuate, assigned_investment) + end it "cannot valuate an assigned investment with a finished valuation" do assigned_investment.update(valuation_finished: true)