Added paper_trail, also starting work on the scheduler

This commit is contained in:
Matt Barringer 2013-01-07 16:45:48 +01:00
parent 90b30db9e8
commit f86232bedf
35 changed files with 523 additions and 32137 deletions

View file

@ -47,6 +47,21 @@ $(function() {
}
});
$("#conference-reg-start-datepicker").datepicker({
dateFormat: 'yy/mm/dd',
numberOfMonths: 2,
onSelect: function(selected) {
$("#conference-reg-end-datepicker").datepicker("option","minDate", selected)
}
});
$("#conference-reg-end-datepicker").datepicker({
dateFormat: 'yy/mm/dd',
numberOfMonths: 2,
onSelect: function(selected) {
$("#conference-reg-start-datepicker").datepicker("option","maxDate", selected)
}
});
$(".comment-reply-link").click(function(){
$(".comment-reply", $(this).parent()).toggle();
return false;

View file

@ -2,6 +2,7 @@
*= require formtastic-bootstrap
*= require bootstrap_and_overrides
*= require osem
*= require schedule
*= require jquery-ui-1.9.2.custom
*= require jquery.fileupload-ui
*/

View file

@ -100,3 +100,4 @@ textarea {
position:relative;
top:1px;
}

View file

@ -0,0 +1,45 @@
.schedule-content {
overflow: hidden;
width: 100%;
}
.unscheduled {
float:left;
border:1px solid #bbb;
padding-left:10px;
padding-right: 10px;
margin-right:20px;
margin-left:20px;
width:149px;
height:100%;
position:relative;
}
.schedule {
overflow: hidden;
}
.schedule-track-column-header {
position: absolute;
width: 149px;
}
.schedule-track-column {
float:left;
border-right:1px solid #bbb;
width:149px;
height:400px;
position:relative;
}
.schedule-event {
position:absolute;
cursor:move;
width:141px;
height:32px;
background: #6af;
color:#fff;
padding:4px;
font-weight:bold;
z-index:1;
}

View file

@ -0,0 +1,13 @@
class Admin::ScheduleController < ApplicationController
before_filter :verify_organizer
layout "schedule"
def show
@dates = @conference.start_date..@conference.end_date
@tracks = @conference.tracks
end
def update
end
end

View file

@ -71,7 +71,8 @@ class EventAttachmentsController < ApplicationController
end
def update
@upload = EventAttachment.find(params[:proposal_id])
@proposal = current_user.person.events.find(params[:proposal_id])
@upload = @proposal.event_attachments.find(params[:proposal_id])
respond_to do |format|
if @upload.update_attributes(params[:upload])

View file

@ -25,7 +25,7 @@ class ProposalController < ApplicationController
@event = @person.events.find_by_id(params[:id])
@attachments = @event.event_attachments
if @event.nil?
if @event.nil? || !@conference.cfp_open?
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid proposal.')
end
end

View file

@ -1,7 +1,9 @@
class Conference < ActiveRecord::Base
attr_accessible :title, :short_title, :social_tag, :contact_email, :timezone, :html_export_path,
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :cfp_open, :registration_open,
:event_types_attributes
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
:event_types_attributes, :registration_start_date, :registration_end_date
has_paper_trail
has_one :call_for_papers, :dependent => :destroy
has_many :events, :dependent => :destroy
@ -61,6 +63,15 @@ class Conference < ActiveRecord::Base
end
end
def registration_open?
today = Date.current
if self.registration_start_date.nil? || self.registration_end_date.nil?
false
end
(registration_start_date..registration_end_date).cover?(today)
end
def cfp_open?
today = Date.current
cfp = self.call_for_papers

View file

@ -1,6 +1,6 @@
class Event < ActiveRecord::Base
include ActiveRecord::Transitions
has_paper_trail
attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :people_attributes, :person,
:proposal_additional_speakers
acts_as_commentable

View file

@ -1,4 +1,6 @@
class EventAttachment < ActiveRecord::Base
has_paper_trail
belongs_to :event
scope :public, where(:public => true)
attr_accessible :public, :attachment, :event_id, :title

View file

@ -32,8 +32,9 @@ class Person < ActiveRecord::Base
:person_id => self.id).count
end
def proposals conference
self.events.where("conference_id = ? AND state != ? AND state != ?", conference.id, "withdrawn", "rejected")
self.events.where("conference_id = ? AND state != ? AND state != ? AND event_people.event_role=?", conference.id, "withdrawn", "rejected", "submitter")
end
def proposal_count conference
@ -48,6 +49,10 @@ class Person < ActiveRecord::Base
end
end
def self.find_person_by_user_id user_id
Person.where(:user_id => user_id).first
end
private
def biography_limit
if self.biography.split.size > 150

View file

@ -11,7 +11,7 @@
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
= f.input :html_export_path, :hint => "The path for static HTML exports"
= f.input :cfp_open, :label => false, :hint => "Allow people to submit papers?"
= f.input :registration_open, :label => false, :hint => "Allow people to register as attendees?"
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -0,0 +1,112 @@
.row-fluid
.span10
%h3
= @event.title
%i= @event.subtitle
.span2
= link_to "Edit Submission", edit_admin_conference_event_path(@conference.short_title, @event),
:class => "btn btn-mini btn-primary pull-right", :style => "margin-top:20px;"
.row-fluid
.span12
%table.table
%tr
%td
%b State
%td
.dropdown
= link_to "#", :class => "dropdown-toggle" do
= @event.state.humanize
<b class="caret"></b>
%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."
- 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."
- 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."
%tr
%td
%b Submitter
%td
= link_to @event.submitter.public_name, admin_person_path(@conference.short_title, @event.submitter)
(
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
)
%tr
%td
%b Biography
%td
= simple_format(@event.submitter.biography)
%tr
%td
%b Submitted on
%td= @event.created_at
%tr
%td
%b Last updated on
%td= @event.updated_at
%tr
%td
%b Abstract
%td= simple_format(@event.abstract)
%tr
%td
%b Description
%td= simple_format(@event.description)
- if @event.event_attachments.size > 0
%table.table
%thead
%th
%b Filename
%th
%b Title
%th
%b Size
%th
%b Public?
%th
%tbody
- @event.event_attachments.each do |a|
%tr
%td
= link_to a.attachment_file_name, conference_proposal_event_attachment_path(@conference.short_title, @event.id, a.id)
%td
= a.title
%td
= number_to_human_size a.attachment_file_size
%td
- if a.public?
Public
- else
Not Public
%td
= link_to "Delete", conference_proposal_event_attachment_path(@conference.short_title, @event.id, a.id),
:method => :delete, :confirm => "Are you sure you want to delete this attachment? It's permanant!"
.row-fluid
= link_to "Comments (#{@comment_count})", "#", :id => "event-comment-link"
#comments-div
%hr
%ul.media
%div
.row-fluid
= form_tag(comment_admin_conference_event_path(@conference.short_title, @event.id), :method => :post) do
= text_area_tag(:comment, "")
= submit_tag "Add Comment", :class => "btn btn-primary pull-right"
%br
- @comments.each do |comment|
%div
= raw format_comments(comment)

View file

@ -1,112 +1,38 @@
.row-fluid
.span10
%h3
= @event.title
%i= @event.subtitle
.tabbable
%ul.nav.nav-tabs
%li.active
= link_to "Proposal", "#proposal-content", "data-toggle"=>"tab"
%li
= link_to "History", "#history-content", "data-toggle"=>"tab"
.tab-content
#proposal-content.tab-pane.active
= render 'proposal'
#history-content.tab-pane
.span12
%table.table
%thead
%th
%b Who
%th
%b Timestamp
%th
%b Modification Type
%th
%b Changes
%tbody
- @event.versions.each do |version|
%tr
%td
- if !version.whodunnit.nil?
= Person.find_person_by_user_id(version.whodunnit).public_name
- else
No user (probably via the console)
%td
= version.created_at
%td
= version.event
%td
- version.changeset.each_key do |key|
= "#{key}: #{version.changeset[key][0]} -> #{version.changeset[key][1]}"
%br
.span2
= link_to "Edit Submission", edit_admin_conference_event_path(@conference.short_title, @event),
:class => "btn btn-mini btn-primary pull-right", :style => "margin-top:20px;"
.row-fluid
.span12
%table.table
%tr
%td
%b State
%td
.dropdown
= link_to "#", :class => "dropdown-toggle" do
= @event.state.humanize
<b class="caret"></b>
%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."
- 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."
- 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."
%tr
%td
%b Submitter
%td
= link_to @event.submitter.public_name, admin_person_path(@conference.short_title, @event.submitter)
(
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
)
%tr
%td
%b Biography
%td
= simple_format(@event.submitter.biography)
%tr
%td
%b Submitted on
%td= @event.created_at
%tr
%td
%b Last updated on
%td= @event.updated_at
%tr
%td
%b Abstract
%td= simple_format(@event.abstract)
%tr
%td
%b Description
%td= simple_format(@event.description)
- if @event.event_attachments.size > 0
%table.table
%thead
%th
%b Filename
%th
%b Title
%th
%b Size
%th
%b Public?
%th
%tbody
- @event.event_attachments.each do |a|
%tr
%td
= link_to a.attachment_file_name, conference_proposal_event_attachment_path(@conference.short_title, @event.id, a.id)
%td
= a.title
%td
= number_to_human_size a.attachment_file_size
%td
- if a.public?
Public
- else
Not Public
%td
= link_to "Delete", conference_proposal_event_attachment_path(@conference.short_title, @event.id, a.id),
:method => :delete, :confirm => "Are you sure you want to delete this attachment? It's permanant!"
.row-fluid
= link_to "Comments (#{@comment_count})", "#", :id => "event-comment-link"
#comments-div
%hr
%ul.media
%div
.row-fluid
= form_tag(comment_admin_conference_event_path(@conference.short_title, @event.id), :method => :post) do
= text_area_tag(:comment, "")
= submit_tag "Add Comment", :class => "btn btn-primary pull-right"
%br
- @comments.each do |comment|
%div
= raw format_comments(comment)

View file

@ -0,0 +1,4 @@
- @tracks.each do |track|
.schedule-track-column-header
= track.name
.schedule-track-column

View file

@ -0,0 +1,43 @@
.schedule-content
.unscheduled
Unscheduled Events
#test1.schedule-event
Test
#test2.schedule-event
Test2
.schedule
.tabbable
%ul.nav.nav-tabs
- @dates.each do |date|
-if date == @dates.first
%li.active
= link_to "#{date}", "##{date}-content", "data-toggle"=>"tab"
- else
%li
= link_to "#{date}", "##{date}-content", "data-toggle"=>"tab"
.tab-content
- @dates.each do |date|
- if date == @dates.first
.tab-pane.active{:id => "#{date}-content"}
= render 'day_tab'
- else
.tab-pane{:id => "#{date}-content"}
= render 'day_tab'
:javascript
$(document).ready( function() {
$('.schedule-track-column').droppable({
accept: '.schedule-event',
drop: function(event, ui) {
var evtName = ui.draggable.text();
var evtDay = $(this).attr('title');
alert('Moved \'' + evtName + '\' to ' + evtDay);
}
});
$('.schedule-event').draggable({
grid: [150,20],
containment: '.schedule-content',
opacity: 0.7,
zIndex: 2
});
});

View file

@ -15,16 +15,19 @@
= conference.venue.address
.row-fluid{:style => "padding-top: 30px;"}
.span4
- if conference.user_registered?(current_user)
= link_to "Modify Registration", register_conference_path(conference.short_title), :class => "mainbutton center-text"
%br
%i.icon-thumbs-up You're attending!
- if conference.registration_open?
- if conference.user_registered?(current_user)
= link_to "Modify Registration", register_conference_path(conference.short_title), :class => "mainbutton center-text"
%br
%i.icon-thumbs-up You're attending!
- else
= link_to "Register", register_conference_path(conference.short_title), :class => "mainbutton center-text"
%br
- if !current_user.nil?
%i.icon-thumbs-down
You haven't registered yet!
- else
= link_to "Register", register_conference_path(conference.short_title), :class => "mainbutton center-text"
%br
- if !current_user.nil?
%i.icon-thumbs-down
You haven't registered yet!
%b Registration is closed.
.span4.offset4.pull-right
- if !current_user.nil? && current_user.person.proposal_count(conference) > 0
= link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class => "mainbutton center-text"

View file

@ -16,6 +16,12 @@
- else
%li
= link_to "Events", admin_conference_events_path(@conference.short_title)
- if current_page?(admin_conference_schedule_path(@conference.short_title))
%li.active
= link_to "Schedule", "#"
-else
%li
= link_to "Schedule ", admin_conference_schedule_path(@conference.short_title)
%ul.nav.secondary-nav.pull-right
- if !@conference.nil?
%li.dropdown

View file

@ -0,0 +1,22 @@
!!!
%html
%head
%meta{:charset => "utf-8"}
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1, maximum-scale=1"}
%title= content_for?(:title) ? yield(:title) : "OSEM"
%meta{:content => "", :name => "description"}
%meta{:content => "", :name => "author"}
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
= csrf_meta_tags
= yield(:head)
%body
.navbar.navbar-fixed-top
.navbar-inner
.container-fluid
= render 'layouts/admin_navigation'
= render 'layouts/messages'
.content
#wrap
#inner-content
= yield

View file

@ -6,40 +6,7 @@
= link_to "Attachments", "#attachment-content", "data-toggle"=>"tab"
.tab-content
#proposal-content.tab-pane.active
.span12
= semantic_form_for(@event, :url => @url) do |f|
%section#basic
= f.inputs :name => "Basic Information" do
= f.input :title, :required => true
= f.input :subtitle
= f.input :abstract, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'abstract-count')"}, :required => true
You have used
%span#abstract-count #{@event.abstract_word_count}
words. Abstracts are limited to 250 words.
%br
%br
= f.input :description, :input_html => {:rows => 5}, :hint => "This will only be shown to organizers, not to attendees."
%section#details
= f.inputs :name => "Event Details" do
= f.input :event_type_id,:as => :select, :collection => @event_types, :include_blank => false
%section#information
= f.inputs :name => "Your Information" do
= semantic_fields_for @person do |p|
= p.input :public_name, :required => true
= p.input :company, :label => "Affiliation", :hint => "This could be a company, a user group, or nothing at all."
= p.input :biography, :required => true, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count')"}
You have used
%span#biography-count #{@person.biography_word_count}
words. Biographies are limited to 150 words.
%br
%br
%section#speakers
= f.inputs :name => "Additional Speakers" do
Will there be any additional speakers? If so, please enter their full names, email address, and a short
biography for each.
= f.input :proposal_additional_speakers, :input_html => {:rows => 5}, :label => false
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= render 'proposal_form'
#attachment-content.tab-pane
.span12
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event),

