Add tabs to sponsor#index
This commit is contained in:
parent
4381f687b6
commit
b770f9bd4d
3 changed files with 94 additions and 35 deletions
|
|
@ -4,7 +4,7 @@ module Admin
|
||||||
load_and_authorize_resource :sponsor, through: :conference
|
load_and_authorize_resource :sponsor, through: :conference
|
||||||
before_action :sponsorship_level_required, only: [:index, :new]
|
before_action :sponsorship_level_required, only: [:index, :new]
|
||||||
|
|
||||||
helper_method :generate_swags_hash
|
helper_method :add_swags
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize! :index, Sponsor.new(conference_id: @conference.id)
|
authorize! :index, Sponsor.new(conference_id: @conference.id)
|
||||||
|
|
@ -57,8 +57,8 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_swag
|
def add_swags(form, index)
|
||||||
swags_hash = @sponsor.swags_hash
|
render partial: 'swag_fields', locals: { f: form, index: (index + 1), v_type: nil, v_quantity: 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
off_text: 'No' }
|
off_text: 'No' }
|
||||||
- @sponsor.swags.each_with_index do |(key, value), index|
|
- @sponsor.swags.each_with_index do |(key, value), index|
|
||||||
=render partial: 'swag_fields', locals: {f: f, index: index, v_type: value[:type].to_s, v_quantity: value[:quantity].to_i}
|
=render partial: 'swag_fields', locals: {f: f, index: index, v_type: value[:type].to_s, v_quantity: value[:quantity].to_i}
|
||||||
=render partial: 'swag_fields', locals: { f: f, index: @sponsor.swag_index, v_type: nil, v_quantity: 0}
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,16 @@
|
||||||
%h1 Sponsors
|
%h1 Sponsors
|
||||||
%p.text-muted
|
%p.text-muted
|
||||||
People supporting your conference
|
People supporting your conference
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%div{ role: 'tabpanel' }
|
||||||
|
%ul.nav.nav-tabs{ role: 'tablist' }
|
||||||
|
%li.active{ role: 'presentation'}
|
||||||
|
%a{ 'aria-controls' => 'sponsorship', 'data-toggle' => 'tab', href: '#sponsorship', role: 'tab'} Sponsorship
|
||||||
|
%li{ role: 'Swags'}
|
||||||
|
%a{ 'aria-controls' => 'swags','data-toggle' => 'tab', href: '#swags', role: 'tab'} Swags
|
||||||
|
.tab-content
|
||||||
|
#sponsorship.tab-pane.active{ role: 'tabpanel' }
|
||||||
- if @conference.sponsors.any?
|
- if @conference.sponsors.any?
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
|
@ -34,6 +44,56 @@
|
||||||
method: :get, class: 'btn btn-primary'
|
method: :get, class: 'btn btn-primary'
|
||||||
= link_to 'Delete', admin_conference_sponsor_path(@conference.short_title, sponsor),
|
= link_to 'Delete', admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the sponsor #{sponsor.name}?" }
|
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the sponsor #{sponsor.name}?" }
|
||||||
|
|
||||||
|
#swags.tab-pane.active{ role: 'tabpanel' }
|
||||||
|
- if @conference.sponsors.any?
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%table.table.table-hover#sponsors
|
||||||
|
%thead
|
||||||
|
%th Logo
|
||||||
|
%th Name
|
||||||
|
%th Banner
|
||||||
|
%th Swags
|
||||||
|
%th Swag Items
|
||||||
|
%th Received
|
||||||
|
%th Actions
|
||||||
|
%tbody
|
||||||
|
- @conference.sponsors.each do |sponsor|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= image_tag(sponsor.picture.thumb.url, width: '20%')
|
||||||
|
%td
|
||||||
|
= link_to sponsor.name, admin_conference_sponsor_path(@conference.short_title, sponsor)
|
||||||
|
%td
|
||||||
|
- if sponsor.has_banner
|
||||||
|
%span.fa.fa-check.text-success
|
||||||
|
- else
|
||||||
|
%span.fa.fa-times
|
||||||
|
%td
|
||||||
|
- if sponsor.has_swag
|
||||||
|
%span.fa.fa-check.text-success
|
||||||
|
- else
|
||||||
|
%span.fa.fa-times
|
||||||
|
%td
|
||||||
|
- if sponsor.has_swag
|
||||||
|
- sponsor.swags.each do |key, value|
|
||||||
|
= value[:type]
|
||||||
|
(
|
||||||
|
= value[:quantity]
|
||||||
|
)
|
||||||
|
%br
|
||||||
|
%td
|
||||||
|
- if sponsor.swag_received
|
||||||
|
%span.fa.fa-check.text-success
|
||||||
|
- else
|
||||||
|
%span.fa.fa-times
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
= link_to 'Edit', edit_admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||||
|
method: :get, class: 'btn btn-primary'
|
||||||
|
= link_to 'Delete', admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||||
|
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the sponsor #{sponsor.name}?" }
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= link_to 'Add Sponsor', new_admin_conference_sponsor_path(@conference.short_title), class: 'btn btn-primary pull-right'
|
= link_to 'Add Sponsor', new_admin_conference_sponsor_path(@conference.short_title), class: 'btn btn-primary pull-right'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue