Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYNC #10

Merged
merged 17 commits into from
Feb 13, 2020
Merged

SYNC #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ GEM
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simple_oauth (0.3.1)
simplecov (0.18.0)
simplecov (0.18.1)
docile (~> 1.1)
simplecov-html (~> 0.11.0)
simplecov-html (0.11.0)
Expand Down Expand Up @@ -536,7 +536,7 @@ GEM
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
unicode-emoji (2.3.1)
unicode-emoji (2.4.0)
url (0.3.2)
web-console (3.7.0)
actionview (>= 5.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/user_sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def handle_site_login_flow

def destroy
@user_session = UserSession.find
@user_session.destroy
@user_session&.destroy
flash[:notice] = I18n.t('user_sessions_controller.logged_out')
prev_uri = URI(request.referer || "").path
redirect_to prev_uri + '?_=' + Time.current.to_i.to_s
Expand Down
12 changes: 12 additions & 0 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ def parent
aid.zero? ? node : answer&.node
end

def status_value
if status == 0
'Banned'
elsif status == 1
'Normal'
elsif status == 4
'Moderated'
else
'Not Defined'
end
end

def mentioned_users
usernames = comment.scan(Callouts.const_get(:FINDER))
User.where(username: usernames.map { |m| m[1] }).distinct
Expand Down
7 changes: 3 additions & 4 deletions app/views/admin/_nodes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

<script>
(function(){
$('input[type=checkbox]#batch-checkbox').bind('click',function(e) {
if ($('#batch-checkbox')[0].checked) $('.batch-checkbox').attr('checked','checked')
else $('.batch-checkbox').attr('checked',false)
})
$('#batch-checkbox').click(function () {
$('.batch-checkbox').prop('checked', this.checked);
});
$('#batch-delete').bind('click',function(e) {
vals = []
alert_error('The mass spam button is disabled pending resolution of <a href="https://github.com/jywarren/plots2/issues/184">ticket #184</a>.')
Expand Down
2 changes: 2 additions & 0 deletions app/views/comments/_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
<td><%= distance_of_time_in_words(comment.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %></td>
<td>
<% if comment.status == 4 && current_user &. can_moderate? %>
Status: <%= comment.status_value %>
<a class="btn btn-outline-secondary btn-sm" href="/admin/publish_comment/<%= comment.id %>"><%= translation('dashboard.moderate.approve') %></a>
<a class="btn btn-outline-secondary btn-sm" href="/admin/mark_comment_spam/<%= comment.id %>"><%= translation('dashboard.moderate.spam') %></a>
<% elsif current_user &. can_moderate? %>
Status: <%= comment.status_value %>
<a rel="tooltip" title="Mark as spam" class="btn btn-sm btn-outline-secondary btn-flag-spam-<%= comment.id %>" data-confirm="Are you sure? The user will no longer be able to log in or publish, and their content will be hidden except comments." href="/admin/mark_comment_spam/<%= comment.id %>">
<i class="fa fa-ban"></i>
</a>
Expand Down
6 changes: 6 additions & 0 deletions app/views/grids/_nodes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@
a.grid-embed:hover {
color: #888;
}
th {
position: sticky;
top: 0;
z-index: 5;
background: #fff;
}
</style>
</div>
6 changes: 6 additions & 0 deletions app/views/grids/_notes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,11 @@
a.grid-embed:hover {
color: #888;
}
th {
position: sticky;
top: 0;
z-index: 5;
background: #fff;
}
</style>
</div>
8 changes: 7 additions & 1 deletion app/views/grids/_wikis.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
}
a.grid-embed:hover {
color: #888;
}
}
th {
position: sticky;
top: 0;
z-index: 5;
background: #fff;
}
</style>
</div>
3 changes: 2 additions & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- ||| menu, displayed for mobile: -->
<a class="navbar-brand ml-lg-5" id="brand" href="<%= root_path %>">Public Lab</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#header-navbar-collapse">
<span class="fa fa-white"></span>
<span class="fas fa-bars fa-white"></span>
</button>

<div class="collapse navbar-collapse" id="header-navbar-collapse">
Expand All @@ -38,6 +38,7 @@
<a class="dropdown-item" href="/getting-started"><b><%= translate('Get started') %> &raquo;</b></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/people"><%= translate('People') %></a>
<a class="dropdown-item" href="/map"><%= translate('Places') %></a>
<a class="dropdown-item" href="/projects"><%= translate('Projects') %></a>
<a class="dropdown-item" href="/events"><%= translate('Events') %></a>
<a class="dropdown-item" href="/questions"><%= translate('Questions') %></a>
Expand Down
14 changes: 13 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<%= raw strip_tags(sanitize(RDiscount.new(@node.body).to_html)).truncate(100) %>
</p>
<% end %>
<p class="facebook-summary" style="display:none;"><%= t('layout._header.summary') %></p>
<p class="facebook-summary" style="display:none;"><%= translation('layout._header.summary') %></p>

<!-- facebook needs this apparently -->
<div id="fb-root"></div>
Expand All @@ -77,6 +77,14 @@
}

});
$("body").on("mouseup", function(e) {
var el = $(e.target);
if (el[0].className.indexOf("popover") == -1) {
$(".popover").each(function() {
$(this).popover("hide");
});
}
});
})

