Sponsors dashboard

Removed explicit rendering of sponsors
This commit is contained in:
Gopesh Tulsyan 2014-06-05 20:05:20 +05:30
parent e38a654af1
commit 67dab025a9
9 changed files with 139 additions and 4 deletions

View file

@ -0,0 +1,17 @@
module Admin
class SponsorsController < ApplicationController
before_filter :verify_organizer
def update
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_sponsors_path(
conference_id: @conference.short_title),
notice: 'Sponsorships were successfully updated.')
else
redirect_to(admin_conference_sponsors_path(
conference_id: @conference.short_title),
alert: 'Sponsorships updation failed')
end
end
end
end

View file

@ -11,7 +11,8 @@ class Conference < ActiveRecord::Base
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
:media_id, :media_type, :color, :description,
:registration_description, :ticket_description,
:sponsorship_levels_attributes
:sponsorship_levels_attributes,
:sponsors_attributes
has_paper_trail
@ -45,6 +46,7 @@ class Conference < ActiveRecord::Base
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 :sponsors, 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

View file

@ -1,5 +1,6 @@
class Sponsor < ActiveRecord::Base
attr_accessible :name, :description, :website_url, :logo
attr_accessible :name, :description, :website_url, :logo,
:sponsorship_level_id
belongs_to :sponsorship_level
belongs_to :conference
has_attached_file :logo,
@ -8,5 +9,5 @@ class Sponsor < ActiveRecord::Base
validates_attachment_content_type :logo,
content_type: [/jpg/, /jpeg/, /png/, /gif/],
size: { in: 0..500.kilobytes }
validates_presence_of :name, :website_url
validates_presence_of :name, :website_url, :sponsorship_level
end

View file

@ -0,0 +1,11 @@
<div class="nested-fields">
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :description %>
<%= image_tag f.object.logo(:thumb) if !f.object.logo.blank? %>
<%= f.input :logo %>
<%= f.input :website_url %>
<%= f.input :sponsorship_level, collection: @conference.sponsorship_levels %>
<%= remove_association_link :sponsor, f %>
<% end %>
</div>

View file

@ -0,0 +1,5 @@
.row
.col-md-8
= semantic_form_for(@conference, :url => admin_conference_sponsor_path(@conference.short_title, @conference.sponsors)) do |f|
= dynamic_association :sponsors, "Sponsors", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -45,10 +45,13 @@
%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))}
%li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))} myAccordion" }
= link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do
%span.glyphicon.glyphicon-star
Sponsorship Levels
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
%li{:class=> active_nav_li(admin_conference_sponsors_path(@conference.short_title))}
= link_to 'Sponsors', admin_conference_sponsors_path(@conference.short_title)
%li{ class: active_nav_li(admin_conference_supporter_levels_path(@conference.short_title)) }
= link_to(admin_conference_supporter_levels_path(@conference.short_title)) do
Supporter Levels