-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
show.html.erb
98 lines (91 loc) · 4.13 KB
/
show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<%= javascript_include_tag('comment_expand') %>
<%= javascript_include_tag('notes') %>
<%= javascript_include_tag('textBoxExpand') %>
<script>
var comments_length = <%= @node.comments.length %>;
$(function(){
$("img").lazyload();
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
$('[rel="tooltip"]').tooltip();
});
</script>
<%= javascript_include_tag('question') %>
<div class="col-lg-9 note-show question-show">
<% if @node.main_image %>
<a class="main-image" style="max-width:100%;width:800px;" href="<%= @node.main_image.path(:original) %>">
<%= image_tag(@node.main_image.path(:large), class:"rounded d-none d-lg-inline", style:'max-height:600px;max-width:100%;') %>
<%= image_tag(@node.main_image.path(:large), class:"rounded d-lg-none", style:'width:100%;') %>
</a>
<% end %>
<h1 style="margin-top: 20px;"><span class="question">Question: </span><a href="<%= @node.path(:question) %>"><%= @node.title %></a></h1>
<% pt = @node.power_tag('question') %>
<div class="alert alert-warning">
<a href="/profile/<%= @node.author.name %>"> <%= @node.author.name %> </a>
is asking a question about <b><a href="/questions/tag/<%= pt %>"><%= pt %></a></b>:
<a class="btn btn-outline-secondary requireLogin" target="_blank" href="/subscribe/tag/question:<%= pt %>">
Follow this topic
</a>
</div>
<div class="inline">
<p>
<% if @node.status == 0 || @node.status == 4 %><span class="badge badge-danger">UNPUBLISHED</span> | <% end %>
<% if @node.status == 3 %><span class="badge badge-success">Draft</span> | <% end %>
by <a href="/profile/<%= @node.author.name %>"><%= @node.author.name %></a> |
<% if @node.has_power_tag('with') %>with <% @node.coauthors.each_with_index do |coauthor,i| %>
<a href="/profile/<%= coauthor.username %>">
<%= coauthor.username%></a> <%= coauthor.new_contributor %>
<%= ',' if i < @node.coauthors.size-1 %><% end %>
<% end %>
<span class="d-none d-lg-inline">
<%= @node.created_at.to_s(:long) %> |
</span>
<span>
<a aria-label="Link to note" href="/n/<%= @node.id %>"><i class="fa fa-link"></i></a> <span class="d-none d-xl-inline"><a href="/n/<%= @node.id %>">#<%= @node.id %></a>
</span>
</p>
</div>
<hr style="margin-top:10px;" />
<div style="overflow:hidden;" id="content" class="pl-content question">
<%= raw auto_link(insert_extras(@node.latest.render_body), :sanitize => false) %>
</div>
<hr />
<%= render :partial => "home/social" %>
<hr />
<% comments = @node.comments_viewable_by(current_user) %>
<div id="legacy-editor-container" class="col-lg-10">
<h3><span id="comment-count"><%= comments.size %></span> Comments</h3>
<div id="comments-list">
<%= javascript_include_tag "editorToolbar" %>
<%= javascript_include_tag "comment" %>
<% comments.includes([:node, :replied_comments]).order("timestamp ASC").each do |comment| %>
<% if comment.reply_to.nil? %>
<%= render :partial => "notes/comment", :locals => {:comment => comment} %>
<% end %>
<% end %>
</div>
<div id="answer-0-comment" style="margin-top: 30px;">
<div id="answer-0-comment-section">
<% if current_user %>
<div class="d-inline" id="question-comment-form">
<%= render :partial => "comments/form", :locals => {
title: "Post Comment",
comment: false,
placeholder: "Help the author refine their post, or point them at other helpful information on the site. Mention users by @username to notify them of this thread by email",
type: "question",
url1: '/conduct',
author: current_user.title,
is_new_contributor: current_user.is_new_contributor?,
location: :main # toolbar needs this to create dropzone ID
} %>
</div>
<% else %>
<p><a data-toggle="modal" data-target="#loginModal">Log in</a> to comment</p>
<% end %>
</div>
</div>
</div>
</div>
<%= render :partial => "sidebar/question" %>