view fixes, updated uesr profile
This commit is contained in:
@@ -22,6 +22,7 @@ class UsersController < ApplicationController
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
@presenter = UserPresenter.new(@user)
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class User < ActiveRecord::Base
|
||||
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
|
||||
has_many :posts, :foreign_key => "uploader_id"
|
||||
has_one :ban
|
||||
has_many :subscriptions, :class_name => "TagSubscription"
|
||||
has_many :subscriptions, :class_name => "TagSubscription", :foreign_key => "creator_id"
|
||||
has_many :note_versions, :foreign_key => "updater_id"
|
||||
belongs_to :inviter, :class_name => "User"
|
||||
scope :named, lambda {|name| where(["lower(name) = ?", name])}
|
||||
|
||||
@@ -5,6 +5,10 @@ class UserPresenter
|
||||
@user = user
|
||||
end
|
||||
|
||||
def join_date
|
||||
user.created_at.strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
def level
|
||||
user.level_string
|
||||
end
|
||||
@@ -26,7 +30,7 @@ class UserPresenter
|
||||
def upload_limit
|
||||
deleted_count = Post.for_user(user.id).deleted.count
|
||||
pending_count = Post.for_user(user.id).pending.count
|
||||
approved_count = Post.where("is_flagged = false and is_pending = false and user_id = ?", user.id).count
|
||||
approved_count = Post.where("is_flagged = false and is_pending = false and uploader_id = ?", user.id).count
|
||||
|
||||
if user.base_upload_limit
|
||||
limit = user.base_upload_limit - pending_count
|
||||
@@ -89,7 +93,7 @@ class UserPresenter
|
||||
if user.inviter_id
|
||||
template.link_to(user.inviter.name, template.user_path(user.inviter_id))
|
||||
else
|
||||
nil
|
||||
"None"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,6 +106,16 @@ class UserPresenter
|
||||
neutral = UserFeedback.for_user(user.id).neutral.count
|
||||
negative = UserFeedback.for_user(user.id).negative.count
|
||||
|
||||
template.link_to("positive:#{positive} neutral:#{neutral} negative:#{negative}", user_feedbacks_path(:search => {:user_id_rq => user.id}))
|
||||
template.link_to("positive:#{positive} neutral:#{neutral} negative:#{negative}", template.user_feedbacks_path(:search => {:user_id_rq => user.id}))
|
||||
end
|
||||
|
||||
def subscriptions(template)
|
||||
if user.subscriptions.any?
|
||||
user.subscriptions.map do |subscription|
|
||||
template.link_to(subscription.name, template.posts_path(:tags => "sub:#{user.name}:#{subscription.name}"))
|
||||
end.join(", ").html_safe
|
||||
else
|
||||
"None"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
<%= image_tag(@advertisement.image_url) %>
|
||||
<%= render "form" %>
|
||||
<div id="c-advertisements">
|
||||
<div id="a-edit">
|
||||
<h1>Edit Advertisement</h1>
|
||||
<%= image_tag(@advertisement.image_url) %>
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
<h4>Advertisements</h4>
|
||||
<div id="c-advertisements">
|
||||
<div id="c-index">
|
||||
<h1>Advertisements</h1>
|
||||
|
||||
<table width="100%" class="highlightable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="5%" style="text-align: right;">Hits</th>
|
||||
<th width="90%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @advertisements.each do |advertisement| %>
|
||||
<tr>
|
||||
<td><%= image_tag(advertisement.image_url, :width => advertisement.preview_width, :height => advertisement.preview_height) %></td>
|
||||
<td style="text-align: right;"><%= advertisement.hits.between(@start_date, @end_date).count %></td>
|
||||
<td><%= link_to "Edit", edit_advertisement_path(advertisement) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<table width="100%" class="highlightable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="5%" style="text-align: right;">Hits</th>
|
||||
<th width="90%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @advertisements.each do |advertisement| %>
|
||||
<tr>
|
||||
<td><%= image_tag(advertisement.image_url, :width => advertisement.preview_width, :height => advertisement.preview_height) %></td>
|
||||
<td style="text-align: right;"><%= advertisement.hits.between(@start_date, @end_date).count %></td>
|
||||
<td><%= link_to "Edit", edit_advertisement_path(advertisement) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
<%= error_messages_for :advertisement %>
|
||||
<%= render "form" %>
|
||||
<div id="c-advertisements">
|
||||
<div id="a-new">
|
||||
<h1>New Advertisement</h1>
|
||||
<%= error_messages_for :advertisement %>
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
<div><%= image_tag(@advertisement.image_url, :width => @advertisement.preview_width, :height => @advertisement.preview_height) %></div>
|
||||
<div id="c-advertisements">
|
||||
<div id="a-show">
|
||||
<h1>Show Advertisement</h1>
|
||||
|
||||
<%= image_tag(@advertisement.image_url, :width => @advertisement.preview_width, :height => @advertisement.preview_height) %>
|
||||
|
||||
<ul>
|
||||
<li>Hits: <%= @advertisement.hits.between(@start_date, @end_date).count %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li>Hits: <%= @advertisement.hits.between(@start_date, @end_date).count %></li>
|
||||
</ul>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<div id="c-artists">
|
||||
<div id="a-index">
|
||||
<h1>Artists</h1>
|
||||
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<div class="bans">
|
||||
<div class="index">
|
||||
<h1>Bans</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<div id="c-comments">
|
||||
<div id="a-index">
|
||||
<h1>Comments</h1>
|
||||
|
||||
<div class="comments-for-post">
|
||||
<div class="list-of-comments">
|
||||
<% @comments.each do |comment| %>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div id="c-comments">
|
||||
<div id="a-search">
|
||||
<h1>Search Comments</h1>
|
||||
|
||||
<%= simple_form_for(@search) do |f| %>
|
||||
<%= hidden_field_tag "group_by", "comment" %>
|
||||
<%= f.input :body_matches, :label => "Body", :required => false %>
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
<h1>Edit Message</h1>
|
||||
<%= render :partial => "form", :locals => {:dmail => @dmail} %>
|
||||
<div id="c-dmails">
|
||||
<div id="a-edit">
|
||||
<h1>Edit Message</h1>
|
||||
<%= render "form", :dmail => @dmail %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
<div id="c-dmails">
|
||||
|
||||
</div>
|
||||
<h1>Messages</h1>
|
||||
|
||||
<%= render "search" %>
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
<option value="lock-note">Lock notes</option>
|
||||
<option value="edit-tag-script">Edit tag script</option>
|
||||
<option value="apply-tag-script">Apply tag script</option>
|
||||
<% if CurrentUser.user.is_janitor? %>
|
||||
<option value="approve">Approve</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
@@ -1,3 +1,54 @@
|
||||
<h1>Namasté <%= CurrentUser.pretty_name %>!</h1>
|
||||
<div id="c-users">
|
||||
<div id="a-show">
|
||||
<h1>Show User: <%= CurrentUser.pretty_name %></h1>
|
||||
|
||||
<dl>
|
||||
<dt>Join Date</dt>
|
||||
<dd><%= @presenter.join_date %></dd>
|
||||
|
||||
<dt>Inviter</dt>
|
||||
<dd><%= @presenter.inviter(self) %></dd>
|
||||
|
||||
<dt>Level</dt>
|
||||
<dd><%= @presenter.level %></dd>
|
||||
|
||||
<dt>Upload Limit</dt>
|
||||
<dd><%= @presenter.upload_limit %></dd>
|
||||
|
||||
<dt>Uploads</dt>
|
||||
<dd><%= @presenter.uploads(self) %></dd>
|
||||
|
||||
<dt>Deleted Uploads</dt>
|
||||
<dd><%= @presenter.deleted_uploads(self) %></dd>
|
||||
|
||||
<dt>Favorites</dt>
|
||||
<dd><%= @presenter.favorites(self) %></dd>
|
||||
|
||||
<dt>Subscriptions</dt>
|
||||
<dd><%= @presenter.subscriptions(self) %></dd>
|
||||
|
||||
<dt>Post Changes</dt>
|
||||
<dd><%= @presenter.post_versions(self) %></dd>
|
||||
|
||||
<dt>Note Changes</dt>
|
||||
<dd><%= @presenter.note_versions(self) %></dd>
|
||||
|
||||
<dt>Wiki Page Changes</dt>
|
||||
<dd><%= @presenter.wiki_page_versions(self) %></dd>
|
||||
|
||||
<dt>Pool Changes</dt>
|
||||
<dd><%= @presenter.pool_versions(self) %></dd>
|
||||
|
||||
<dt>Forum Posts</dt>
|
||||
<dd><%= @presenter.forum_posts(self) %></dd>
|
||||
|
||||
<dt>Approvals</dt>
|
||||
<dd><%= @presenter.approvals(self) %></dd>
|
||||
|
||||
<dt>Feedback</dt>
|
||||
<dd><%= @presenter.feedbacks(self) %></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "secondary_links" %>
|
||||
Reference in New Issue
Block a user