Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added user page with review and item caches. Modified search bar. Add…
…ed Gravatar.
- Loading branch information
1 parent
dffc88c
commit 550a01b
Showing
16 changed files
with
143 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,11 @@ | ||
<div class="content"> | ||
<h2>Your Uploads</h2> | ||
|
||
<% if @items[0] == nil %> | ||
<p>You can use Simplici7y to share something with the Aleph One community.</p> | ||
<%= link_to "Add your first item", new_item_url, :class => 'button positive add' %> | ||
<% else %> | ||
<p><%= link_to "Add a new item", new_item_url, :class => 'button positive add' %></p> | ||
<% for item in @items %> | ||
<% versions = item.versions %> | ||
<% if versions[0] != nil %> | ||
<div class="manage_map"> | ||
<table class="manage"> | ||
<tr> | ||
<th scope="col">Version</th> | ||
<th scope="col">Downloads</th> | ||
<th scope="col">Uploaded</th> | ||
</tr> | ||
<% for version in versions %> | ||
<tr class="<%= "newest" if version == item.find_version %>"> | ||
<td width="100px"> | ||
<% if version == item.find_version %> | ||
<%= clean(version.name) %></small> | ||
<% else %> | ||
<%= clean(version.name) %> | ||
<% end %> | ||
</td> | ||
<td><%= version.downloads.size %></td> | ||
<td><%= version.created_at.to_s(:readable_short) %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<h3><%= link_to clean(item.name), item_path(item) %></h3> | ||
<%= pluralize(item.reviews.size, 'review') %>, <%= pluralize(item.downloads.size, 'downloads') %> | ||
<hr /> | ||
</div> | ||
<% else %> | ||
<div class="notice"> | ||
<%= clean(item.name) %> is missing its first revision, <%= link_to 'add one', new_item_version_url(item) %> or <%= link_to "Destroy it", item_url(item), :class => 'controls', :confirm => "Are you sure?", :method => :delete %>. | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<%= will_paginate @items, :next_label => 'Next', :previous_label => 'Previous' %> | ||
<% end %> | ||
|
||
</div> | ||
<% for user in @users %> | ||
<a href="<%= user_path(user.permalink) %>"> | ||
<div class="user"> | ||
<%= content_tag :h3, truncate(user.login, 15, "...") %> | ||
<%= content_tag :h4, ( pluralize(user.items_count, 'item') + ', ' + pluralize(user.reviews_count, 'review') ) %> | ||
</div> | ||
</a> | ||
<% end %> | ||
|
||
<hr /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<div class="content"> | ||
|
||
<h2>Your Uploads</h2> | ||
|
||
<% if @items[0] == nil %> | ||
<p>You can use Simplici7y to share something with the Aleph One community.</p> | ||
<%= link_to "Add your first item", new_item_url, :class => 'button positive add' %> | ||
<% else %> | ||
<p><%= link_to "Add a new item", new_item_url, :class => 'button positive add' %></p> | ||
<% for item in @items %> | ||
<% versions = item.versions %> | ||
<% if versions[0] != nil %> | ||
<div class="manage_map"> | ||
<table class="manage"> | ||
<tr> | ||
<th scope="col">Version</th> | ||
<th scope="col">Downloads</th> | ||
<th scope="col">Uploaded</th> | ||
</tr> | ||
<% for version in versions %> | ||
<tr class="<%= "newest" if version == item.find_version %>"> | ||
<td width="100px"> | ||
<% if version == item.find_version %> | ||
<%= clean(version.name) %></small> | ||
<% else %> | ||
<%= clean(version.name) %> | ||
<% end %> | ||
</td> | ||
<td><%= version.downloads.size %></td> | ||
<td><%= version.created_at.to_s(:readable_short) %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<h3><%= link_to clean(item.name), item_path(item) %></h3> | ||
<%= pluralize(item.reviews.size, 'review') %><br /> <%= pluralize(item.downloads.size, 'downloads') %> | ||
<hr /> | ||
</div> | ||
<% else %> | ||
<div class="notice"> | ||
<%= clean(item.name) %> is missing its first revision, <%= link_to 'add one', new_item_version_url(item) %> or <%= link_to "Destroy it", item_url(item), :class => 'controls', :confirm => "Are you sure?", :method => :delete %>. | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<%= will_paginate @items, :next_label => 'Next', :previous_label => 'Previous' %> | ||
<% end %> | ||
|
||
</div> | ||
|
||
<hr /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class AddUserCountCaches < ActiveRecord::Migration | ||
def self.up | ||
add_column :users, :items_count, :integer, :default => 0 | ||
add_column :users, :reviews_count, :integer, :default => 0 | ||
|
||
User.reset_column_information | ||
|
||
User.find(:all).each do |u| | ||
u.update_attribute :reviews_count, Review.find(:all, :conditions => [ "user_id = ?", u.id ]).length | ||
u.update_attribute :items_count, Item.find(:all, :conditions => [ "versions_count > 0 AND user_id = ?", u.id ]).length | ||
end | ||
end | ||
|
||
def self.down | ||
remove_column :users, :items_count | ||
remove_column :users, :reviews_count | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters