Merge branch 'master' into desktop_harry

This commit is contained in:
Christophe Vilayphiou 2012-04-13 13:39:00 +08:00
commit f54dba8b0b
34 changed files with 378 additions and 212 deletions

BIN
app/assets/images/check.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -17,4 +17,12 @@ $('.quick_edit_cancel').live('click', function(){
$('#' + tr).hide();
$("tr#bulletin_file_" + $(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);
});

View File

@ -1,14 +1,19 @@
$(document).ready(function() {
$('.check[checked="checked"]').parents(".checkbox").addClass("checked");
$('.check[checked="checked"]').parents(".checkbox").addClass("checked")
$(".checkbox").click(function(){
if($(this).children(".check").attr("checked")){
// uncheck
$(this).children(".check").attr('checked', false);
$(this).removeClass("checked");
$(this).children(".check").attr('checked', false);
$(this).removeClass("checked");
}else{
// check
$(this).children(".check").attr({checked: "checked"});
$(this).addClass("checked");
}
});
$(".checkbox").popover({
trigger: 'hover',
placement: 'bottom',
delay: { show: 100, hide: 300 },
});
});

View File

@ -0,0 +1,31 @@
// JavaScript Document
// can copy code to any of ur desired javascsript
//extended jquery to search fast.
$.extend($.expr[':'], {
'containsi': function (elem, i, match, array) {
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
$(document).ready(function(){
$("#user_filter").keyup(function(){
if($(this).val()){
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").length
if(totalfoundbyname!=0){
$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().parent().slideUp();
//$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().popover('hide');
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().parent().slideDown();
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().popover('toggle');
}else if(totalfoundbyname==0){
$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").parent().slideUp();
//$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").popover('hide');
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").parent().slideDown();
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").popover('toggle');
}
}else{
$(".checkbox").popover('hide');
$("div.checkblock").slideDown();
}
})
})

View File

@ -12,4 +12,5 @@
//= require orbit-1.0
//= require tinymce-jquery
//= require tinymce_orbit
//= require orbit-bar-search
//= require orbit-bar-search
//= require side_bar_history

View File

@ -51,7 +51,7 @@ $(document).ready(function(){
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('#main-sidebar').tinyscrollbar();
$('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
@ -72,14 +72,14 @@ $(window).resize(function(){
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition();
});
/*main-table position*/
function mainTablePosition() {
var $height = $('#main-wrap .subnav').length && $('#main-wrap .subnav').height();
var $table = $('#main-wrap > table').length && $('#main-wrap > table');
var $table = $('.main-list').length && $('.main-list:last');
if($table && $table==0){
$table.css({marginTop:$height});
}

View File

@ -1,31 +1,49 @@
$(function () {
$('#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;
}
);
var history_edited = false;
$('#back_main a.reload').live('click',
function () {
$.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');
$('#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;
});
}
);
$(window).bind("popstate", function () {
if (history_edited) {
$.getScript(location.href);
}
});
$('#back_main a.reload').live('click',
function () {
$.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);
}
});

View File

@ -102,6 +102,14 @@ table .span1-2 {
float: none;
margin-left: 0;
}
table .span1-3 {
min-width: 200px;
float: none;
margin-left: 0;
}
.qe-block .form-horizontal .form-actions {
text-align:right;
}
.modal.fade {
top: -50%;
}

View File

@ -7,8 +7,8 @@
display:none;
}
.checkbox{
padding:5px;
margin:5px;
padding: 5px;
margin: 5px 5px 10px;
display: inline-block;
color:#777777;
text-shadow: 0 1px 0px rgba(255,255,255,.4);
@ -28,26 +28,50 @@
.checkbox .check-icon {
display: none;
position: absolute;
width: 22px;
height: 22px;
border-radius: 11px;
background-color: #d0f311;
right: -5px;
width: 26px;
height: 26px;
background: url('img/check.png') no-repeat left top;
right: -10px;
top: -5px;
box-shadow: 0px 0px 5px rgba(0,0,0,.05);
}
.checkbox .check-icon i {
margin: 1px 0 0 3px;
}
.checkbox .member-name {
cursor: pointer;
font-family: helvetica;
font-size: 12px;
line-height: 30px;
padding: 0 10px;
padding: 0 10px 0 40px;
color: #333333;
display: inline-block;
margin-bottom: 0;
}
.member-avatar {
position: absolute;
width: 34px;
height: 34px;
overflow: hidden;
margin-top: -2px;
}
img.member-img {
display: inline-block;
float: left;
max-width: 30px;
max-width: 100%;
}
.checked .check-icon {
display: block;
}
.popover-inner {
width: auto;
display: inline-block;
text-align: center;
}
.popover-title {
display: block;
font-size: 12px;
font-weight: normal;
padding: 3px 10px;
}
.popover-content {
padding: 3px 10px;
color: #898989;
}
.popover-content p {
font-size: 12px;
}

View File

@ -1,12 +1,5 @@
module Admin::AdBannerHelper
def preview_block(ad_banner)
res =''
#same code as in frontend backend parser
if ad_banner
res << "<script type='text/javascript'>
$(document).ready(function(){ $('#slideshow-#{ad_banner.title.dehumanize}').cycle({delay: -1000, fx: '#{ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx}', timeoutFn: getTimeout }); });
</script>"
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
def preview_block_ad_images_helper(ad_banner)
printable_ad_images = []
ad_banner.ad_images.each do |ad_image|
if ad_image.display?
@ -17,18 +10,7 @@ module Admin::AdBannerHelper
end
printable_ad_images.shuffle!
printable_ad_images.each do |ad_image| #TODO Need Reflact
res << "<img src='#{ad_image.file}' "
res << "alt='#{ad_image.title || ' '}' "
res << "time_to_next='#{ad_banner.transition_sec}' "
res << "link_open='#{ad_image.link_open}' "
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' "
res << "/>"
end
res << "</div>"
res.html_safe
end
end
end
end

View File

@ -83,7 +83,7 @@ module ApplicationHelper
end
def active_for_action(controller_name, action_name)
(controller.controller_name.eql?(controller_name) && controller.action_name.eql?(action_name)) ? 'active' : nil
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end
def sortable(column)
@ -102,18 +102,10 @@ module ApplicationHelper
' web-symbol' if params[:sort].eql?(name)
end
def add_filter(param_name, value)
filter = params[:filter] 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
def is_filter_active?(type, id)
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
def process_page(page, id)
parse_page_noko(page, id)
end

View File

@ -15,5 +15,5 @@
<%= link_to 'Add AdImage',new_admin_ad_banner_ad_image_path(ad_banner_tab) %>
</div>
<% end -%>
<%= preview_block ad_banner_tab %>
<%= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %>
</div>

View File

@ -1,5 +1,3 @@
<script type="text/javascript" charset="utf-8">
</script>
<div id="new-a-banner" class="modal fade in tab-pane <%= 'active' if @active.nil? %>">
<%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %>
@ -37,4 +35,21 @@
</div>
<% end %>
</div>
<script type="text/javascript" charset="utf-8">
if(window.location.pathname == "/admin/ad_banners/new"){
$('#new-a-banner').modal({show: true});
}
$('#new_ad_banner_tab_but').on('shown', function (e) {
$('#new-a-banner').modal({show: true});
})
$('#new-a-banner').on('shown', function (e) {
alert('show!');
})
$('#new-a-banner').on('hidden', function (e) {
$(".nav.nav-tabs a[id!='new_ad_banner_tab_but']:last").tab('show');
})
</script>

View File

@ -0,0 +1,29 @@
<% if ad_banner -%>
<%= link_to 'Preview',"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %>
<div class="modal hide fade in" id='slideshow-<%=ad_banner.title.dehumanize%>'>
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p class="ad_banner_slideshow">
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
<% end -%>
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Close</a>
</div>
</div>
<% end -%>
<script type='text/javascript' src='/static/kernel.js'></script>
<script type='text/javascript'>
$('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () {
$('#slideshow-banner_1').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout });
});
</script>

View File

@ -1,9 +1,9 @@
<div id="post-body-content" class="clear">
<ul class="nav nav-tabs">
<% @ad_banners.each do |ab| %>
<%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : '' ) %>
<%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %>
<% end -%>
<%= content_tag :li,link_to('New',"#new-a-banner",:data=>{:toggle=>"tab"}),:class => (@active.nil? ? 'active' : '' ) %>
<%= content_tag :li,link_to('New',"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>
</ul>
@ -13,4 +13,3 @@
</div>
</div>

View File

@ -7,18 +7,4 @@
<li><%= link_to t('admin.member'), admin_users_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.translation'), admin_translations_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.site'), admin_sites_path, :class => 'orblink' %></li>
<!-- <li><%= link_to t('admin.purchase'), admin_purchases_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.site_setting'), admin_sites_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.design'), admin_designs_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.announcement'), panel_announcement_back_end_root_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.super_pages'), '', :class => 'orblink' %></li>
<li><%= link_to t('admin.links'), '', :class => 'orblink' %></li>
<li><%= link_to t('admin.ad_banner'), admin_ad_banners_path, :class => 'orblink' %></li>
<li><%= link_to t('admin.calendar'), '', :class => 'orblink' %></li>
<li><%= link_to t('admin.nccu'), '', :class => 'orblink' %></li>
t('admin.dashbroad')
t('admin.content'
t('admin.add_drop_down_item')
-->
</ul>

View File

@ -2,14 +2,14 @@
<%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %>
<% end -%>
<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys') do -%>
<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys')) do -%>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %>
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('bulletins', 'fact_check_setting') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %>
<% end -%>
<% end -%>
@ -44,7 +44,7 @@
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %>
<% end -%>
<% end -%>

View File

@ -9,11 +9,28 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
get_categorys(params[:bulletin_category_id])
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.search(params[:search], params[:category_id])
# @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_link = BulletinLink.new
@ -24,7 +41,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
respond_to do |format|
format.html # index.html.erb
format.js
format.js { }
format.xml { render :xml => @bulletins }
end
end
@ -273,6 +290,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
get_tags
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
@ -285,21 +309,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
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
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_sorted_bulletins
def get_sorted_and_filtered_bulletins
bulletins = Bulletin.all
case params[:sort]
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'
category_ids = bulletins.distinct(:bulletin_category_id)
categories = BulletinCategory.find(category_ids) rescue nil
@ -308,19 +327,15 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
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.flatten!
Kaminari.paginate_array(sorted_categorys).page(params[:page]).per(10)
else
nil
bulletins = sorted_categorys.flatten!
end
when 'title'
h = Array.new
bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] }
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
sorted_titles = sorted.collect {|a| a[1] }
Kaminari.paginate_array(sorted_titles).page(params[:page]).per(10)
bulletins = sorted.collect {|a| a[1] }
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'
user_ids = bulletins.distinct(:update_user_id)
users = User.find(user_ids) rescue nil
@ -329,10 +344,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
users.each { |user| h << [user.name, user.id] }
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.flatten!
Kaminari.paginate_array(sorted_users).page(params[:page]).per(10)
else
nil
bulletins = sorted_users.flatten
end
when 'tags'
a = Array.new
@ -344,10 +356,37 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_titles = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
a.flatten!
Kaminari.paginate_array(a).page(params[:page]).per(10)
bulletins = a.flatten
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

