mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
|
||||
before_filter :verify_organizer
|
||||
respond_to :html
|
||||
|
||||
def index
|
||||
@people = Person.all
|
||||
|
|
@ -15,16 +16,28 @@ class Admin::PeopleController < ApplicationController
|
|||
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
|
||||
|
||||
def show
|
||||
@person = Person.find(params[:id])
|
||||
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
|
||||
|
||||
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
|
||||
@event = Event.find(params[:id])
|
||||
@speaker = @event.speakers.first || @event.submitter
|
||||
end
|
||||
|
||||
def confirm
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class Event < ActiveRecord::Base
|
|||
has_many :event_people, :dependent => :destroy
|
||||
has_many :event_attachments, :dependent => :destroy
|
||||
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 :track
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class Person < ActiveRecord::Base
|
|||
|
||||
validates :first_name, :presence => true
|
||||
validates :last_name, :presence => true
|
||||
validates :email, :presence => true
|
||||
validate :biography_limit
|
||||
|
||||
before_create :generate_guid
|
||||
|
|
|
|||
|
|
@ -101,12 +101,15 @@
|
|||
%b Title
|
||||
%th
|
||||
%b Submitter
|
||||
%th
|
||||
%b Speaker
|
||||
%th
|
||||
%b Type
|
||||
%th
|
||||
%b Track
|
||||
%th
|
||||
%b State
|
||||
%th
|
||||
- @events.each do |event|
|
||||
%tr
|
||||
%td
|
||||
|
|
@ -124,6 +127,13 @@
|
|||
(Unregistered!)
|
||||
- else
|
||||
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
|
||||
= event.event_type.title
|
||||
%td
|
||||
|
|
@ -180,4 +190,4 @@
|
|||
$("#events-stats1-link").click(function() {
|
||||
$("#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
|
||||
People
|
||||
- if @people
|
||||
= "(#{@people.length})"
|
||||
.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)
|
||||
.row-fluid
|
||||
.span6
|
||||
%h2
|
||||
People
|
||||
- if @people
|
||||
= "(#{@people.length})"
|
||||
.span6
|
||||
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
|
||||
= link_to "New person", new_admin_person_path, :class => "btn btn-success"
|
||||
|
||||
.row-fluid
|
||||
.span12
|
||||
.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
|
||||
%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
|
||||
$(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
|
||||
%h3
|
||||
by
|
||||
= @event.submitter.public_name
|
||||
- if @event.submitter.company
|
||||
= @speaker.public_name
|
||||
- if @speaker.company
|
||||
%br
|
||||
%span.muted
|
||||
from
|
||||
= @event.submitter.company
|
||||
-if @event.submitter.biography
|
||||
= simple_format(@event.submitter.biography)
|
||||
= @speaker.company
|
||||
-if @speaker.biography
|
||||
= simple_format(@speaker.biography)
|
||||
.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"
|
||||
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
||||
<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>
|
||||
<%= event[0].title %><br>
|
||||
<% unless event[0].subtitle.empty? %>
|
||||
<span class="text-error"><%= event[0].subtitle %></span><br>
|
||||
<% end %>
|
||||
<i class="icon-user"></i>
|
||||
<%= event[0].submitter.public_name %>
|
||||
<%= speaker.public_name %>
|
||||
<% if event[0].track%>
|
||||
<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>
|
||||
|
|
@ -112,4 +113,4 @@ $(function() {
|
|||
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
||||
});
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ Osem::Application.routes.draw do
|
|||
put :update_state
|
||||
put :update_track
|
||||
end
|
||||
resource :speaker, :only => [:edit, :update]
|
||||
end
|
||||
resources :supporters
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue