Merge pull request #14 from ancorgs/feature_addpeople
Manually adding people and changing speaker for an event
This commit is contained in:
commit
207f2dcdca
16 changed files with 128 additions and 38 deletions
|
|
@ -242,3 +242,13 @@ $.extend( $.fn.dataTableExt.oPagination, {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
/* Commodity function for modal windows */
|
||||||
|
|
||||||
|
window.build_dialog = function(selector, content) {
|
||||||
|
// Close it and remove content if it's already open
|
||||||
|
$("#" + selector).modal('hide');
|
||||||
|
$("#" + selector).remove();
|
||||||
|
// Add new content and pops it up
|
||||||
|
$("body").append("<div id=\"" + selector + "\" class=\"modal fade\" role=\"dialog\">\n" + content + "</div>");
|
||||||
|
$("#" + selector).modal();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
class Admin::PeopleController < ApplicationController
|
class Admin::PeopleController < ApplicationController
|
||||||
before_filter :verify_organizer
|
before_filter :verify_organizer
|
||||||
|
respond_to :html
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@people = Person.all
|
@people = Person.all
|
||||||
|
|
@ -15,16 +16,28 @@ class Admin::PeopleController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def new
|
||||||
|
@person = Person.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@person = Person.new(params[:person])
|
||||||
|
flash[:notice] = 'Person was successfully created.' if @person.save
|
||||||
|
respond_with @person, :location => admin_people_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@person = Person.find(params[:id])
|
@person = Person.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def edit
|
||||||
|
@person = Person.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@person = Person.find(params[:id])
|
||||||
|
flash[:notice] = 'Person was successfully updated' if @person.update_attributes(params[:person])
|
||||||
|
respond_with @person, :location => admin_people_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
|
|
|
||||||
17
app/controllers/admin/speakers_controller.rb
Normal file
17
app/controllers/admin/speakers_controller.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
class Admin::SpeakersController < ApplicationController
|
||||||
|
before_filter :verify_organizer
|
||||||
|
respond_to :js, :html
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@event = @conference.events.find(params[:event_id])
|
||||||
|
@speaker = @event.event_people.where(:event_role => "speaker").first
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@event = @conference.events.find(params[:event_id])
|
||||||
|
@speaker = @event.event_people.where(:event_role => "speaker").first
|
||||||
|
@speaker.person_id = params[:speaker][:person_id]
|
||||||
|
@speaker.save
|
||||||
|
respond_with @speaker, :location => admin_conference_events_path(@conference.short_title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -138,6 +138,7 @@ class ProposalController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@event = Event.find(params[:id])
|
@event = Event.find(params[:id])
|
||||||
|
@speaker = @event.speakers.first || @event.submitter
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm
|
def confirm
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ class Event < ActiveRecord::Base
|
||||||
has_many :event_people, :dependent => :destroy
|
has_many :event_people, :dependent => :destroy
|
||||||
has_many :event_attachments, :dependent => :destroy
|
has_many :event_attachments, :dependent => :destroy
|
||||||
has_many :people, :through => :event_people
|
has_many :people, :through => :event_people
|
||||||
|
has_many :speakers, :through => :event_people, :source => :person, :conditions => {"event_people.event_role" => "speaker"}
|
||||||
belongs_to :event_type
|
belongs_to :event_type
|
||||||
|
|
||||||
belongs_to :track
|
belongs_to :track
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class Person < ActiveRecord::Base
|
||||||
|
|
||||||
validates :first_name, :presence => true
|
validates :first_name, :presence => true
|
||||||
validates :last_name, :presence => true
|
validates :last_name, :presence => true
|
||||||
|
validates :email, :presence => true
|
||||||
validate :biography_limit
|
validate :biography_limit
|
||||||
|
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,15 @@
|
||||||
%b Title
|
%b Title
|
||||||
%th
|
%th
|
||||||
%b Submitter
|
%b Submitter
|
||||||
|
%th
|
||||||
|
%b Speaker
|
||||||
%th
|
%th
|
||||||
%b Type
|
%b Type
|
||||||
%th
|
%th
|
||||||
%b Track
|
%b Track
|
||||||
%th
|
%th
|
||||||
%b State
|
%b State
|
||||||
|
%th
|
||||||
- @events.each do |event|
|
- @events.each do |event|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
|
|
@ -124,6 +127,13 @@
|
||||||
(Unregistered!)
|
(Unregistered!)
|
||||||
- else
|
- else
|
||||||
Unknown submitter
|
Unknown submitter
|
||||||
|
%td
|
||||||
|
- if speaker = event.speakers.first
|
||||||
|
= link_to speaker.public_name, admin_person_path(speaker)
|
||||||
|
- else
|
||||||
|
Unknown speaker
|
||||||
|
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
||||||
|
= "(#{l})".html_safe
|
||||||
%td
|
%td
|
||||||
= event.event_type.title
|
= event.event_type.title
|
||||||
%td
|
%td
|
||||||
|
|
@ -180,4 +190,4 @@
|
||||||
$("#events-stats1-link").click(function() {
|
$("#events-stats1-link").click(function() {
|
||||||
$("#events-stats1").toggle();
|
$("#events-stats1").toggle();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
10
app/views/admin/people/_form.html.haml
Normal file
10
app/views/admin/people/_form.html.haml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
= semantic_form_for [:admin, @person] do |f|
|
||||||
|
= f.inputs "Basic Information" do
|
||||||
|
= f.input :first_name, :as => :string
|
||||||
|
= f.input :last_name, :as => :string
|
||||||
|
= f.input :public_name, :as => :string
|
||||||
|
= f.input :email
|
||||||
|
= f.input :company, :as => :string
|
||||||
|
= f.input :biography, :input_html => {:rows => 10}
|
||||||
|
= f.actions do
|
||||||
|
= f.action :submit, :button_html => {:class => "btn primary"}
|
||||||
|
|
@ -1,29 +1,39 @@
|
||||||
%h2
|
.row-fluid
|
||||||
People
|
.span6
|
||||||
- if @people
|
%h2
|
||||||
= "(#{@people.length})"
|
People
|
||||||
.well
|
- if @people
|
||||||
%table.table.table-striped.table-bordered.table-hover#people
|
= "(#{@people.length})"
|
||||||
%thead
|
.span6
|
||||||
%th
|
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
|
||||||
%b Email
|
= link_to "New person", new_admin_person_path, :class => "btn btn-success"
|
||||||
%th
|
|
||||||
%b Last Name
|
.row-fluid
|
||||||
%th
|
.span12
|
||||||
%b First Name
|
.well
|
||||||
%th
|
%table.table.table-striped.table-bordered.table-hover#people
|
||||||
%b Public Name
|
%thead
|
||||||
%th
|
%th
|
||||||
%b # of Conference Registrations
|
%b Email
|
||||||
%th
|
%th
|
||||||
- @people.each do |person|
|
%b Last Name
|
||||||
%tr
|
%th
|
||||||
%td= person.email
|
%b First Name
|
||||||
%td= person.last_name
|
%th
|
||||||
%td= person.first_name
|
%b Public Name
|
||||||
%td= person.public_name
|
%th
|
||||||
%td= person.registrations.count
|
%b # of Conference Registrations
|
||||||
%td= link_to "View", admin_person_path(person)
|
%th
|
||||||
|
%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 "Edit", edit_admin_person_path(person)
|
||||||
|
%td= link_to "View", admin_person_path(person)
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
||||||
11
app/views/admin/speakers/_form.html.haml
Normal file
11
app/views/admin/speakers/_form.html.haml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
.modal-header
|
||||||
|
%button.close{:type => "button", :data => {:dismiss => "modal"}} ×
|
||||||
|
%h3
|
||||||
|
Assign speaker
|
||||||
|
= semantic_form_for @speaker, :as => :speaker, :url => admin_conference_event_speaker_path(@conference.short_title, @event), :method => :put do |f|
|
||||||
|
.form-inputs.form-horizontal.modal-body
|
||||||
|
= f.collection_select(:person_id, Person.order(:public_name), :id, :public_name)
|
||||||
|
|
||||||
|
.modal-footer
|
||||||
|
= link_to "Close", "#", :data => {:dismiss => "modal"}, :class => 'btn'
|
||||||
|
= f.button "Assign", :class => 'btn btn-primary'
|
||||||
2
app/views/admin/speakers/edit.js.erb
Normal file
2
app/views/admin/speakers/edit.js.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
build_dialog('edit_speaker', '<%= j render :partial => 'form' %>');
|
||||||
|
|
||||||
1
app/views/application/edit.html.haml
Normal file
1
app/views/application/edit.html.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render :partial => "form"
|
||||||
1
app/views/application/new.html.haml
Normal file
1
app/views/application/new.html.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render :partial => "form"
|
||||||
|
|
@ -38,15 +38,15 @@
|
||||||
.span8
|
.span8
|
||||||
%h3
|
%h3
|
||||||
by
|
by
|
||||||
= @event.submitter.public_name
|
= @speaker.public_name
|
||||||
- if @event.submitter.company
|
- if @speaker.company
|
||||||
%br
|
%br
|
||||||
%span.muted
|
%span.muted
|
||||||
from
|
from
|
||||||
= @event.submitter.company
|
= @speaker.company
|
||||||
-if @event.submitter.biography
|
-if @speaker.biography
|
||||||
= simple_format(@event.submitter.biography)
|
= simple_format(@speaker.biography)
|
||||||
.span4
|
.span4
|
||||||
= image_tag @event.submitter.gravatar_url(:size => 200), :class => "img-rounded pull-right", :style => "margin: 8px;"
|
= image_tag @speaker.gravatar_url(:size => 200), :class => "img-rounded pull-right", :style => "margin: 8px;"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,15 @@
|
||||||
class="event" role="button"
|
class="event" role="button"
|
||||||
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
||||||
<h5>
|
<h5>
|
||||||
<%= image_tag event[0].submitter.gravatar_url, :class => "img-circle pull-right", :alt => event[0].submitter.public_name, :title => event[0].submitter.public_name, :style => "padding:8px;" %>
|
<%- speaker = event[0].speakers.first || event[0].submitter %>
|
||||||
|
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right", :alt => speaker.public_name, :title => speaker.public_name, :style => "padding:8px;" %>
|
||||||
<i class="icon-comment"></i>
|
<i class="icon-comment"></i>
|
||||||
<%= event[0].title %><br>
|
<%= event[0].title %><br>
|
||||||
<% unless event[0].subtitle.empty? %>
|
<% unless event[0].subtitle.empty? %>
|
||||||
<span class="text-error"><%= event[0].subtitle %></span><br>
|
<span class="text-error"><%= event[0].subtitle %></span><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
<i class="icon-user"></i>
|
<i class="icon-user"></i>
|
||||||
<%= event[0].submitter.public_name %>
|
<%= speaker.public_name %>
|
||||||
<% if event[0].track%>
|
<% if event[0].track%>
|
||||||
<br><i class="icon-road"></i>
|
<br><i class="icon-road"></i>
|
||||||
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
|
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
|
||||||
|
|
@ -112,4 +113,4 @@ $(function() {
|
||||||
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ Osem::Application.routes.draw do
|
||||||
put :update_state
|
put :update_state
|
||||||
put :update_track
|
put :update_track
|
||||||
end
|
end
|
||||||
|
resource :speaker, :only => [:edit, :update]
|
||||||
end
|
end
|
||||||
resources :supporters
|
resources :supporters
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue