User/Person models merge
This commit is contained in:
parent
66b84e3660
commit
23bf55b66c
80 changed files with 1064 additions and 1221 deletions
|
|
@ -11,9 +11,9 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td #{index + 1}
|
||||
%td #{registration.public_name}
|
||||
%td #{registration.name}
|
||||
%td #{registration.conference.title}
|
||||
%td #{registration.created_at.strftime('%m/%d/%Y')}
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No registrations!
|
||||
No registrations!
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td #{index + 1}
|
||||
%td #{event.submitter}
|
||||
%td #{event.submitter.name}
|
||||
%td #{event.title}
|
||||
%td #{event.conference.title}
|
||||
%td
|
||||
.span{'class'=>label_for(event.state)} #{event.state.humanize}
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No submissions!
|
||||
No submissions!
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@
|
|||
%span.label.label-danger Unconfirmed
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No sign ups!
|
||||
No sign ups!
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
- @top_submitter.each do |key, value|
|
||||
.row.top-submitter
|
||||
.col-md-2
|
||||
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.public_name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
|
||||
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
|
||||
.col-md-10
|
||||
%h4
|
||||
#{key}
|
||||
#{key.name}
|
||||
%div
|
||||
%small
|
||||
#{pluralize(value, 'submission')}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
.nested-fields
|
||||
= f.inputs do
|
||||
= f.input :email
|
||||
= f.input :public_name
|
||||
= remove_association_link :person, f
|
||||
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
%td
|
||||
%b Submitter
|
||||
%td
|
||||
= link_to @event.submitter.public_name, admin_person_path(@event.submitter)
|
||||
= link_to @event.submitter.name, admin_user_path(@event.submitter)
|
||||
(
|
||||
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
|
||||
)
|
||||
|
|
|
|||
6
app/views/admin/events/_user_fields.html.haml
Normal file
6
app/views/admin/events/_user_fields.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.nested-fields
|
||||
= f.inputs do
|
||||
= f.input :email
|
||||
= f.input :name
|
||||
= remove_association_link :user, f
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
%td{:style => "width:15%"}
|
||||
%b Rating
|
||||
%td
|
||||
- if @event.average_rating.to_f > 0
|
||||
- if @event.average_rating.to_f > 0
|
||||
#{@event.average_rating}/#{@conference.call_for_papers.rating}
|
||||
- else
|
||||
Rating: 0/#{@conference.call_for_papers.rating}
|
||||
|
|
@ -15,20 +15,20 @@
|
|||
- else
|
||||
= label_tag "label_rating", "", :class => "avgrating"
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
%b Voters
|
||||
%td
|
||||
= @event.voters.length
|
||||
- if @event.voters.length > 0
|
||||
(
|
||||
= @ratings.map {|x| "#{x.first_name} #{x.last_name}"}.join ', '
|
||||
= @ratings.map {|x| "#{x.name}"}.join ', '
|
||||
)
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
%b Your vote
|
||||
%td
|
||||
- @conference.call_for_papers.rating.times do |counter|
|
||||
- voted = @event.voted?(@event, current_user.person)
|
||||
- voted = @event.voted?(@event, current_user)
|
||||
- if voted && voted.rating == counter+1
|
||||
= link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating", :voted => true
|
||||
- else
|
||||
|
|
@ -37,20 +37,20 @@
|
|||
|
||||
- if @ratings.length > 0
|
||||
- @ratings.each do |rate|
|
||||
- unless rate.person_id == current_user.person.id
|
||||
- unless rate.user_id == current_user.id
|
||||
%tr
|
||||
%td
|
||||
= rate.first_name
|
||||
= rate.last_name
|
||||
%td
|
||||
- @conference.call_for_papers.rating.times do |counter|
|
||||
- voted = @event.voted?(@event, rate.person)
|
||||
- voted = @event.voted?(@event, rate.user)
|
||||
- if voted && voted.rating == counter+1
|
||||
= label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true
|
||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
||||
- else
|
||||
= label_tag "label#{counter+1}", "", :class => "othersrating"
|
||||
:javascript
|
||||
:javascript
|
||||
$(function () {
|
||||
var checkedId = $("a[voted='true']").attr('id');
|
||||
$('a[id=' + checkedId + ']').prevAll().andSelf().addClass('bright');
|
||||
|
|
@ -68,4 +68,4 @@
|
|||
$(".myrating").click(function() {
|
||||
$(this).siblings().removeClass("bright");
|
||||
$(this).prevAll().andSelf().addClass("bright");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@
|
|||
- bgcolor=""
|
||||
%td{:style=>"background-color: #{bgcolor}"}
|
||||
- if !event.submitter.nil?
|
||||
=link_to event.submitter.public_name, admin_person_path(event.submitter)
|
||||
=link_to event.submitter.name, admin_user_path(event.submitter)
|
||||
- if event.submitter.registrations.count < 1
|
||||
(Unregistered!)
|
||||
- else
|
||||
Unknown submitter
|
||||
%td
|
||||
- if speaker = event.speakers.first
|
||||
= link_to speaker.public_name, admin_person_path(speaker)
|
||||
= link_to speaker.name, admin_user_path(speaker)
|
||||
- else
|
||||
Unknown speaker
|
||||
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
%tr
|
||||
%td
|
||||
- if !version.whodunnit.nil?
|
||||
= Person.find_person_by_user_id(version.whodunnit).public_name
|
||||
= User.find(version.whodunnit).name
|
||||
- else
|
||||
No user (probably via the console)
|
||||
%td
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
= 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,43 +0,0 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
People
|
||||
- if @people
|
||||
= "(#{@people.length})"
|
||||
= link_to "New person", new_admin_person_path, :class => "btn btn-success pull-right"
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.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() {
|
||||
$('#people').dataTable( {
|
||||
"bPaginate": false,
|
||||
"bLengthChange": false
|
||||
} );
|
||||
} );
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
%table.table
|
||||
%tr
|
||||
%td
|
||||
%b First Name
|
||||
%td
|
||||
= @person.first_name
|
||||
%tr
|
||||
%td
|
||||
%b Last Name
|
||||
%td
|
||||
= @person.last_name
|
||||
%tr
|
||||
%td
|
||||
%b Public Name
|
||||
%td
|
||||
= @person.public_name
|
||||
%tr
|
||||
%td
|
||||
%b Company
|
||||
%td
|
||||
= @person.company
|
||||
%tr
|
||||
%td
|
||||
%b Email
|
||||
%td
|
||||
= @person.email
|
||||
%tr
|
||||
%td
|
||||
%b Created At
|
||||
%td
|
||||
= @person.created_at
|
||||
%tr
|
||||
%td
|
||||
%b Updated At
|
||||
%td
|
||||
= @person.updated_at
|
||||
%tr
|
||||
%td
|
||||
%b Biography
|
||||
%td
|
||||
= @person.biography
|
||||
%tr
|
||||
%td
|
||||
%b Registered to attend
|
||||
%td
|
||||
- if @person.registrations.count == 0
|
||||
None
|
||||
- else
|
||||
= @person.registrations.map { |r| r.conference.title }.join ','
|
||||
|
|
@ -1,19 +1,15 @@
|
|||
.row
|
||||
.col-md-12
|
||||
%h3
|
||||
Edit registration of #{@person.public_name} (#{@person.email}) for #{@conference.title}
|
||||
Edit registration of #{@user.name} (#{@user.email}) for #{@conference.title}
|
||||
%br
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
||||
= f.inputs "Personal Information" do
|
||||
= f.fields_for :person do |p|
|
||||
= p.input :first_name, :as => :string
|
||||
= p.input :last_name, :as => :string
|
||||
= p.label :Nickname, :as => :string
|
||||
= p.text_field :irc_nickname, :as => :string
|
||||
= p.label :Affiliation
|
||||
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
|
||||
= f.fields_for :user do |u|
|
||||
= u.input :nickname, :as => :string
|
||||
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
||||
= f.inputs "Registration Information" do
|
||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||
= f.semantic_fields_for :supporter_registration do |reg|
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
- @headers.each do |field|
|
||||
%td
|
||||
- if field == "name"
|
||||
#{registration.last_name} #{registration.first_name} (#{registration.irc_nickname}) #{registration.company}
|
||||
#{registration.name} #{registration.nickname} #{registration.affiliation}
|
||||
- if registration.supporter_level && registration.supporter_level.title != 'Free'
|
||||
%p{:style => "color:red"}
|
||||
= registration.supporter_level.title
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
= link_to "Edit", edit_admin_conference_registration_path(@conference.short_title, :id => registration), :method => :get, :class => "btn btn-primary"
|
||||
|
||||
%td
|
||||
= link_to "Delete", admin_conference_registration_path(@conference.short_title, registration), :method => :delete, :class => "btn btn-danger", data: {confirm: "Really delete registration for #{registration.public_name} #{registration.email}?"}
|
||||
= link_to "Delete", admin_conference_registration_path(@conference.short_title, registration), :method => :delete, :class => "btn btn-danger", data: {confirm: "Really delete registration for #{registration.name} #{registration.email}?"}
|
||||
%tr{:id => "row#{counter}", :style=>"display:none;"}
|
||||
%td{:colspan=>13}
|
||||
= render :partial => "questions", :locals => {:registration => registration}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
||||
table_array = []
|
||||
header_array = [" ",
|
||||
"Last Name",
|
||||
"First Name",
|
||||
"Public Name",
|
||||
"Name",
|
||||
"Email",
|
||||
"Attending Social Events",
|
||||
"Attending With Partner",
|
||||
|
|
@ -13,9 +11,7 @@ prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
|||
@registrations.each do |registration|
|
||||
row = []
|
||||
row << ""
|
||||
row << registration.last_name
|
||||
row << registration.first_name
|
||||
row << registration.public_name
|
||||
row << registration.name
|
||||
row << registration.email
|
||||
if registration.attending_social_events
|
||||
row << "X"
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ wb.add_worksheet(:name => "registrations") do |sheet|
|
|||
@registrations.each do |reg|
|
||||
row = []
|
||||
row << reg.attended
|
||||
row << "#{reg.last_name} #{reg.first_name} (#{reg.public_name})"
|
||||
row << reg.irc_nickname
|
||||
row << reg.company
|
||||
row << reg.name
|
||||
row << reg.nickname
|
||||
row << reg.affiliation
|
||||
row << reg.email
|
||||
row << reg.attending_social_events
|
||||
row << reg.attending_with_partner
|
||||
|
|
@ -21,5 +21,5 @@ wb.add_worksheet(:name => "registrations") do |sheet|
|
|||
sheet.add_row row
|
||||
end
|
||||
sheet.column_info[8].width = [sheet.column_info[8].width, 30].min
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,16 +7,11 @@
|
|||
= semantic_form_for(@registration, :url => admin_conference_registrations_path(@conference.short_title)) do |f|
|
||||
|
||||
= f.inputs "Your details" do
|
||||
= f.fields_for @person do |p|
|
||||
= p.fields_for @user do |u|
|
||||
= u.input :email, :as => :string, :hint => "Please enter a valid email address. You will need it to log in to OSEM later."
|
||||
= p.input :first_name, :as => :string
|
||||
= p.input :last_name, :as => :string
|
||||
= p.input :public_name, :as => :string
|
||||
= p.label :Nickname
|
||||
= p.text_field :irc_nickname, :as => :string
|
||||
= p.label :Affiliation
|
||||
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
|
||||
= f.fields_for @user do |u|
|
||||
= u.input :email, :as => :string, :hint => "Please enter a valid email address. You will need it to log in to OSEM later."
|
||||
= u.input :name, as: :string
|
||||
= u.input :nickname, :as => :string
|
||||
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
||||
|
||||
= f.inputs "Registration Information" do
|
||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
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)
|
||||
= f.collection_select(:user_id, User.order(:name), :id, :name)
|
||||
|
||||
.modal-footer
|
||||
= link_to "Close", "#", :data => {:dismiss => "modal"}, :class => 'btn'
|
||||
|
|
|
|||
|
|
@ -5,22 +5,16 @@
|
|||
%thead
|
||||
%th
|
||||
ID
|
||||
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
||||
- (@speaker_fields_user + @speaker_fields_reg).each do |field|
|
||||
%th
|
||||
= field.capitalize
|
||||
- @speakers.each do |speaker|
|
||||
%tr
|
||||
%td
|
||||
= count +=1
|
||||
- @speaker_fields_person.each do |field|
|
||||
- @speaker_fields_user.each do |field|
|
||||
%td
|
||||
- if field == 'name'
|
||||
= speaker.first_name
|
||||
= speaker.last_name
|
||||
%br
|
||||
(#{speaker.public_name})
|
||||
- else
|
||||
= speaker.send(field.to_sym)
|
||||
= speaker.send(field.to_sym)
|
||||
- @speaker_fields_reg.each do |field|
|
||||
%td
|
||||
- reg = speaker_reg(speaker)
|
||||
|
|
|
|||
8
app/views/admin/users/_form.html.haml
Normal file
8
app/views/admin/users/_form.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
= semantic_form_for [:admin, @user] do |f|
|
||||
= f.inputs "Basic Information" do
|
||||
= f.input :name, :as => :string
|
||||
= f.input :email
|
||||
= f.input :affiliation, :as => :string
|
||||
= f.input :biography, :input_html => {:rows => 10}
|
||||
= f.actions do
|
||||
= f.action :submit, :button_html => {:class => "btn btn-primary"}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
Users
|
||||
- if @users
|
||||
= "(#{@users.length})"
|
||||
|
||||
= 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
|
||||
|
|
@ -14,18 +16,15 @@
|
|||
%th
|
||||
%b Email
|
||||
%th
|
||||
%b Last Name
|
||||
%b Name
|
||||
%th
|
||||
%b First Name
|
||||
%th
|
||||
%b Public Name
|
||||
%b # of Conference Registrations
|
||||
%th
|
||||
%b Roles
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
- @users.each do |user|
|
||||
- person = Person.find_person_by_user_id(user.id)
|
||||
%tr
|
||||
%td
|
||||
= user.id
|
||||
|
|
@ -37,13 +36,9 @@
|
|||
%td
|
||||
= user.email
|
||||
%td
|
||||
= user.last_name
|
||||
= user.name
|
||||
%td
|
||||
= user.first_name
|
||||
%td
|
||||
= user.public_name
|
||||
%td
|
||||
= user.roles.map { |role| role.name }.join ','
|
||||
= user.registrations.count
|
||||
%td
|
||||
.modal.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"}
|
||||
.modal-dialog
|
||||
|
|
@ -60,22 +55,21 @@
|
|||
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
||||
Cancel
|
||||
- else
|
||||
= "Give #{user.public_name} (#{user.email}) the following roles:"
|
||||
= "Give #{user.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}",id: "user-modify-role-#{user.id}"
|
||||
=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 "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" => ""
|
||||
= 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"
|
||||
- else
|
||||
=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"
|
||||
|
||||
|
||||
|
|
|
|||
7
app/views/admin/users/show.html.haml
Normal file
7
app/views/admin/users/show.html.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
%table.table
|
||||
- @show_attributes.each do |attr|
|
||||
%tr
|
||||
%td
|
||||
%b
|
||||
= attr.capitalize.gsub('_', ' ')
|
||||
%td= @user.send(attr)
|
||||
Loading…
Add table
Add a link
Reference in a new issue