changes
This commit is contained in:
@@ -21,10 +21,7 @@ class CommentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@comment = Comment.new(params[:comment])
|
@comment = Comment.create(params[:comment])
|
||||||
@comment.post_id = params[:comment][:post_id]
|
|
||||||
@comment.score = 0
|
|
||||||
@comment.save
|
|
||||||
respond_with(@comment) do |format|
|
respond_with(@comment) do |format|
|
||||||
format.html do
|
format.html do
|
||||||
redirect_to post_path(@comment.post), :notice => "Comment posted"
|
redirect_to post_path(@comment.post), :notice => "Comment posted"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PoolsController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Pool.search(params[:search])
|
@search = Pool.search(params[:search])
|
||||||
@pools = @search.paginate(:page => params[:page])
|
@pools = @search.paginate(params[:page])
|
||||||
respond_with(@pools)
|
respond_with(@pools)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25,9 +25,7 @@ class PoolsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@pool = Pool.find(params[:id])
|
@pool = Pool.find(params[:id])
|
||||||
@post_set = PostSets::Base.new(:id => @pool, :page => params[:page])
|
@post_set = PostSets::Pool.new(@pool, params[:page])
|
||||||
@post_set.extend(PostSets::Numbered)
|
|
||||||
@post_set.extend(PostSets::Pool)
|
|
||||||
respond_with(@pool)
|
respond_with(@pool)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
31
app/logical/post_sets/pool.rb
Normal file
31
app/logical/post_sets/pool.rb
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
module PostSets
|
||||||
|
class Pool < Base
|
||||||
|
attr_reader :pool, :page, :posts
|
||||||
|
|
||||||
|
def initailize(pool, page)
|
||||||
|
@pool = pool
|
||||||
|
@page = page
|
||||||
|
@posts = pool.posts(:offset => offset, :limit => limit)
|
||||||
|
end
|
||||||
|
|
||||||
|
def offset
|
||||||
|
([page.to_i, 1].max - 1) * limit
|
||||||
|
end
|
||||||
|
|
||||||
|
def limit
|
||||||
|
Danbooru.config.posts_per_page
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_array
|
||||||
|
["pool:#{pool.id}"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_string
|
||||||
|
tag_array.join("")
|
||||||
|
end
|
||||||
|
|
||||||
|
def presenter
|
||||||
|
@presenter ||= PostSetPresenters::Pool.new(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -6,7 +6,7 @@ class Comment < ActiveRecord::Base
|
|||||||
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
|
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
|
||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
after_save :update_last_commented_at
|
after_save :update_last_commented_at
|
||||||
attr_accessible :body
|
attr_accessible :body, :post_id
|
||||||
attr_accessor :do_not_bump_post
|
attr_accessor :do_not_bump_post
|
||||||
|
|
||||||
scope :recent, :order => "comments.id desc", :limit => 6
|
scope :recent, :order => "comments.id desc", :limit => 6
|
||||||
|
|||||||
32
app/presenters/post_set_presenters/pool.rb
Normal file
32
app/presenters/post_set_presenters/pool.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
module PostSetPresenters
|
||||||
|
class Pool
|
||||||
|
attr_accessor :tag_set_presenter
|
||||||
|
|
||||||
|
def initialize(pool_set)
|
||||||
|
@pool_set = pool_set
|
||||||
|
@tag_set_presenter = TagSetPresenter.new(
|
||||||
|
RelatedTagCalculator.calculate_from_sample_to_array(
|
||||||
|
pool_set.tag_string
|
||||||
|
).map {|x| x[0]}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_list_html(template)
|
||||||
|
tag_set_presenter.tag_list_html(template)
|
||||||
|
end
|
||||||
|
|
||||||
|
def post_previews_html(template)
|
||||||
|
html = ""
|
||||||
|
|
||||||
|
if pool_set.posts.empty?
|
||||||
|
return template.render(:partial => "post_sets/blank")
|
||||||
|
end
|
||||||
|
|
||||||
|
pool_set.posts.each do |post|
|
||||||
|
html << PostPresenter.preview(post)
|
||||||
|
end
|
||||||
|
|
||||||
|
html.html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="c-notes">
|
<div id="c-notes">
|
||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<table>
|
<table width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Post</th>
|
<th>Post</th>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<li><%= link_to "Listing", pools_path %></li>
|
<li><%= link_to "Listing", pools_path %></li>
|
||||||
<li><%= link_to "Search", search_pools_path %></li>
|
<li><%= link_to "Search", search_pools_path %></li>
|
||||||
<li><%= link_to "New", new_pool_path %></li>
|
<li><%= link_to "New", new_pool_path %></li>
|
||||||
<% if @pool %>
|
<% if @pool && !@pool.new_record? %>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
<li><%= link_to "Show", pool_path(@pool) %></li>
|
<li><%= link_to "Show", pool_path(@pool) %></li>
|
||||||
<li><%= link_to "Posts", posts_path(:tags => "pool:#{@pool.id}") %></li>
|
<li><%= link_to "Posts", posts_path(:tags => "pool:#{@pool.id}") %></li>
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
<div id="c-pools">
|
<div id="c-pools">
|
||||||
<div id="c-new">
|
<div id="c-new">
|
||||||
<h1>New Pool</h1>
|
<%= simple_form_for(@pool) do |f| %>
|
||||||
<%= render :partial => "form", :locals => {:pool => @pool} %>
|
<h1>New Pool</h1>
|
||||||
|
<%= f.input :name %>
|
||||||
|
<%= f.input :description %>
|
||||||
|
<%= f.button :submit %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= render "secondary_links" %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% content_for(:secondary_links) do %>
|
<% content_for(:secondary_links) do %>
|
||||||
<menu>
|
<menu>
|
||||||
<li><%= link_to "Listing", tag_aliases_path %></li>
|
<li><%= link_to "Listing", tag_aliases_path %></li>
|
||||||
<li><%= link_to "Add", new_tag_alias_path %></li>
|
<li><%= link_to "New", new_tag_alias_path %></li>
|
||||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_aliases") %></li>
|
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_aliases") %></li>
|
||||||
</menu>
|
</menu>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% content_for(:secondary_links) do %>
|
<% content_for(:secondary_links) do %>
|
||||||
<menu>
|
<menu>
|
||||||
<li><%= link_to "Listing", tag_implications_path %></li>
|
<li><%= link_to "Listing", tag_implications_path %></li>
|
||||||
<li><%= link_to "Add", new_tag_implication_path %></li>
|
<li><%= link_to "New", new_tag_implication_path %></li>
|
||||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_implications") %></li>
|
<li><%= link_to "Help", wiki_pages_path(:title => "help:tag_implications") %></li>
|
||||||
</menu>
|
</menu>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,77 +1,31 @@
|
|||||||
<%= form_for @user do |f| %>
|
<%= simple_form_for @user do |f| %>
|
||||||
<p>Hover over the labels to see a brief explanation of the setting. Required fields are marked in red.</p>
|
<p>Hover over the labels to see a brief explanation of the setting. Required fields are marked in red.</p>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Basic</legend>
|
<legend>Basic</legend>
|
||||||
|
|
||||||
<p>
|
<%= f.input :email, :required => Danbooru.config.enable_email_verification? %>
|
||||||
<%= f.label :email %>
|
<%= f.input :time_zone %>
|
||||||
<% if Danbooru.config.enable_email_verification? %>
|
<%= f.input :receive_email_notifications, :title => "Enable to receive email notification when you receive a DMail" %>
|
||||||
<%= f.text_field :email %>
|
<%= f.input :comment_threshold, :title => "Comments below this score will be hidden by default" %>
|
||||||
<% else %>
|
<%= f.input :always_resize_images, :title => "Enable to automatically resize images to fit your browser window" %>
|
||||||
<%= f.text_field :email, :class => "required" %>
|
<%= f.input :default_image_size, :title => "Medium shows images resized to #{Danbooru.config.medium_image_width} pixels wide, large is #{Danbooru.config.large_image_width} pixels wide, and original is whatever the original image is", :collection => %w(Medium Large Original) %>
|
||||||
<% end %>
|
<%= f.input :favorite_tags, :title => "A list of whitespace delimited tags that show up in your profile" %>
|
||||||
</p>
|
<%= f.input :blacklisted_tags, :title => "A list of newline delimited tags that you never want to see" %>
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :time_zone %>
|
|
||||||
<%= f.time_zone_select :time_zone %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :receive_email_notifications, "Email notifications", :title => "Enable to receive email notification when you receive a DMail" %>
|
|
||||||
<%= f.check_box :receive_email_notifications %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :comment_threshold, nil, :title => "Comments below this score will be hidden by default" %>
|
|
||||||
<%= f.text_field :comment_threshold, :size => 2 %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :always_resize_images, nil, :title => "Enable to automatically resize images to fit your browser window" %>
|
|
||||||
<%= f.check_box :always_resize_images %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :default_image_size, nil, :title => "Medium shows images resized to #{Danbooru.config.medium_image_width} pixels wide, large is #{Danbooru.config.large_image_width} pixels wide, and original is whatever the original image is" %>
|
|
||||||
<%= f.select :default_image_size, %w(Medium Large Original) %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :favorite_tags, nil, :title => "A list of whitespace delimited tags that show up in your profile" %>
|
|
||||||
<%= f.text_area :favorite_tags, :rows => 5 %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :blacklisted_tags, nil, :title => "A list of newline delimited tags that you never want to see" %>
|
|
||||||
<%= f.text_area :blacklisted_tags, :rows => 5 %>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Special</legend
|
<legend>Special</legend
|
||||||
<p>For security purposes, changing the following settings requires you to re-enter your password. You can leave the new password field blank to keep your current one.</p>
|
<p>For security purposes, changing the following settings requires you to re-enter your password. You can leave the new password field blank to keep your current one.</p>
|
||||||
|
|
||||||
<p>
|
<%= f.input :name %>
|
||||||
<%= f.label :name, nil, :title => "Your login name" %>
|
<%= f.input :password, :title => "What you want your new password to be (leave blank if you don't want to change your password)", :label => "New password" %>
|
||||||
<%= f.text_field :name %>
|
<%= f.input :old_password, :title => "Your old password (you must enter your password if updating your name or password)", :as => :password %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :password, "New password", :title => "What you want your new password to be (leave blank if you don't want to change your password)" %>
|
|
||||||
<%= f.text_field :password %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :old_password, nil, :title => "Your old password (you must enter your password if updating your name or password)" %>
|
|
||||||
<%= f.text_field :old_password %>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<%= submit_tag "Submit" %>
|
<%= f.button :submit %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
<% content_for(:page_title) do %>
|
||||||
/ Users / <%= @user.name %> / Settings
|
/Users/<%= @user.name %>/Settings
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<section id="content">
|
||||||
|
<h1>Edit Wiki Page: <%= @wiki_page.title %></h1>
|
||||||
<%= render "form" %>
|
<%= render "form" %>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div id="paginator">
|
<div id="paginator">
|
||||||
<%= smart_paginator(@wiki_pages) do |page| %>
|
<%= numbered_paginator(@wiki_pages) do |page| %>
|
||||||
<%= link_to(page, wiki_pages_path(:page => page, :search => params[:search])) %>
|
<%= link_to(page, wiki_pages_path(:page => page, :search => params[:search])) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<%= render "sidebar" %>
|
<%= render "sidebar" %>
|
||||||
|
|
||||||
<section id="content">
|
<section id="content">
|
||||||
|
<h1>New Wiki Page</h1>
|
||||||
<%= render "form" %>
|
<%= render "form" %>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user