View File

@ -79,6 +79,17 @@ class Bulletin
end
def status
case self.is_checked
when nil
I18n.t('announcement.bulletin.fact_check_pending')
when true
I18n.t('announcement.bulletin.fact_check_pass')
when false
I18n.t('announcement.bulletin.fact_check_not_pass')
end
end
def is_expired?
Date.today > self.deadline ? true : false rescue false
#some dates might sat as nil so rescue false

View File

@ -1,5 +1,5 @@
<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>
<% if bulletin.is_top? %>
<span class="label label-success"><%= t(:top) %></span>
@ -10,6 +10,7 @@
<% if bulletin.is_hidden? %>
<span class="label"><%= t(:hidden) %></span>
<% end %>
<%= bulletin.status %>
</td>
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
<td>

View File

@ -7,9 +7,9 @@
<th class="span1-2"></th>
<th class="span1-2"></th>
<th class="span1-2"></th>
<th class="span1-2"></th>
<th class="span1-3"></th>
</tr>
</thead>
<tbody class="sort-holder">
<tbody id="tbody_bulletins" class="sort-holder">
<%= render :partial => 'bulletin', :collection => @bulletins %>
</tbody>

View File

@ -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>

View File

@ -18,73 +18,16 @@
</ul>
<div class="filters">
<div class="accordion-body collapse" id="collapse-status">
<div class="accordion-inner" data-toggle="buttons-checkbox">
<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>
<%= render 'filter_status' %>
</div>
<div class="accordion-body collapse" id="collapse-category">
<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 => 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>
<%= render 'filter_categories' %>
</div>
<div class="accordion-body collapse" id="collapse-tags">
<div class="accordion-inner" data-toggle="buttons-checkbox">
<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>
<%= render 'filter_tags' %>
</div>
<div class="table-label">
<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') %>">
<%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path(sortable('status')) %>
</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')) %>
</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')) %>
</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')) %>
</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')) %>
</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')) %>
</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')) %>
</th>
</tr>
</thead>
</table>
<div id="sort_headers" class="table-label">
<%= render 'sort_headers' %>
</div>
</div>
</div>

