* Continued work on improving post view templates

* Added statistics-based estimator for related tag calculator
* Fleshed out IpBan class based on changes to Danbooru 1.xx
This commit is contained in:
albert
2010-04-29 17:32:15 -04:00
parent 3666364469
commit 23656e3fa9
39 changed files with 816 additions and 86 deletions

View File

View File

@@ -0,0 +1,19 @@
<div class="comment-section" data-post-id="<%= post.id %>">
<div class="comment-list">
<%= render :partial => "comments/partials/show/comment", :collection => comments %>
</div>
<div class="comment-response">
<p><%= submit_tag "Post comment", :class => "expand-comment-response" %></p>
<div class="comment-preview"></div>
<% form_tag(comments_path) do %>
<%= hidden_field "comment", "post_id", :value => post.id%>
<%= text_area "comment", "body", :size => "60x7" %><br>
<%= submit_tag "Post" %>
<%= submit_tag "Preview" %>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,22 @@
<article data-comment-id="<%= comment.id %>">
<header>
<h1><%= link_to comment.creator_name, user_path(comment.creator_id) %></h1>
<time datetime="<%= comment.created_at %>"><%= time_ago_in_words(comment.created_at) %> ago</time>
</header>
<div>
<section>
<%= format_text(comment.body) %>
</section>
<footer>
<menu>
<li><span class="link">Quote</span></li>
<% if @current_user.is_janitor? || @current_user.id == comment.creator_id %>
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Do you really want to delete this comment?", :method => :delete %></li>
<% end %>
<li><%= link_to "Vote up", comment_vote_path(comment.id, :is_positive => true), :method => :post %></li>
<li><%= link_to "Vote down", comment_vote_path(comment.id, :is_positive => false), :method => :post %></li>
</menu>
</footer>
</div>
</article>
<div class="clearfix"></div>

View File

@@ -12,11 +12,13 @@
<%= stylesheet_link_tag "default" %>
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" %>
<%= javascript_include_tag "rails" %>
<%= javascript_include_tag "application" %>
<%= Danbooru.config.custom_html_header_content %>
<%= yield :html_header %>
</head>
<body>
<header>
<h1><%= Danbooru.config.app_name %></h1>
<nav>
<menu>
<% if @current_user.is_anonymous? %>

View File

@@ -0,0 +1 @@
<%= content_tag(:article, note.body, "data-width" => note.width, "data-height" => note.height, "data-x" => note.x, "data-y" => note.y, "data-id" => note.id) %>

View File

@@ -4,7 +4,7 @@
</div>
<% end %>
<aside>
<aside class="sidebar">
<section id="search-box">
<h1>Search</h1>
<% form_tag(posts_path, :method => "get") do %>

View File

@@ -0,0 +1,4 @@
<% form_tag(posts_path, :method => "get") do %>
<%= text_field_tag("tags", params[:tags], :size => 15) %>
<%= submit_tag "Go" %>
<% end %>

View File

@@ -0,0 +1,50 @@
<div id="edit">
<% unless @current_user.is_contributor? %>
<div style="margin-bottom: 1em;">
<p>Before editing, read the <%= link_to "how to tag guide", wiki_page_path(:id => "howto:tag") %>.</p>
</div>
<% end %>
<% form_for(post) do |f| %>
<%= f.hidden_field :old_tags, :value => post.tag_string %>
<p>
<% if post.is_rating_locked? %>
This post is rating locked.
<% else %>
<%= f.label :rating_explicit, "Explicit" %>
<%= f.radio_button :rating, :e %>
<%= f.label :rating_questionable, "Questionable" %>
<%= f.radio_button :rating, :q %>
<%= f.label :rating_safe, "Safe" %>
<%= f.radio_button :rating, :s %>
<% end %>
</p>
<% if @current_user.is_privileged? %>
<p>
<%= f.label :is_note_locked, "Lock notes" %>
<%= f.check_box :is_note_locked %>
</p>
<p>
<%= f.label :is_rating_locked, "Lock rating" %>
<%= f.check_box :is_rating_locked %>
</p>
<% end %>
<p>
<%= f.label :source %>
<%= f.text_field :source %>
</p>
<p>
<%= f.label :tag_string, "Tags" %>
<%= f.text_area :tag_string , :size => "50x3" %>
</p>
<%= submit_tag "Submit" %>
<% end %>
</div>

