74 lines
2.4 KiB
Plaintext
74 lines
2.4 KiB
Plaintext
<% if params[:custom_module].blank? %>
|
|
<div class="bind_modules_list">
|
|
<ul>
|
|
<% @custom_bulletin_configs.each do |c|%>
|
|
<% target_model = c.bind_model.constantize rescue nil %>
|
|
<% next if target_model.nil? %>
|
|
<li>
|
|
<a href="<%= admin_custom_announcements_path + "/#{c.module}" %>">
|
|
<% icon_class = OrbitApp::Module::SideBarRegistration.all.select{|r| r.get_module_app_key == c.module}.first.get_icon_class rescue '' %>
|
|
<i class="<%= icon_class %> icon_big"></i>
|
|
<%= t("module_name.#{c.module}") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% else %>
|
|
<% config = @custom_bulletin_configs.where(:module=>params[:custom_module]).first %>
|
|
<% target_model = config.bind_model.constantize %>
|
|
<% page_num = params[:page] || 1 %>
|
|
<% target_records = target_model.where(config.title_field.to_sym.nin=>[nil,""]).page(page_num).per(10) %>
|
|
<% if params[:search_title].present?
|
|
target_records = target_records.where(config.title_field.to_sym=>/#{params[:search_title].gsub(/(\[|\]|\(|\)|\.)/){|f| "\\"+f}}/)
|
|
end %>
|
|
<h3><%= t("module_name.#{config.module}") %></h3>
|
|
<form>
|
|
<input id="search_title" type="text" name="search_title" placeholder="<%= t(:title) %>" value="<%=params[:search_title]%>"><button><%= t(:search_) %></button>
|
|
</form>
|
|
<table class="table main-list footable-loaded tablet">
|
|
<thead>
|
|
<th class="span5"><%= t(:title) %></th>
|
|
<th class="span2"><%= t("custom_announcement.total_amount") %></th>
|
|
</thead>
|
|
<% target_records.each do |record| %>
|
|
<tr>
|
|
<% uid = record.send(config.uid_field) %>
|
|
<td>
|
|
<a href="<%= admin_custom_announcements_path + "/#{config.module}-#{uid}" %>" title="<%=record.send(config.title_field)%>"><%= record.send(config.title_field) %></a>
|
|
</td>
|
|
<td>
|
|
<%= CustomBulletin.where(:custom_module=>params[:custom_module],:bind_uid=>uid).count %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
<%=
|
|
content_tag :div, class: "bottomnav clearfix" do
|
|
content_tag :div, paginate(target_records), class: "pagination pagination-centered"
|
|
end
|
|
%>
|
|
<% end %>
|
|
<style type="text/css">
|
|
i.icon_big{
|
|
font-size: 3em;
|
|
display: block;
|
|
}
|
|
.bind_modules_list li{
|
|
font-size: 1.3em;
|
|
list-style: none;
|
|
float: left;
|
|
margin: 0.8em;
|
|
}
|
|
.bind_modules_list a{
|
|
color: black;
|
|
}
|
|
.bind_modules_list a:hover {
|
|
text-decoration: none;
|
|
color: #403f3f;
|
|
}
|
|
#search_title{
|
|
margin-bottom: 0;
|
|
margin-right: 1em;
|
|
}
|
|
</style> |