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
|
end
|
||||||
|
|
||||||
def show
|
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.swag_index = @sponsor.swag.length
|
||||||
@sponsor.carrier_index = @sponsor.swag_transportation.length
|
@sponsor.carrier_index = @sponsor.swag_transportation.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
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.swag_index = @sponsor.swag.length
|
||||||
@sponsor.carrier_index = @sponsor.swag_transportation.length
|
@sponsor.carrier_index = @sponsor.swag_transportation.length
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,9 @@
|
||||||
- else
|
- else
|
||||||
%span.fa.fa-times.text-danger
|
%span.fa.fa-times.text-danger
|
||||||
%td
|
%td
|
||||||
- if sponsor.has_swag
|
- if sponsor.swag.length > 0
|
||||||
- sponsor.swag.each do |key, value|
|
- sponsor.swag.each do |key, value|
|
||||||
|
- unless value[:type].blank?
|
||||||
= value[:type]
|
= value[:type]
|
||||||
(
|
(
|
||||||
= value[:quantity]
|
= value[:quantity]
|
||||||
|
|
@ -163,7 +164,7 @@
|
||||||
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||||
method: :patch, class: 'btn btn-mini btn-warning'
|
method: :patch, class: 'btn btn-mini btn-warning'
|
||||||
#to_contact.tab-pane
|
#to_contact.tab-pane
|
||||||
- if @conference.sponsors.to_contact.any?
|
- if @conference.sponsors.any?
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%table.table.table-hover#sponsors
|
%table.table.table-hover#sponsors
|
||||||
|
|
@ -175,7 +176,8 @@
|
||||||
%th Level
|
%th Level
|
||||||
%th Actions
|
%th Actions
|
||||||
%tbody
|
%tbody
|
||||||
- @conference.sponsors.to_contact.each do |sponsor|
|
- @conference.sponsors.each do |sponsor|
|
||||||
|
- if sponsor.state =='to_contact'
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= image_tag(sponsor.picture.thumb.url, width: '20%')
|
= image_tag(sponsor.picture.thumb.url, width: '20%')
|
||||||
|
|
@ -197,7 +199,7 @@
|
||||||
= link_to 'Confirm', confirm_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
= link_to 'Confirm', confirm_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||||
method: :patch, class: 'btn btn-mini btn-success'
|
method: :patch, class: 'btn btn-mini btn-success'
|
||||||
- if sponsor.transition_possible? :contact
|
- if sponsor.transition_possible? :contact
|
||||||
= link_to 'Contacted', contact_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
= link_to 'Mark as Contacted', contact_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||||
method: :patch, class: 'btn btn-mini btn-default'
|
method: :patch, class: 'btn btn-mini btn-default'
|
||||||
- if sponsor.transition_possible? :cancel
|
- if sponsor.transition_possible? :cancel
|
||||||
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
= link_to 'Cancel', cancel_admin_conference_sponsor_path(@conference.short_title, sponsor.id),
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
off_text: 'No' }
|
off_text: 'No' }
|
||||||
|
|
||||||
|
|
||||||
- if @sponsor.has_swag
|
- if @sponsor.swag.length > 0
|
||||||
%tr
|
%tr
|
||||||
%td.col-md-2
|
%td.col-md-2
|
||||||
%b Swag's Type
|
%b Swag's Type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue