Filter and delete for bulletins
This commit is contained in:
parent
963a0cb604
commit
486845460c
|
@ -18,3 +18,11 @@ $('.quick_edit_cancel').live('click', function(){
|
||||||
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
|
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
|
||||||
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
|
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.list-remove', function(){
|
||||||
|
$('#delete_bulletins').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '#check_all_bulletins', function(){
|
||||||
|
$('.checkbox_in_list').attr("checked", this.checked);
|
||||||
|
});
|
|
@ -102,18 +102,10 @@ module ApplicationHelper
|
||||||
' web-symbol' if params[:sort].eql?(name)
|
' web-symbol' if params[:sort].eql?(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_filter(param_name, value)
|
def is_filter_active?(type, id)
|
||||||
filter = params[:filter] rescue nil
|
' active' if (@filter[type].include?(id.to_s) rescue nil)
|
||||||
if filter && filter.has_key(param_name)
|
|
||||||
filter[param_name] << value
|
|
||||||
elsif filter
|
|
||||||
filter.merge({param_name => [value]})
|
|
||||||
else
|
|
||||||
{param_name => [value]}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def process_page(page, id)
|
def process_page(page, id)
|
||||||
parse_page_noko(page, id)
|
parse_page_noko(page, id)
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,11 +9,28 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
get_categorys(params[:bulletin_category_id])
|
get_categorys(params[:bulletin_category_id])
|
||||||
get_tags
|
get_tags
|
||||||
|
|
||||||
|
@filter = params[:filter]
|
||||||
|
new_filter = params[:new_filter]
|
||||||
|
|
||||||
|
if @filter && params[:clear]
|
||||||
|
@filter.delete(params[:type])
|
||||||
|
elsif @filter && new_filter
|
||||||
|
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||||
|
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||||
|
elsif @filter.has_key?(new_filter[:type])
|
||||||
|
@filter[new_filter[:type]] << new_filter[:id].to_s
|
||||||
|
else
|
||||||
|
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||||
|
end
|
||||||
|
elsif new_filter
|
||||||
|
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||||
|
end
|
||||||
|
|
||||||
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
|
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
|
||||||
|
|
||||||
# @bulletins = Bulletin.search(params[:search], params[:category_id])
|
# @bulletins = Bulletin.search(params[:search], params[:category_id])
|
||||||
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
||||||
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all.page(params[:page]).per(10)
|
@bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10)
|
||||||
@bulletin_categories = BulletinCategory.all
|
@bulletin_categories = BulletinCategory.all
|
||||||
|
|
||||||
@bulletin_link = BulletinLink.new
|
@bulletin_link = BulletinLink.new
|
||||||
|
@ -24,7 +41,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.js
|
format.js { }
|
||||||
format.xml { render :xml => @bulletins }
|
format.xml { render :xml => @bulletins }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -273,6 +290,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
get_tags
|
get_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
if params[:to_delete]
|
||||||
|
bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all
|
||||||
|
end
|
||||||
|
redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
@ -290,11 +314,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_sorted_bulletins
|
def get_sorted_and_filtered_bulletins
|
||||||
bulletins = Bulletin.all
|
bulletins = Bulletin.all
|
||||||
case params[:sort]
|
case params[:sort]
|
||||||
when 'postdate', 'deadline'
|
when 'postdate', 'deadline'
|
||||||
bulletins.order_by([params[:sort], params[:direction]]).page(params[:page]).per(10)
|
bulletins = bulletins.order_by([params[:sort], params[:direction]])
|
||||||
when 'category'
|
when 'category'
|
||||||
category_ids = bulletins.distinct(:bulletin_category_id)
|
category_ids = bulletins.distinct(:bulletin_category_id)
|
||||||
categories = BulletinCategory.find(category_ids) rescue nil
|
categories = BulletinCategory.find(category_ids) rescue nil
|
||||||
|
@ -303,19 +327,15 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
|
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
|
||||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||||
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
|
sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries }
|
||||||
sorted_categorys.flatten!
|
bulletins = sorted_categorys.flatten!
|
||||||
Kaminari.paginate_array(sorted_categorys).page(params[:page]).per(10)
|
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
when 'title'
|
when 'title'
|
||||||
h = Array.new
|
h = Array.new
|
||||||
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
|
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
|
||||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||||
sorted_titles = sorted.collect {|a| a[1] }
|
bulletins = sorted.collect {|a| a[1] }
|
||||||
Kaminari.paginate_array(sorted_titles).page(params[:page]).per(10)
|
|
||||||
when 'status'
|
when 'status'
|
||||||
bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).page(params[:page]).per(10)
|
bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction])
|
||||||
when 'update_user_id'
|
when 'update_user_id'
|
||||||
user_ids = bulletins.distinct(:update_user_id)
|
user_ids = bulletins.distinct(:update_user_id)
|
||||||
users = User.find(user_ids) rescue nil
|
users = User.find(user_ids) rescue nil
|
||||||
|
@ -324,10 +344,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
users.each { |user| h << [user.name, user.id] }
|
users.each { |user| h << [user.name, user.id] }
|
||||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||||
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
|
sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries }
|
||||||
sorted_users.flatten!
|
bulletins = sorted_users.flatten
|
||||||
Kaminari.paginate_array(sorted_users).page(params[:page]).per(10)
|
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
when 'tags'
|
when 'tags'
|
||||||
a = Array.new
|
a = Array.new
|
||||||
|
@ -339,10 +356,37 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
||||||
sorted_titles = sorted.collect {|a| a[1] }
|
sorted_titles = sorted.collect {|a| a[1] }
|
||||||
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
|
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
|
||||||
a.flatten!
|
bulletins = a.flatten
|
||||||
Kaminari.paginate_array(a).page(params[:page]).per(10)
|
|
||||||
end
|
end
|
||||||
|
if @filter
|
||||||
|
@filter.each do |key, value|
|
||||||
|
case key
|
||||||
|
when 'status'
|
||||||
|
a = Array.new
|
||||||
|
bulletins.each do |bulletin|
|
||||||
|
value.each do |v|
|
||||||
|
a << bulletin if bulletin[v]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bulletins = a
|
||||||
|
when 'categories'
|
||||||
|
a = Array.new
|
||||||
|
bulletins.each do |bulletin|
|
||||||
|
a << bulletin if value.include?(bulletin.bulletin_category.id.to_s)
|
||||||
|
end
|
||||||
|
bulletins = a
|
||||||
|
when 'tags'
|
||||||
|
a = Array.new
|
||||||
|
bulletins.each do |bulletin|
|
||||||
|
bulletin.tags.each do |tag|
|
||||||
|
a << bulletin if value.include?(tag.id.to_s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bulletins = a
|
||||||
|
end if value.size > 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Kaminari.paginate_array(bulletins).page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<tr id="<%= dom_id bulletin %>" class="with_action">
|
<tr id="<%= dom_id bulletin %>" class="with_action">
|
||||||
<td><input type="checkbox"></td>
|
<td><%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %></td>
|
||||||
<td>
|
<td>
|
||||||
<% if bulletin.is_top? %>
|
<% if bulletin.is_top? %>
|
||||||
<span class="label label-success"><%= t(:top) %></span>
|
<span class="label label-success"><%= t(:top) %></span>
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
<th class="span1-2"></th>
|
<th class="span1-2"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="sort-holder">
|
<tbody id="tbody_bulletins" class="sort-holder">
|
||||||
<%= render :partial => 'bulletin', :collection => @bulletins %>
|
<%= render :partial => 'bulletin', :collection => @bulletins %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="filter-clear">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-brush-large') + t(:clear), panel_announcement_back_end_bulletins_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn js_history" %>
|
||||||
|
</div>
|
|
@ -18,73 +18,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<div class="accordion-body collapse" id="collapse-status">
|
<div class="accordion-body collapse" id="collapse-status">
|
||||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
<%= render 'filter_status' %>
|
||||||
<a href="#" class="btn">Category1</a>
|
|
||||||
<a href="#" class="btn">Category2</a>
|
|
||||||
</div>
|
|
||||||
<div class="filter-clear">
|
|
||||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="accordion-body collapse" id="collapse-category">
|
<div class="accordion-body collapse" id="collapse-category">
|
||||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
<%= render 'filter_categories' %>
|
||||||
<% @bulletin_categories.each do |category| -%>
|
|
||||||
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => add_filter(:categories, category.id)), :class => 'btn' %>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
<div class="filter-clear">
|
|
||||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="accordion-body collapse" id="collapse-tags">
|
<div class="accordion-body collapse" id="collapse-tags">
|
||||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
<%= render 'filter_tags' %>
|
||||||
<a href="#" class="btn">Tag1</a>
|
|
||||||
<a href="#" class="btn">Tag2</a>
|
|
||||||
<a href="#" class="btn">Tag3</a>
|
|
||||||
<a href="#" class="btn">Tag4</a>
|
|
||||||
<a href="#" class="btn">Tag5</a>
|
|
||||||
<a href="#" class="btn">Tag6</a>
|
|
||||||
<a href="#" class="btn">Tag7</a>
|
|
||||||
<a href="#" class="btn">Tag8</a>
|
|
||||||
<a href="#" class="btn">Tag9</a>
|
|
||||||
<a href="#" class="btn">Tag10</a>
|
|
||||||
</div>
|
|
||||||
<div class="filter-clear">
|
|
||||||
<a href="#" class="btn"><i class="icons-brush-large"></i>Clear/重置</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="table-label">
|
<div id="sort_headers" class="table-label">
|
||||||
<table class="table main-list">
|
<%= render 'sort_headers' %>
|
||||||
<thead>
|
|
||||||
<tr class="sort-header">
|
|
||||||
<th class="span1 strong">
|
|
||||||
<input type="checkbox">
|
|
||||||
<a href class="list-remove"><i class="icon-trash"></i></a>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('status') %>">
|
|
||||||
<%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path(sortable('status')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('category') %>">
|
|
||||||
<%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path(sortable('category')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span7 <%= is_sort_active?('title') %>">
|
|
||||||
<%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path(sortable('title')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
|
|
||||||
<%= link_to t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path(sortable('postdate')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
|
|
||||||
<%= link_to t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline')), panel_announcement_back_end_bulletins_path(sortable('deadline')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
|
|
||||||
<%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path(sortable('tags')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('update_user_id') %>">
|
|
||||||
<%= link_to t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id')), panel_announcement_back_end_bulletins_path(sortable('update_user_id')), :class => 'js_history' %>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||||
|
<% @bulletin_categories.each do |category| -%>
|
||||||
|
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||||
|
<%= link_to t(:is_top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_top')}" %>
|
||||||
|
<%= link_to t(:is_hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hot')}" %>
|
||||||
|
<%= link_to t(:is_hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_hidden')}" %>
|
||||||
|
<%= link_to t(:is_checked), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('status', 'is_checked')}" %>
|
||||||
|
</div>
|
||||||
|
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||||
|
<% @tags.each do |tag| -%>
|
||||||
|
<%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>
|
|
@ -1,20 +0,0 @@
|
||||||
<%= render 'filter' %>
|
|
||||||
<table id="bulettin_sort_list" class="table main-list">
|
|
||||||
<%= render 'bulletins' %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort]} %>
|
|
||||||
|
|
||||||
<div id="bulletin_link_qe">
|
|
||||||
<div id="modal-link" class="modal fade">
|
|
||||||
<%= render :partial => "bulletin_link_qe" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "bulletin_form" %>
|
|
||||||
<% end %>
|
|
|
@ -1,38 +0,0 @@
|
||||||
<table class="table main-list">
|
|
||||||
<thead>
|
|
||||||
<tr class="sort-header">
|
|
||||||
<th class="span1 strong">
|
|
||||||
<input type="checkbox">
|
|
||||||
<a href class="list-remove"><i class="icon-trash"></i></a>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('status') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('status')) %>">
|
|
||||||
<%= t('bulletin.status') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('status')) %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('category') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('category')) %>">
|
|
||||||
<%= t('bulletin.category') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('category')) %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span7 <%= is_sort_active?('title') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('title')) %>">
|
|
||||||
<%= t('bulletin.title') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('title')) %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('postdate') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('postdate')) %>">
|
|
||||||
<%= t('bulletin.start_date') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('postdate')) %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('deadline') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('deadline')) %>">
|
|
||||||
<%= t('bulletin.end_date') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('deadline')) %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('tags') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('tags')) %>">
|
|
||||||
<%= t('bulletin.tags') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('tags')) %>
|
|
||||||
</th>
|
|
||||||
<th class="sort span1-2 <%= is_sort_active?('update_user_id') %>" rel="<%= panel_announcement_back_end_bulletins_path(sortable('update_user_id')) %>">
|
|
||||||
<%= t('bulletin.last_modified') %>
|
|
||||||
<%= content_tag(:b, nil, :class => is_sort?('update_user_id')) %>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<th class="span1 strong">
|
||||||
|
<input id="check_all_bulletins" type="checkbox">
|
||||||
|
<a href='#' class="list-remove"><i class="icon-trash"></i></a>
|
||||||
|
</th>
|
||||||
|
<th class="sort span1-2 <%= is_sort_active?('status') %>">
|
||||||
|
<%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('status'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
<th class="sort span1-2 <%= is_sort_active?('category') %>">
|
||||||
|
<%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('category'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
<th class="sort span7 <%= is_sort_active?('title') %>">
|
||||||
|
<%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('title'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
|
||||||
|
<%= link_to t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('postdate'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
|
||||||
|
<%= link_to t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('deadline'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
|
||||||
|
<%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('tags'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
<th class="sort span1-2 <%= is_sort_active?('update_user_id') %>">
|
||||||
|
<%= link_to t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('update_user_id'))), :class => 'js_history' %>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
|
@ -1 +1,25 @@
|
||||||
<%= render 'index' %>
|
<%= form_for :bulletins, :url => delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil), :html => {:id => 'delete_bulletins'}, :remote => true do %>
|
||||||
|
<%= render 'filter' %>
|
||||||
|
<table id="bulettin_sort_list" class="table main-list">
|
||||||
|
<%= render 'bulletins' %>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div id="bulletin_pagination">
|
||||||
|
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="bulletin_link_qe">
|
||||||
|
<div id="modal-link" class="modal fade">
|
||||||
|
<%= render :partial => "bulletin_link_qe" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "bulletin_form" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
$("#main-wrap").html("<%= j render 'index' %>");
|
$("#collapse-status").html("<%= j render 'filter_status' %>");
|
||||||
mainTablePosition();
|
$("#collapse-category").html("<%= j render 'filter_categories' %>");
|
||||||
|
$("#collapse-tags").html("<%= j render 'filter_tags' %>");
|
||||||
|
$("#delete_bulletins").attr("action", "<%= delete_panel_announcement_back_end_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter]) %>");
|
||||||
|
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||||
|
$("#tbody_bulletins").html("<%= j render :partial => 'bulletin', :collection => @bulletins %>");
|
||||||
|
$("#bulletin_pagination").html("<%= j paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
@ -6,13 +6,15 @@ Rails.application.routes.draw do
|
||||||
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
|
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
|
||||||
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
|
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
|
||||||
|
|
||||||
root :to => "bulletins#index"
|
|
||||||
resources :bulletins do
|
resources :bulletins do
|
||||||
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
|
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
|
||||||
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
|
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
|
||||||
member do
|
member do
|
||||||
get 'load_quick_edit'
|
get 'load_quick_edit'
|
||||||
end
|
end
|
||||||
|
collection do
|
||||||
|
post 'delete'
|
||||||
|
end
|
||||||
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
match "file_quick_add/:bulletin_id" => "bulletins#file_quick_add" ,:as => :file_quick_add
|
||||||
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue