Change filter to js with history for bulletins
This commit is contained in:
parent
253f4bcb54
commit
963a0cb604
|
@ -12,4 +12,5 @@
|
||||||
//= require orbit-1.0
|
//= require orbit-1.0
|
||||||
//= require tinymce-jquery
|
//= require tinymce-jquery
|
||||||
//= require tinymce_orbit
|
//= require tinymce_orbit
|
||||||
//= require orbit-bar-search
|
//= require orbit-bar-search
|
||||||
|
//= require side_bar_history
|
|
@ -1,31 +1,49 @@
|
||||||
$(function () {
|
var history_edited = false;
|
||||||
$('#back_sidebar a, #back_main a.nav').live('click',
|
|
||||||
function () {
|
|
||||||
$.getScript(this.href);
|
|
||||||
history.pushState(null, document.title, this.href);
|
|
||||||
history_edited = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$('#back_main a.reload').live('click',
|
$('#back_sidebar a, #back_main a.nav').live('click',
|
||||||
function () {
|
function () {
|
||||||
$.getScript(this.href);
|
$.getScript(this.href);
|
||||||
history.replaceState(null, document.title, this.href);
|
history.pushState(null, document.title, this.href);
|
||||||
history_edited = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$('.form').live('submit', function () {
|
|
||||||
$.post(this.action, $(this).serialize(), null, 'script');
|
|
||||||
history_edited = true;
|
history_edited = true;
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$(window).bind("popstate", function () {
|
$('#back_main a.reload').live('click',
|
||||||
if (history_edited) {
|
function () {
|
||||||
$.getScript(location.href);
|
$.getScript(this.href);
|
||||||
}
|
history.replaceState(null, document.title, this.href);
|
||||||
});
|
history_edited = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$('.form').live('submit', function () {
|
||||||
|
$.post(this.action, $(this).serialize(), null, 'script');
|
||||||
|
history_edited = true;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.js_history',
|
||||||
|
function () {
|
||||||
|
$.getScript(this.href);
|
||||||
|
history.pushState(null, document.title, this.href);
|
||||||
|
history_edited = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$(document).on('click', '.pagination a',
|
||||||
|
function () {
|
||||||
|
$.getScript(this.href);
|
||||||
|
history.pushState(null, document.title, this.href);
|
||||||
|
history_edited = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$(window).bind("popstate", function () {
|
||||||
|
if (history_edited) {
|
||||||
|
$.getScript(location.href);
|
||||||
|
}
|
||||||
});
|
});
|
|
@ -285,11 +285,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_tags
|
|
||||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
|
||||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_tags
|
def get_tags
|
||||||
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
|
||||||
@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)
|
||||||
|
|
|
@ -62,25 +62,25 @@
|
||||||
<a href class="list-remove"><i class="icon-trash"></i></a>
|
<a href class="list-remove"><i class="icon-trash"></i></a>
|
||||||
</th>
|
</th>
|
||||||
<th class="sort span1-2 <%= is_sort_active?('status') %>">
|
<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')) %>
|
<%= 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>
|
||||||
<th class="sort span1-2 <%= is_sort_active?('category') %>">
|
<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')) %>
|
<%= 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>
|
||||||
<th class="sort span7 <%= is_sort_active?('title') %>">
|
<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')) %>
|
<%= 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>
|
||||||
<th class="sort span1-2 <%= is_sort_active?('postdate') %>">
|
<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')) %>
|
<%= 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>
|
||||||
<th class="sort span1-2 <%= is_sort_active?('deadline') %>">
|
<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')) %>
|
<%= 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>
|
||||||
<th class="sort span1-2 <%= is_sort_active?('tags') %>">
|
<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')) %>
|
<%= 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>
|
||||||
<th class="sort span1-2 <%= is_sort_active?('update_user_id') %>">
|
<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')) %>
|
<%= 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>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<%= 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 %>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<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>
|
|
@ -1,26 +1 @@
|
||||||
<%= render 'filter' %>
|
<%= render 'index' %>
|
||||||
<table id="bulettin_sort_list" class="table main-list">
|
|
||||||
<%= render 'bulletins' %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<%= paginate @bulletins %>
|
|
||||||
|
|
||||||
<div id="bulletin_link_qe">
|
|
||||||
<div id="modal-link" class="modal fade">
|
|
||||||
<%= render :partial => "bulletin_link_qe" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="bulletin_file_qe">
|
|
||||||
<div id="modal-file" class="modal fade">
|
|
||||||
<%= render :partial => "bulletin_file_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 %>
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#main-wrap").html("<%= j render 'index' %>");
|
||||||
|
mainTablePosition();
|
Reference in New Issue