Sponsor dashboard added, with sponsor component for splash page
This commit is contained in:
parent
643b8b173a
commit
ea119a8158
36 changed files with 549 additions and 12 deletions
43
app/controllers/admin/organizations_controller.rb
Normal file
43
app/controllers/admin/organizations_controller.rb
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
class Admin::OrganizationsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
respond_to :html
|
||||
|
||||
def index
|
||||
@organizations = Organization.all
|
||||
end
|
||||
|
||||
def new
|
||||
@organization = Organization.new
|
||||
end
|
||||
|
||||
def create
|
||||
@organization = Organization.new(params[:organization])
|
||||
flash[:notice] = 'Organization was successfully created.' if @organization.save
|
||||
respond_with @organization, :location => admin_organizations_path
|
||||
end
|
||||
|
||||
def show
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def edit
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@organization = Organization.find(params[:id])
|
||||
flash[:notice] = 'Organization was successfully updated' if @organization.update_attributes(params[:organization])
|
||||
respond_with @organization, :location => admin_organizations_path
|
||||
end
|
||||
|
||||
def delete
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.destroy
|
||||
redirect_to admin_organizations_path, :notice => "Organization got deleted"
|
||||
|
||||
end
|
||||
end
|
||||
16
app/controllers/admin/sponsorship_levels_controller.rb
Normal file
16
app/controllers/admin/sponsorship_levels_controller.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class Admin::SponsorshipLevelsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def show
|
||||
render :sponsorship_levels
|
||||
end
|
||||
|
||||
def update
|
||||
begin
|
||||
@conference.update_attributes!(params[:conference])
|
||||
redirect_to(admin_conference_sponsorship_levels_path(:conference_id => @conference.short_title), :notice => 'Sponsorship levels were successfully updated.')
|
||||
rescue Exception => e
|
||||
redirect_to(admin_conference_sponsorship_levels_path(:conference_id => @conference.short_title), :alert => "Sponsorship levels update failed: #{e.message}")
|
||||
end
|
||||
end
|
||||
end
|
||||
17
app/controllers/admin/sponsorships_controller.rb
Normal file
17
app/controllers/admin/sponsorships_controller.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class Admin::SponsorshipsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def create
|
||||
params[:sponsorship_registration][:conference_id] = @conference.id
|
||||
sponsorship = SponsorshipRegistration.new(params[:sponsorship_registration])
|
||||
if sponsorship.save
|
||||
redirect_to(admin_conference_sponsorships_path(:conference_id => @conference.short_title), :notice => "Sponsorship added")
|
||||
else
|
||||
redirect_to(admin_conference_sponsorships_path(:conference_id => @conference.short_title),
|
||||
:alert => "Sponsorship creation failed.#{sponsorship.errors.full_messages.join('. ')}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -3,13 +3,16 @@
|
|||
|
||||
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, :dietary_choices_attributes,
|
||||
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes,
|
||||
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
||||
:dietary_choices_attributes,
|
||||
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes,
|
||||
:social_events_attributes,
|
||||
:event_types_attributes, :registration_start_date, :registration_end_date, :logo,
|
||||
:questions_attributes, :question_ids, :answers_attributes, :answer_ids,
|
||||
:difficulty_levels_attributes, :use_difficulty_levels,
|
||||
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
|
||||
:media_id, :media_type
|
||||
:media_id, :media_type, :sponsorship_levels_attributes, :sponsor_email,
|
||||
:sponsor_description
|
||||
|
||||
has_paper_trail
|
||||
|
||||
|
|
@ -30,6 +33,8 @@ class Conference < ActiveRecord::Base
|
|||
has_many :vdays, :dependent => :destroy
|
||||
has_many :vpositions, :dependent => :destroy
|
||||
has_many :vchoices, :dependent => :destroy
|
||||
has_many :sponsorship_levels, dependent: :destroy
|
||||
has_many :sponsorship_registrations, dependent: :destroy
|
||||
|
||||
belongs_to :venue
|
||||
|
||||
|
|
@ -40,6 +45,7 @@ class Conference < ActiveRecord::Base
|
|||
accepts_nested_attributes_for :venue
|
||||
accepts_nested_attributes_for :dietary_choices, :allow_destroy => true
|
||||
accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
|
||||
accepts_nested_attributes_for :sponsorship_levels, :allow_destroy => true
|
||||
accepts_nested_attributes_for :event_types, :allow_destroy => true
|
||||
accepts_nested_attributes_for :email_settings
|
||||
accepts_nested_attributes_for :questions, :allow_destroy => true
|
||||
|
|
|
|||
16
app/models/organization.rb
Normal file
16
app/models/organization.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class Organization < ActiveRecord::Base
|
||||
attr_accessible :title, :photo, :email_id, :description, :website_url
|
||||
has_many :sponsorship_registrations, dependent: :destroy
|
||||
has_attached_file :photo,
|
||||
:styles => {:thumb => "100x100>", :large => "300x300>" }
|
||||
|
||||
validates_attachment_content_type :photo,
|
||||
:content_type => [/jpg/, /jpeg/, /png/, /gif/],
|
||||
:size => { :in => 0..500.kilobytes }
|
||||
validates_presence_of :title,
|
||||
:email_id,
|
||||
:website_url
|
||||
validates_uniqueness_of :email_id
|
||||
|
||||
|
||||
end
|
||||
6
app/models/sponsorship_level.rb
Normal file
6
app/models/sponsorship_level.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class SponsorshipLevel < ActiveRecord::Base
|
||||
attr_accessible :title, :description
|
||||
belongs_to :conference
|
||||
has_many :sponsorship_registrations
|
||||
validates_presence_of :title
|
||||
end
|
||||
11
app/models/sponsorship_registration.rb
Normal file
11
app/models/sponsorship_registration.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class SponsorshipRegistration < ActiveRecord::Base
|
||||
attr_accessible :name, :email_id, :contact_no, :amount_donated, :method_of_donation,
|
||||
:sponsorship_level_id, :conference_id, :organization_id
|
||||
belongs_to :organization
|
||||
belongs_to :sponsorship_level
|
||||
belongs_to :conference
|
||||
validates_presence_of :name, :email_id, :contact_no, :amount_donated,
|
||||
:method_of_donation, :sponsorship_level,
|
||||
:conference, :organization
|
||||
validates_uniqueness_of :email_id
|
||||
end
|
||||
|
|
@ -1,3 +1,33 @@
|
|||
.row
|
||||
.col-md-8
|
||||
%h1 Dashboard for #{@conference.title}
|
||||
%h1 Dashboard for #{@conference.title}
|
||||
.col-md-9
|
||||
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
||||
= f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'"
|
||||
= f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs"
|
||||
= f.input :social_tag, :hint => "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
|
||||
= f.input :contact_email, :hint => "Contact email address for your conference. Will be used as reply-to address in emails sent out by the system."
|
||||
|
||||
= f.inputs :name => "Scheduling" do
|
||||
= 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.inputs :name => "Media" do
|
||||
- if !@conference.logo.blank?
|
||||
= image_tag @conference.logo(:thumb)
|
||||
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
||||
= f.input :media_type, :as => :select, :label => "Conference Promo Media Type", :class=>"form-control", :collection => Conference.media_types.values, :include_blank => false, :hint => "This media-item will be used to represent this conference at various places in OSEM."
|
||||
= f.input :media_id, :label => "Conference Promo Media ID", :as => :string
|
||||
%p{:class => "help-block media-type", :id => "youtube-help"} Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/"
|
||||
%p{:class => "help-block media-type", :id => "slideshare-help", :style => "display:none"} Go to your SlideShare, click on "share" -> "embed" and copy the id
|
||||
%p{:class => "help-block media-type", :id => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
||||
%p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
||||
%p{:class => "help-block media-type", :id => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id
|
||||
%p{:class => "help-block media-type", :id => "instagram-help", :style => "display:none"} Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol)
|
||||
= f.input :sponsor_email, hint: 'This mail id is used by sponsors to contact organizers'
|
||||
= f.input :sponsor_description, hint: 'This description will be displayed in sponsor section of splash page'
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
>>>>>>> Sponsor dashboard added, with sponsor component for splash page
|
||||
|
|
|
|||
11
app/views/admin/organizations/_form.html.haml
Normal file
11
app/views/admin/organizations/_form.html.haml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
= semantic_form_for [:admin, @organization] do |f|
|
||||
= f.inputs "Basic Information" do
|
||||
= f.input :title, as: :string
|
||||
= f.input :email_id, as: :string
|
||||
= f.input :website_url, as: :string
|
||||
= f.input :description
|
||||
- if !@organization.photo.blank?
|
||||
= image_tag @organization.photo(:thumb)
|
||||
= f.input :photo
|
||||
= f.actions do
|
||||
= f.action :submit, :button_html => {:class => "btn primary"}
|
||||
36
app/views/admin/organizations/index.html.haml
Normal file
36
app/views/admin/organizations/index.html.haml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
Organizations
|
||||
- if @organizations
|
||||
= "(#{@organizations.length})"
|
||||
= link_to "New Organization", new_admin_organization_path, :class => "btn btn-success pull-right"
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.well
|
||||
%table.table.table-striped.table-bordered.table-hover#organization
|
||||
%thead
|
||||
%th
|
||||
%b Title
|
||||
%th
|
||||
%b Email
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
- @organizations.each do |organization|
|
||||
%tr
|
||||
%td= organization.title
|
||||
%td= organization.email_id
|
||||
%td= link_to "Edit", edit_admin_organization_path(organization)
|
||||
%td= link_to "View", admin_organization_path(organization)
|
||||
%td=link_to 'Delete',admin_organization_path(organization), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('#organization').dataTable( {
|
||||
"bPaginate": false,
|
||||
"bLengthChange": false
|
||||
} );
|
||||
} );
|
||||
26
app/views/admin/organizations/show.html.haml
Normal file
26
app/views/admin/organizations/show.html.haml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
%table.table
|
||||
%tr
|
||||
%td
|
||||
%b Title
|
||||
%td
|
||||
= @organization.title
|
||||
%tr
|
||||
%td
|
||||
%b Email
|
||||
%td
|
||||
= @organization.email_id
|
||||
%tr
|
||||
%td
|
||||
%b Logo
|
||||
%td
|
||||
= image_tag(@organization.photo(:thumb), class: 'img-responsive') if @organization.photo?
|
||||
%tr
|
||||
%td
|
||||
%b Description
|
||||
%td
|
||||
= @organization.description
|
||||
%tr
|
||||
%td
|
||||
%b Website Url
|
||||
%td
|
||||
= @organization.website_url
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<div class="nested-fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :title %>
|
||||
<%= f.input :description %>
|
||||
<%= remove_association_link :sponsorship_level, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
4
app/views/admin/sponsorship_levels/index.html.haml
Normal file
4
app/views/admin/sponsorship_levels/index.html.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
.col-md-9
|
||||
= semantic_form_for(@conference, :url => admin_conference_sponsorship_level_path(@conference.short_title, @conference.sponsorship_levels)) do |f|
|
||||
= dynamic_association :sponsorship_levels, "Sponsorship Levels", f
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
45
app/views/admin/sponsorships/index.html.haml
Normal file
45
app/views/admin/sponsorships/index.html.haml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#new-sponsorship-dialog
|
||||
= semantic_form_for :sponsorship_registration, :html => {:id => "sponsorship-add-form"} do |f|
|
||||
= f.input :name, :label => "Sponsorship Name"
|
||||
= f.input :email_id, :label => "Sponsorship Email"
|
||||
= f.input :organization_id, as: :select, collection: Organization.all
|
||||
= f.input :sponsorship_level_id, :as => :select, :collection => @conference.sponsorship_levels
|
||||
= f.input :contact_no, :label => "Phone Number"
|
||||
= f.input :amount_donated
|
||||
= f.input :method_of_donation
|
||||
= f.action :submit, :button_html => { :value => "Save", :class => "btn btn-primary" }
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
|
||||
= link_to "New Sponsorship", "#", :id => "new-sponsorship-button", :class => "btn btn-success"
|
||||
.row
|
||||
.col-md-12
|
||||
%h2 Sponsorships
|
||||
.well
|
||||
%table.table.table-striped#sponsorships
|
||||
%thead
|
||||
%th
|
||||
Name
|
||||
%th
|
||||
Email
|
||||
%th
|
||||
Level
|
||||
%th
|
||||
Organization
|
||||
%th
|
||||
Phone Number
|
||||
%th
|
||||
Amount Donated
|
||||
%th
|
||||
Method of Donation
|
||||
%tbody
|
||||
- @conference.sponsorship_registrations.each do |u|
|
||||
%tr
|
||||
%td= u.name
|
||||
%td= u.email_id
|
||||
%td= u.sponsorship_level.title if u.sponsorship_level
|
||||
%td= u.organization.title
|
||||
%td= u.contact_no
|
||||
%td= u.amount_donated
|
||||
%td= u.method_of_donation
|
||||
20
app/views/conference/_sponsor.html.haml
Normal file
20
app/views/conference/_sponsor.html.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
%div.container#sponsors.text-center
|
||||
%div.row
|
||||
%div.col-md-12
|
||||
%h2 Sponsors
|
||||
-if !@conference.sponsor_description.blank?
|
||||
%p #{ @conference.sponsor_description }
|
||||
-if !@conference.sponsor_email.blank?
|
||||
%h3= mail_to "#{ @conference.sponsor_email }", 'Become a Sponsor'
|
||||
- if !@conference.sponsorship_levels.blank?
|
||||
- @conference.sponsorship_levels.each do |l|
|
||||
- if !l.sponsorship_registrations.blank?
|
||||
%div.row.multi-columns-row
|
||||
%h4 #{l.title}
|
||||
- l.sponsorship_registrations.each_with_index do |r,index|
|
||||
%div.col-md-4
|
||||
- if !r.organization.photo.blank?
|
||||
= link_to image_tag(r.organization.photo(:large), class: 'img-responsive', alt: "#{r.organization.title} Logo", title: "#{r.organization.description}"), "http://#{r.organization.website_url}"
|
||||
- unless index == 0
|
||||
- if index%2 == 0
|
||||
%div.clearfix.visible-md.visible-lg
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
= content_for :splash_logo do
|
||||
= link_to @conference.title, "#", :class => 'navbar-brand'
|
||||
= render :partial => "home/conference_details", :locals => {:conference => @conference}
|
||||
= content_for :splash_header do
|
||||
%ul.nav.navbar-nav
|
||||
%li
|
||||
%a{ href: '#sponsors' } Sponsors
|
||||
= render 'sponsor'
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@
|
|||
= link_to(admin_conference_registrations_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-user
|
||||
Registrations
|
||||
%li{:class=> active_nav_li(admin_conference_sponsorships_path(@conference.short_title))}
|
||||
= link_to(admin_conference_sponsorships_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-usd
|
||||
Sponsorships
|
||||
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
|
||||
= link_to(admin_conference_events_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-comment
|
||||
|
|
@ -31,7 +35,7 @@
|
|||
%li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))}
|
||||
= link_to(admin_conference_schedule_path(@conference.short_title), target: '_blank') do
|
||||
%span.glyphicon.glyphicon-calendar
|
||||
Shedule
|
||||
Schedule
|
||||
%hr
|
||||
%li.nav-header
|
||||
%a
|
||||
|
|
@ -49,6 +53,10 @@
|
|||
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
|
||||
%li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))}
|
||||
= link_to 'Rooms', admin_conference_rooms_path(@conference.short_title)
|
||||
%li{:class=> active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))}
|
||||
= link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-star
|
||||
Sponsorship Levels
|
||||
%li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))}
|
||||
= link_to(admin_conference_emails_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-envelope
|
||||
|
|
|
|||
|
|
@ -28,3 +28,8 @@
|
|||
= link_to(admin_people_path) do
|
||||
%span.glyphicon.glyphicon-star-empty
|
||||
People
|
||||
%li
|
||||
= link_to(admin_organizations_path) do
|
||||
%span.glyphicon.glyphicon-th
|
||||
Organization
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
-if has_role?(current_user, "admin") || has_role?(current_user, "organizer")
|
||||
%li.divider
|
||||
%li
|
||||
|
||||
= link_to(admin_conference_index_path()) do
|
||||
%span.glyphicon.glyphicon-home
|
||||
Administration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue