Skip to content

Commit

Permalink
Add warning message re wildcard search (publiclab#2180)
Browse files Browse the repository at this point in the history
* combined changes by @ina-mastabba

* re-add missing section
  • Loading branch information
ina-mastabba authored and Souravirus committed Mar 12, 2018
1 parent cf1dd76 commit 876769b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 46 deletions.
99 changes: 53 additions & 46 deletions app/views/tag/_contributors.html.erb
Original file line number Diff line number Diff line change
@@ -1,51 +1,58 @@
<% if @tag %>
<% if @tag %>

<% if @users %>

<% if @users %>
<% if params["action"] == "contributors"%>
<hr />
<% end %>
<div class="row" id="highlight" style=" text-align: center;">
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= @users.length || 0 %> contributors</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= @note_count %> research notes</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= @wikis.length %> wiki pages</h3>
</div>
<% if params["action"] == "contributors"%>
<hr />
<% end %>
<% end %>
<% if params["action"] == "contributors"%>
<hr />
<% end %>

<div class="row" id="highlight" style=" text-align: center;">
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= @users.length || 0 %> contributors</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= @noteCount %> research notes</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= @wikis.length %> wiki pages</h3>
</div>

<% if params["action"] == "contributors"%>
<hr />
<% end %>

<% end %>

<% if current_user && params["action"] == "contributors" %>
<!-- AJAXify -->
<div class="btn-group">
<a class="btn btn-default btn-sm" href="/feed/tag/<%= params[:id] %>.rss"><i class="fa fa-rss"></i> RSS</a>
<% if current_user.following(params[:id]) %>
<a rel="tooltip" title="<%= t('tag.contributors.unfollow') %>" class="btn btn-default btn-sm" href="/unsubscribe/tag/<%= params[:id] %>"><i class="fa fa-eye"></i> <%= t('tag.contributors.following') %> <b><%= params[:id] %></b></a>
<% else %>
<a class="btn btn-default btn-sm" href="/subscribe/tag/<%= params[:id] %>"><i class="fa fa-eye"></i> <%= t('tag.contributors.follow') %> <b><%= params[:id] %></b></a>
<% end %>
<a class="btn btn-default btn-sm" rel="popover" data-placement="bottom" data-html="true" data-title="<%= t('tag.show.users_following_tag') %>" data-content="<% Tag.followers(params[:id]).each do |user| %><i class='fa fa-star-o'></i> <a href='/profile/<%= user.username %>'><%= user.username %></a><br /><% end %><% if Tag.follower_count(params[:id]) == 0 %><i><%= t('tag.show.none') %></i><% end %>"><%= Tag.follower_count(params[:id]) %> <i class="fa fa-user"></i> <span class="caret"></span></a>
</div>
<br /><br />
<!-- AJAXify -->
<!-- AJAXify -->
<div class="btn-group">
<a class="btn btn-default btn-sm" href="/feed/tag/<%= params[:id] %>.rss"><i class="fa fa-rss"></i> RSS</a>
<% if current_user.following(params[:id]) %>
<a rel="tooltip" title="<%= t('tag.contributors.unfollow') %>" class="btn btn-default btn-sm" href="/unsubscribe/tag/<%= params[:id] %>"><i class="fa fa-eye"></i> <%= t('tag.contributors.following') %> <b><%= params[:id] %></b></a>
<% else %>
<a class="btn btn-default btn-sm" href="/subscribe/tag/<%= params[:id] %>"><i class="fa fa-eye"></i> <%= t('tag.contributors.follow') %> <b><%= params[:id] %></b></a>
<% end %>
<a class="btn btn-default btn-sm" rel="popover" data-placement="bottom" data-html="true" data-title="<%= t('tag.show.users_following_tag') %>" data-content="<% Tag.followers(params[:id]).each do |user| %><i class='fa fa-star-o'></i> <a href='/profile/<%= user.username %>'><%= user.username %></a><br /><% end %><% if Tag.follower_count(params[:id]) == 0 %><i><%= t('tag.show.none') %></i><% end %>"><%= Tag.follower_count(params[:id]) %> <i class="fa fa-user"></i> <span class="caret"></span></a>
</div>
<br /><br />
<!-- AJAXify -->
<% end %>
<% end %>

<% if @note_count.nil? || @note_count == 0 %>
<p><%= raw t('tag.contributors.no_contributors', :tag => params[:id]) %>:</p>
<% else %>
<table class="table">
<tr>
<th style=" width:25%; "><%= t('tag.contributors.contributor') %></th>
<th><%= t('tag.contributors.notes') %></th>
</tr>
<% if @users %>
<% @users.each do |user| %>
<tr>
<td><a href='/profile/<%= user.name %>'><i class="fa fa-user"></i> <%= user.name %></a></td>
<td><a href='/notes/author/<%= user.name %>/<%= params[:id] %>'><%= t('tag.contributors.notes') %> &raquo;</a></td>
</tr>
<% end %>
<% end %>
</table>
<br />
<% end %>
<% end %>

<% if @wildcard %>
<p><%= raw t('tag.contributors.wild_card_search_detected', :tag => params[:id]) %></p>
<% elsif @noteCount.nil? || @noteCount == 0 %>
<p><%= raw t('tag.contributors.no_contributors', :tag => params[:id]) %>:</p>
<% else %>
<table class="table">
<tr>
<th style="width:25%;"><%= t('tag.contributors.contributor') %></th>
<th><%= t('tag.contributors.notes') %></th>
</tr>
<% if @users %>
<% @users.each do |user| %>
<tr>
<td><a href='/profile/<%= user.name %>'><i class="fa fa-user"></i> <%= user.name %></a></td>
<td><a href='/notes/author/<%= user.name %>/<%= params[:id] %>'><%= t('tag.contributors.notes') %> &raquo;</a></td>
</tr>
<% end %>
<% end %>
</table>
<br />
<% end %>
1 change: 1 addition & 0 deletions config/locales/views/tag/contributors/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ en:
follow: "Follow"
people_watching_tag: "%{count} people are watching this tag"
no_contributors: "No contributors for that tag; try searching for '<b>%{tag}</b>'"
wild_card_search_detected: "Wildcard tag search detected. Wildcard tag searches use the * asterisk in their URLs, and will not show contributor listings."
contributor: "Contributor"
notes: "Notes"

0 comments on commit 876769b

Please sign in to comment.