Commit f29c746e

mo k <mo@mokhan.ca>
2011-06-20 04:34:53
tidy up the edit creation page and remove the rotating banner from all pages except for the home page.
1 parent 453c76b
app/controllers/home_controller.rb
@@ -1,6 +1,6 @@
 class HomeController < ApplicationController
   def index
-    @creations = Creation.all.reverse.take(6)
+    @creations = Creation.all.reverse.take(4)
 
     respond_to do |format|
       format.html # index.html.erb
app/controllers/search_controller.rb
@@ -1,6 +1,7 @@
 class SearchController < ApplicationController
   def index
     @creations = Creation.search params[:q], :include => :user, :match_mode => :boolean
+    @search = params[:q]
   end
 
 end
app/views/creations/_form.html.erb
@@ -11,10 +11,10 @@
   <% end %>
 
   <fieldset class="cute_form">
-    <%= f.label :image %>
-    <%= f.file_field :image, :class => "forms"  %>
-    <%= f.label :remote_image_url, "or image url" %>
-    <%= f.file_field :remote_image_url, :class => "forms"  %>
+    <%= f.label :image, 'data-editable' => 'false' %>
+    <%= f.file_field :image, :class => "forms", 'data-editable' => 'false'   %>
+    <%= f.label :remote_image_url, "or image url", 'data-editable' => 'false'  %>
+    <%= f.text_field :remote_image_url, :class => "forms", 'data-editable' => 'false'  %>
     <%= f.label :name %>
     <%= f.text_field :name, :class => "forms" %>
     <%= f.label :story %>
app/views/creations/edit.html.erb
@@ -1,18 +1,12 @@
-<h1>Browse All Creations</h1>
-<p><em>What time is it? Nana, nana, naaaaana caake time!</em></p>  
-<p>Check out our communities most recent cake work.</p>
+<% content_for :script do %>
+  $('label[data-editable="false"]').addClass('hidden');
+  $('input[data-editable="false"]').addClass('hidden');
+<% end %>
 
-<h2>Editing creation <%= @creation.name %></h2>
+<h1>Editing creation <em><%= @creation.name %></em></h1>
+
+<%= image_tag @creation.image_url.to_s, :class => 'photo' %>
+<%= render 'form' %>
 
-<div class="width100 floatLeft">
-  <div class="width50 floatLeft">
-    <%= render 'form' %>
-  </div>
-  <div class="width50 floatRight">
-    <p>
-    <%= image_tag @creation.image_url.to_s, :class => 'photo' %>
-    </p>
-  </div>
-</div>
 
 <%= link_to 'Show', @creation %> |
app/views/creations/index.html.erb
@@ -2,7 +2,7 @@
 <p><em>What time is it? Nana, nana, naaaaana caake time!</em></p>  
 <p>Check out our communities most recent cake work.</p>
 
-<% @creations.reverse.each_with_index do |creation, index| %>
+<% @creations.reverse.each do |creation| %>
 <div class="product_box">
   <a href="<%= url_for creation %>">
     <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
app/views/creations/mine.html.erb
@@ -1,6 +1,8 @@
 <h1>My Creations</h1>
 
-<%= link_to "add creation", new_creation_path(@creation) %>
+<div class="floatRight">
+  <%= link_to "add new creation", new_creation_path(@creation) %>
+</div>
 
 <hr />
 <% if @creations.length == 0 %>
app/views/creations/show.html.erb
@@ -1,24 +1,22 @@
 <h1><%= @creation.name %> by <em> <%= link_to @creation.user.name, profile_path(@creation.user) %> </em> </h1>
 
+<% if signed_in? %>
+  <div class="floatRight">
+    <%= link_to "Add Creation", new_creation_path %>
+  </div>
+<% end %>
+
 <div class="width100 floatLeft">
   <div class="width25 floatLeft">
     <p> <%= @creation.story %> </p>
-    <p>
-    <% if signed_in? %>
-      <%= link_to "Add Creation", new_creation_path %>
-    <% end %>
-    <%= link_to 'Back', creations_path %>
-    </p>
   </div>
   <div class="width75 floatRight">
-    <p>
-    <%= image_tag @creation.image_url.to_s, :class => 'photo' %>
-    </p>
+    <p> <%= image_tag @creation.image_url.to_s, :class => 'photo' %> </p>
+    <p> submitted on: <%= @creation.created_at %> </p>
     <% if @creation.user == current_user %>
       <%= link_to 'Edit', edit_creation_path(@creation) %>
       <%= button_to 'Delete', @creation, :method => :delete %>
     <% end %>
