venue_management/app/helpers/venue_admin_helper.rb

26 lines
1.2 KiB
Ruby

module VenueAdminHelper
include OrbitFormHelper
alias :org_datetime_picker :datetime_picker
def datetime_picker(*arg,**args)
tp = org_datetime_picker(*arg,**args)
venue = @template.instance_variable_get(:@venue)
if !venue.nil?
style_attr = ''
if !@object.send(arg[0].to_s+'_reminder')
style_attr = " style=\"display: none;\""
end
onclick_func = "function reminder_switch(ele){
if ($(ele).prop('checked')){
$(ele).parents('.controls').find('.email_reminder').show()
}else{
$(ele).parents('.controls').find('.email_reminder').hide()
}
};reminder_switch(this)"
tp2 = content_tag(:div, :style => "float: left;flex-wrap: wrap;display: inline-flex;margin-left: 1em;align-items: center;") do
self.check_box((arg[0].to_s+'_reminder').to_sym,:onclick => onclick_func) + "寄送Email提醒<div class=\"email_reminder\"#{style_attr}>:&nbsp;提前#{self.number_field((arg[0].to_s+'_reminder_day').to_sym, :class => 'input-mini')}天寄送</div>".html_safe
end
tp = content_tag(:div, tp , :style=>"float: left;")+ tp2
end
tp
end
end