Merge branch 'master' into legislation-module-stable
This commit is contained in:
@@ -70,6 +70,11 @@ a {
|
||||
}
|
||||
}
|
||||
|
||||
.button.hollow {
|
||||
border: 1px solid $link;
|
||||
color: $link;
|
||||
}
|
||||
|
||||
.postfix.button {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ module Budgets
|
||||
end
|
||||
|
||||
def destroy
|
||||
investment.destroy
|
||||
@investment.destroy
|
||||
redirect_to user_path(current_user, filter: 'budget_investments'), notice: t('flash.actions.destroy.budget_investment')
|
||||
end
|
||||
|
||||
|
||||
@@ -38,4 +38,8 @@ module BudgetsHelper
|
||||
def current_ballot
|
||||
Budget::Ballot.where(user: current_user, budget: @budget).first
|
||||
end
|
||||
|
||||
def investment_tags_select_options
|
||||
Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,6 +46,7 @@ module Abilities
|
||||
can :create, SpendingProposal
|
||||
|
||||
can :create, Budget::Investment, budget: { phase: "accepting" }
|
||||
can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id
|
||||
can :vote, Budget::Investment, budget: { phase: "selecting" }
|
||||
can [:show, :create], Budget::Ballot, budget: { phase: "balloting" }
|
||||
can [:create, :destroy], Budget::Ballot::Line, budget: { phase: "balloting" }
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= select_tag :tag_name,
|
||||
options_for_select(spending_proposal_tags_select_options, params[:tag_name]),
|
||||
options_for_select(investment_tags_select_options, params[:tag_name]),
|
||||
{ prompt: t("admin.budget_investments.index.tags_filter_all"),
|
||||
label: false,
|
||||
class: "js-submit-on-change" } %>
|
||||
|
||||
@@ -7,23 +7,24 @@
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<% if headings.blank? %>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_heading") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.form.table_heading") %></th>
|
||||
<th><%= t("admin.budgets.form.table_amount") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% end %>
|
||||
<% if headings.blank? %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_heading") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.form.table_heading") %></th>
|
||||
<th><%= t("admin.budgets.form.table_amount") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% end %>
|
||||
|
||||
<!-- new heading form -->
|
||||
<tr id="group-<%= group.id %>-new-heading-form" style="display:none">
|
||||
@@ -52,16 +53,15 @@
|
||||
<!-- /. new heading form -->
|
||||
<!-- headings list -->
|
||||
<% headings.each do |heading| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= heading.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.price %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<%= heading.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.price %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- /. headings list -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
<% if browser.device.mobile? %>
|
||||
<a href="whatsapp://send?text=<%= investment.title %> <%= budget_investment_url(budget_id: investment.budget_id, id: investment.id) %>" data-action="share/whatsapp/share">
|
||||
<span class="icon-whatsapp whatsapp"></span>
|
||||
<span class="sr-only"><%= t("social.whatsapp") %></span>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<% if browser.device.mobile? %>
|
||||
<a href="whatsapp://send?text=<%= @debate.title %> <%= debate_url(@debate) %>" data-action="share/whatsapp/share">
|
||||
<span class="icon-whatsapp whatsapp"></span>
|
||||
<span class="sr-only"><%= t("social.whatsapp") %></span>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<ul class="tabs" data-tabs id="example-tabs">
|
||||
<ul class="tabs" data-tabs id="proposals-tabs">
|
||||
<li class="tabs-title is-active">
|
||||
<%= link_to "#tab-comments" do %>
|
||||
<h3>
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
<% if browser.device.mobile? %>
|
||||
<a href="whatsapp://send?text=<%= @proposal.title %> <%= proposal_url(@proposal) %>" data-action="share/whatsapp/share">
|
||||
<span class="icon-whatsapp whatsapp"></span>
|
||||
<span class="sr-only"><%= t("social.whatsapp") %></span>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -136,7 +137,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="tabs-content" data-tabs-content="example-tabs">
|
||||
<div class="tabs-content" data-tabs-content="proposals-tabs" role="tablist">
|
||||
<%= render "proposals/filter_subnav" %>
|
||||
<%= render "proposals/notifications" %>
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<% if browser.device.mobile? %>
|
||||
<a href="whatsapp://send?text=<%= @spending_proposal.title %> <%= spending_proposal_url(@spending_proposal) %>" data-action="share/whatsapp/share">
|
||||
<span class="icon-whatsapp whatsapp"></span>
|
||||
<span class="sr-only"><%= t("social.whatsapp") %></span>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
<td>
|
||||
<%= link_to budget_investment.title, budget_investment_path(budget_investment.budget, budget_investment) %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<% if can? :destroy, budget_investment %>
|
||||
<%= link_to t('shared.delete'), budget_investment_path(budget_investment.budget, budget_investment),
|
||||
method: :delete, class: "button hollow alert" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
@@ -200,7 +200,7 @@ en:
|
||||
external_link_transparency: Transparency
|
||||
external_link_transparency_url: https://transparency.consul
|
||||
locale: 'Language:'
|
||||
logo: Consul
|
||||
logo: Consul logo
|
||||
management: Management
|
||||
moderation: Moderation
|
||||
valuation: Valuation
|
||||
@@ -435,6 +435,7 @@ en:
|
||||
search: 'Filter'
|
||||
title: 'Advanced search'
|
||||
to: 'To'
|
||||
delete: Delete
|
||||
author_info:
|
||||
author_deleted: User deleted
|
||||
back: Go back
|
||||
@@ -479,6 +480,7 @@ en:
|
||||
facebook: Facebook
|
||||
twitter: Twitter
|
||||
youtube: YouTube
|
||||
whatsapp: WhatsApp
|
||||
spending_proposals:
|
||||
form:
|
||||
association_name_label: 'If you propose in name of an assocation or collective add the name here'
|
||||
|
||||
@@ -200,7 +200,7 @@ es:
|
||||
external_link_transparency: Transparencia
|
||||
external_link_transparency_url: https://transparency.consul
|
||||
locale: 'Idioma:'
|
||||
logo: Consul
|
||||
logo: Consul logo
|
||||
management: Gestión
|
||||
moderation: Moderar
|
||||
valuation: Evaluación
|
||||
@@ -435,6 +435,7 @@ es:
|
||||
search: 'Filtrar'
|
||||
title: 'Búsqueda avanzada'
|
||||
to: 'Hasta'
|
||||
delete: 'Borrar'
|
||||
author_info:
|
||||
author_deleted: Usuario eliminado
|
||||
back: Volver
|
||||
@@ -479,6 +480,7 @@ es:
|
||||
facebook: Facebook
|
||||
twitter: Twitter
|
||||
youtube: YouTube
|
||||
whatsapp: WhatsApp
|
||||
spending_proposals:
|
||||
form:
|
||||
association_name_label: 'Si propones en nombre de una asociación o colectivo añade el nombre aquí'
|
||||
|
||||
@@ -874,7 +874,7 @@ fr:
|
||||
external_link_transparency: Transparence
|
||||
external_link_transparency_url: https://transparency.consul
|
||||
locale: 'Langue :'
|
||||
logo: Consul
|
||||
logo: Consul logo
|
||||
moderation: Modération
|
||||
more_information: Plus d'information
|
||||
my_account_link: Mon compte
|
||||
|
||||
@@ -860,7 +860,7 @@ pt-BR:
|
||||
external_link_transparency: Transparência
|
||||
external_link_transparency_url: https://transparency.consul
|
||||
locale: 'Idioma:'
|
||||
logo: Consul
|
||||
logo: Consul logotipo
|
||||
moderation: Moderação
|
||||
more_information: Mais informações
|
||||
my_account_link: Minha conta
|
||||
|
||||
@@ -16,4 +16,4 @@ en:
|
||||
tumblr: "Tumblr"
|
||||
plurk: "Plurk"
|
||||
pinterest: "Pinterest"
|
||||
email: "Email"
|
||||
email: "Email"
|
||||
@@ -16,4 +16,4 @@ es:
|
||||
tumblr: "Tumblr"
|
||||
plurk: "Plurk"
|
||||
pinterest: "Pinterest"
|
||||
email: "Correo electrónico"
|
||||
email: "Correo electrónico"
|
||||
@@ -331,7 +331,7 @@ Rails.application.routes.draw do
|
||||
get :support_investments
|
||||
get :print_investments
|
||||
end
|
||||
resources :investments, only: [:index, :new, :create, :show], controller: 'budgets/investments' do
|
||||
resources :investments, only: [:index, :new, :create, :show, :destroy], controller: 'budgets/investments' do
|
||||
post :vote, on: :member
|
||||
get :print, on: :collection
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Error 404 | Not found</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Error 422 | The change you wanted was rejected</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Error 500 | Internal server error</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
@@ -252,6 +252,21 @@ feature 'Admin budget investments' do
|
||||
expect(page).to have_content("More schools")
|
||||
end
|
||||
|
||||
scenario "Filtering by tag, display only valuation tags" do
|
||||
investment1 = create(:budget_investment, budget: @budget, tag_list: 'Education')
|
||||
investment2 = create(:budget_investment, budget: @budget, tag_list: 'Health')
|
||||
|
||||
investment1.set_tag_list_on(:valuation, 'Teachers')
|
||||
investment2.set_tag_list_on(:valuation, 'Hospitals')
|
||||
|
||||
investment1.save
|
||||
investment2.save
|
||||
|
||||
visit admin_budget_budget_investments_path(budget_id: @budget.id)
|
||||
|
||||
expect(page).to have_select("tag_name", options: ["All tags", "Hospitals", "Teachers"])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario 'Show' do
|
||||
|
||||
@@ -315,6 +315,20 @@ feature 'Budget Investments' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Author can destroy while on the accepting phase" do
|
||||
user = create(:user, :level_two)
|
||||
sp1 = create(:budget_investment, heading: heading, price: 10000, author: user)
|
||||
|
||||
login_as(user)
|
||||
visit user_path(user, tab: :budget_investments)
|
||||
|
||||
within("#budget_investment_#{sp1.id}") do
|
||||
expect(page).to have_content(sp1.title)
|
||||
click_link('Delete')
|
||||
end
|
||||
|
||||
visit user_path(user, tab: :budget_investments)
|
||||
end
|
||||
end
|
||||
|
||||
context "Selecting Phase" do
|
||||
@@ -476,6 +490,8 @@ feature 'Budget Investments' do
|
||||
expect(page).to have_content "€10,000"
|
||||
end
|
||||
|
||||
|
||||
|
||||
scenario "Sidebar in show should display vote text" do
|
||||
investment = create(:budget_investment, :selected, budget: budget)
|
||||
visit budget_investment_path(budget, investment)
|
||||
@@ -561,4 +577,4 @@ feature 'Budget Investments' do
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,12 +10,18 @@ describe "Abilities::Common" do
|
||||
let(:comment) { create(:comment) }
|
||||
let(:proposal) { create(:proposal) }
|
||||
let(:accepting_budget) { create(:budget, phase: 'accepting') }
|
||||
let(:reviewing_budget) { create(:budget, phase: 'reviewing') }
|
||||
let(:selecting_budget) { create(:budget, phase: 'selecting') }
|
||||
let(:balloting_budget) { create(:budget, phase: 'balloting') }
|
||||
|
||||
let(:investment_in_accepting_budget) { create(:budget_investment, budget: accepting_budget) }
|
||||
let(:investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget) }
|
||||
let(:investment_in_selecting_budget) { create(:budget_investment, budget: selecting_budget) }
|
||||
let(:investment_in_balloting_budget) { create(:budget_investment, budget: balloting_budget) }
|
||||
let(:own_investment_in_accepting_budget) { create(:budget_investment, budget: accepting_budget, author: user) }
|
||||
let(:own_investment_in_reviewing_budget) { create(:budget_investment, budget: reviewing_budget, author: user) }
|
||||
let(:own_investment_in_selecting_budget) { create(:budget_investment, budget: selecting_budget, author: user) }
|
||||
let(:own_investment_in_balloting_budget) { create(:budget_investment, budget: balloting_budget, author: user) }
|
||||
let(:ballot_in_accepting_budget) { create(:budget_ballot, budget: accepting_budget) }
|
||||
let(:ballot_in_selecting_budget) { create(:budget_ballot, budget: selecting_budget) }
|
||||
let(:ballot_in_balloting_budget) { create(:budget_ballot, budget: balloting_budget) }
|
||||
@@ -117,6 +123,16 @@ describe "Abilities::Common" do
|
||||
it { should be_able_to(:vote, investment_in_selecting_budget) }
|
||||
it { should_not be_able_to(:vote, investment_in_balloting_budget) }
|
||||
|
||||
it { should_not be_able_to(:destroy, investment_in_accepting_budget) }
|
||||
it { should_not be_able_to(:destroy, investment_in_reviewing_budget) }
|
||||
it { should_not be_able_to(:destroy, investment_in_selecting_budget) }
|
||||
it { should_not be_able_to(:destroy, investment_in_balloting_budget) }
|
||||
|
||||
it { should be_able_to(:destroy, own_investment_in_accepting_budget) }
|
||||
it { should be_able_to(:destroy, own_investment_in_reviewing_budget) }
|
||||
it { should_not be_able_to(:destroy, own_investment_in_selecting_budget) }
|
||||
it { should_not be_able_to(:destroy, investment_in_balloting_budget) }
|
||||
|
||||
it { should_not be_able_to(:create, ballot_in_accepting_budget) }
|
||||
it { should_not be_able_to(:create, ballot_in_selecting_budget) }
|
||||
it { should be_able_to(:create, ballot_in_balloting_budget) }
|
||||
|
||||
Reference in New Issue
Block a user