diff --git a/app/assets/images/check.png b/app/assets/images/check.png new file mode 100644 index 00000000..e415c89b Binary files /dev/null and b/app/assets/images/check.png differ diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index d20f5081..abb908b4 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -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); }); \ No newline at end of file diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js index e314d2aa..fc91b857 100644 --- a/app/assets/javascripts/inc/permission-checkbox.js +++ b/app/assets/javascripts/inc/permission-checkbox.js @@ -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 }, + }); }); \ No newline at end of file diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js new file mode 100644 index 00000000..979b5621 --- /dev/null +++ b/app/assets/javascripts/inc/search.js @@ -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(); + } + }) +}) \ No newline at end of file diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 5741437c..45bfcbbc 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -12,4 +12,5 @@ //= require orbit-1.0 //= require tinymce-jquery //= require tinymce_orbit -//= require orbit-bar-search \ No newline at end of file +//= require orbit-bar-search +//= require side_bar_history \ No newline at end of file diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index e83c69f6..5f69b297 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -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}); } diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js index 036c63d4..e9505aa1 100644 --- a/app/assets/javascripts/side_bar_history.js +++ b/app/assets/javascripts/side_bar_history.js @@ -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); + } }); \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap-orbit.css b/app/assets/stylesheets/bootstrap-orbit.css index eede71d4..34425d50 100644 --- a/app/assets/stylesheets/bootstrap-orbit.css +++ b/app/assets/stylesheets/bootstrap-orbit.css @@ -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%; } \ No newline at end of file diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css index 9d7beb5e..0adf7225 100644 --- a/app/assets/stylesheets/inc/permission-checkbox.css +++ b/app/assets/stylesheets/inc/permission-checkbox.css @@ -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; } \ No newline at end of file diff --git a/app/helpers/admin/ad_banner_helper.rb b/app/helpers/admin/ad_banner_helper.rb index 2de0504b..eff12427 100644 --- a/app/helpers/admin/ad_banner_helper.rb +++ b/app/helpers/admin/ad_banner_helper.rb @@ -1,12 +1,5 @@ module Admin::AdBannerHelper - def preview_block(ad_banner) - res ='' - #same code as in frontend backend parser - if ad_banner - res << "" - res << "
" + 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 << "" - end - res << "
" - res.html_safe - end - end + end + end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6d2cf9a8..e45fa4d6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 19ba5087..d9b1b902 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -15,5 +15,5 @@ <%= link_to 'Add AdImage',new_admin_ad_banner_ad_image_path(ad_banner_tab) %> <% end -%> - <%= preview_block ad_banner_tab %> + <%= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %> diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 418b8c8f..8e8de1d9 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -1,5 +1,3 @@ - <% end %> + diff --git a/app/views/admin/ad_banners/_preview_block.html.erb b/app/views/admin/ad_banners/_preview_block.html.erb new file mode 100644 index 00000000..4e8432b6 --- /dev/null +++ b/app/views/admin/ad_banners/_preview_block.html.erb @@ -0,0 +1,29 @@ +<% if ad_banner -%> +<%= link_to 'Preview',"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %> + + + +<% end -%> + + + diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 54d95e00..38b67dd7 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -1,9 +1,9 @@
@@ -13,4 +13,3 @@
- diff --git a/app/views/layouts/_drop_down_menu.html.erb b/app/views/layouts/_drop_down_menu.html.erb index 900437a6..89285ebb 100644 --- a/app/views/layouts/_drop_down_menu.html.erb +++ b/app/views/layouts/_drop_down_menu.html.erb @@ -7,18 +7,4 @@
  • <%= link_to t('admin.member'), admin_users_path, :class => 'orblink' %>
  • <%= link_to t('admin.translation'), admin_translations_path, :class => 'orblink' %>
  • <%= link_to t('admin.site'), admin_sites_path, :class => 'orblink' %>
  • - - \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 3a36a48a..f74f24f6 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -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 -%> diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index e8b899eb..e66c51a4 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -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 diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index e24f7f21..4808b3a9 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -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 diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index 62b28c0c..ca80512e 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -1,5 +1,5 @@ - + <%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %> <% if bulletin.is_top? %> <%= t(:top) %> @@ -10,6 +10,7 @@ <% if bulletin.is_hidden? %> <%= t(:hidden) %> <% end %> + <%= bulletin.status %> <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb index 81daae8b..778340ec 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb @@ -7,9 +7,9 @@ - + - + <%= render :partial => 'bulletin', :collection => @bulletins %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_clear_filters.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_clear_filters.html.erb new file mode 100644 index 00000000..e9c9c481 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_clear_filters.html.erb @@ -0,0 +1,3 @@ +
    + <%= 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" %> +
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb index f8ea5418..b052a770 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb @@ -18,73 +18,16 @@
    - - + <%= render 'filter_status' %>
    -
    - <% @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 -%> -
    - + <%= render 'filter_categories' %>
    -
    - Tag1 - Tag2 - Tag3 - Tag4 - Tag5 - Tag6 - Tag7 - Tag8 - Tag9 - Tag10 -
    - + <%= render 'filter_tags' %>
    -
    - - - - - - - - - - - - - -
    - - - - <%= 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.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path(sortable('category')) %> - - <%= 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.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path(sortable('postdate')) %> - - <%= 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.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path(sortable('tags')) %> - - <%= 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')) %> -
    +
    + <%= render 'sort_headers' %>
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb new file mode 100644 index 00000000..7ffb08f5 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb @@ -0,0 +1,6 @@ +
    + <% @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 -%> +
    +<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_status.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_status.html.erb new file mode 100644 index 00000000..15a982c1 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_status.html.erb @@ -0,0 +1,7 @@ +
    + <%= 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')}" %> +
    +<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_tags.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_tags.html.erb new file mode 100644 index 00000000..b2f11834 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_tags.html.erb @@ -0,0 +1,6 @@ +
    + <% @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 -%> +
    +<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb new file mode 100644 index 00000000..6d6c54e0 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb @@ -0,0 +1,31 @@ + + + + + + + + + + + + + +
    + + + + <%= 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' %> + + <%= 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' %> + + <%= 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' %> + + <%= 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' %> + + <%= 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' %> + + <%= 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' %> + + <%= 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' %> +
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 2925f0db..78532f00 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -1,20 +1,18 @@ -<%= render 'filter' %> - - <%= render 'bulletins' %> -
    +<%= 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' %> + + <%= render 'bulletins' %> +
    +<% end %> -<%= paginate @bulletins %> +
    + <%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> +
    - -
    - + <%= render :partial => "bulletin_link_qe" %> +
    @@ -24,3 +22,4 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "bulletin_form" %> <% end %> + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.js.erb new file mode 100644 index 00000000..24e36542 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.js.erb @@ -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} %>"); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb index 7a7725f4..759e941d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb @@ -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| -%>
    -
    + + <% user.sub_roles.each do |sr| %> + + <% 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 %>
    -
    <% if user.avatar? %> @@ -16,7 +19,7 @@
    <%= 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" -%> -
    + <%end -%>
    <% end -%> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb index cf5cf13c..7303b705 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb @@ -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 @@ @@ -27,6 +30,9 @@