Skip to content

Commit

Permalink
Remove show/print action from initiatives' admin
Browse files Browse the repository at this point in the history
  • Loading branch information
andreslucena committed Apr 13, 2022
1 parent d5a4b1d commit ce70c09
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def index
@initiatives = filtered_collection
end

# GET /admin/initiatives/:id
def show
enforce_permission_to :read, :initiative, initiative: current_initiative
end

# GET /admin/initiatives/:id/edit
def edit
enforce_permission_to :edit, :initiative, initiative: current_initiative
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions decidim-initiatives/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ en:
edit: Edit
new: New
photos: Photos
show:
print: Print
update:
error: An error has occurred
success: The initiative has been successfully updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AdminEngine < ::Rails::Engine
resources :initiatives_type_scopes, except: [:index, :show]
end

resources :initiatives, only: [:index, :show, :edit, :update], param: :slug do
resources :initiatives, only: [:index, :edit, :update], param: :slug do
member do
get :send_to_technical_validation
post :publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,64 +73,6 @@
end
end

context "when show" do
context "and Users without initiatives" do
before do
sign_in user, scope: :user
end

it "are not not allowed" do
get :show, params: { slug: initiative.to_param }
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:found)
end
end

context "and anonymous users" do
it "are not allowed" do
get :show, params: { slug: initiative.to_param }
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:found)
end
end

context "and admin users" do
before do
sign_in admin_user, scope: :user
end

it "are allowed" do
get :show, params: { slug: initiative.to_param }
expect(flash[:alert]).to be_nil
expect(response).to have_http_status(:ok)
end
end

context "and initiative author" do
before do
sign_in initiative.author, scope: :user
end

it "are allowed" do
get :show, params: { slug: initiative.to_param }
expect(flash[:alert]).to be_nil
expect(response).to have_http_status(:ok)
end
end

context "and promotal committee members" do
before do
sign_in initiative.committee_members.approved.first.user, scope: :user
end

it "initiative list is allowed" do
get :show, params: { slug: initiative.to_param }
expect(flash[:alert]).to be_nil
expect(response).to have_http_status(:ok)
end
end
end

context "when edit" do
context "and Users without initiatives" do
before do
Expand Down

0 comments on commit ce70c09

Please sign in to comment.