myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2777] branches/elico/app/views/contributions/_sh


From: noreply
Subject: [myexperiment-hackers] [2777] branches/elico/app/views/contributions/_sharing_form.rhtml: Fixed crash when uploading new contributable.
Date: Tue, 1 Nov 2011 05:08:49 -0400 (EDT)

Revision
2777
Author
fbacall
Date
2011-11-01 05:08:49 -0400 (Tue, 01 Nov 2011)

Log Message

Fixed crash when uploading new contributable. Restricted layout option to only show for workflows

Modified Paths

Diff

Modified: branches/elico/app/views/contributions/_sharing_form.rhtml (2776 => 2777)


--- branches/elico/app/views/contributions/_sharing_form.rhtml	2011-10-31 15:46:24 UTC (rev 2776)
+++ branches/elico/app/views/contributions/_sharing_form.rhtml	2011-11-01 09:08:49 UTC (rev 2777)
@@ -160,32 +160,35 @@
             <option value="1" <%= 'selected="selected"' if !edit or !perm or (perm and perm.level == 1) %>>View and Download only</option>
             <option value="2" <%= 'selected="selected"' if perm and perm.level == 2 %>>View, Download and Update</option>
           </select>
-          <%# 'checked="checked"' if edit && contributable.contribution.layout == n.layout_name %>
         </p>
       <% end %>
       <br/>
-      <div id="layout_options_box">
-        <strong>Layout:</strong>
-        <div class="box_infotext" style="margin: 1em 0">
-          <p>
-            One or more of the groups you have elected to share this <%= c_type -%> with have custom layouts. To
-            apply a custom layout to this <%= c_type -%>, choose one from the list below. The layout can be changed at any time
-            by visiting the 'edit' page.
-          </p>
+      <%# Only available for Workflows at the moment %>
+      <% if c_type == "Workflow" %>
+        <div id="layout_options_box">
+          <strong>Layout:</strong>
+          <div class="box_infotext" style="margin: 1em 0">
+            <p>
+              One or more of the groups you have elected to share this <%= c_type -%> with have custom layouts specified.
+              To apply a group's custom layout to this <%= c_type -%>, choose one from the list below, or select "Default"
+              to use keep the <%= Conf.sitename -%> default layout. The layout can be changed at any time by visiting the
+              'edit' page.
+            </p>
+          </div>
+          <% selected_option = (Conf.layouts[contributable.contribution.layout]["network_id"] unless
+              contributable.contribution.nil? || contributable.contribution.layout.nil?) %>
+          <%= select_tag "layout", "<option value="">Default</option>" +
+              options_from_collection_for_select(applicable_networks.select {|n| n.layout_name}, 'id','title', selected_option) %>
+          <%# TODO: In Rails 2, have a link that allows a user to preview the selected layout using polymorphic_path %>
         </div>
-        <%= select_tag "layout", "<option value="">Default</option>" + options_from_collection_for_select(applicable_networks.select {|n| n.layout_name}, 'id','title', (Conf.layouts[contributable.contribution.layout]["network_id"] unless contributable.contribution.layout.nil?)) %>
-        <%# TODO: In Rails 2, have a link that allows a user to preview the selected layout using polymorphic_path %>
-      </div>
+      <% end %>
     </div>
   </div>
 </div>
 
 <script>update_sharing(<%= @sharing_mode %>)</script>
 <script type="text/_javascript_">
-  //Code to show/hide layout selection box
 
-  var number_of_layout_options = $$('select#layout option').size();
-
   function toggle_layout_option(id, enable) {
     var option = $$('select#layout option[value=' + id + ']').first();
 
@@ -196,10 +199,11 @@
       }
     }
 
+    //Disable/enable option in dropdown menu
     option.disabled = !enable;
 
-    //If everything except default is disabled, hide the layout option box
-    if($$('select#layout option[disabled]').size() == (number_of_layout_options - 1)) {
+    //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 {

reply via email to

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