diff --git a/app/views/admin/questions/_questions.html.haml b/app/views/admin/questions/_questions.html.haml index 9feda3aa..d5577cb6 100644 --- a/app/views/admin/questions/_questions.html.haml +++ b/app/views/admin/questions/_questions.html.haml @@ -18,11 +18,13 @@ = ',' = label_tag dom_id(q), "Answers: #{q.answers.map {|a| a.title}.join(', ')}" - %td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q), - class: 'btn btn-primary', - disabled: q.global == true && !has_role?(current_user, 'Admin') + - if can? :update, q + %td= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q), + class: 'btn btn-primary', + disabled: q.global == true - %td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q), - method: :delete, remote: true, class: 'btn btn-danger', - confirm: "Delete question '#{q.title}'?", - disabled: q.global == true && !has_role?(current_user, "Admin") + - if can? :destroy, q + %td= link_to 'Delete', admin_conference_question_path(@conference.short_title, q), + method: :delete, remote: true, class" 'btn btn-danger', + confirm: "Delete question '#{q.title}'?", + disabled: q.global == true diff --git a/app/views/admin/registrations/index.html.haml b/app/views/admin/registrations/index.html.haml index 78aa4db7..a0590a59 100644 --- a/app/views/admin/registrations/index.html.haml +++ b/app/views/admin/registrations/index.html.haml @@ -7,9 +7,11 @@ = "(#{@registrations.length})" = " - Attended (#{@attended})" .btn-group.pull-right - = link_to "New", new_admin_conference_registration_path(@conference.short_title), :class => "btn btn-default" - = link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default" - = link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default" + - if can? :create, Registration + = link_to "New", new_admin_conference_registration_path(@conference.short_title), :class => "btn btn-default" + - if can? :read, Registration + = link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default" + = link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default" %table.table.table-bordered.table-striped.table-hover#registrations %thead %th @@ -21,7 +23,7 @@ %th %th %th - - counter = 0 + - counter = 0 - @registrations.each do |registration| %tr %td @@ -33,7 +35,7 @@ - if registration.supporter_level && registration.supporter_level.title != 'Free' %p{:style => "color:red"} = registration.supporter_level.title - + -elsif field == 'attended' = link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :patch, ":#{field}" => registration.send(field.to_sym), :class => "btn btn-success" @@ -64,11 +66,11 @@ "bLengthChange": false } ); } ); - + function toggle(rowid) { if( document.getElementById(rowid).style.display=='none' ){ document.getElementById(rowid).style.display = ''; }else{ document.getElementById(rowid).style.display = 'none'; } - }; \ No newline at end of file + }; diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index d66a475d..5b7880d7 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -5,7 +5,7 @@ - if @users = "(#{@users.length})" - = link_to "New User", new_admin_user_path, :class => "btn btn-success pull-right" + = link_to "New User", new_admin_user_path, class: 'btn btn-success pull-right' .well %table.table.table-striped.table-bordered.table-hover#users %thead @@ -61,16 +61,22 @@ %button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"} Cancel = f.action :submit, :as => :button, :button_html => {:value => "Save", :class => "btn btn-primary"} - =link_to "#{user.roles.map { |role| role.name }.join ', '}", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}",id: "user-modify-role-#{user.id}" - %td - = link_to "Edit", edit_admin_user_path(user) - %td - = link_to "View", admin_user_path(user) - %td - - if current_user.id == user.id or user.role_ids.include? 3 - =link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button" + - if can? :update, Role + =link_to "#{user.roles.map { |role| role.name }.join ', '}", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}",id: "user-modify-role-#{user.id}" - else - =link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger" + = user.roles.map { |role| role.name }.join ', ' + - if can? :update, user + %td + = link_to "Edit", edit_admin_user_path(user) + - if can? :show, user + %td + = link_to "View", admin_user_path(user) + - if can? :destroy, user + %td + - if current_user.id == user.id or user.role_ids.include? 3 + =link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button" + - else + =link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger" :javascript diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 2b17ba53..13a4d34f 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -10,83 +10,104 @@ %span.glyphicon.glyphicon-home All Conferences - @conferences.each do |conference| + - if can? :show, conference + %li + = link_to(admin_conference_path(conference.short_title)) do + %span.glyphicon.glyphicon-cog + Manage + = conference.short_title + - if can? :create, Conference %li - = link_to(admin_conference_path(conference.short_title)) do - %span.glyphicon.glyphicon-cog - Manage - = conference.short_title - %li - = link_to(new_admin_conference_path) do - %span.glyphicon.glyphicon-plus - New Conference + = link_to(new_admin_conference_path) do + %span.glyphicon.glyphicon-plus + New Conference %hr - %li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"} - = link_to(admin_conference_path(@conference.short_title)) do - %span.glyphicon.glyphicon-dashboard - Manage - %li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))} - = link_to(admin_conference_events_path(@conference.short_title)) do - %span.glyphicon.glyphicon-comment - Events - %li{:class=> active_nav_li(admin_conference_registrations_path(@conference.short_title))} - = link_to(admin_conference_registrations_path(@conference.short_title)) do - %span.glyphicon.glyphicon-user - Registrations - %li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))} - = link_to(admin_conference_schedule_path(@conference.short_title), target: '_blank') do - %span.glyphicon.glyphicon-calendar - Schedule - %li{class: active_nav_li(admin_conference_campaigns_path(@conference.short_title))} - = link_to(admin_conference_campaigns_path(@conference.short_title)) do - %span.glyphicon.glyphicon-bullhorn - Campaigns + - if can? :show, @conference + %li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"} + = link_to(admin_conference_path(@conference.short_title)) do + %span.glyphicon.glyphicon-dashboard + Manage + - if can? :index, Event, conference_id: @conference.id + %li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))} + = link_to(admin_conference_events_path(@conference.short_title)) do + %span.glyphicon.glyphicon-comment + Events + - if can? :index, @conference => Registration + %li{:class=> active_nav_li(admin_conference_registrations_path(@conference.short_title))} + = link_to(admin_conference_registrations_path(@conference.short_title)) do + %span.glyphicon.glyphicon-user + Registrations + - if can? :update, :schedule + %li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))} + = link_to(admin_conference_schedule_path(@conference.short_title), target: '_blank') do + %span.glyphicon.glyphicon-calendar + Schedule + - if can? :index, Campaign, conference_id: @conference.id + %li{class: active_nav_li(admin_conference_campaigns_path(@conference.short_title))} + = link_to(admin_conference_campaigns_path(@conference.short_title)) do + %span.glyphicon.glyphicon-bullhorn + Campaigns %hr - %li{:class=> "#{active_nav_li(edit_admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"} - = link_to(edit_admin_conference_path(@conference.short_title)) do - %span.glyphicon.glyphicon-cog - Settings - %li{:class=> "#{active_nav_li(admin_conference_targets_path(@conference.short_title))}"} - = link_to(admin_conference_targets_path(@conference.short_title)) do - %span.glyphicon.glyphicon-flag - Targets - %li{:class=> "#{active_nav_li(admin_conference_venue_info_path(@conference.short_title))} myAccordion"} - = link_to(admin_conference_venue_info_path(@conference.short_title)) do - %span.glyphicon.glyphicon-road - Venue - %span.small.glyphicon.glyphicon-chevron-right - %ul.nav.nav-stacked.nav-pills.small.collapse.subNav - %li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))} - = link_to 'Rooms', admin_conference_rooms_path(@conference.short_title) - %li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) } - = link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title) - %li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))} myAccordion" } - = link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do - %span.glyphicon.glyphicon-star - Sponsorship - %span.small.glyphicon.glyphicon-chevron-right - %ul.nav.nav-stacked.nav-pills.small.collapse.subNav - %li{:class=> active_nav_li(admin_conference_sponsors_path(@conference.short_title))} - = link_to 'Sponsors', admin_conference_sponsors_path(@conference.short_title) - %li{ class: active_nav_li(admin_conference_supporter_levels_path(@conference.short_title)) } - = link_to(admin_conference_supporter_levels_path(@conference.short_title)) do - %span.glyphicon.glyphicon-usd - Supporter Levels - %li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))} - = link_to(admin_conference_emails_path(@conference.short_title)) do - %span.glyphicon.glyphicon-envelope - E-Mails - %li{:class=> "#{active_nav_li(admin_conference_callforpapers_path(@conference.short_title))} myAccordion"} - = link_to(admin_conference_callforpapers_path(@conference.short_title)) do - %span.glyphicon.glyphicon-comment - Call for papers - %span.small.glyphicon.glyphicon-chevron-right - %ul.nav.nav-stacked.nav-pills.small.collapse.subNav - %li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))} - = link_to 'Tracks', admin_conference_tracks_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_event_types_path(@conference.short_title))} - = link_to 'Event types', admin_conference_event_types_path(@conference.short_title) - %li{:class=> active_nav_li(admin_conference_difficulty_levels_path(@conference.short_title))} - = link_to 'Difficulty levels', admin_conference_difficulty_levels_path(@conference.short_title) + - if can? :update, Conference, id: @conference.id + %li{:class=> "#{active_nav_li(edit_admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"} + = link_to(edit_admin_conference_path(@conference.short_title)) do + %span.glyphicon.glyphicon-cog + Settings + - if can? :index, Target, conference_id: @conference.id + %li{:class=> "#{active_nav_li(admin_conference_targets_path(@conference.short_title))}"} + = link_to(admin_conference_targets_path(@conference.short_title)) do + %span.glyphicon.glyphicon-flag + Targets + - if can? :index, Venue, id: @conference.venue.id + %li{:class=> "#{active_nav_li(admin_conference_venue_info_path(@conference.short_title))} myAccordion"} + = link_to(admin_conference_venue_info_path(@conference.short_title)) do + %span.glyphicon.glyphicon-road + Venue + %span.small.glyphicon.glyphicon-chevron-right + %ul.nav.nav-stacked.nav-pills.small.collapse.subNav + - if can? :index, Room, conference_id: @conference.id + %li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))} + = link_to 'Rooms', admin_conference_rooms_path(@conference.short_title) + - if can? :index, Lodging, venue_id: @conference.venue.id + %li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) } + = link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title) + - if can? :index, SponsorshipLevel, conference_id: @conference.id + %li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))} myAccordion" } + = link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do + %span.glyphicon.glyphicon-star + Sponsorship + %span.small.glyphicon.glyphicon-chevron-right + %ul.nav.nav-stacked.nav-pills.small.collapse.subNav + - if can? :index, Sponsor, conference_id: @conference.id + %li{:class=> active_nav_li(admin_conference_sponsors_path(@conference.short_title))} + = link_to 'Sponsors', admin_conference_sponsors_path(@conference.short_title) + - if can? :index, SupporterLevel, conference_id: @conference.id + %li{ class: active_nav_li(admin_conference_supporter_levels_path(@conference.short_title)) } + = link_to(admin_conference_supporter_levels_path(@conference.short_title)) do + %span.glyphicon.glyphicon-usd + Supporter Levels + - if can? :index, EmailSettings, conference_id: @conference.id + %li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))} + = link_to(admin_conference_emails_path(@conference.short_title)) do + %span.glyphicon.glyphicon-envelope + E-Mails + - if can? :index, CallForPapers, conference_id: @conference.id + %li{:class=> "#{active_nav_li(admin_conference_callforpapers_path(@conference.short_title))} myAccordion"} + = link_to(admin_conference_callforpapers_path(@conference.short_title)) do + %span.glyphicon.glyphicon-comment + Call for papers + %span.small.glyphicon.glyphicon-chevron-right + %ul.nav.nav-stacked.nav-pills.small.collapse.subNav + - if can? :index, @conference => Track + %li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))} + = link_to 'Tracks', admin_conference_tracks_path(@conference.short_title) + - if can? :index, EventType, conference_id: @conference.id + %li{:class=> active_nav_li(admin_conference_event_types_path(@conference.short_title))} + = link_to 'Event types', admin_conference_event_types_path(@conference.short_title) + - if can? :index, DifficultyLevel, conference_id: @conference.id + %li{:class=> active_nav_li(admin_conference_difficulty_levels_path(@conference.short_title))} + = link_to 'Difficulty levels', admin_conference_difficulty_levels_path(@conference.short_title) + - if can? :index, Question, conference_id: @conference.id %li{:class=> active_nav_li(admin_conference_questions_path(@conference.short_title))} = link_to(admin_conference_questions_path(@conference.short_title)) do %span.glyphicon.glyphicon-question-sign diff --git a/app/views/layouts/_admin_sidebar_index.html.haml b/app/views/layouts/_admin_sidebar_index.html.haml index a5f4191c..08e8b3fb 100644 --- a/app/views/layouts/_admin_sidebar_index.html.haml +++ b/app/views/layouts/_admin_sidebar_index.html.haml @@ -10,17 +10,20 @@ %span.glyphicon.glyphicon-home All Conferences - @conferences.each do |conference| + - if can? :show, conference + %li + = link_to(admin_conference_path(conference.short_title)) do + %span.glyphicon.glyphicon-cog + Manage + = conference.short_title + - if can? :create, Conference %li - = link_to(admin_conference_path(conference.short_title)) do - %span.glyphicon.glyphicon-cog - Manage - = conference.short_title - %li - = link_to(new_admin_conference_path) do - %span.glyphicon.glyphicon-plus - New Conference - %hr - %li - = link_to(admin_users_path) do - %span.glyphicon.glyphicon-user - Users + = link_to(new_admin_conference_path) do + %span.glyphicon.glyphicon-plus + New Conference + - if can? :index, User + %hr + %li + = link_to(admin_users_path) do + %span.glyphicon.glyphicon-user + Users diff --git a/app/views/layouts/_user_menu.html.haml b/app/views/layouts/_user_menu.html.haml index bfcbfa6f..fe5edfb3 100644 --- a/app/views/layouts/_user_menu.html.haml +++ b/app/views/layouts/_user_menu.html.haml @@ -11,13 +11,13 @@ = link_to(destroy_user_session_path, :method=>'delete') do %span.glyphicon.glyphicon-minus Sign out --if has_role?(current_user, "admin") || has_role?(current_user, "organizer") +- if can? :index, Conference %li.divider %li = link_to(admin_conference_index_path()) do %span.glyphicon.glyphicon-home Administration - -if @conference and @conference.id + -if @conference and @conference.id and can? :index, @conference %li = link_to(admin_conference_path(@conference.short_title)) do %span.glyphicon.glyphicon-cog diff --git a/app/views/proposal/_form.html.haml b/app/views/proposal/_form.html.haml index e8c8d17d..0e88e38a 100644 --- a/app/views/proposal/_form.html.haml +++ b/app/views/proposal/_form.html.haml @@ -45,7 +45,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) diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index 284c815e..dc182c12 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -1,7 +1,7 @@ = semantic_form_for(@event, :url => @url) do |f| %section#basic = f.inputs :name => "Session Information" do - - if can? :update, @event + - if can? :update, @event or can? :create, @event = f.input :title, :as => :string, :required => true - else Title: #{@event.title} @@ -9,7 +9,7 @@ %br = f.input :subtitle, :as => :string %section#details - - if can? :update, @event + - 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}