Merge pull request #824 from consul/spending_proposals_cancancan
Uses Abilities instead of exceptions in the proposals controller
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -24,7 +24,7 @@ gem 'devise'
|
|||||||
gem 'omniauth'
|
gem 'omniauth'
|
||||||
gem 'omniauth-twitter'
|
gem 'omniauth-twitter'
|
||||||
gem 'omniauth-facebook', '~> 3.0.0'
|
gem 'omniauth-facebook', '~> 3.0.0'
|
||||||
gem 'omniauth-google-oauth2', '~> 0.2.10'
|
gem 'omniauth-google-oauth2', '~> 0.3.0'
|
||||||
|
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'ancestry'
|
gem 'ancestry'
|
||||||
|
|||||||
38
Gemfile.lock
38
Gemfile.lock
@@ -67,9 +67,9 @@ GEM
|
|||||||
arel (6.0.3)
|
arel (6.0.3)
|
||||||
ast (2.2.0)
|
ast (2.2.0)
|
||||||
bcrypt (3.1.10)
|
bcrypt (3.1.10)
|
||||||
browser (1.0.1)
|
browser (1.1.0)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
bullet (4.14.10)
|
bullet (5.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.9.0)
|
uniform_notifier (~> 1.9.0)
|
||||||
byebug (8.2.1)
|
byebug (8.2.1)
|
||||||
@@ -96,7 +96,7 @@ GEM
|
|||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
xpath (~> 2.0)
|
xpath (~> 2.0)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
ckeditor (4.1.5)
|
ckeditor (4.1.6)
|
||||||
cocaine
|
cocaine
|
||||||
orm_adapter (~> 0.5.0)
|
orm_adapter (~> 0.5.0)
|
||||||
climate_control (0.0.3)
|
climate_control (0.0.3)
|
||||||
@@ -173,7 +173,7 @@ GEM
|
|||||||
fuubar (2.0.0)
|
fuubar (2.0.0)
|
||||||
rspec (~> 3.0)
|
rspec (~> 3.0)
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.4)
|
||||||
geocoder (1.2.13)
|
geocoder (1.2.14)
|
||||||
globalid (0.3.6)
|
globalid (0.3.6)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
groupdate (2.5.0)
|
groupdate (2.5.0)
|
||||||
@@ -229,7 +229,7 @@ GEM
|
|||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
net-scp (1.2.1)
|
net-scp (1.2.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (3.0.1)
|
net-ssh (3.0.2)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
newrelic_rpm (3.14.1.311)
|
newrelic_rpm (3.14.1.311)
|
||||||
nokogiri (1.6.7.1)
|
nokogiri (1.6.7.1)
|
||||||
@@ -247,23 +247,23 @@ GEM
|
|||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
omniauth-facebook (3.0.0)
|
omniauth-facebook (3.0.0)
|
||||||
omniauth-oauth2 (~> 1.2)
|
omniauth-oauth2 (~> 1.2)
|
||||||
omniauth-google-oauth2 (0.2.10)
|
omniauth-google-oauth2 (0.3.0)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
jwt (~> 1.0)
|
jwt (~> 1.0)
|
||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
omniauth (>= 1.1.1)
|
omniauth (>= 1.1.1)
|
||||||
omniauth-oauth2 (~> 1.3.1)
|
omniauth-oauth2 (>= 1.3.1)
|
||||||
omniauth-oauth (1.1.0)
|
omniauth-oauth (1.1.0)
|
||||||
oauth
|
oauth
|
||||||
omniauth (~> 1.0)
|
omniauth (~> 1.0)
|
||||||
omniauth-oauth2 (1.3.1)
|
omniauth-oauth2 (1.4.0)
|
||||||
oauth2 (~> 1.0)
|
oauth2 (~> 1.0)
|
||||||
omniauth (~> 1.2)
|
omniauth (~> 1.2)
|
||||||
omniauth-twitter (1.2.1)
|
omniauth-twitter (1.2.1)
|
||||||
json (~> 1.3)
|
json (~> 1.3)
|
||||||
omniauth-oauth (~> 1.1)
|
omniauth-oauth (~> 1.1)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
paranoia (2.1.4)
|
paranoia (2.1.5)
|
||||||
activerecord (~> 4.0)
|
activerecord (~> 4.0)
|
||||||
parser (2.2.3.0)
|
parser (2.2.3.0)
|
||||||
ast (>= 1.1, < 3.0)
|
ast (>= 1.1, < 3.0)
|
||||||
@@ -312,7 +312,7 @@ GEM
|
|||||||
rake (10.4.2)
|
rake (10.4.2)
|
||||||
redcarpet (3.3.4)
|
redcarpet (3.3.4)
|
||||||
referer-parser (0.3.0)
|
referer-parser (0.3.0)
|
||||||
request_store (1.2.1)
|
request_store (1.3.0)
|
||||||
responders (2.1.1)
|
responders (2.1.1)
|
||||||
railties (>= 4.2.0, < 5.1)
|
railties (>= 4.2.0, < 5.1)
|
||||||
rest-client (1.8.0)
|
rest-client (1.8.0)
|
||||||
@@ -331,7 +331,7 @@ GEM
|
|||||||
rspec-expectations (3.4.0)
|
rspec-expectations (3.4.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.4.0)
|
rspec-support (~> 3.4.0)
|
||||||
rspec-mocks (3.4.0)
|
rspec-mocks (3.4.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.4.0)
|
rspec-support (~> 3.4.0)
|
||||||
rspec-rails (3.4.0)
|
rspec-rails (3.4.0)
|
||||||
@@ -344,14 +344,14 @@ GEM
|
|||||||
rspec-support (~> 3.4.0)
|
rspec-support (~> 3.4.0)
|
||||||
rspec-support (3.4.1)
|
rspec-support (3.4.1)
|
||||||
ruby-progressbar (1.7.5)
|
ruby-progressbar (1.7.5)
|
||||||
sass (3.4.20)
|
sass (3.4.21)
|
||||||
sass-rails (5.0.4)
|
sass-rails (5.0.4)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
sass (~> 3.1)
|
sass (~> 3.1)
|
||||||
sprockets (>= 2.8, < 4.0)
|
sprockets (>= 2.8, < 4.0)
|
||||||
sprockets-rails (>= 2.0, < 4.0)
|
sprockets-rails (>= 2.0, < 4.0)
|
||||||
tilt (>= 1.1, < 3)
|
tilt (>= 1.1, < 3)
|
||||||
sassc (1.8.2)
|
sassc (1.8.3)
|
||||||
bundler
|
bundler
|
||||||
ffi (~> 1.9.6)
|
ffi (~> 1.9.6)
|
||||||
sass (>= 3.3.0)
|
sass (>= 3.3.0)
|
||||||
@@ -369,14 +369,14 @@ GEM
|
|||||||
nokogiri (>= 1.4.0)
|
nokogiri (>= 1.4.0)
|
||||||
nori (~> 2.4)
|
nori (~> 2.4)
|
||||||
wasabi (~> 3.4)
|
wasabi (~> 3.4)
|
||||||
simple_captcha2 (0.3.4)
|
simple_captcha2 (0.4.0)
|
||||||
rails (>= 4.1)
|
rails (>= 4.1)
|
||||||
simplecov (0.11.1)
|
simplecov (0.11.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (~> 1.8)
|
json (~> 1.8)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.0)
|
simplecov-html (0.10.0)
|
||||||
spring (1.6.1)
|
spring (1.6.2)
|
||||||
spring-commands-rspec (1.0.4)
|
spring-commands-rspec (1.0.4)
|
||||||
spring (>= 0.9.1)
|
spring (>= 0.9.1)
|
||||||
sprockets (3.5.2)
|
sprockets (3.5.2)
|
||||||
@@ -395,11 +395,11 @@ GEM
|
|||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
thread (0.2.2)
|
thread (0.2.2)
|
||||||
thread_safe (0.3.5)
|
thread_safe (0.3.5)
|
||||||
tilt (2.0.1)
|
tilt (2.0.2)
|
||||||
tins (1.6.0)
|
tins (1.6.0)
|
||||||
turbolinks (2.5.3)
|
turbolinks (2.5.3)
|
||||||
coffee-rails
|
coffee-rails
|
||||||
turnout (2.2.0)
|
turnout (2.2.1)
|
||||||
rack (~> 1.3)
|
rack (~> 1.3)
|
||||||
rack-accept (~> 0.4)
|
rack-accept (~> 0.4)
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.2)
|
||||||
@@ -477,7 +477,7 @@ DEPENDENCIES
|
|||||||
newrelic_rpm (~> 3.14)
|
newrelic_rpm (~> 3.14)
|
||||||
omniauth
|
omniauth
|
||||||
omniauth-facebook (~> 3.0.0)
|
omniauth-facebook (~> 3.0.0)
|
||||||
omniauth-google-oauth2 (~> 0.2.10)
|
omniauth-google-oauth2 (~> 0.3.0)
|
||||||
omniauth-twitter
|
omniauth-twitter
|
||||||
paranoia
|
paranoia
|
||||||
pg
|
pg
|
||||||
@@ -504,4 +504,4 @@ DEPENDENCIES
|
|||||||
whenever
|
whenever
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.10.6
|
1.11.2
|
||||||
|
|||||||
@@ -220,6 +220,16 @@ a {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-nav {
|
||||||
|
border-bottom: 1px solid $border;
|
||||||
|
|
||||||
|
dd.active {
|
||||||
|
border-bottom: 2px solid $brand;
|
||||||
|
color: $brand;
|
||||||
|
padding-bottom: $line-height/4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 02. Header
|
// 02. Header
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
@@ -974,7 +984,7 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
left: 28px;
|
left: 28px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 84px;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,17 +1812,6 @@ table {
|
|||||||
|
|
||||||
.activity {
|
.activity {
|
||||||
margin-bottom: $line-height*2;
|
margin-bottom: $line-height*2;
|
||||||
margin-top: $line-height;
|
|
||||||
|
|
||||||
.sub-nav {
|
|
||||||
border-bottom: 1px solid $border;
|
|
||||||
|
|
||||||
dd.active {
|
|
||||||
border-bottom: 2px solid $brand;
|
|
||||||
color: $brand;
|
|
||||||
padding-bottom: $line-height/4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border: 0;
|
border: 0;
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
class Admin::SpendingProposalsController < Admin::BaseController
|
class Admin::SpendingProposalsController < Admin::BaseController
|
||||||
has_filters %w{unresolved accepted rejected}, only: :index
|
has_filters %w{unresolved accepted rejected}, only: :index
|
||||||
|
|
||||||
load_and_authorize_resource except: [:index, :show]
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@spending_proposals = SpendingProposal.includes([:geozone]).send(@current_filter).order(created_at: :desc).page(params[:page])
|
@spending_proposals = @spending_proposals.includes([:geozone]).send(@current_filter).order(created_at: :desc).page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@spending_proposal = SpendingProposal.includes([:author, :geozone]).find(params[:id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept
|
def accept
|
||||||
@@ -21,4 +20,4 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
|||||||
redirect_to request.query_parameters.merge(action: :index)
|
redirect_to request.query_parameters.merge(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
|
|
||||||
|
<h1 class="left margin-top"><%= t("notifications.index.title") %></h1>
|
||||||
|
|
||||||
<% if @notifications.empty? %>
|
<% if @notifications.empty? %>
|
||||||
<div class="alert-box radius info margin-top">
|
<div class="alert-box radius info margin-top clear">
|
||||||
<%= t("notifications.index.empty_notifications") %>
|
<%= t("notifications.index.empty_notifications") %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
<dl class="sub-nav">
|
<dl class="sub-nav">
|
||||||
<dt><%= t("#{i18n_namespace}.filter") %>: </dt>
|
<dt class="sr-only"><%= t("#{i18n_namespace}.filter") %>: </dt>
|
||||||
|
|
||||||
<% @valid_filters.each do |filter| %>
|
<% @valid_filters.each do |filter| %>
|
||||||
<% if @current_filter == filter %>
|
<% if @current_filter == filter %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<section role="main">
|
<section role="main">
|
||||||
<div class="activity row">
|
<div class="activity row margin-top">
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ en:
|
|||||||
user_permission_verify_info: "* Only for users on Madrid City Census."
|
user_permission_verify_info: "* Only for users on Madrid City Census."
|
||||||
notifications:
|
notifications:
|
||||||
index:
|
index:
|
||||||
|
title: "Notifications"
|
||||||
mark_all_as_read: "Mark all as read"
|
mark_all_as_read: "Mark all as read"
|
||||||
empty_notifications: "You don't have new notifications."
|
empty_notifications: "You don't have new notifications."
|
||||||
comments_on:
|
comments_on:
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ es:
|
|||||||
user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid."
|
user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid."
|
||||||
notifications:
|
notifications:
|
||||||
index:
|
index:
|
||||||
|
title: "Notificaciones"
|
||||||
mark_all_as_read: "Marcar todas como leídas"
|
mark_all_as_read: "Marcar todas como leídas"
|
||||||
empty_notifications: "No tienes notificaciones nuevas."
|
empty_notifications: "No tienes notificaciones nuevas."
|
||||||
comments_on:
|
comments_on:
|
||||||
|
|||||||
Reference in New Issue
Block a user