-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy path_notes.html.erb
143 lines (127 loc) · 6.55 KB
/
_notes.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<% notes = notes || @notes # accept local if present, default to instance %>
<div id="notes">
<div class="row">
<% notes.each_with_index do |node,i| %>
<div class="<% if @widget %>col-4 <% end %><%= node.tagnames_as_classes %> col-lg-4 clearfix node note node-nid-<%= node.id %> note-nid-<%= node.id %><% if node.status == 4 %> moderated<% end %>">
<div class="card">
<% if node.main_image %>
<a class="card-img-top img" style="overflow: hidden; height:10em;"<% if @widget %>target="_blank"<% end %> href="<%= node.path %>"><img src="<%= node.main_image.path(:default) %>" style="width:100%;"/></a>
<% elsif node.scraped_image %>
<a class="card-img-top img" style="overflow: hidden; height:10em;" href="<%= node.path %>"><img src="<%= node.scraped_image %>" style="width:100%;" /></a>
<% else %>
<a class="imgg" style="height:10em; margin-bottom: 10px;">
<i class="fa fa-picture-o note-not aria-hidden="true" style="color: #ccc; font-size: 6em;"></i>
</a>
<% end %>
<div class="card-body">
<% if node.status == 4 %>
<p class="alert alert-warning moderated">
<% if logged_in_as(['admin','moderator']) %>
<%= t('notes._notes.moderate_first_time_post') %> <br class="d-none d-lg-inline"/>
<a class="btn btn-outline-secondary btn-sm" href="/moderate/publish/<%= node.id %>"><%= t('notes._notes.approve') %></a>
<a class="btn btn-outline-secondary btn-sm" data-test="spam" href="/moderate/spam/<%= node.id %>"><%= t('notes._notes.spam') %></a>
<% else %>
<%= raw t('notes._notes.pending_approval', :url1 => '/wiki/moderation') %>
<% end %>
</p>
<% end %>
<h5 style="margin-bottom: 0px;"><a <% if @widget %>target="_blank"<% end %> href="<%= node.path %>" style="color: black"><%= (node.type == 'note') ? node.title : node.latest.title %></a></h5>
<small>
<% if node.type == 'note' %>
<div style="font-size: 1.0em; color: darkgray">Post by <a <% if @widget %>target="_blank"<% end %> href="/profile/<%= node.author.name %>" style="color: #303030">@<%= node.author.name %></a> <%= node.author.new_contributor %></div><br>
<span style="color: darkgray"> <i class="fa fa-comment-o"></i> <%= node.comments.size %> | <%= distance_of_time_in_words(node.created_at, Time.current, { include_seconds: false, scope:'datetime.time_ago_in_words' }).gsub('about ','') %></span>
<a class="ellipsis bottom-right" data-toggle="dropdown"> <i class="fa fa-ellipsis-h" style="color : #666; font-size:15px; float:right;"></i></a>
<ul class="dropdown-menu" style = "width: 150px; font-size:10px;">
<li>
<a> Made: <%= distance_of_time_in_words(node.created_at, Time.current, { include_seconds: false, scope:'datetime.time_ago_in_words' }) %> </a>
</li>
<% else %>
<li>
<a>Last Edited: <%= t('notes._notes.last_edit_by') %> <a <% if @widget %>target="_blank"<% end %> href="/profile/<%= node.latest.author.name %>"><%= node.latest.author.name %></a></a>
</li>
<li>
<a><%= distance_of_time_in_words(Time.at(node.latest.timestamp), Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %></a>
</li>
<% end %>
<li>
<a>Total Views: </i> <%= number_with_delimiter(node.views) %> <span class="d-none d-lg-inline"><%= t('notes._notes.views') %></span></a>
</li>
<li>
<a> Total Likes: <%= node.likers.length %></a>
</li>
<div class="content" style="width: 100%" >
<% if @compact.nil? %>
<% if params[:action].to_s.include?("methods") %>
<p><small>
<li><a <% if @widget %>target="_blank"<% end %> href="<%= node.path %>#Activities"><i class="fa fa-flask" style="color:#3da56a;"></i> <%= node.activities.count %> activities</a> </li>
<!-- <p><i class="fa fa-users" style="color:blue"></i> contributors</p> -->
<li><a <% if @widget %>target="_blank"<% end %> href="<%= node.path %>#Questions"><i class="fa fa-question-circle" style="color:#db3a1e;"></i> <span id="questions-count-<%= node.id %>"><%= node.questions.count %> questions</span></a></li>
</small></p>
<% end %>
<li class="buttons mb-2"><% if logged_in_as(['admin','moderator']) %><a style="width: 90px" class="btn btn-outline-secondary" href="/moderate/spam/<%= node.id %>"><i class="fa fa-ban"></i> <%= t('notes._notes.spam') %></a><% end %></li>
<li class="buttons"><a style="width: 90px;" class="btn btn-outline-secondary" href="<%= node.path %>"><%= t('notes._notes.read_more') %></a></li>
<% end %>
<% if params[:mod] %>
<a class="btn btn-outline-secondary" href="#"><i class="fa fa-ban-circle"></i> <%= t('notes._notes.spam') %></a>
<% end %>
<hr style="display:none;" class="bottom" />
</div>
</ul>
</small>
</div>
</div>
</div>
<% unless @widget %><hr class="d-md-none" /><% end %>
<% end %>
</div>
</div>
<%= will_paginate notes, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
<style>
#notes .card {
background-color: #fff;
border: 1px solid;
border-color: #D3D3D3;
border-radius: 6px;
margin:1em 0em 1em 0em;
padding: 0px !important;
}
#notes .card-body {
margin-right: 1em;
margin-left: 1em;
padding: 0.8em;
text-align: left;
}
#notes .btn {
font-size: 15px;
}
#notes .buttons {
text-align: center;
}
#notes .imgg {
background: #aaa;
display: flex;
align-items: center;
}
#notes .note-not {
margin-left:auto;
margin-right: auto;
color: #fff;
}
#notes .ellipsis {
cursor: pointer;
}
#notes .dropdown-menu li a{
display: inline-block;
padding-bottom: 5px;
padding-left: 14px;
font-size: 13px;
}
#notes .bottom-right {
position: absolute;
bottom: 10px;
right: 16px;
color: #fff;
text-shadow: 0.5px 0.5px #333;
text-decoration: underline;
}
</style>