myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3658] branches/packs/app: combined the three add


From: noreply
Subject: [myexperiment-hackers] [3658] branches/packs/app: combined the three add pack item forms into one
Date: Mon, 2 Sep 2013 12:18:07 +0000 (UTC)

Revision
3658
Author
dgc
Date
2013-09-02 12:18:07 +0000 (Mon, 02 Sep 2013)

Log Message

combined the three add pack item forms into one

Modified Paths

Diff

Modified: branches/packs/app/controllers/packs_controller.rb (3657 => 3658)


--- branches/packs/app/controllers/packs_controller.rb	2013-09-02 09:02:46 UTC (rev 3657)
+++ branches/packs/app/controllers/packs_controller.rb	2013-09-02 12:18:07 UTC (rev 3658)
@@ -396,7 +396,12 @@
   
   def quick_add
     respond_to do |format|
-      uri = preprocess_uri(params[:uri])
+
+      uri = params[:uri]
+      uri = params[:uri2] if uri.blank?
+      uri = params[:uri3] if uri.blank?
+
+      uri = preprocess_uri(uri)
       if uri.blank?
         flash.now[:error] = 'Failed to add item. See error(s) below.'
         @error_message = "Please enter a link"

Modified: branches/packs/app/views/packs/_add_item.rhtml (3657 => 3658)


--- branches/packs/app/views/packs/_add_item.rhtml	2013-09-02 09:02:46 UTC (rev 3657)
+++ branches/packs/app/views/packs/_add_item.rhtml	2013-09-02 12:18:07 UTC (rev 3658)
@@ -5,107 +5,73 @@
 		<br/>
 	<% end -%>
 	
-	<!-- Quick add (a link) -->
-	<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">
-				<tr>
-					<td class="label" style="vertical-align: top; padding-bottom: 0;" rowspan=2>
-						<%= info_icon_with_tooltip("Type or paste in a link to something (either in #{Conf.sitename} or elsewhere). The link will then be resolved appropriately.") -%>
-						<b>Quick add:</b>
-						<p class="inner">(a link)</p>
-					</td>
-					<td style="padding-bottom: 0;">
-						<%= text_field_tag "uri", params[:uri], :style => "width: 280px;",
+  <% form_tag quick_add_pack_url(@pack) do -%>
+    <table class="quick_add">
+      <tr>
+        <td class="label" style="vertical-align: top; padding-bottom: 0;" rowspan=2>
+          <%= info_icon_with_tooltip("Type or paste in a link to something (either in #{Conf.sitename} or elsewhere). The link will then be resolved appropriately.") -%>
+          <b>Quick add:</b>
+        </td>
+        <td style="padding-bottom: 0;">
+          <div>
+            <%= text_field_tag "uri", params[:uri], :style => "width: 280px;",
             :placeholder => 'http://www.example.com/resource' -%>