</script>
Expand All @@ -98,6 +106,10 @@
overflow: auto;
}

.leaflet-top{
z-index:800 !important;
}

#ex1Slider .slider-selection {
background: #BABABA;
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/like/_like.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<a rel='tooltip' title='Flag as spam' class='btn btn-sm btn-outline-secondary btn-flag-spam-<%= node.id %>' href='mailto:moderators@publiclab.org?subject=Reporting+spam+on+Public+Lab&body=Hi,+I+found+this+item+that+looks+like+spam+or+needs+to+be+moderated:+<%= node.title.gsub(/ /,'+') %>+https://publiclab.org/n/<%= node.id %>+by+https://publiclab.org/profile/<%= node.author.username %>+Thanks!'>
<i class='fa fa-flag'></i>
</a>
<li data-toggle='tooltip' data-placement='top' title='Follow by tag or author' id='menu-follow-btn' class='btn btn-outline-secondary btn-sm requireLogin nestedPopover' data-html='true' rel='popover' data-placement='left' data-content=&quot; <%= "No tags" if tagnames.nil? || tagnames.length == 0 %> <% if tagnames %><% tagnames.each do |tagname| %><p style='margin-bottom:3px; overflow: hidden; text-overflow: ellipsis;'><a href='/subscribe/tag/<%= tagname %>' class='btn btn-outline-secondary btn-sm'><%= tagname %></a></p><% end %><% end %><hr /><i class='fa fa-user'></i><% if current_user && !current_user.following?(node.author) %>&nbsp;<a class='btn btn-sm' href='/relationships?followed_id=<%= node.author.id %>' data-method='post' > <%= node.author.name %></a><% else %> &nbsp;<%= node.author.name %><% end %>&quot;>
<li data-toggle='tooltip' data-placement='top' title='Follow by tag or author' id='menu-follow-btn' class='btn btn-outline-secondary btn-sm requireLogin nestedPopover' data-html='true' rel='popover' data-placement='left' data-content=&quot; <%= "No tags" if tagnames.nil? || tagnames.length == 0 %> <% if tagnames %><% tagnames.each do |tagname| %><p style='margin-bottom:3px; overflow: hidden; text-overflow: ellipsis;'><a href='/subscribe/tag/<%= tagname %>' class='btn btn-outline-secondary btn-sm'><%= tagname %></a></p><% end %><% end %><hr /><i class='fa fa-user'></i><% if current_user && !current_user.following?(node.author) && node.author != current_user %>&nbsp;<a class='btn btn-sm' href='/relationships?followed_id=<%= node.author.id %>' data-method='post' > <%= node.author.name %></a><% else %> &nbsp;<%= node.author.name %><% end %>&quot;>
<i class='fa fa-user-plus' aria-hidden='true'></i>
</li>

