Merge pull request #824 from consul/spending_proposals_cancancan

Uses Abilities instead of exceptions in the proposals controller
This commit is contained in:
Juanjo Bazán
2016-01-13 17:08:59 +01:00
9 changed files with 42 additions and 39 deletions

View File

@@ -24,7 +24,7 @@ gem 'devise'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook', '~> 3.0.0'
gem 'omniauth-google-oauth2', '~> 0.2.10'
gem 'omniauth-google-oauth2', '~> 0.3.0'
gem 'kaminari'
gem 'ancestry'

View File

@@ -67,9 +67,9 @@ GEM
arel (6.0.3)
ast (2.2.0)
bcrypt (3.1.10)
browser (1.0.1)
browser (1.1.0)
builder (3.2.2)
bullet (4.14.10)
bullet (5.0.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0)
byebug (8.2.1)
@@ -96,7 +96,7 @@ GEM
rack-test (>= 0.5.4)
xpath (~> 2.0)
chronic (0.10.2)
ckeditor (4.1.5)
ckeditor (4.1.6)
cocaine
orm_adapter (~> 0.5.0)
climate_control (0.0.3)
@@ -173,7 +173,7 @@ GEM
fuubar (2.0.0)
rspec (~> 3.0)
ruby-progressbar (~> 1.4)
geocoder (1.2.13)
geocoder (1.2.14)
globalid (0.3.6)
activesupport (>= 4.1.0)
groupdate (2.5.0)
@@ -229,7 +229,7 @@ GEM
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.0.1)
net-ssh (3.0.2)
netrc (0.11.0)
newrelic_rpm (3.14.1.311)
nokogiri (1.6.7.1)
@@ -247,23 +247,23 @@ GEM
rack (>= 1.0, < 3)
omniauth-facebook (3.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-google-oauth2 (0.2.10)
omniauth-google-oauth2 (0.3.0)
addressable (~> 2.3)
jwt (~> 1.0)
multi_json (~> 1.3)
omniauth (>= 1.1.1)
omniauth-oauth2 (~> 1.3.1)
omniauth-oauth2 (>= 1.3.1)
omniauth-oauth (1.1.0)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.3.1)
omniauth-oauth2 (1.4.0)
oauth2 (~> 1.0)
omniauth (~> 1.2)
omniauth-twitter (1.2.1)
json (~> 1.3)
omniauth-oauth (~> 1.1)
orm_adapter (0.5.0)
paranoia (2.1.4)
paranoia (2.1.5)
activerecord (~> 4.0)
parser (2.2.3.0)
ast (>= 1.1, < 3.0)
@@ -312,7 +312,7 @@ GEM
rake (10.4.2)
redcarpet (3.3.4)
referer-parser (0.3.0)
request_store (1.2.1)
request_store (1.3.0)
responders (2.1.1)
railties (>= 4.2.0, < 5.1)
rest-client (1.8.0)
@@ -331,7 +331,7 @@ GEM
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-rails (3.4.0)
@@ -344,14 +344,14 @@ GEM
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
ruby-progressbar (1.7.5)
sass (3.4.20)
sass (3.4.21)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (1.8.2)
sassc (1.8.3)
bundler
ffi (~> 1.9.6)
sass (>= 3.3.0)
@@ -369,14 +369,14 @@ GEM
nokogiri (>= 1.4.0)
nori (~> 2.4)
wasabi (~> 3.4)
simple_captcha2 (0.3.4)
simple_captcha2 (0.4.0)
rails (>= 4.1)
simplecov (0.11.1)
docile (~> 1.1.0)
json (~> 1.8)
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 (>= 0.9.1)
sprockets (3.5.2)
@@ -395,11 +395,11 @@ GEM
thor (0.19.1)
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.1)
tilt (2.0.2)
tins (1.6.0)
turbolinks (2.5.3)
coffee-rails
turnout (2.2.0)
turnout (2.2.1)
rack (~> 1.3)
rack-accept (~> 0.4)
tzinfo (1.2.2)
@@ -477,7 +477,7 @@ DEPENDENCIES
newrelic_rpm (~> 3.14)
omniauth
omniauth-facebook (~> 3.0.0)
omniauth-google-oauth2 (~> 0.2.10)
omniauth-google-oauth2 (~> 0.3.0)
omniauth-twitter
paranoia
pg
@@ -504,4 +504,4 @@ DEPENDENCIES
whenever
BUNDLED WITH
1.10.6
1.11.2

View File

@@ -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
// - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -974,7 +984,7 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar {
height: 100%;
left: 28px;
position: absolute;
top: 0;
top: 84px;
width: 2px;
}
@@ -1802,17 +1812,6 @@ table {
.activity {
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 {
border: 0;

View File

@@ -1,14 +1,13 @@
class Admin::SpendingProposalsController < Admin::BaseController
has_filters %w{unresolved accepted rejected}, only: :index
load_and_authorize_resource except: [:index, :show]
load_and_authorize_resource
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
def show
@spending_proposal = SpendingProposal.includes([:author, :geozone]).find(params[:id])
end
def accept

View File

@@ -1,7 +1,10 @@
<div class="row">
<div class="small-12 column">
<h1 class="left margin-top"><%= t("notifications.index.title") %></h1>
<% 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") %>
</div>
<% else %>

View File

@@ -4,7 +4,7 @@
%>
<dl class="sub-nav">
<dt><%= t("#{i18n_namespace}.filter") %>: </dt>
<dt class="sr-only"><%= t("#{i18n_namespace}.filter") %>: </dt>
<% @valid_filters.each do |filter| %>
<% if @current_filter == filter %>

View File

@@ -1,5 +1,5 @@
<section role="main">
<div class="activity row">
<div class="activity row margin-top">
<div class="small-12 column">
<h2>

View File

@@ -342,6 +342,7 @@ en:
user_permission_verify_info: "* Only for users on Madrid City Census."
notifications:
index:
title: "Notifications"
mark_all_as_read: "Mark all as read"
empty_notifications: "You don't have new notifications."
comments_on:

View File

@@ -342,6 +342,7 @@ es:
user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid."
notifications:
index:
title: "Notificaciones"
mark_all_as_read: "Marcar todas como leídas"
empty_notifications: "No tienes notificaciones nuevas."
comments_on: