Only a moderator can delete an organisation

This commit is contained in:
echarp 2015-12-27 12:56:33 +01:00
parent c994947f22
commit 0b3db18477
2 changed files with 8 additions and 6 deletions

View File

@ -2,9 +2,10 @@
class OrgasController < ApplicationController class OrgasController < ApplicationController
before_action :set_orga, except: [:index, :new, :create] before_action :set_orga, except: [:index, :new, :create]
before_action :set_mailer_host before_action :set_mailer_host
before_action :authenticate_user!, only: [:edit, :update, :cancel, :destroy], before_action :authenticate_user!, only: [:edit, :update],
unless: :check_secret unless: :check_secret
before_action :authenticate_user!, only: [:validate, :accept] before_action :authenticate_user!, only: [:validate, :accept, :cancel,
:destroy]
def index def index
@search = Orga.moderated.includes(:kind).includes(:region).search params[:q] @search = Orga.moderated.includes(:kind).includes(:region).search params[:q]

View File

@ -51,10 +51,11 @@
= link_to edit_orga_path @orga do = link_to edit_orga_path @orga do
%em.fa.fa-lg.fa-pencil %em.fa.fa-lg.fa-pencil
= t '.edit' = t '.edit'
%h2 - if user_signed_in?
= link_to cancel_orga_path @orga do %h2
%em.fa.fa-lg.fa-thumbs-down = link_to cancel_orga_path @orga do
= t '.cancel' %em.fa.fa-lg.fa-thumbs-down
= t '.cancel'
%h3= t '.description' %h3= t '.description'
.description .description