Skip to content

Commit

Permalink
Toggle view option for image added in the sidebar (#738)
Browse files Browse the repository at this point in the history
* Toggle option for image view added

* list view correction

* Toggle-view
  • Loading branch information
divyabaid16 authored and jywarren committed Aug 16, 2019
1 parent 0ae8eb5 commit c7d700d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
9 changes: 8 additions & 1 deletion app/assets/stylesheets/sidebar.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
.grid-list {
margin-left: 25px;
margin-bottom: 10px;
display: inline-block;
padding-right: 30px;
color: orange;
}
.image-order{
display: inline-block;
float: right;
margin-right: 35px;
margin-right: 15px;
margin-bottom: 10px;
}
.sidebar-heading{
Expand Down
20 changes: 18 additions & 2 deletions app/views/images/_index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<div>
<h4 class="sidebar-heading">Images</h4>
<div class="grid-list">
<button class="list-view" onClick="list()"><i class="fa fa-bars"></i></button>
<button class="grid-view" onClick="grid()"><i class="fa fa-th"></i></button>
</div>
<div class="image-order">
<button type="button" class="btn btn-outline-secondary">Sort Images</button>
<div class="image-order-content">
Expand All @@ -9,9 +13,10 @@
</div>
</div>
</div>

<% if @map.warpables.empty? %>
<p id="no-images">No images uploaded. </p>
<%end%>
<% end %>
<table class="warpables-all table table-striped">
<tbody>
<% sort_param = params[:sort] %>
Expand Down Expand Up @@ -123,4 +128,15 @@
</td>
<% end %>
</tbody>
</table>
</table>
<script>
function grid(){
$('td').hide();
$('.warpable').show();
$('tr').css('display','inline-block');
$('.warpable').css('padding','0.75rem 0.5rem')
}
function list(){
$('td').show()
}
</script>

0 comments on commit c7d700d

Please sign in to comment.