myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2954] trunk/app/views/contributions/_sharing_for


From: noreply
Subject: [myexperiment-hackers] [2954] trunk/app/views/contributions/_sharing_form.rhtml: Fixed problem where layout options weren't disabled when a group wasn' t shared with
Date: Thu, 1 Mar 2012 12:31:27 +0000 (UTC)

Revision
2954
Author
fbacall
Date
2012-03-01 12:31:27 +0000 (Thu, 01 Mar 2012)

Log Message

Fixed problem where layout options weren't disabled when a group wasn't shared with

Modified Paths

Diff

Modified: trunk/app/views/contributions/_sharing_form.rhtml (2953 => 2954)


--- trunk/app/views/contributions/_sharing_form.rhtml	2012-02-29 14:58:12 UTC (rev 2953)
+++ trunk/app/views/contributions/_sharing_form.rhtml	2012-03-01 12:31:27 UTC (rev 2954)
@@ -193,28 +193,32 @@
   function toggle_layout_option(id, enable) {
     var option = $$('select#layout option[value=' + id + ']').first();
 
-    //If a "share with group" box is unticked, and that group's layout is selected, go to default.
-    if(!enable){
-      if($('layout').selectedIndex == option.index){
-        $('layout').selectedIndex = 0;
+    if(option != null) {
+      //If a "share with group" box is unticked, and that group's layout is selected, go to default.
+      if(!enable){
+        if($('layout').selectedIndex == option.index){
+          $('layout').selectedIndex = 0;
+        }
       }
-    }
 
-    //Disable/enable option in dropdown menu
-    option.disabled = !enable;
+      //Disable/enable option in dropdown menu
+      option.disabled = !enable;
 
-    //If all options except "default" are disabled, hide the layout option box
-    if($$('select#layout option[disabled]').size() == ($$('select#layout option').size() - 1)) {
-      $('layout_options_box').hide();
+      //If all options except "default" are disabled, hide the layout option box
+      if($$('select#layout option[disabled]').size() == ($$('select#layout option').size() - 1)) {
+        $('layout_options_box').hide();
+      }
+      else {
+        $('layout_options_box').show();
+      }
     }
-    else {
-      $('layout_options_box').show();
-    }
   }
 
   //Initial state
-  $$('input.group_sharing').each (function (box) {
-    toggle_layout_option(box.value, box.checked);
+  document.observe("dom:loaded", function() {
+    $$('input.group_sharing').each (function (box) {
+      toggle_layout_option(box.value, box.checked);
+    });
   });
 </script>
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]