View File

@ -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'} %>

View File

@ -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'} %>

View File

@ -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'} %>

View File

@ -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-3 <%= 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>

View File

@ -1,20 +1,18 @@
<%= render 'filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'bulletins' %>
</table>
<%= 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 %>
<%= paginate @bulletins %>
<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 id="bulletin_file_qe">
<div id="modal-file" class="modal fade">
<%= render :partial => "bulletin_file_qe" %>
</div>
<%= render :partial => "bulletin_link_qe" %>
</div>
</div>
<div class="form-actions">
@ -24,3 +22,4 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<% end %>

View File

@ -0,0 +1,7 @@
$("#collapse-status").html("<%= j render 'filter_status' %>");
$("#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} %>");

View File

@ -1,11 +1,14 @@
<%= content_tag :div ,:id => "users_checkbox_ary", do -%>
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
<% sys_users = User.all -%>
<% sys_users.each do |user| -%>
<div class="checkblock">
<div class="checkbox clear">
<% user.sub_roles.each do |sr| %>
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
<% end %>
<%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.fact_check_setting_window_title'),:content => "#{user.sub_roles.collect{|sr| sr.key}.join(',')}"},:class=>"checkbox clear" do %>
<div class="check-icon">
<i class="icons-check-2 icons-white"></i>
</div>
<div class='member-avatar'>
<% if user.avatar? %>
@ -16,7 +19,7 @@
</div>
<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
<%= check_box_tag "[users][#{user.id}]", 'true',users.include?(user),:class => "check" -%>
</div>
<%end -%>
</div>
<% end -%>

