Commit 6392c66

mo khan <mo@mokhan.ca>
2013-06-24 04:31:57
condense the links table
1 parent 6cbfb2b
Changed files (1)
app
views
app/views/links/index.html.erb
@@ -1,4 +1,3 @@
-
 <% content_for :javascript do %>
 <script src="http://cdn.embed.ly/jquery.embedly-3.0.5.min.js" type="text/javascript"></script>
 <script src="http://cdn.embed.ly/jquery.preview-0.3.2.min.js" type="text/javascript"></script>
@@ -14,10 +13,14 @@ $('form').on('submit', function(){
 
 <div class="row">
   <div class="span12">
-    <%= form_for Link.new, :url => links_path, :method => :post, :html => { :class => "form-horizontal" } do |f| %>
-      <input id="url" type="text" name="url"/>
-      <%= f.submit :add, :class => "btn" %>
-      <div class="selector-wrapper"></div>
+    <% if user_signed_in? %>
+      <%= form_for Link.new, :url => links_path, :method => :post, :html => { :class => "form-inline" } do |f| %>
+        <input type="text" id="url" name="url" value="" placeholder="http://google.com/" />
+        <%= f.submit :add, :class => "btn" %>
+        <div class="selector-wrapper"></div>
+      <% end %>
+    <% else %>
+      <%= link_to "Add Link", new_user_session_path %>
     <% end %>
   </div>
 </div>
@@ -33,10 +36,9 @@ $('form').on('submit', function(){
       </tr>
       <% @links.each do |link| %>
         <tr>
-        <td><%= link.url %></td>
-        <td><%= link.description %></td>
-        <td><%= link.title %></td>
         <td><%= image_tag link.thumbnail_url %></td>
+        <td><%= link_to link.title, link.url %></td>
+        <td><%= link.description %></td>
       </tr>
     <% end %>
     </table>