myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2118] trunk: made new/upload gadget configurable


From: noreply
Subject: [myexperiment-hackers] [2118] trunk: made new/upload gadget configurable
Date: Thu, 12 Mar 2009 17:27:49 -0400 (EDT)

Revision
2118
Author
dgc
Date
2009-03-12 17:27:49 -0400 (Thu, 12 Mar 2009)

Log Message

made new/upload gadget configurable

Modified Paths

Diff

Modified: trunk/app/views/gadgets/_new_object.rhtml (2117 => 2118)


--- trunk/app/views/gadgets/_new_object.rhtml	2009-03-11 13:45:16 UTC (rev 2117)
+++ trunk/app/views/gadgets/_new_object.rhtml	2009-03-12 21:27:49 UTC (rev 2118)
@@ -1,26 +1,10 @@
 <script type="text/_javascript_">
   function redirectToNew() {
     var klass = $("new_object_type").value;
-    
-    if (klass == "Blob") {
-      location.href = "" new_file_path -%>";
-		} else if (klass == "Pack") {
-      location.href = "" new_pack_path -%>";
-    } else if (klass == "Workflow") {
-      location.href = "" new_workflow_path -%>";
-    } else if (klass == "Group") {
-      location.href = "" new_group_path -%>";
-    } else if (klass == "Message") {
-      location.href = "" new_message_path -%>";
-    } else if (klass == "Experiment") {
-      location.href = "" new_experiment_path -%>";
-		} else if (klass == "Job") {
-      location.href = "" url_for :controller => 'jobs', :action ="" 'new' -%>";
-		} else if (klass == "Runner") {
-      location.href = "" new_runner_path -%>";
-		} else {
-      // do nothing!!
-    }
+<% Conf.new_menu.each do |item| %>
+    if (klass == "<%= item['label'] %>")
+      location.href = "" item['link'] %>";
+<% end %>
   }
 </script>
 
@@ -38,18 +22,10 @@
       <form  return false;">
         <p>
           <select id="new_object_type">
-            <option value="Workflow" <%= "selected" if ["workflows"].include? controller.controller_name.to_s %>>Workflow</option>
-						<option value="Blob" <%= "selected" if ["blobs"].include? controller.controller_name.to_s %>>File</option>
-						<option value="Pack" <%= "selected" if ["packs"].include? controller.controller_name.to_s %>>Pack</option>
-						<option value="Group" <%= "selected" if ["networks"].include? controller.controller_name.to_s %>>Group</option>
-						<% if logged_in? -%>
-							<option value="Message" <%= "selected" if ["messages"].include? controller.controller_name.to_s %>>Message</option>
-							<option value="Runner" <%= "selected" if ["runners"].include? controller.controller_name.to_s %>>Runner</option>
-							<% unless TavernaEnactor.for_user(current_user).empty? -%>
-								<option value="Experiment" <%= "selected" if ["experiments"].include? controller.controller_name.to_s %>>Experiment</option>
-								<option value="Job" <%= "selected" if ["jobs"].include? controller.controller_name.to_s %>>Job</option>
-							<% end -%>
-						<% end -%>
+            <% Conf.new_menu.each do |item| %>
+              <% next if item['condition'] and !eval(item['condition']) %>
+              <option value="<%= item['label'] %>" <%= "selected" if item['controller'] && controller.controller_name.match(item['controller']) %>><%= item['label'] %></option>
+            <% end %>
           </select>
           <%= submit_tag "GO" %>
         </p>

Modified: trunk/config/boot.rb (2117 => 2118)


--- trunk/config/boot.rb	2009-03-11 13:45:16 UTC (rev 2117)
+++ trunk/config/boot.rb	2009-03-12 21:27:49 UTC (rev 2118)
@@ -1,7 +1,5 @@
 # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
 
-require 'lib/conf'
-
 RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
 
 unless defined?(Rails::Initializer)

Modified: trunk/config/environment.rb (2117 => 2118)


--- trunk/config/environment.rb	2009-03-11 13:45:16 UTC (rev 2117)
+++ trunk/config/environment.rb	2009-03-12 21:27:49 UTC (rev 2118)
@@ -64,6 +64,8 @@
 
 # Include your application configuration below
 
+require 'lib/conf'
+
 # SMTP configuration
 
 require 'smtp_tls'

Modified: trunk/lib/conf.rb (2117 => 2118)


--- trunk/lib/conf.rb	2009-03-11 13:45:16 UTC (rev 2117)
+++ trunk/lib/conf.rb	2009-03-12 21:27:49 UTC (rev 2118)
@@ -39,6 +39,10 @@
     @vars['main_tabs']
   end
 
+  def self.new_menu
+    @vars['new_menu']
+  end
+
   # This method is required to create an administrator in the test fixtures
 
   def self.admins=(value)

reply via email to

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