Remove nil hash objects
This commit is contained in:
parent
7cd1635317
commit
88a6b2769b
3 changed files with 41 additions and 36 deletions
|
|
@ -9,12 +9,15 @@ module Admin
|
|||
end
|
||||
|
||||
def show
|
||||
@sponsor.swag.reject! { |_key, value| value[:type].blank? || value[:quantity].blank? }
|
||||
@sponsor.swag_transportation.reject! { |_key, value| value[:carrier_name].blank? || value[:tracking_number].blank? || value[:boxes].blank? }
|
||||
@sponsor.swag_index = @sponsor.swag.length
|
||||
@sponsor.carrier_index = @sponsor.swag_transportation.length
|
||||
end
|
||||
|
||||
def edit
|
||||
@sponsor.swag = @sponsor.swag
|
||||
@sponsor.swag.reject! { |_key, value| value[:type].blank? || value[:quantity].blank? }
|
||||
@sponsor.swag_transportation.reject! { |_key, value| value[:carrier_name].blank? || value[:tracking_number].blank? }
|
||||
@sponsor.swag_index = @sponsor.swag.length
|
||||
@sponsor.carrier_index = @sponsor.swag_transportation.length
|
||||
end
|
||||
|
|
|
|||
|
|
@ -92,13 +92,14 @@
|
|||
- else
|
||||
%span.fa.fa-times.text-danger
|
||||
%td
|
||||
- if sponsor.has_swag
|
||||
- if sponsor.swag.length > 0
|
||||
- sponsor.swag.each do |key, value|
|
||||
= value[:type]
|
||||
(
|
||||
= value[:quantity]
|
||||
)
|
||||
%br
|
||||
- unless value[:type].blank?
|
||||
= value[:type]
|
||||
(
|
||||
= value[:quantity]
|
||||
)
|
||||
%br
|
||||
|
||||
%td
|
||||
= check_box_tag @conference.short_title, sponsor.id, sponsor.swag_received,
|
||||
|
|
@ -163,7 +164,7 @@
|
|||
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-warning'
|
||||
#to_contact.tab-pane
|
||||
- if @conference.sponsors.to_contact.any?
|
||||
- if @conference.sponsors.any?
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover#sponsors
|
||||
|
|
@ -175,33 +176,34 @@
|
|||
%th Level
|
||||
%th Actions
|
||||
%tbody
|
||||
- @conference.sponsors.to_contact.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
|
||||
= truncate(sponsor.description)
|
||||
%td
|
||||
= link_to sponsor.website_url, sponsor.website_url
|
||||
%td
|
||||
= sponsor.sponsorship_level.title
|
||||
%td
|
||||
.btn-group
|
||||
= link_to 'Edit', edit_admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||
method: :get, class: 'btn btn-mini btn-primary'
|
||||
= link_to 'Delete', admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||
method: :delete, class: 'btn btn-mini btn-danger', data: { confirm: "Do you really want to delete the sponsor #{sponsor.name}?" }
|
||||
- if sponsor.transition_possible? :confirm
|
||||
= link_to 'Confirm', confirm_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-success'
|
||||
- if sponsor.transition_possible? :contact
|
||||
= link_to 'Contacted', contact_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-default'
|
||||
- if sponsor.transition_possible? :cancel
|
||||
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-warning'
|
||||
- @conference.sponsors.each do |sponsor|
|
||||
- if sponsor.state =='to_contact'
|
||||
%tr
|
||||
%td
|
||||
= image_tag(sponsor.picture.thumb.url, width: '20%')
|
||||
%td
|
||||
= link_to sponsor.name, admin_conference_sponsor_path(@conference.short_title, sponsor)
|
||||
%td
|
||||
= truncate(sponsor.description)
|
||||
%td
|
||||
= link_to sponsor.website_url, sponsor.website_url
|
||||
%td
|
||||
= sponsor.sponsorship_level.title
|
||||
%td
|
||||
.btn-group
|
||||
= link_to 'Edit', edit_admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||
method: :get, class: 'btn btn-mini btn-primary'
|
||||
= link_to 'Delete', admin_conference_sponsor_path(@conference.short_title, sponsor),
|
||||
method: :delete, class: 'btn btn-mini btn-danger', data: { confirm: "Do you really want to delete the sponsor #{sponsor.name}?" }
|
||||
- if sponsor.transition_possible? :confirm
|
||||
= link_to 'Confirm', confirm_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-success'
|
||||
- if sponsor.transition_possible? :contact
|
||||
= link_to 'Mark as Contacted', contact_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-default'
|
||||
- if sponsor.transition_possible? :cancel
|
||||
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||
method: :patch, class: 'btn btn-mini btn-warning'
|
||||
|
||||
- else
|
||||
%p There are no unconfirmed sponsors
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
off_text: 'No' }
|
||||
|
||||
|
||||
- if @sponsor.has_swag
|
||||
- if @sponsor.swag.length > 0
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Swag's Type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue