posts: add /posts/{id}.html?variant=tooltip template.
This commit is contained in:
@@ -23,3 +23,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.split-inline-tag-list {
|
||||
@extend .inline-tag-list;
|
||||
|
||||
ul {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
|
||||
before_action :set_started_at_session
|
||||
before_action :api_check
|
||||
before_action :set_safe_mode
|
||||
before_action :set_variant
|
||||
# before_action :secure_cookies_check
|
||||
layout "default"
|
||||
helper_method :show_moderation_notice?
|
||||
@@ -184,6 +185,10 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
def set_variant
|
||||
request.variant = params[:variant].try(:to_sym)
|
||||
end
|
||||
|
||||
User::Roles.each do |role|
|
||||
define_method("#{role}_only") do
|
||||
if !CurrentUser.user.is_banned_or_ip_banned? && CurrentUser.user.__send__("is_#{role}?")
|
||||
|
||||
@@ -31,7 +31,10 @@ class PostsController < ApplicationController
|
||||
include_deleted = @post.is_deleted? || (@post.parent_id.present? && @post.parent.is_deleted?) || CurrentUser.user.show_deleted_children?
|
||||
@parent_post_set = PostSets::PostRelationship.new(@post.parent_id, :include_deleted => include_deleted)
|
||||
@children_post_set = PostSets::PostRelationship.new(@post.id, :include_deleted => include_deleted)
|
||||
respond_with(@post)
|
||||
|
||||
respond_with(@post) do |format|
|
||||
format.html.tooltip { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def show_seq
|
||||
|
||||
@@ -113,6 +113,10 @@ module ApplicationHelper
|
||||
link_to ip, moderator_ip_addrs_path(:search => {:ip_addr => ip})
|
||||
end
|
||||
|
||||
def link_to_search(search)
|
||||
link_to search, posts_path(tags: search)
|
||||
end
|
||||
|
||||
def link_to_wiki(*wiki_titles, **options)
|
||||
links = wiki_titles.map do |title|
|
||||
link_to title.tr("_", " "), wiki_pages_path(title: title)
|
||||
|
||||
@@ -46,6 +46,10 @@ class TagSetPresenter < Presenter
|
||||
template.tag.span(html, class: classes)
|
||||
end
|
||||
|
||||
def split_inline_tag_list_html(template, **options)
|
||||
inline_tag_list_html(template, classes: "split-inline-tag-list", **options)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def typed_tags(name)
|
||||
|
||||
7
app/views/posts/show.html+tooltip.erb
Normal file
7
app/views/posts/show.html+tooltip.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<%= @post.presenter.split_inline_tag_list_html(self) %>
|
||||
|
||||
<div class="post-tooltip-metatags">
|
||||
<%= link_to_search "user:#{@post.uploader_name}" if CurrentUser.is_moderator? %>
|
||||
<%= link_to_search "rating:#{@post.pretty_rating.downcase}" %>
|
||||
<%= link_to_search "score:#{@post.score}" %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user