fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-12-24 05:36 am

[dw-free] Adding a user to your circle is confusing with access and subscribe filters both visible o

[commit: http://hg.dwscoalition.org/dw-free/rev/43189297acfd]

http://bugs.dwscoalition.org/show_bug.cgi?id=4140

Only show the access / subscribe filter lists if we have the appropriate
checkbox selected above.

Patch by [personal profile] fu.

Files modified:
  • htdocs/js/jquery.circle-add.js
  • htdocs/manage/circle/add.bml
--------------------------------------------------------------------------------
diff -r 9fe20412065b -r 43189297acfd htdocs/js/jquery.circle-add.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/js/jquery.circle-add.js	Sat Dec 24 13:35:22 2011 +0800
@@ -0,0 +1,9 @@
+jQuery(function($) {
+$("#add_trust, #add_watch").click(function() {
+    var $this = $(this);
+    var $linked = $("."+$this.attr("id"))
+    $this.is(":checked") ? $linked.fadeIn() : $linked.fadeOut();
+})
+$("#add_trust").triggerHandler("click");
+$("#add_watch").triggerHandler("click");
+})
diff -r 9fe20412065b -r 43189297acfd htdocs/manage/circle/add.bml
--- a/htdocs/manage/circle/add.bml	Sat Dec 24 01:50:55 2011 +0800
+++ b/htdocs/manage/circle/add.bml	Sat Dec 24 13:35:22 2011 +0800
@@ -30,7 +30,9 @@
 
     $body = "";
 
-    LJ::need_res(qw(js/core.js js/dom.js js/colorpicker.js));
+    LJ::need_res( { group => "jquery" }, qw( js/colorpicker.js js/jquery.circle-add.js ) );
+    LJ::set_active_resource_group( "jquery" );
+
     LJ::set_active_crumb('addfriend');
 
     unless ($remote)
@@ -261,7 +263,7 @@
 
     # trust group buttons
     if ( $remote->can_trust( $u ) && @trust_groups ) {
-        $body .= "<div style='float: left; width: 45%; padding: 1em;'>";
+        $body .= "<div class='add_trust' style='float: left; width: 45%; padding: 1em;'>";
         $body .= "<?p &nbsp;<br />";
         $body .= "$ML{'.groups.text1'} p?>\n";
         foreach my $group ( @trust_groups ) {
@@ -278,7 +280,7 @@
 
     # content filter buttons
     if ( $remote->can_watch( $u ) && @content_filters ) {
-        $body .= "<div style='float: left; width: 45%; padding: 1em;'><?p &nbsp;<br />";
+        $body .= "<div class='add_watch' style='float: left; width: 45%; padding: 1em;'><?p &nbsp;<br />";
         $body .= "$ML{'.groups.reading'} p?>\n";
         my @sorted_content_filters = sort { $a->{sortorder} <=> $b->{sortorder} } @content_filters;
         foreach my $filter ( @sorted_content_filters ) {
@@ -298,6 +300,7 @@
 
     my $color_switch_checked = $custom_colors ?  "checked=\"checked\"" : "";
 
+    $body .= "<div class='add_watch'>";
     ## let them pick the colors
     my $color_text = "<?p <table summary=\\'\\'><tr><td valign=\"top\"><i>$ML{'.optional'}:</i> ".
              "<input type=\"checkbox\" id=\"color_switch\" name=\"color_switch\" onClick=\"color_display(this);\" $color_switch_checked> </td><td><label for=\"color_switch\">" .
@@ -306,9 +309,9 @@
     $body .= "<script>\n";
     $body .= "function color_display(check) {\n";
     $body .= "  if (check.checked) {\n";
-    $body .= "    \$(\"color_opt\").style.display = '';\n";
+    $body .= "    \$(\"#color_opt\").slideDown();\n";
     $body .= "  } else {\n";
-    $body .= "    \$(\"color_opt\").style.display = 'none';\n";
+    $body .= "    \$(\"#color_opt\").slideUp();\n";
     $body .= "  }\n";
     $body .= "}\n";
     $body .= "var text = '$color_text';\n";
@@ -325,8 +328,8 @@
     my $ret = "";
     $ret .= "  <div id='color_opt'>\n";
     $ret .= "<script>\n";
-    $ret .= "  \$(\"color_opt\").style.display = 'none'\n";
-    $ret .= "  color_display(\$(\"color_switch\"));\n";
+    $ret .= "  \$(\"#color_opt\").hide()\n";
+    $ret .= "  color_display(\$(\"#color_switch\"));\n";
     $ret .= "</script>\n";
 
     $ret .= "<?p <script type=\"text/javascript\" language=\"JavaScript\">\n<!--\ndocument.write(\"<span style='font-size: 7pt;'>";
@@ -548,7 +551,7 @@
    p?>
    ~;
 
-    $ret .= "</div>\n";
+    $ret .= "</div></div>\n";
 
    if ( $u->is_community ) {
        $body .= "<br />$ML{'.disclaimer'}";
--------------------------------------------------------------------------------