View File

@@ -0,0 +1,6 @@
<% content_tag(:object, :width => post.image_width, :height => post.image_height) do %>
<%= tag :params, :name => "movie", :value => post.file_url %>
<%= tag :embed, :src => post.file_url, :width => post.image_width, :height => post.image_height, :allowScriptAccess => "never" %>
<% end %>
<p><%= link_to "Save this flash (right click and save)", post.file_url %></p>

View File

@@ -0,0 +1,2 @@
<%= render :partial => "posts/partials/show/notes", :locals => {:post => post, :notes => post.notes.active} %>
<%= image_tag(post.file_url_for(@current_user), :alt => post.tag_string, :width => post.image_width_for(@current_user), :height => post.image_height_for(@current_user), "data-original-width" => post.image_width, "data-original-height" => post.image_height) %>

View File

@@ -0,0 +1,13 @@
<ul>
<li>ID: <%= post.id %></li>
<li>Uploader: <%= link_to_unless(post.uploader.nil?, post.uploader_name, user_path(post.uploader)) %></li>
<li>Uploaded: <%= time_ago_in_words(post.created_at).gsub(/about/, "") %> ago</li>
<% if post.approver %>
<li>Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %></li>
<% end %>
<li>
Size: <%= image_dimension_menu(post, @current_user) %>
</li>
<li><%= link_to "Tag History", post_versions_path(:post_id => post) %></li>
<li><%= link_to "Note History", note_versions_path(:post_id => post) %></li>
</ul>

View File

@@ -0,0 +1,3 @@
<% notes.each do |note| %>
<%= content_tag(:article, "data-width" => note.width, "data-height" => note.height, "data-x" => note.x, "data-y" => note.y, "data-body" => note.formatted_body) %>
<% end %>

View File

@@ -0,0 +1,15 @@
<ul>
<% if !post.is_deleted? && post.is_image? && post.image_width && post.image_width > 700 %>
<li><%= link_to "Resize", "#" %></li>
<% end %>
<li><%= link_to "Favorite", "#" %></li>
<li><%= link_to "Unfavorite", "#" %></li>
<li><%= link_to "Translate", "#" %></li>
<li><%= link_to "Unapprove", "#" %></li>
<% if @current_user.is_janitor? %>
<li><%= link_to "Approve", "#" %></li>
<li><%= link_to "Undelete", "#" %></li>
<li><%= link_to "Delete", "#" %></li>
<% end %>
<li><%= link_to "Pool", "#" %></li>
</ul>

View File

@@ -1,25 +1,22 @@
<aside>
<aside class="sidebar">
<section>
<h1>Search</h1>
<% form_tag(posts_path, :method => "get") do %>
<%= text_field_tag("tags", params[:tags], :size => 20) %>
<%= submit_tag "Go" %>
<% end %>
<%= render :partial => "posts/partials/common/search" %>
</section>
<section>
<h1>Tags</h1>
<%= @post.presenter.tag_list_html %>
<%= @post.presenter.tag_list_html(self, @current_user) %>
</section>
<section>
<h1>Information</h1>
<%= render :partial => "information", :locals => {:post => @post} %>
<%= render :partial => "posts/partials/show/information", :locals => {:post => @post} %>
</section>
<section>
<h1>Options</h1>
<%= render :partial => "options", :locals => {:post => @post} %>
<%= render :partial => "posts/partials/show/options", :locals => {:post => @post} %>
</section>
</aside>
@@ -33,15 +30,17 @@
<section>
<h2>Notes</h2>
<%= @post.presenter.note_html %>
<%= render :partial => "notes/note", :collection => @post.notes.active %>
</section>
<section>
<h2>Comments</h2>
<%= render :partial => "comments/partials/index/list", :locals => {:comments => @post.comments, :post => @post} %>
</section>
<section>
<h2>Edit</h2>
<%= render :partial => "posts/partials/show/edit", :locals => {:post => @post} %>
</section>
</section>

View File

@@ -0,0 +1,5 @@
<ul>
<% tags.each do |tag| %>
<li><%= tag %></li>
<% end %>
</ul>