Commit 69542620
Changed files (12)
app
models
views
home
profiles
registrations
search
public
stylesheets
app/models/creation.rb
@@ -11,7 +11,7 @@ class Creation < ActiveRecord::Base
end
def short_story
- story.split[0...10].join(' ')
+ story.split[0...8].join(' ') + '...'
end
end
app/views/creations/_form.html.erb
@@ -11,12 +11,24 @@
<% end %>
<fieldset class="cute_form">
+ <%# <%= 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" %>
+ <table>
+ <tr>
+ <td>
<%= f.label :image, 'data-editable' => 'false' %>
<%= f.file_field :image, :class => "forms", 'data-editable' => 'false' %>
+ </td>
+ <td>
<%= 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" %>
+ </td>
+ </tr>
+ </table>
<%= f.label :story %>
<%= f.text_area :story, :class => "forms" %>
<input type="image" id="submit" name="submit" src="/images/template/button_submit.gif" title="Submit Message" />
app/views/creations/edit.html.erb
@@ -3,10 +3,9 @@
$('input[data-editable="false"]').addClass('hidden');
<% end %>
+<%= link_to 'Show', @creation, :class => 'floatRight' %>
<h1>Editing creation <em><%= @creation.name %></em></h1>
-<%= image_tag @creation.image_url.to_s, :class => 'photo' %>
+<%= image_tag @creation.image_url.to_s, :class => ['photo'] %>
<%= render 'form' %>
-
-<%= link_to 'Show', @creation %> |
app/views/creations/index.html.erb
@@ -4,10 +4,10 @@
<% @creations.reverse.each do |creation| %>
<div class="product_box">
+ <h2><%= creation.name %></h2>
<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.short_story %> <%= link_to 'more...', creation %></p>
</div>
<% end %>
app/views/creations/mine.html.erb
@@ -1,20 +1,18 @@
+<%= link_to "add new creation", new_creation_path(@creation), :class => 'floatRight' %>
<h1>My Creations</h1>
-<div class="floatRight">
- <%= link_to "add new creation", new_creation_path(@creation) %>
-</div>
-
-<hr />
<% if @creations.length == 0 %>
- <p> you have no creations. </p>
+ <p>
+ you have no creations. <%= link_to "add new creation", new_creation_path(@creation), :class => 'floatRight' %>
+ </p>
<% else %>
- <% @creations.reverse.each_with_index do |creation, index| %>
+ <% @creations.reverse.each do |creation| %>
<div class="product_box">
<h2><%= creation.name %></h2>
<a href="<%= url_for creation %>">
<%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo" %>
</a>
- <p><%= creation.short_story %> <%= link_to 'more...', creation %></p>
+ <p><%= creation.short_story %> <%= link_to 'more', creation %></p>
</div>
<% end %>
<% end %>
app/views/creations/show.html.erb
@@ -1,38 +1,42 @@
-<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 %>
+<% if @creation.user == current_user %>
+ <h1><%= @creation.name %> <%= link_to '(edit)', edit_creation_path(@creation), :class => 'smallFont' %> by <em> <%= link_to @creation.user.name, profile_path(@creation.user) %> </em> </h1>
+<% else %>
+ <h1><%= @creation.name %> by <em> <%= link_to @creation.user.name, profile_path(@creation.user) %> </em> </h1>
+<% end %>
<div class="width100 floatLeft">
- <div class="width25 floatLeft">
- <p> <%= @creation.story %> </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','floatRight'], :alt => @creation.name %>
+ <%= @creation.story %>
+ <% if @creation.user == current_user %>
+ <%= link_to '(edit)', edit_creation_path(@creation), :class => 'smallFont' %>
+ <% end %>
+ </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 %>
- </div>
</div>
<hr />
<hr class="clear" />
-<h3> other creations by <%= @creation.user.name.to_s %> <em><%= link_to 'view more...', profile_path(@creation.user) %> </em> </h3>
+<h3> other creations by <%= @creation.user.name.to_s %> <em><%= link_to 'view all', profile_path(@creation.user) %> </em> </h3>
<% other_creations = @creation.user.creations.last(4).reverse %>
<% other_creations.each do |creation| %>
<% if creation != @creation %>
<div class="product_box">
+ <h2><%= @creation.name %></h2>
<a href="<%= url_for creation %>">
- <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
+ <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :alt => creation.name %>
</a>
- <h2><%= @creation.name %></h2>
- <p><%= creation.short_story %> <%= link_to 'more...', creation %></p>
+ <p><%= creation.short_story %> <%= link_to 'more', creation %></p>
</div>
<% end %>
<% end %>
app/views/home/index.html.erb
@@ -15,6 +15,6 @@
<a href="<%= url_for creation %>">
<%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :alt => creation.name %>
</a>
- <p><%= creation.short_story %> <%= link_to 'more...', creation %></p>
+ <p><%= creation.short_story %> <%= link_to 'more', creation %></p>
</div>
<% end %>
app/views/profiles/index.html.erb
@@ -6,14 +6,16 @@
<tr>
<th></th>
<th>name</th>
+ <th>creations</th>
<th>member since</th>
</tr>
</thead>
<tbody>
<% @profiles.each do |profile| %>
<tr>
- <td> <%= image_tag avatar_url(profile), :class => "photo" %> </td>
+ <td><a href="<%= url_for profile_path(profile) %>"><%= image_tag avatar_url(profile), :class => "photo" %></a></td>
<td><%= link_to profile.name, profile_path(profile) %></td>
+ <td><a href="<%= url_for profile_path(profile) %>"><%= profile.creations.length %> creations</a></td>
<td><%= profile.created_at %></td>
</tr>
<% end %>
app/views/profiles/show.html.erb
@@ -1,19 +1,19 @@
+<%= image_tag avatar_url(@profile) + '&s=200', :class => ['photo', 'floatLeft'] %>
<h1><%= @profile.name %></h1>
-<%= image_tag avatar_url(@profile) + '&s=200', :class => "photo" %>
+<p><em>A member since <%= @profile.created_at %>, with <%= @profile.creations.length %> creations.</em></p>
<% if @profile == current_user %>
<a href="http://en.gravatar.com/">change your photo</a>
<% end %>
-<p><em>A member since <%= @profile.created_at %>, with <%= @profile.creations.length %> creations.</em></p>
<hr />
<% @profile.creations.reverse.each_with_index do |creation, index| %>
<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.short_story %> <%= link_to 'more...', creation %></p>
+ <h2><%= creation.name %></h2>
+ <a href="<%= url_for creation %>">
+ <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
+ </a>
+ <p><%= creation.short_story %> <%= link_to 'more', creation %></p>
</div>
<% end %>
app/views/registrations/edit.html.erb
@@ -1,11 +1,8 @@
-<h1>C'mon In... </h1>
-<p>"You don't make friends with salad" - Homer Simpson<p>
-
-<div class="floatRight">
- <%= link_to "my other authentications", authentications_path %>
-</div>
-
-<h2>Update My Account</h2>
+<%= link_to "my other authentications", authentications_path, :class => 'floatRight' %>
+<h1>Update My Account</h1>
+<p>
+If you prefer not to change your password, then just leave it blank.
+</p>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
@@ -16,13 +13,13 @@
<%= f.label :email %>
<%= f.email_field :email, :class => "forms" %>
- <%= f.label :password %> <i>(leave blank if you don't want to change it)</i>
+ <%= f.label :password %>
<%= f.password_field :password, :class => "forms" %>
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, :class => "forms" %>
- <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i>
+ <%= f.label :current_password %>
<%= f.password_field :current_password, :class => "forms" %>
<input type="image" src="/images/template/button_submit.gif" class="submit_button" />
app/views/search/index.html.erb
@@ -1,14 +1,12 @@
-<h1>Search Results</h1>
+<h1>Search Results for <em><%= @search %></em></h1>
<p><em>What time is it? Nana, nana, naaaaana caake time!</em></p>
-<h2>You searched for <%= @search %></h2>
-
<% @creations.reverse.each do |creation| %>
<div class="product_box">
+ <h2><%= creation.name %></h2>
<a href="<%= url_for creation %>">
- <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :class => "photo", :alt => creation.name %>
+ <%= image_tag creation.image_url.to_s, :width => "285px", :height => "140px", :alt => creation.name %>
</a>
- <h2><%= creation.name %></h2>
<p><%= creation.short_story %> <%= link_to 'more...', creation %></p>
</div>
<% end %>
public/stylesheets/layout.css
@@ -48,7 +48,6 @@ div.field, div.actions {
.field_with_errors {
padding: 2px;
background-color: red;
- display: table;
}
#error_explanation {
@@ -133,3 +132,5 @@ div.field, div.actions {
font-size: 11px;
}
.hidden{display:none;}
+.smallFont{font-size:small;}
+.smallerFont{font-size:smaller;}