Skip to content

Commit

Permalink
List map tags in view map page (new show page) (#1064)
Browse files Browse the repository at this point in the history
* list map tags in view map page

* add tests for maps show page

* align center
  • Loading branch information
nstjean authored and cesswairimu committed Oct 29, 2019
1 parent 7adb470 commit 59ae290
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/views/maps/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@
<div class= "row" id="knitter-map-pane" style="height: 450px; width: 100%; margin-bottom: 1%; z-index: 5; float: none; max-width: none;"> </div>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="col-md-4">
<button type="button" class="btn btn-outline-info btn-sm" onClick="$('.share-link').toggle()" style="margin-left: 1%;">Embed code</button>
<div class="share-link" style="display:none;">
<%= render :partial => 'maps/share' %>
</div>
</div>
<div class="col-md-6">
<div class="col-md-3 offset-md-1">
<% @map.tags.each do |tag| %>
<span id="tag_<%= tag.id %>" class="badge badge-light">
<a href="/tags/<%= tag.name %>" id="tag_<%= tag.id %>"><%= tag.name %></a>
<%= link_to([@map, tag], :method => "delete") do %>
<span>&times;</span>
<% end %>
</span>
<% end %>
</div>
<div class="col-md-4">
<% if !@map.anonymous? || (current_user == true && current_user.can_edit?(@map)) %>
<a href="/maps/<%= @map.slug %>/edit">
<button class="btn btn-outline-info float-right">
Expand Down
5 changes: 5 additions & 0 deletions test/controllers/maps_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@ def teardown
end

test "should get show" do
@map = maps(:yaya)
map = maps(:nairobi)
get(:show, params: { id: @map.slug })
assert_response :success
assert_not_nil assigns(:map)
assert assigns(:users)
assert assigns(:maps)
assert_includes assigns(:maps), map
end

test 'should archive map' do
Expand Down

0 comments on commit 59ae290

Please sign in to comment.