View file

@ -0,0 +1,34 @@
.span12
= semantic_form_for(@event, :url => @url) do |f|
%section#basic
= f.inputs :name => "Basic Information" do
= f.input :title, :required => true
= f.input :subtitle
= f.input :abstract, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'abstract-count')"}, :required => true
You have used
%span#abstract-count #{@event.abstract_word_count}
words. Abstracts are limited to 250 words.
%br
%br
= f.input :description, :input_html => {:rows => 5}, :hint => "This will only be shown to organizers, not to attendees."
%section#details
= f.inputs :name => "Event Details" do
= f.input :event_type_id,:as => :select, :collection => @event_types, :include_blank => false
%section#information
= f.inputs :name => "Your Information" do
= semantic_fields_for @person do |p|
= p.input :public_name, :required => true
= p.input :company, :label => "Affiliation", :hint => "This could be a company, a user group, or nothing at all."
= p.input :biography, :required => true, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count')"}
You have used
%span#biography-count #{@person.biography_word_count}
words. Biographies are limited to 150 words.
%br
%br
%section#speakers
= f.inputs :name => "Additional Speakers" do
Will there be any additional speakers? If so, please enter their full names, email address, and a short
biography for each.
= f.input :proposal_additional_speakers, :input_html => {:rows => 5}, :label => false
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -13,6 +13,7 @@
.span10
= event.title
.pull-right
= link_to "Edit", edit_conference_proposal_path(@conference.short_title, event.id), :class => "btn btn-mini btn-primary"
= link_to "Withdraw", conference_proposal_path(@conference.short_title, event.id), :method => :delete,
:confirm => "Are you sure you want to withdraw this proposal?", :class => "btn btn-mini btn-danger"
- if @conference.cfp_open?
= link_to "Edit", edit_conference_proposal_path(@conference.short_title, event.id), :class => "btn btn-mini btn-primary"
= link_to "Withdraw", conference_proposal_path(@conference.short_title, event.id), :method => :delete,
:confirm => "Are you sure you want to withdraw this proposal?", :class => "btn btn-mini btn-danger"

View file

@ -1,2 +1,2 @@
.container
= render 'form'
= render 'proposal_form'