-              <%= select_tag(:type, options_for_select(Conf.ro_resource_types.map { |x| [x["label"], x["uri"]] },
-                    "http://purl.org/wf4ever/ro#Resource") )  -%>
-              Folder: <%= select_tag(:folder, options_for_select(['(automatic)'] + @ore_directories)) -%>
-					</td>
-					<td class="submit" style="padding-bottom: 0;">
-						<%= submit_tag "Add", :disable_with => "..." -%>
-					</td>
-				</tr>
-				<tr>
-					<td style="padding-top: 0;">
-						<p style="text-align: center; color: #333333; font-size: 77%; padding: 0;">
-							eg: "http://www.myexperiment.org/workflows/1" or "http://www.example.com/resource"
-						</p>
-					</td>
-					<td style="padding-top: 0;">&nbsp;</td>
-				</tr>
-			</table>
-		<% end -%>
-	</div>
-	
-	<!-- Quick add (from your stuff) -->
-	<% unless (contributions = current_user.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">
-					<tr>
-						<td class="label">
-							<%= info_icon_with_tooltip("Quickly add something from your collections of items.") -%>
-							<b>Quick add:</b>
-							<p class="inner">(from your stuff)</p>
-						</td>
-						<td>
-							<select id="uri2" name="uri" style="width: 280px;">
-					  		<% 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 -%>
-					  		<% end -%>
-							</select>
-              <%= select_tag(:type, options_for_select(Conf.ro_resource_types.map { |x| [x["label"], x["uri"]] },
-                    "http://purl.org/wf4ever/ro#Resource") )  -%>
-              Folder: <%= select_tag(:folder, options_for_select(['(automatic)'] + @ore_directories)) -%>
-						</td>
-						<td class="submit">
-							<%= submit_tag "Add", :disable_with => "..." -%>
-						</td>
-					</tr>
-				</table>
-			<% end -%>
-		</div>
-	<% end -%>
-	
-	<!-- Quick add (from your favourites) -->
-	<% unless (bookmarks = current_user.bookmarks).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">
-					<tr>
-						<td class="label">
-							<%= info_icon_with_tooltip("Quickly add something from your list of favourite items.") -%>
-							<b>Quick add:</b>
-							<p class="inner">(from favourites)</p>
-						</td>
-						<td>
-							<select id="uri2" name="uri" style="width: 320px;">
-					  		<% bookmarks.each do |b| -%>
-									<% if ["workflow", "blob", "pack"].include? b.bookmarkable_type.downcase -%>
-						    		<% show = (b.bookmarkable_type == 'Pack' ? (@pack.id != b.bookmarkable_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(b.bookmarkable_id, b.bookmarkable_type, @base_host) -%>">
-						      		  <%= "#{visible_name b.bookmarkable_type}: #{contributable_name(b.bookmarkable_id, b.bookmarkable_type)}" -%>
-						    		  </option>
-										<% end %>
-									<% end -%>
-					  		<% end -%>
-							</select>
-						</td>
-						<td class="submit">
-							<%= submit_tag "Add", :disable_with => "..." -%>
-						</td>
-					</tr>
-				</table>
-			<% end -%>
-		</div>
-	<% end -%>
+          </div>
+
+          <% unless (contributions = current_user.contributions).empty? -%>
+            <div>or</div>
+            <div>
+              <select id="uri2" name="uri2" style="width: 280px;">
+                <option value="">Select from your contributions...</option>
+                <% 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 -%>
+                <% end -%>
+              </select>
+            </div>
+          <% end %>
+
+          <% unless (bookmarks = current_user.bookmarks).empty? -%>
+            <div>or</div>
+            <div>
+              <select id="uri3" name="uri3" style="width: 320px;">
+                <option value="">Select from your favourites...</option>
+                <% bookmarks.each do |b| -%>
+                  <% if ["workflow", "blob", "pack"].include? b.bookmarkable_type.downcase -%>
+                    <% show = (b.bookmarkable_type == 'Pack' ? (@pack.id != b.bookmarkable_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(b.bookmarkable_id, b.bookmarkable_type, @base_host) -%>">
+                        <%= "#{visible_name b.bookmarkable_type}: #{contributable_name(b.bookmarkable_id, b.bookmarkable_type)}" -%>
+                      </option>
+                    <% end %>
+                  <% end -%>
+                <% end -%>
+              </select>
+            </div>
+          <% end %>
+
+          <%= select_tag(:type, options_for_select(Conf.ro_resource_types.map { |x| [x["label"], x["uri"]] },
+                "http://purl.org/wf4ever/ro#Resource") )  -%>
+          Folder: <%= select_tag(:folder, options_for_select(['(automatic)'] + @ore_directories)) -%>
+        </td>
+        <td class="submit">
+          <%= submit_tag "Add", :disable_with => "..." -%>
+        </td>
+      </tr>
+      <tr>
+        <td style="padding-top: 0;">
+          <p style="text-align: center; color: #333333; font-size: 77%; padding: 0;">
+            eg: "http://www.myexperiment.org/workflows/1" or "http://www.example.com/resource"
+          </p>
+        </td>
+        <td style="padding-top: 0;">&nbsp;</td>
+      </tr>
+    </table>
+  <% end -%>
 <% end -%>

reply via email to

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