myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2856] branches/datasets/app: Added data sets to


From: noreply
Subject: [myexperiment-hackers] [2856] branches/datasets/app: Added data sets to Quick Add
Date: Thu, 1 Dec 2011 08:32:00 -0500 (EST)

Revision
2856
Author
fbacall
Date
2011-12-01 08:31:55 -0500 (Thu, 01 Dec 2011)

Log Message

Added data sets to Quick Add

Modified Paths

Diff

Modified: branches/datasets/app/helpers/application_helper.rb (2855 => 2856)


--- branches/datasets/app/helpers/application_helper.rb	2011-12-01 12:56:06 UTC (rev 2855)
+++ branches/datasets/app/helpers/application_helper.rb	2011-12-01 13:31:55 UTC (rev 2856)
@@ -367,9 +367,8 @@
     when "Blob", "Pack", "Blog", "DataSet"
       resource = eval(contributabletype).find_by_id(contributableid)
       name = h(resource.label)
-      contributabletype = "File" if contributabletype == "Blob"
       # todo: Rails 2: refactor this, or just remove and use polymorphic_path
-      url = "" + "_url(resource)")
+      url = "" + "_url(resource)")
       return link ? link_to(name, url) : name
     when "Workflow"
       if w = Workflow.find(:first, :conditions => ["id = ?", contributableid])
@@ -871,7 +870,7 @@
       end
     end
         
-    name
+    name.titleize
   end
   
   def controller_visible_name(humanized_controller_for)

Modified: branches/datasets/app/views/packs/_add_item.rhtml (2855 => 2856)


--- branches/datasets/app/views/packs/_add_item.rhtml	2011-12-01 12:56:06 UTC (rev 2855)
+++ branches/datasets/app/views/packs/_add_item.rhtml	2011-12-01 13:31:55 UTC (rev 2856)
@@ -35,7 +35,7 @@
 	</div>
 	
 	<!-- Quick add (from your stuff) -->
-	<% unless (contributions = current_user.contributions).empty? -%>
+	<% unless (contributions = current_user.all_contributions).empty? -%>
 		<div class="box_currentuser_specific" style="margin-bottom: 0.5em; padding: 0.1em 0;">
 			<% form_tag quick_add_pack_url(@pack) do -%>
 				<table class="quick_add">
@@ -47,15 +47,11 @@
 						</td>
 						<td>
 							<select id="uri2" name="uri" style="width: 320px;">
-					  		<% contributions.each do |c| -%>
-									<% if ["workflow", "blob", "pack"].include? c.contributable_type.downcase -%>
-						    	  <% show = (c.contributable.class.to_s == 'Pack' ? (@pack.id != c.contributable.id) : true) -%> <!-- prevents from displaying current pack in the list of things that are enabled to be added to the current pack -->
-									  <% if show -%>
-										  <option value="<%= contributable_url(c.contributable_id, c.contributable_type, @base_host) -%>">
-						      	  	<%= "#{visible_name c.contributable_type}: #{contributable_name(c.contributable_id, c.contributable_type)}" -%>
-						    		  </option>
-										<% end %>
-									<% end -%>
+					  		<% contributions.reject {|c| c == @pack || c.contributable.nil?}.each do |c| -%>
+                  <%# todo: Rails 2: Refactor this to use polymorphic_url %>
+                  <option value="<%= eval(c.contributable_type.model_alias.underscore + "_url(c.contributable_id)") -%>">
+                    <%= "#{visible_name c.contributable_type}: #{c.contributable.label}" -%>
+                  </option>
 					  		<% end -%>
 							</select>
 						</td>

reply via email to

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