View File

@ -2,7 +2,9 @@
<%= stylesheet_link_tag "inc/permission-checkbox" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bootstrap" %>
<%= javascript_include_tag "inc/permission-checkbox" %>
<%= javascript_include_tag "inc/search" %>
<% end %>
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
<%= form_tag('', :remote => true) %>
@ -12,6 +14,7 @@
<div class="form-search" style="margin: 5px 10px;">
<%= label_tag :category, t("announcement.bulletin.category") %>
<%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %>
<%= search_field_tag 'user_filter' %>
</div>
</li>
</ul>
@ -27,6 +30,9 @@
</div>
<script type="text/javascript" charset="utf-8">
var availableTags = [];
$(function() {
$('#category_id').change(function() {
$(this).parents('form').submit();
});

View File

@ -40,7 +40,10 @@ en:
fact_check_stat: Fact Check Status
fact_check_not_pass: 'Not Pass'
fact_check_not_pass_reason: 'Reason'
fact_check_pending: 'Pending'
fact_check_pass: 'Pass'
fact_check_setting_window_title: 'Unit'
# admin:
# action: Action
# add_language: Add language

View File

@ -33,10 +33,11 @@ zh_tw:
fact_check: 公告審核
fact_check_setting: 審核設定
fact_check_stat: 審核狀況
fact_check_pending: 審核中
fact_check_not_pass: '不通過'
fact_check_pass: '通過'
fact_check_not_pass_reason: '不通過原因'
fact_check_setting_window_title: '單位'
# admin:
# action: 行動
# add_language: 新增語言

View File

@ -6,13 +6,15 @@ Rails.application.routes.draw do
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
root :to => "bulletins#index"
resources :bulletins do
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
member do
get 'load_quick_edit'
end
collection do
post 'delete'
end
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
end