event_ann/app/views/event_anns/index.html.erb

73 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

2020-07-13 08:04:57 +00:00
<% params = OrbitHelper.params
page = Page.where(url:params['url']).first
enable_search_flag = false
if page.methods.include? 'select_option_items'.to_sym
ModuleApp.all.select{|tmp| tmp.key.to_s=='event_ann'}.each do |modile_app|
@show_option_items = modile_app.show_option_items rescue nil
end
page.select_option_items.each do |select_option_item|
if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys[1].to_s
value = YAML.load(select_option_item.value)
if value[I18n.locale] == t('event_ann.yes')
enable_search_flag = true
end
end
end
end
%>
<% if enable_search_flag %>
<style type="text/css">
#category_select_box, input.search_box, #category_select_box>option {
background: none;
color: #333;
border-radius: 2px;
font-size: 13px;
border: 1px solid #656565;
margin-right: 3px;
font-weight: normal;
margin-left: 3px;
padding: 0 5px;
}
input.search_box[type='submit'] {
background: #eee;
padding: 0 10px;
}
input.search_box[type='submit']:hover{
background: #20d0bc;
color: white;
border: none;
}
input.search_box[type='submit']:active{
background: #20d0bc;
color: white;
border: none;
}
</style>
<form>
<% cats = Array(page.categories)
if cats.include? 'all'
cats = ModuleApp.where(key: 'event_ann').first.categories
else
cats = cats.map{|v| Category.where(id: v).first}.compact
end
all_cat = [[t('event_ann.all'),'all']]
%>
<div class="search_widget" style="display: flex;flex-wrap: wrap;font-size: 1.1em;">
<%= select_tag('category',options_for_select(all_cat.concat(cats.map{|v| [v.title,v.id.to_s]}),:selected => params['category'].to_s),:id=>"category_select_box",:prompt => t('event_ann.select_prompt')) %>
<input class="search_box" type="text" name="keywords" value="<%= params['keywords'].to_s.gsub(/\"/,'') %>" placeholder="<%= t('event_ann.keywords') %>">
<div style="display: flex;flex-wrap: wrap;">
<div class="default_picker">
<input class="search_box" type="text" name="stime" value="<%= params['stime'].to_s.gsub(/\"/,'') %>" placeholder="<%= t('event_ann.stime') %>" data-format="yyyy/mm/dd">
</div>
~
<div class="default_picker">
<input class="search_box" type="text" name="etime" value="<%= params['etime'].to_s.gsub(/\"/,'') %>" placeholder="<%= t('event_ann.etime') %>" data-format="yyyy/mm/dd">
</div>
</div>
<input type="hidden" name="authenticity_token" value="<%= (0...46).map { ('a'..'z').to_a[rand(26)] }.join %>">
<input class="search_box" type="submit" value="<%= t('event_ann.search') %>">
</div>
</form>
<% end %>
<%= render_view %>