Expand Down
2 changes: 1 addition & 1 deletion app/views/tag/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="tag-buttons">
<div class="btn-group" role="group">
<% if current_user && current_user.following(params[:id]) %>
<a rel="tooltip" title="<%= t('sidebar._post_button.share_your_work') %>" data-placement="bottom" href="/post?tags=<%= @title %>" class="btn btn-primary requireLogin">New post <i class="fa fa-plus fa-white"></i></a>
<a rel="tooltip" title="<%= translation('sidebar._post_button.share_your_work') %>" data-placement="bottom" href="/post?tags=<%= @title %>" class="btn btn-primary requireLogin">New post <i class="fa fa-plus fa-white"></i></a>
<% else %>
<a class="btn btn-primary requireLogin" target="_blank" href="/subscribe/tag/<%= params[:id] %>"> Follow</a>
<% if @related_tags %>
Expand Down
6 changes: 6 additions & 0 deletions app/views/tag/show/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,10 @@
.bottom-right a {
color: #fff;
}

@media (min-width: 576px) {
.d-md-block {
display: block !important;
}
}
</style>
2 changes: 1 addition & 1 deletion app/views/tag/show/_nav_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<div class="dropdown" style="margin-top:10px; float:right;">
<div class="dropdown" style="margin-top:10px; float:right; margin-right: 5px;">

<button class="btn btn-outline-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">by type</button>

Expand Down
2 changes: 1 addition & 1 deletion app/views/users/list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<% if current_user && (current_user.role == "admin" || current_user.role == "moderator") %>
<% if user.status == 0 %>
<i class='fa fa-ban' style="color:#a00;"></i> <%= t('users.list.banned') %>
<% elsif user.status == 1 %>
<% elsif user.status == 1 && user != current_user %>
<li><a data-confirm="<%= t('users.list.are_you_sure') %>" href="/ban/<%= user.uid %>" ><i class='fa fa-ban'></i> <%= t('users.list.ban') %></a></li>
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/profile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

<% if logged_in_as(['admin', 'moderator']) && @profile_user.status == 0 %>
<a href="/unban/<%= @profile_user.id %>" class="btn btn-outline-secondary btn-block"><i class="fa fa-thumbs-up"></i> <%= t('users.profile.unban_user') %></a>
<% elsif logged_in_as(['admin', 'moderator']) && @profile_user.status == 1 %>
<% elsif logged_in_as(['admin', 'moderator']) && @profile_user.status == 1 && @profile_user != current_user %>
<a data-confirm="<%= t('users.profile.confirm_ban_user') %>" href="/ban/<%= @profile_user.id %>" class="btn btn-outline-secondary btn-block"><i class="fa fa-ban"></i> <%= t('users.profile.ban_user') %></a>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"typeahead.js-browserify": "Javier-Rotelli/typeahead.js-browserify#~1.0.7",
"urlhash": "^0.1.3",
"woofmark": "~4.2.0",
"@fortawesome/fontawesome-free": "^5.12.0"
"@fortawesome/fontawesome-free": "^5.12.1"
},
"devDependencies": {},
"homepage": "https://github.com/publiclab/plots2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
esutils "^2.0.2"
js-tokens "^4.0.0"

"@fortawesome/fontawesome-free@^5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.0.tgz#8ceb9f09edfb85ea18a6c7bf098f6f5dd5ffd62b"
integrity sha512-vKDJUuE2GAdBERaQWmmtsciAMzjwNrROXA5KTGSZvayAsmuTGjam5z6QNqNPCwDfVljLWuov1nEC3mEQf/n6fQ==
"@fortawesome/fontawesome-free@^5.12.1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.1.tgz#2a98fea9fbb8a606ddc79a4680034e9d5591c550"
integrity sha512-ZtjIIFplxncqxvogq148C3hBLQE+W3iJ8E4UvJ09zIJUgzwLcROsWwFDErVSXY2Plzao5J9KUYNHKHMEUYDMKw==

abab@^1.0.0:
version "1.0.4"
Expand Down