From 39ca877e5ea010dddc3f78784f1c67115665576c Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 7 May 2013 15:09:13 +0200 Subject: [PATCH] Count events and use datatables, put all tables into wells --- app/views/admin/events/index.html.haml | 114 ++++++++++++--------- app/views/admin/people/index.html.haml | 47 +++++---- app/views/admin/supporters/index.html.haml | 1 + app/views/admin/users/index.html.haml | 107 +++++++++---------- 4 files changed, 144 insertions(+), 125 deletions(-) diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 1f058d87..589d1c89 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -1,53 +1,65 @@ .row-fluid .span12 - %table.table.table-striped.table-bordered.table-hover - %thead - %th - %b Title - %th - %b Submitter - %th - %b Type - %th - %b State - - @events.each do |event| - %tr - %td - =link_to event.title, admin_conference_event_path(@conference.short_title, event) - %td - - if !event.submitter.nil? - =link_to event.submitter.public_name, admin_person_path(event.submitter) - - else - Unknown submitter - %td - = event.event_type.title - %td - - if event.state == "withdrawn" - Withdrawn - - else - .dropdown - = link_to "#", :class => "dropdown-toggle" do - = event.state.humanize - - %ul.dropdown-menu - - if event.transition_possible? :accept - %li= link_to "Accept event (no email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :accept, :send_mail => false), - :method => :put, :hint => "Accept this event without sending an automated email." - %li= link_to "Accept event (WITH email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :accept, :send_mail => true), - :method => :put, :hint => "Accept this event and send an automated email." - - if event.transition_possible? :reject - %li= link_to "Reject event (no email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :reject, :send_mail => false), - :method => :put, :confirm => "Are you sure?", - :hint => "Reject this event without sending an automated email." - %li= link_to "Reject event (WITH email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :reject, :send_mail => true), - :method => :put, :confirm => "Are you sure?", - :hint => "Reject this event and send an automated email." - - if event.transition_possible? :start_review - %li= link_to "Start review", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :start_review), - :method => :put - - if event.transition_possible? :confirm - %li= link_to "Confirm event", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :confirm), - :method => :put, :hint => "Confirm that the speaker(s) will be present and that the event will actually take place." - - if event.transition_possible? :cancel - %li= link_to "Cancel event", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :cancel), - :method => :put, :hint => "Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance." + %h2 + Events + - if @events + = "(#{@events.length})" + .well + %table.table.table-striped.table-bordered.table-hover#events + %thead + %th + %b Title + %th + %b Submitter + %th + %b Type + %th + %b State + - @events.each do |event| + %tr + %td + =link_to event.title, admin_conference_event_path(@conference.short_title, event) + %td + - if !event.submitter.nil? + =link_to event.submitter.public_name, admin_person_path(event.submitter) + - else + Unknown submitter + %td + = event.event_type.title + %td + - if event.state == "withdrawn" + Withdrawn + - else + .dropdown + = link_to "#", :class => "dropdown-toggle" do + = event.state.humanize + + %ul.dropdown-menu + - if event.transition_possible? :accept + %li= link_to "Accept event (no email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :accept, :send_mail => false), + :method => :put, :hint => "Accept this event without sending an automated email." + %li= link_to "Accept event (WITH email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :accept, :send_mail => true), + :method => :put, :hint => "Accept this event and send an automated email." + - if event.transition_possible? :reject + %li= link_to "Reject event (no email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :reject, :send_mail => false), + :method => :put, :confirm => "Are you sure?", + :hint => "Reject this event without sending an automated email." + %li= link_to "Reject event (WITH email)", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :reject, :send_mail => true), + :method => :put, :confirm => "Are you sure?", + :hint => "Reject this event and send an automated email." + - if event.transition_possible? :start_review + %li= link_to "Start review", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :start_review), + :method => :put + - if event.transition_possible? :confirm + %li= link_to "Confirm event", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :confirm), + :method => :put, :hint => "Confirm that the speaker(s) will be present and that the event will actually take place." + - if event.transition_possible? :cancel + %li= link_to "Cancel event", update_state_admin_conference_event_path(@conference.short_title, event, :transition => :cancel), + :method => :put, :hint => "Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance." + +:javascript + $(document).ready(function() { + $('#events').dataTable( { + "bPaginate": false + } ); + } ); diff --git a/app/views/admin/people/index.html.haml b/app/views/admin/people/index.html.haml index ae3c480f..567fedfe 100644 --- a/app/views/admin/people/index.html.haml +++ b/app/views/admin/people/index.html.haml @@ -2,31 +2,34 @@ People - if @people = "(#{@people.length})" -%table.table.table-striped.table-bordered.table-hover#people - %thead - %th - %b Email - %th - %b Last Name - %th - %b First Name - %th - %b Public Name - %th - %b # of Conference Registrations - %th - - @people.each do |person| - %tr - %td= person.email - %td= person.last_name - %td= person.first_name - %td= person.public_name - %td= person.registrations.count - %td= link_to "View", admin_person_path(person) +.well + %table.table.table-striped.table-bordered.table-hover#people + %thead + %th + %b Email + %th + %b Last Name + %th + %b First Name + %th + %b Public Name + %th + %b # of Conference Registrations + %th + - @people.each do |person| + %tr + %td= person.email + %td= person.last_name + %td= person.first_name + %td= person.public_name + %td= person.registrations.count + %td= link_to "View", admin_person_path(person) :javascript $(document).ready(function() { $('#people').dataTable( { - sPaginationType: "full_numbers" + "bScrollInfinite": true, + "bScrollCollapse": true, + "sScrollY": "200px" } ); } ); diff --git a/app/views/admin/supporters/index.html.haml b/app/views/admin/supporters/index.html.haml index 256a9276..31bebdcf 100644 --- a/app/views/admin/supporters/index.html.haml +++ b/app/views/admin/supporters/index.html.haml @@ -13,6 +13,7 @@ = link_to "New Supporter", "#", :id => "new-supporter-button", :class => "btn btn-success" .row-fluid .span12 + %h2 Supporters .well %table.table.table-striped#supporters %thead diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 4e4a7379..d118e7b7 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -5,63 +5,66 @@ Users - if @users = "(#{@users.length})" - %table.table.table-striped.table-bordered.table-hover#users - %thead - %th - %b Email - %th - %b Last Name - %th - %b First Name - %th - %b Public Name - %th - %b Roles - %th - %th - - @users.each do |user| - %tr - %td - = user.email - %td - = user.last_name - %td - = user.first_name - %td - = user.public_name - %td - = user.roles.map { |role| role.name }.join ',' - %td - .modal.hide.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"} - .modal-header - %button{"type"=>"button", :class=>"close", "data-dismiss"=>"modal", "aria-hidden"=>"true"} - × - %h3{:id => "role-selector-header-#{user.id}"} - Modifying Roles - .modal-body - - if current_user == user - You cannot modify your own role! - %br - %button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"} - Cancel - - - else - = "Give #{user.public_name} (#{user.email}) the following roles:" - = semantic_form_for(user, :url => admin_user_path(user), :method => :put) do |f| - = f.input :roles, :label => false + .well + %table.table.table-striped.table-bordered.table-hover#users + %thead + %th + %b Email + %th + %b Last Name + %th + %b First Name + %th + %b Public Name + %th + %b Roles + %th + %th + - @users.each do |user| + %tr + %td + = user.email + %td + = user.last_name + %td + = user.first_name + %td + = user.public_name + %td + = user.roles.map { |role| role.name }.join ',' + %td + .modal.hide.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"} + .modal-header + %button{"type"=>"button", :class=>"close", "data-dismiss"=>"modal", "aria-hidden"=>"true"} + × + %h3{:id => "role-selector-header-#{user.id}"} + Modifying Roles + .modal-body + - if current_user == user + You cannot modify your own role! + %br %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 "Modify Roles", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}}" - %td - =link_to "Details", "javascript: void(0)", :class => "user-details-popover", "data-trigger" => "click", "data-placement" => "bottom", - "data-html" => "true", - "data-content" => user.popup_details, - "data-original-title" => "" + + - else + = "Give #{user.public_name} (#{user.email}) the following roles:" + = semantic_form_for(user, :url => admin_user_path(user), :method => :put) do |f| + = f.input :roles, :label => false + %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 "Modify Roles", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}}" + %td + =link_to "Details", "javascript: void(0)", :class => "user-details-popover", "data-trigger" => "click", "data-placement" => "bottom", + "data-html" => "true", + "data-content" => user.popup_details, + "data-original-title" => "" :javascript $(document).ready(function() { $('#users').dataTable( { - sPaginationType: "full_numbers" + "bScrollInfinite": true, + "bScrollCollapse": true, + "sScrollY": "200px" } ); } );