-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy path_queue.html.erb
150 lines (149 loc) · 8.77 KB
/
_queue.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
144
145
146
147
148
149
150
<script>
$(document).ready(function () {
var table = table_main("#queue_table");
$("#all").click(function () { //select all button
select_all();
});
$("#batch-spam").bind('click', function (e) { //batch spam
batch_nav("batch_spam");
});
$("#batch-publish").bind('click', function (e) { //batch publish
batch_nav("batch_publish");
});
$("#batch-ban").bind('click', function (e) { //batch ban
batch_nav("batch_ban");
});
$("#batch-unban").bind('click', function (e) { //batch unban
batch_nav("batch_unban");
});
$("#delete-batch").bind('click', function (e) { // batch delete
batch_nav("batch_delete");
});
});
</script>
<div class="py-3 pl-3 w-100">
<% if @tags_followed.length == 0 %>
<span class="text-secondary">You are not following any tag, Click <a class="badge badge-pill badge-info" href="/subscriptions">here</a> to follow. </span>
<% else %>
<a class="fa fa-plus-circle text-info" href="/subscriptions"> </a>
<% end %>
<% @tags_followed.limit(20).each do |tag| %>
<a class="btn btn-xs my-1 btn-<% if params[:tag] == tag.tagname %>info<%else%>light border<%end%> border-curve" href="/spam2/queue/filter/<%= tag.tagname %>"><%= tag.tagname %> <span class="badge badge-pill badge-<% if params[:tag] == tag.tagname %>light<%else%>info<%end%>" data-toggle="tooltip" data-placement="top" title="Filter Nodes by Tag"><%= Tag.followers(tag.tagname).where('rusers.role = ?', 'moderator').or(Tag.followers(tag.tagname).where('rusers.role = ?', 'admin')).size %></span></a>
<% end %>
</div>
<div class="card" id="table-card">
<div class="bg-light navbar navbar-expand">
<ul class="nav navbar-expand navbar-nav-scroll">
<li class="nav-item">
<a class="btn nav-link text-secondary" data-toggle="tooltip" data-placement="top" title="Selected per page"> Selected <span id="select-count" class="badge badge-dark">0</span></a>
</li>
<li class="nav-item">
<a href="/spam2/queue/filter/everything" class="btn nav-link <% if params[:tag] == "everything" %> active<% else %> text-secondary<% end %>"><i class="fa fa-arrow-circle-o-up <% if params[:tag] == "everything" %> text-dark<% else %> text-secondary<% end %>" data-toggle="tooltip" data-placement="top" title="All Nodes which you are following"></i> All Tags</a>
</li>
</ul>
</div>
<div class="card-body" style="overflow-x:hidden;">
<% unless @queue.empty? %>
<div class="my-0 text-secondary small "><%= page_entries_info(@queue) %>s</div>
<% end %>
<table id="queue_table" class="nowrap table table-hover" style="width:100%; text-align:left">
<thead style="text-align:left;">
<tr>
<th><input type="checkbox" id="selectall"/></th>
<th style="width:250px !important;"><%=translation('users.profile.title')%></th>
<th>Author</th>
<th>Updated at</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @queue.each do |node| %>
<tr id="n<%= node.id %>">
<td><input class="selectedId" value="<%= node.nid %>" type="checkbox" /></td>
<td style="width:250px !important;">
<% if node.status == 1 %><i class="fa fa-check text-success"></i> <% elsif node.status == 0 %><i class="fa fa-ban text-danger"></i> <% elsif node.status == 4 %><i class="fa fa-circle text-primary"></i> <% end %> <% if params[:type] == 'flagged'%> <i class="fa fa-flag text-warning"><% end %>
<a href="javascript:void(0);" class="text-dark font-weight-bold" id="node-hover" data-toggle="modal" data-target="#ninfo<%= node.id %>"><%= node.title.truncate(25) %></a><br />
<span class="text-secondary small"><%= node.type.capitalize %> | <%= time_ago_in_words(node.created_at) %> ago</span>
</td>
<td>
<a href="/profile/<%= node.author&.name %>" class="text-info"><%= node.author&.name.truncate(15) %></a><br>
<span class="text-secondary small"><%= Node.where(uid: node.author&.id).count %> Nodes<span> <%= node.author&.new_contributor%>
</td>
<td>
<span class="text-dark"><%= time_ago_in_words(node.updated_at) %> ago</span>
</td>
<td>
<a class="btn btn-xs border-curve font-weight-bold btn<% if node.status != 1 %>-success<% else %>-secondary disabled<% end %> publish" data-remote="true" href="/moderate/publish/<%= node.id %>" ><i class="fa fa-check-circle fa-white"></i> Publish post</a>
<a class="btn btn-xs border-curve font-weight-bold btn<% if node.status != 0 %>-danger<% else %>-secondary disabled<% end %> spam" data-remote="true" href="/moderate/spam/<%= node.id %>"><i class="fa fa-ban fa-white"></i> Spam post</a>
<a class="btn btn-xs border-curve font-weight-bold btn-secondary ban a<%= node.author.id %>" <% if node.author.status == 0 %>style="display:none;"<% end %> data-remote="true" href="/ban/<%= node.author.id %>">Ban user</a>
<a class="btn btn-xs border-curve font-weight-bold btn-secondary unban a-unban<%= node.author.id %>" <% if node.author.status == 1 %>style="display:none;"<% end %> data-remote="true" href="/unban/<%= node.author.id %>">Unban user</a>
<a class="btn btn-xs border-curve font-weight-bold btn-warning unflag <% if node.flag == 0 %>disabled <% end %>" data-remote="true"href="/moderate/remove_flag_node/<%= node.id %>"> Unflag</a>
<%= link_to "/notes/delete/#{node.id}", data: { confirm: "Are you sure you want to delete #{node.path}?" }, :remote => true, :class => "btn border-curve btn-sm font-weight-bold btn-light delete" do %>
<i class="fa fa-trash text-dark"></i>
<% end %>
<script>
$('#n<%= node.id %> .delete').bind('ajax:success', function(e){
$('#n<%= node.id %>').fadeOut()
notyNotification('relax', 3000, 'danger', 'topRight', 'Node deleted');
});
$('#n<%= node.id %> .publish').bind('ajax:success', function(e){
$('#n<%= node.id %>').hide()
notyNotification('relax', 3000, 'success', 'topRight', 'Node published');
});
$('#n<%= node.id %> .spam').bind('ajax:success', function(e){
$('#n<%= node.id %>').hide()
notyNotification('relax', 3000, 'success', 'topRight', 'Node spammed');
});
$('.a<%= node.author.id %>.ban').bind('ajax:success', function(e){
$('.a<%= node.author.id %>').hide() // ban toggle
$('.a-unban<%= node.author.id %>').show()
notyNotification('relax', 3000, 'danger', 'topRight', 'Author banned');
});
$('.a-unban<%= node.author.id %>.unban').bind('ajax:success', function(e){
$('.a-unban<%= node.author.id %>').hide()
$('.a<%= node.author.id %>').show()
notyNotification('relax', 3000, 'success', 'topRight', 'Author unbanned');
});
$('#n<%= node.id %> .unflag').bind('ajax:success', function(e){
$('#n<%= node.id %>').hide()
notyNotification('relax', 3000, 'warning', 'topRight', 'Node flagged');
});
</script>
</td>
</tr>
<div class="modal fade" id="ninfo<%= node.id %>">
<div class="modal-dialog" >
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><a href="<%= node.path %>"><%= node.title %></a></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span>×</span>
</button>
</div>
<div class="modal-body">
<% node.tags.limit(4).each do |tag| %>
<span ><a class="badge badge-primary" href="/questions/tag/<%= tag.name %>"> <%= tag.name %> </a></span>
<% end %>
<br>
<%= node.body %>
</div>
<div class="modal-footer">
<%= time_ago_in_words(node.created_at) %> ago
</div>
</div>
</div>
</div>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="page-table">
<div class="float-right">
<%= will_paginate @queue, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated || @queue.empty? %>
</div>
<div class="float-left text-secondary">
<% unless @queue.empty? %> Page number <%= @queue.current_page %> of <%= @queue.total_pages %> total Pages <% end %>
</div>
</div>