myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2913] trunk: Fixed an issue with editting resour


From: noreply
Subject: [myexperiment-hackers] [2913] trunk: Fixed an issue with editting resources with missing layouts
Date: Fri, 20 Jan 2012 09:55:05 -0500 (EST)

Revision
2913
Author
fbacall
Date
2012-01-20 09:55:05 -0500 (Fri, 20 Jan 2012)

Log Message

Fixed an issue with editting resources with missing layouts

Modified Paths

Diff

Modified: trunk/app/views/contributions/_sharing_form.rhtml (2912 => 2913)


--- trunk/app/views/contributions/_sharing_form.rhtml	2012-01-20 14:51:41 UTC (rev 2912)
+++ trunk/app/views/contributions/_sharing_form.rhtml	2012-01-20 14:55:05 UTC (rev 2913)
@@ -175,10 +175,11 @@
               </p>
             </div>
             <% selected_option = (Conf.layouts[contributable.contribution.layout]["network_id"] unless
-                contributable.contribution.nil? || contributable.contribution.layout.nil?) %>
+                (contributable.contribution.nil? || contributable.contribution.layout.nil? ||
+                 Conf.layouts[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 %>
+                options_from_collection_for_select(applicable_networks.select {|n| n.layout_name if Conf.layouts[n.layout_name]},
+                                                   'id','title', selected_option) %>
           </div>
         <% end %>
       </div>

Modified: trunk/lib/conf.rb (2912 => 2913)


--- trunk/lib/conf.rb	2012-01-20 14:51:41 UTC (rev 2912)
+++ trunk/lib/conf.rb	2012-01-20 14:55:05 UTC (rev 2913)
@@ -178,8 +178,7 @@
   end
 
   def self.layouts
-    #TODO: Perhaps implement code that can load different/extra settings files based on current environment
-    layouts = self.fetch_entry('layouts') || {}
+    layouts = self.fetch_entry('layouts', {})
     layouts.delete_if {|k,v| v["environment"] && (v["environment"] != ENV["RAILS_ENV"])}
   end
 
@@ -249,13 +248,6 @@
   end
 
   def self.fetch_entry(key, default = nil)
-
-    if @config != nil
-      if @settings['virtual_hosts'address@hidden
-        return @settings['virtual_hosts'address@hidden
-      end
-    end
-
     return @settings[key] if @settings[key]
     return @defaults[key] if @defaults[key]
 

reply via email to

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