From d1dce81b3efc82e96341538e6033599e49852689 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 5 Apr 2012 18:27:23 +0800 Subject: [PATCH 01/20] factcheck status for and --- .../announcement/app/models/bulletin.rb | 11 +++++++++++ .../back_end/bulletins/_bulletin.html.erb | 1 + .../announcement/config/locales/zh_tw.yml | 1 + 3 files changed, 13 insertions(+) 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..73d37efd 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 @@ -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/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index e2dfd957..bee4b04e 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -33,6 +33,7 @@ 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: '不通過原因' From fd5c082225b51c6c4cbd389b6053973c17a16591 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 5 Apr 2012 18:30:45 +0800 Subject: [PATCH 02/20] fix i18n var for fact check pending --- vendor/built_in_modules/announcement/config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 6143b177..b21546f8 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -40,6 +40,7 @@ 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' # admin: # action: Action From fa441814f378e92034d46f87f42f05c951c1c0b3 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 6 Apr 2012 17:46:50 +0800 Subject: [PATCH 03/20] A filter UI for permission select. with Harry's JS --- .../javascripts/inc/permission-checkbox.js | 12 +++-- .../stylesheets/inc/permission-checkbox.css | 53 ------------------- .../fact_checks/_privilege_user.html.erb | 11 ++-- .../back_end/fact_checks/setting.html.erb | 6 +++ .../announcement/config/locales/en.yml | 2 + .../announcement/config/locales/zh_tw.yml | 2 +- 6 files changed, 25 insertions(+), 61 deletions(-) delete mode 100644 app/assets/stylesheets/inc/permission-checkbox.css diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js index e314d2aa..78a50759 100644 --- a/app/assets/javascripts/inc/permission-checkbox.js +++ b/app/assets/javascripts/inc/permission-checkbox.js @@ -1,14 +1,20 @@ $(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 }, + }); + //$(".checkbox").popover('toggle'); }); \ No newline at end of file diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css deleted file mode 100644 index 9d7beb5e..00000000 --- a/app/assets/stylesheets/inc/permission-checkbox.css +++ /dev/null @@ -1,53 +0,0 @@ -.checkblock { - display: inline-block; - float: left; - width: 200px; -} -.check[type="checkbox"]{ - display:none; -} -.checkbox{ - padding:5px; - margin:5px; - display: inline-block; - color:#777777; - text-shadow: 0 1px 0px rgba(255,255,255,.4); - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - height: 30px; - position: relative; - cursor: pointer; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); - background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -} -.checkbox .check-icon { - display: none; - position: absolute; - width: 22px; - height: 22px; - border-radius: 11px; - background-color: #d0f311; - right: -5px; - top: -5px; - box-shadow: 0px 0px 5px rgba(0,0,0,.05); -} -.checkbox .check-icon i { - margin: 1px 0 0 3px; -} -.checkbox .member-name { - line-height: 30px; - padding: 0 10px; -} -img.member-img { - display: inline-block; - float: left; - max-width: 30px; -} -.checked .check-icon { - display: block; -} \ 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 a4c903c7..38090cf6 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 @@ " - 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/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 @@
- From 486845460c5ff110443a5e7ee745831f333cea4c Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 06:50:36 +0800 Subject: [PATCH 08/20] Filter and delete for bulletins --- app/assets/javascripts/bulletin_form.js.erb | 8 ++ app/helpers/application_helper.rb | 12 +-- .../back_end/bulletins_controller.rb | 80 ++++++++++++++----- .../back_end/bulletins/_bulletin.html.erb | 2 +- .../back_end/bulletins/_bulletins.html.erb | 2 +- .../bulletins/_clear_filters.html.erb | 3 + .../back_end/bulletins/_filter.html.erb | 67 ++-------------- .../bulletins/_filter_categories.html.erb | 6 ++ .../bulletins/_filter_status.html.erb | 7 ++ .../back_end/bulletins/_filter_tags.html.erb | 6 ++ .../back_end/bulletins/_index.html.erb | 20 ----- .../back_end/bulletins/_sort_header.html.erb | 38 --------- .../back_end/bulletins/_sort_headers.html.erb | 31 +++++++ .../back_end/bulletins/index.html.erb | 26 +++++- .../back_end/bulletins/index.js.erb | 9 ++- .../announcement/config/routes.rb | 4 +- 16 files changed, 167 insertions(+), 154 deletions(-) create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_clear_filters.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_status.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_tags.html.erb delete mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_index.html.erb delete mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_header.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb 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/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6d2cf9a8..2f37a517 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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/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 3022afe4..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 @@ -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) 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 @@ -303,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 @@ -324,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 @@ -339,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/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..3abf2fa9 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) %> 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..d5975fbc 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 @@ -10,6 +10,6 @@ - + <%= 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 ae4cf6ed..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')), :class => 'js_history' %> - - <%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path(sortable('category')), :class => 'js_history' %> - - <%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path(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(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(sortable('deadline')), :class => 'js_history' %> - - <%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path(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(sortable('update_user_id')), :class => 'js_history' %> -
+
+ <%= 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/_index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_index.html.erb deleted file mode 100644 index 9013cde5..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_index.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - <%= render 'filter' %> - - <%= render 'bulletins' %> -
- - <%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort]} %> - - - -
- <%= 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' %> -
- -<% 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/_sort_header.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_header.html.erb deleted file mode 100644 index c18be27d..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_header.html.erb +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - -
- - - - <%= t('bulletin.status') %> - <%= content_tag(:b, nil, :class => is_sort?('status')) %> - - <%= t('bulletin.category') %> - <%= content_tag(:b, nil, :class => is_sort?('category')) %> - - <%= t('bulletin.title') %> - <%= content_tag(:b, nil, :class => is_sort?('title')) %> - - <%= t('bulletin.start_date') %> - <%= content_tag(:b, nil, :class => is_sort?('postdate')) %> - - <%= t('bulletin.end_date') %> - <%= content_tag(:b, nil, :class => is_sort?('deadline')) %> - - <%= t('bulletin.tags') %> - <%= content_tag(:b, nil, :class => is_sort?('tags')) %> - - <%= t('bulletin.last_modified') %> - <%= content_tag(:b, nil, :class => is_sort?('update_user_id')) %> -
\ 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..ee08b45b --- /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 a9f90735..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 +1,25 @@ -<%= render 'index' %> \ No newline at end of file +<%= 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, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> +
+ + + +
+ <%= 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' %> +
+ +<% 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 index f9bc6a8b..292e97bd 100644 --- 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 @@ -1,2 +1,7 @@ -$("#main-wrap").html("<%= j render 'index' %>"); -mainTablePosition(); \ No newline at end of file +$("#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/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index fc1ef4f0..048926cb 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -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 From 7bca339a5bdc0c8ae237f61b3e5264c714e623e2 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 07:01:34 +0800 Subject: [PATCH 09/20] Ray's fix for columns width in bulletins --- app/assets/stylesheets/bootstrap-orbit.css | 8 ++++++++ .../announcement/back_end/bulletins/_bulletins.html.erb | 2 +- .../announcement/back_end/bulletins/_filter.html.erb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) 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/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..cdda48fe 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,7 +7,7 @@ - + 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..55a5c2b9 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 @@ -79,7 +79,7 @@ <%= 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')) %> From 1fd38c81359c36adb733e4319a61983759de5712 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 5 Apr 2012 18:27:23 +0800 Subject: [PATCH 10/20] factcheck status for and --- .../announcement/app/models/bulletin.rb | 11 +++++++++++ .../back_end/bulletins/_bulletin.html.erb | 1 + .../announcement/config/locales/zh_tw.yml | 1 + 3 files changed, 13 insertions(+) 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 3abf2fa9..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 @@ -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/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index e2dfd957..bee4b04e 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -33,6 +33,7 @@ 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: '不通過原因' From 0909156eb40a83efb9804bf5f7c373c1a7be51f3 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 5 Apr 2012 18:30:45 +0800 Subject: [PATCH 11/20] fix i18n var for fact check pending --- vendor/built_in_modules/announcement/config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 6143b177..b21546f8 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -40,6 +40,7 @@ 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' # admin: # action: Action From e4c41ab54c280ea14692d48e015dd7dfe8a7c22e Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 6 Apr 2012 17:46:50 +0800 Subject: [PATCH 12/20] A filter UI for permission select. with Harry's JS --- .../javascripts/inc/permission-checkbox.js | 12 +++-- .../stylesheets/inc/permission-checkbox.css | 53 ------------------- .../fact_checks/_privilege_user.html.erb | 11 ++-- .../back_end/fact_checks/setting.html.erb | 6 +++ .../announcement/config/locales/en.yml | 2 + .../announcement/config/locales/zh_tw.yml | 2 +- 6 files changed, 25 insertions(+), 61 deletions(-) delete mode 100644 app/assets/stylesheets/inc/permission-checkbox.css diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js index e314d2aa..78a50759 100644 --- a/app/assets/javascripts/inc/permission-checkbox.js +++ b/app/assets/javascripts/inc/permission-checkbox.js @@ -1,14 +1,20 @@ $(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 }, + }); + //$(".checkbox").popover('toggle'); }); \ No newline at end of file diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css deleted file mode 100644 index 9d7beb5e..00000000 --- a/app/assets/stylesheets/inc/permission-checkbox.css +++ /dev/null @@ -1,53 +0,0 @@ -.checkblock { - display: inline-block; - float: left; - width: 200px; -} -.check[type="checkbox"]{ - display:none; -} -.checkbox{ - padding:5px; - margin:5px; - display: inline-block; - color:#777777; - text-shadow: 0 1px 0px rgba(255,255,255,.4); - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - height: 30px; - position: relative; - cursor: pointer; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); - background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -} -.checkbox .check-icon { - display: none; - position: absolute; - width: 22px; - height: 22px; - border-radius: 11px; - background-color: #d0f311; - right: -5px; - top: -5px; - box-shadow: 0px 0px 5px rgba(0,0,0,.05); -} -.checkbox .check-icon i { - margin: 1px 0 0 3px; -} -.checkbox .member-name { - line-height: 30px; - padding: 0 10px; -} -img.member-img { - display: inline-block; - float: left; - max-width: 30px; -} -.checked .check-icon { - display: block; -} \ 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 @@ " - 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/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 @@
- From 93ac99d23573dbada55e0dc215d706d08c466eb7 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 18:12:46 +0800 Subject: [PATCH 16/20] Add missing css in "inc" --- .../stylesheets/inc/permission-checkbox.css | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 app/assets/stylesheets/inc/permission-checkbox.css diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css new file mode 100644 index 00000000..0adf7225 --- /dev/null +++ b/app/assets/stylesheets/inc/permission-checkbox.css @@ -0,0 +1,77 @@ +.checkblock { + display: inline-block; + float: left; + width: 200px; +} +.check[type="checkbox"]{ + display:none; +} +.checkbox{ + padding: 5px; + margin: 5px 5px 10px; + display: inline-block; + color:#777777; + text-shadow: 0 1px 0px rgba(255,255,255,.4); + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + height: 30px; + position: relative; + cursor: pointer; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); + background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} +.checkbox .check-icon { + display: none; + position: absolute; + width: 26px; + height: 26px; + background: url('img/check.png') no-repeat left top; + right: -10px; + top: -5px; +} +.checkbox .member-name { + cursor: pointer; + font-family: helvetica; + font-size: 12px; + line-height: 30px; + 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 { + 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 From 015c0cb4524f93e2982dc7cc50d34c13c13c0e09 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 18:13:10 +0800 Subject: [PATCH 17/20] Delete useless code in items --- app/views/layouts/_drop_down_menu.html.erb | 14 -------------- 1 file changed, 14 deletions(-) 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 From 167f6d07a0cc6496523c6920fe69bf0687d8115e Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 18:13:26 +0800 Subject: [PATCH 18/20] Remove extra "]" --- .../views/panel/announcement/back_end/bulletins/index.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 292e97bd..24e36542 100644 --- 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 @@ -1,7 +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]) %>"); +$("#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 From 6728c35023bff21f6d7e7cc858997777ef46e0ec Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 18:14:00 +0800 Subject: [PATCH 19/20] Fix side_bar. In the case of tags, take the uri instead of controller name --- app/helpers/application_helper.rb | 2 +- app/views/layouts/_side_bar.html.erb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2f37a517..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) 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 -%> From f8873267a2a185dd13fe46fabb288b674e3c82c2 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 12 Apr 2012 18:41:14 +0800 Subject: [PATCH 20/20] Ray's fix for announcement list --- app/assets/javascripts/orbit-1.0.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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}); }