47 lines
2.9 KiB
Ruby
47 lines
2.9 KiB
Ruby
|
module VenueAdminHelper
|
||
|
include ActionView::Helpers::FormOptionsHelper
|
||
|
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?
|
||
|
module_pages = @template.instance_variable_get(:@module_pages)
|
||
|
base_name = self.object_name
|
||
|
calendar_types = @template.instance_variable_get(:@calendar_types)
|
||
|
style_attr = ''
|
||
|
calendar_show = !@object['calendar_dict'][arg[0]].nil?
|
||
|
hide_style = " style=\"display: none;\""
|
||
|
if !@object.send(arg[0].to_s+'_reminder')
|
||
|
style_attr = hide_style
|
||
|
end
|
||
|
style_attr2 = calendar_show ? '' : hide_style
|
||
|
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)"
|
||
|
onclick_func1 = "function reminder_switch_calendar(ele){
|
||
|
if ($(ele).prop('checked')){
|
||
|
$(ele).parents('.controls').find('.calendar_div').show()
|
||
|
}else{
|
||
|
$(ele).parents('.controls').find('.calendar_div').hide()
|
||
|
}
|
||
|
};reminder_switch_calendar(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) + "#{I18n.t('venue_management.send_email_reminder')}<div class=\"email_reminder\"#{style_attr}>: #{I18n.t('venue_management.before')}#{self.number_field((arg[0].to_s+'_reminder_day').to_sym, :class => 'input-mini')}#{I18n.t('venue_management.day_send_email')}</div>".html_safe
|
||
|
end
|
||
|
calendar_type_key = "#{base_name}[calendar_data][type][#{arg[0]}]"
|
||
|
calendar_type = @object['calendar_data']['type'][arg[0]] rescue nil
|
||
|
tp4 = select_tag("#{base_name}[calendar_data][page_id][#{arg[0]}]",options_for_select([["----- Select a page -----",nil]]+module_pages,(@object['calendar_data']['page_id'][arg[0]] rescue nil)))
|
||
|
tp3 = content_tag(:div, :style => "float: left;flex-wrap: wrap;display: inline-flex;margin-left: 1em;align-items: center;") do
|
||
|
check_box_tag("#{base_name}[calendar_data][key][]",arg[0],calendar_show,:onclick => onclick_func1) + "#{I18n.t('venue_management.add_to_calendar')}<div class=\"calendar_div\"#{style_attr2}>: #{select_tag(calendar_type_key,options_for_select(calendar_types,calendar_type))}#{tp4}</div>".html_safe
|
||
|
end
|
||
|
|
||
|
tp = content_tag(:div, tp , :style=>"float: left;")+ tp2 + tp3
|
||
|
end
|
||
|
tp
|
||
|
end
|
||
|
end
|