-    <p> submitted on: <%= @creation.created_at %> </p>
   </div>
 </div>
 
@@ -26,7 +24,7 @@
 <hr class="clear" />
 
 <h3> other creations by <%= @creation.user.name.to_s %> <em><%= link_to 'view more...', profile_path(@creation.user) %> </em> </h3>
-<% other_creations = @creation.user.creations.last(4) %>
+<% other_creations = @creation.user.creations.last(4).reverse %>
 <% other_creations.each do |creation| %>
   <% if creation != @creation %>
   <div class="product_box">
app/views/home/index.html.erb
@@ -1,8 +1,15 @@
+<% content_for :script do %>
+  $('#s1').removeClass('hidden');
+  $('#s1').addClass('slide');
+  $('#s1').cycle({fx:'fade',speed:1500,timeout:4000});
+<% end %>
+
+
 <h1>Welcome to the CakeSide</h1>
 <p><em>An online community for cake artists, enthusiasists and eaters.</em></p>
 <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec malesuada facilisis erat, id sollicitudin leo sollicitudin in. Quisque quis elit eget neque convallis imperdiet in ut odio. Nunc vel lectus turpis, nec tincidunt ipsum. Pellentesque turpis tellus, pulvinar vehicula sodales a, sollicitudin egestas mauris. </p>
 
-<% @creations.each_with_index do |creation, index| %>
+<% @creations.each do |creation| %>
   <div class="product_box">
     <h2><%= creation.name %></h2>
     <a href="<%= url_for creation %>">
app/views/layouts/application.html.erb
@@ -36,23 +36,20 @@
     <div id="menu_container">
       <ul id="navigation">
         <li><%= link_to "home", home_index_path %></li>
-        <li><%= link_to "artists", all_profiles_path %></li>
-        <li class="last"><%= link_to "Browse", creations_path %></li>
+        <li><%= link_to "browse", creations_path %></li>
+        <li class="last"><%= link_to "artists", all_profiles_path %></li>
       </ul>
     </div>
     <div id="mainContent">
       <!-- start body content -->
       <div id="right_side">
-        <div id="s1" class="slide"> 
+        <div id="s1" class="hidden"> 
           <img style="display: none;" src="/images/template/banner_cupcakes.jpg" alt="" width="666" height="226" /> 
           <img style="display: none;" src="/images/template/banner_weddings.jpg" alt="" width="666" height="226" />
         </div>
         <div id="body_text">
           <!-- begin main page content -->
-
-
-<%= yield %>
-
+          <%= yield %>
           <!-- end main page content -->
         </div>
       </div>
@@ -106,10 +103,11 @@
 <%= javascript_include_tag :all %>
 <script type="text/javascript" src="/javascripts/template/jquery.cycle.all.js"></script>
 <script type="text/javascript" src="/javascripts/template/hide-select.js"></script>
+
 <script type="text/javascript">
-	$(function() {
-    $('#s1').cycle({fx:'fade',speed:1500,timeout:4000});
-	});
+$(function() {
+  <%= yield :script %>
+});
 </script>
 
   <!--[if lt IE 7 ]>
app/views/search/index.html.erb
@@ -1,14 +1,14 @@
 <h1>Search Results</h1>
 <p><em>What time is it? Nana, nana, naaaaana caake time!</em></p>  
-<p>Check out our communities most recent cake work.</p>
-<a href="<%= url_for my_creations_path %>"> my creations </a>
 
-<div>The most recent creations</div>
+<h2>You searched for <%= search %></h2>
 
-<% @creations.reverse.each_with_index do |creation, index| %>
+<% @creations.reverse.each do |creation| %>
+<div class="product_box">
   <a href="<%= url_for creation %>">
     <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
   </a>
   <h2><%= creation.name %></h2>
-  <p><%= creation.story %> <%= link_to 'more...', creation %></p>
+  <p><%= creation.short_story %> <%= link_to 'more...', creation %></p>
+</div>
 <% end %>
public/stylesheets/layout.css
@@ -132,4 +132,4 @@ div.field, div.actions {
   color: #666;
   font-size: 11px;
 }
-
+.hidden{display:none;}