Merge pull request #2803 from evazion/fix-comment-cleanups
Various minor comment code cleanups
This commit is contained in:
@@ -13,9 +13,6 @@ Danbooru.Note = {
|
|||||||
|
|
||||||
$inner_border.css({
|
$inner_border.css({
|
||||||
opacity: opacity,
|
opacity: opacity,
|
||||||
"-ms-filter": "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)",
|
|
||||||
"filter": "alpha(opacity=50)",
|
|
||||||
zoom: 1
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var $note_box = $('<div/>');
|
var $note_box = $('<div/>');
|
||||||
|
|||||||
@@ -49,13 +49,6 @@ $preview_flagged_color: #F00;
|
|||||||
text-shadow: $val;
|
text-shadow: $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin transparency($value) {
|
|
||||||
opacity: $value;
|
|
||||||
-ms-filter: unqoute("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$value * 100})");
|
|
||||||
filter: unquote("alpha(opacity=#{$value * 100})");
|
|
||||||
zoom: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin inline-block {
|
@mixin inline-block {
|
||||||
display: -moz-inline-box;
|
display: -moz-inline-box;
|
||||||
-moz-box-orient: vertical;
|
-moz-box-orient: vertical;
|
||||||
|
|||||||
@@ -41,16 +41,10 @@ div.comments-for-post {
|
|||||||
}
|
}
|
||||||
|
|
||||||
article.comment.below-threshold {
|
article.comment.below-threshold {
|
||||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30);
|
|
||||||
filter: alpha(opacity=30);
|
|
||||||
zoom: 1;
|
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
article.comment.below-threshold:hover {
|
article.comment.below-threshold:hover {
|
||||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
|
||||||
filter: alpha(opacity=100);
|
|
||||||
zoom: 1;
|
|
||||||
opacity: 1.0;
|
opacity: 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class CommentsController < ApplicationController
|
class CommentsController < ApplicationController
|
||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json
|
||||||
before_filter :member_only, :only => [:update, :create, :edit, :destroy]
|
before_filter :member_only, :except => [:index, :search, :show]
|
||||||
rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception
|
rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@@ -48,9 +48,7 @@ class CommentsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@comment = Comment.find(params[:id])
|
@comment = Comment.find(params[:id])
|
||||||
respond_with(@comment) do |format|
|
respond_with(@comment)
|
||||||
format.json {render :json => @comment.to_json(:methods => [:creator_name])}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def for_creator(user_id)
|
def for_creator(user_id)
|
||||||
where("creator_id = ?", user_id)
|
user_id.present? ? where("creator_id = ?", user_id) : where("false")
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_creator_name(user_name)
|
def for_creator_name(user_name)
|
||||||
where("creator_id = (select _.id from users _ where lower(_.name) = lower(?))", user_name.mb_chars.downcase)
|
for_creator(User.name_to_id(user_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
@@ -69,8 +69,12 @@ class Comment < ActiveRecord::Base
|
|||||||
q = q.body_matches(params[:body_matches])
|
q = q.body_matches(params[:body_matches])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if params[:id].present?
|
||||||
|
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
|
||||||
|
end
|
||||||
|
|
||||||
if params[:post_id].present?
|
if params[:post_id].present?
|
||||||
q = q.where("post_id = ?", params[:post_id].to_i)
|
q = q.where("post_id in (?)", params[:post_id].split(",").map(&:to_i))
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:post_tags_match].present?
|
if params[:post_tags_match].present?
|
||||||
@@ -78,7 +82,7 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
if params[:creator_name].present?
|
if params[:creator_name].present?
|
||||||
q = q.for_creator_name(params[:creator_name].tr(" ", "_"))
|
q = q.for_creator_name(params[:creator_name])
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:creator_id].present?
|
if params[:creator_id].present?
|
||||||
@@ -199,6 +203,10 @@ class Comment < ActiveRecord::Base
|
|||||||
super + [:body_index]
|
super + [:body_index]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def method_attributes
|
||||||
|
super + [:creator_name, :updater_name]
|
||||||
|
end
|
||||||
|
|
||||||
def delete!
|
def delete!
|
||||||
update_attributes(:is_deleted => true)
|
update_attributes(:is_deleted => true)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
<% if post.hidden_comment_count(@current_user) > 0 %>
|
|
||||||
<span class="info" id="threshold-comments-notice-for-<%= post.id %>"><%= link_to_remote "#{pluralize post.hidden_comment_count(@current_user), 'comment'} below threshold", :url => index_all_comments_path(:post_id => post.id) %>.</span>
|
|
||||||
<% end %>
|
|
||||||
@@ -102,7 +102,6 @@ Rails.application.routes.draw do
|
|||||||
resources :votes, :controller => "comment_votes", :only => [:create, :destroy]
|
resources :votes, :controller => "comment_votes", :only => [:create, :destroy]
|
||||||
collection do
|
collection do
|
||||||
get :search
|
get :search
|
||||||
get :index_all
|
|
||||||
end
|
end
|
||||||
member do
|
member do
|
||||||
put :unvote
|
put :unvote
|
||||||
|
|||||||
Reference in New Issue
Block a user