Implement role authorization

This commit is contained in:
Stella Rouzi 2014-08-12 11:51:59 +03:00
parent 6755328c4c
commit e2fb434dc7
122 changed files with 1386 additions and 751 deletions

View file

@ -26,11 +26,14 @@
= commercial.commercial_type
.flexvideo
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }
= link_to 'Edit', edit_conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id), class: 'btn btn-primary'
= link_to 'Delete', conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
- if can? :update, commercial
= link_to 'Edit', edit_conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id), class: 'btn btn-primary'
- if can? :destrooy, commercial
= link_to 'Delete', conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
:method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'
%hr
= link_to 'Add Commercial', new_conference_proposal_commercial_path(@conference.short_title, @event.id), class: 'btn btn-primary'
- if can? :create, @event.commercials.new
%hr
= link_to 'Add Commercial', new_conference_proposal_commercial_path(@conference.short_title, @event.id), class: 'btn btn-primary'
#attachment-content.tab-pane
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event), :html => { :multipart => true, :id => "fileupload" } do |f|
@ -68,7 +71,7 @@
data.formData = inputs.serializeArray();
});
$.getJSON($('#fileupload').prop('action'), function (files) {
var fu = $('#fileupload').data('fileupload'),
var fu = $('#fileupload').data('blueimpFileupload'),
template;
fu._adjustMaxNumberOfFiles(-files.length);
template = fu._renderDownload(files)

View file

@ -1,20 +1,20 @@
= semantic_form_for(@event, :url => @url) do |f|
%section#basic
= f.inputs :name => "Session Information" do
- if !@conference.call_for_papers.schedule_changes && @event.state == "confirmed" && !organizer_or_admin?
- if can? :update, @event or can? :create, @event
= f.input :title, :as => :string, :required => true
- else
Title: #{@event.title}
%br
%br
- else
= f.input :title, :as => :string, :required => true
= f.input :subtitle, :as => :string
%section#details
- if (@event.state === "unconfirmed" || @event.state === "confirmed") && !organizer_or_admin? && !@conference.call_for_papers.schedule_changes
- if can? :update, @event or can? :create, @event
= f.input :event_type_id,:as => :select, :collection => @conference.event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id]}, :include_blank => false, :label => "Session Type"
- else
Event type: #{@event.event_type.title}
%br
%br
- else
= f.input :event_type_id,:as => :select, :collection => @conference.event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id]}, :include_blank => false, :label => "Session Type"
= f.input :difficulty_level, :as => :select, :collection => @conference.difficulty_levels, :include_blank => "(Please select)" if @conference.use_difficulty_levels
= f.input :require_registration
= f.input :abstract, :input_html => {:rows => 5, :class => "span11"},

View file

@ -2,7 +2,7 @@
.col-md-12.page-header
%h1
= "My Proposals for #{@conference.title}"
- if @conference.cfp_open? || organizer_or_admin?
- if @conference.cfp_open? || (current_user.has_role? :organizer, @conference)
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-success pull-right"
- if current_user.proposal_count(@conference) > 0
.row
@ -27,7 +27,7 @@
(Pre-registered: #{pre_registered(event).count})
- if event.confirmed? && !@conference.user_registered?(current_user)
%br
= link_to "Register to attend", register_conference_path(@conference.short_title), :style => "font-size:10px;"
= link_to "Register to attend", conference_register_path(@conference.short_title), :style => "font-size:10px;"
%td
.pull-right
- if event.transition_possible? :confirm

View file

@ -1,6 +1,6 @@
.row
.col-md-12
= simple_format(@conference.call_for_papers.description)
= simple_format(@conference.call_for_papers.description) if @conference.call_for_papers
.row
.col-md-12
= render 'proposal_form'

View file

@ -7,7 +7,7 @@
%small
= @event.subtitle
= link_to "Schedule", conference_schedule_path(@conference.short_title), :class =>"btn btn-success pull-right"
- if has_role?(current_user, "admin")
- if can? :edit, @event
= link_to "Edit", edit_admin_conference_event_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary pull-right"
.row
.col-md-3
@ -37,7 +37,7 @@
%span.label{:style =>"background-color: #{@event.difficulty_level.color};"}
= @event.difficulty_level.title
- if @event.require_registration
= link_to "Registration required!", register_conference_path(@conference.short_title), :class => "btn btn-xs btn-warning"
= link_to "Registration required!", conference_register_path(@conference.short_title), :class => "btn btn-xs btn-warning"
.col-md-9
.row
.col-md-12