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