Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 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
18 changes: 10 additions & 8 deletions app/views/tag/_miniCard.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="card" style="clear:left;">
<div class="card<% if local_assigns[:hide_button] %> more-tags<% end %>" style="clear:left;<% if local_assigns[:hide_buttong] %>display:none;<% end %><% if local_assigns[:grey] %>background:#eee;<% end %>">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could redo the background here using css and then system test for it...

<div class="card-body">

<a class="ellipsis pull-right" data-toggle="dropdown" style="cursor:pointer"><i class="fa fa-ellipsis-h" style="color:#666;font-size:18px;margin-right:10px;"></i></a>
Expand All @@ -20,14 +20,16 @@
<a href="/tag/<%= tag.name%>">
<h5 style="text-decoration:underline;color:black;"><%= tag.name %></h5>
</a>
<p style="font-size:15px;">
<a style="color:#808080;" href="/tag/<%= tag.name %>"><%= Tag.follower_count(tag.name) %> following</a>
</p>
<% unless local_assigns[:hide_button] %>
<p style="font-size:15px;<% if local_assigns[:hide_button] %>margin-bottom:0;<% end %>">
<a style="color:#808080;" href="/tag/<%= tag.name %>"><%= Tag.follower_count(tag.name) %> following</a>
</p>

<% if current_user && current_user.following(tag.name) %>
<a class="pull-right btn btn-primary requireLogin" href="/post?tags=<%= tag.name %>">Post <i class="fa fa-plus fa-white"></i></a>
<% else %>
<a class="pull-right btn btn-primary requireLogin" href='/subscribe/tag/<%= tag.name %>'>Follow</a>
<% if current_user && current_user.following(tag.name) %>
<a class="pull-right btn btn-primary requireLogin" href="/post?tags=<%= tag.name %>">Post <i class="fa fa-plus fa-white"></i></a>
<% else %>
<a class="pull-right btn btn-primary requireLogin" href='/subscribe/tag/<%= tag.name %>'>Follow</a>
<% end %>
<% end %>
</div>
</div>
Expand Down
11 changes: 1 addition & 10 deletions app/views/tag/_tags.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@
<a class="show-more-tags" href="javascript:void(0);"><p style="float:left; color:#666; margin-top:14px; margin-left:5px;"><u><%= tags.length - 2 %> more</u> &nbsp </p></a>
<% end %>

<p class="badge <%= badge_name %> pop more-tags" style="display:none;cursor:pointer;margin-bottom:3px;" id="tag_<%= tag.tid %>" data-toggle="popover" data-trigger="focus" data-count=0 data-placement="top" data-content="<p style='text-align:center;'><a href='/tag/<%= tag.name %>'><%= Tag.tagged_node_count(tag.name) || 0 %> notes</a> - <a href='/contributors/<%= tag.name %>'><%= Tag.contributors(tag.name).count %> people <br></a></p> <p style='text-align:center;font-size:12px;'><%if tag.description %><%= tag.description %> |<% end %> created by <a href='/profile/<%= tag.try(:author).try(:username) %>'><%= tag.try(:author).try(:username) %></a> <%= time_ago_in_words(Time.at(tag.date)) %> ago </p><div class='text-center'><a href='/subscribe/tag/<%= tag.name %>' class='btn btn-primary'>Follow</a></div>" data-html="true" title="<%= tag.name %>">
<a class='tag-name' href='/tag/<%= tag.name %>'><%= tag.name %></a>
<% if logged_in_as(['admin', 'moderator']) || (current_user && ( current_user.uid == @node.uid || current_user.uid == tag.uid)) %>
<% if tag.name.include? ':' %>
<a aria-label="Delete tag" data-confirm="This is a power tag (see https://publiclab.org/wiki/power-tags) -- and may drive a specific function on this page. Are you sure you want to delete it?" class="tag-delete" data-remote="true" href="/tag/delete/<%= @node.id %>/<%= tag.tid %>" data-tag-id="<%= tag.tid %>" data-method="delete"><i class='fa fa-times-circle fa-white blue pl-1' aria-hidden='true' ></i></a>
<% else %>
<a data-confirm="Are you sure you want to delete it?" class="tag-delete" data-remote="true" href="/tag/delete/<%= @node.id %>/<%= tag.tid %>" data-tag-id="<%= tag.tid %>" data-method="delete"><i class='fa fa-times-circle fa-white blue pl-1' aria-hidden='true' ></i></a>
<% end %>
<% end %>
</p>
<%= render partial: 'tag/miniCard', locals: { tag: tag, hide_button: true, grey: power_tag } %>

<% end %>

Expand Down
7 changes: 4 additions & 3 deletions test/system/post_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def setup

find('a#tags-open').click()

# There should be 1 tag that shows up as a badge and 2 as a card
page.assert_selector('.tags-list .card-body', :count => 2)
page.assert_selector('.tags-list p.badge', :count => 1)
# There should be 0 tags that shows up as a badge and 3 as a card
# TODO: adjust these to check for buttons in cards (should be 2) and grey cards (none until we have power tags in the test)
page.assert_selector('.tags-list .card-body', count: 3)
page.assert_selector('.tags-list p.badge', count: 0)

accept_alert do
find('.tags-list p.badge .tag-delete').click()
Expand Down