Skip to content

Commit

Permalink
Fixes publiclab#11198: Added date picker modal
Browse files Browse the repository at this point in the history
  • Loading branch information
KarishmaVanwari committed Jun 17, 2022
1 parent 833f7b1 commit 60b3c80
Showing 1 changed file with 59 additions and 24 deletions.
83 changes: 59 additions & 24 deletions app/views/tag/show/_sort.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
<div class="dropdown pull-right">
<button class="btn btn-outline-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="margin-left:14px;"><%=translation('tag.index.sort_by')%></button>
<div class="dropdown-menu dropdown-menu-right mt-1" aria-labelledby="dropdownMenuButton">
<% if params[:action] == "show" %>
<a class="dropdown-item <% if params[:order] == 'last_updated' %> active<% end %>" href="/tag/<%= params[:id] %>">
<% if @node_type == 'wiki' %>
<i class="fa fa-clock-o"></i> <span class="d-lg-inline">by created date</span>
<% else %>
<i class="fa fa-clock-o"></i> <span class="d-lg-inline">by last updated</span>
<% end %>
</a>
<a class="dropdown-item <% if params[:order] == 'views' %> active<% end %>" href="?order=views">
<i class="fa fa-eye"></i> <span class="d-lg-inline">by views</span>
</a>
<a class="dropdown-item <% if params[:order] == 'likes' %> active<% end %>" href="?order=likes">
<i class="fa fa-star"></i> <span class="d-lg-inline">by likes</span>
</a>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">View date range</h6>
<a class="dropdown-item" href="?start=<%= (@start || Time.now - 1.month).to_formatted_s(:long) %>&end=<%= (@end || Time.now).to_formatted_s(:long) %>" >past month</a>
<a class="dropdown-item" href="?start=<%= (@start || Time.now - 1.year).to_formatted_s(:long) %>&end=<%= (@end || Time.now).to_formatted_s(:long) %>" >past year</a>
<% end %>
</div>
</div>
<div class="dropdown pull-right">
<button class="btn btn-outline-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="margin-left:14px;"><%=translation('tag.index.sort_by')%></button>
<div class="dropdown-menu dropdown-menu-right mt-1" aria-labelledby="dropdownMenuButton">
<% if params[:action] == "show" %>
<a class="dropdown-item <% if params[:order] == 'last_updated' %> active<% end %>" href="/tag/<%= params[:id] %>">
<% if @node_type == 'wiki' %>
<i class="fa fa-clock-o"></i> <span class="d-lg-inline">by created date</span>
<% else %>
<i class="fa fa-clock-o"></i> <span class="d-lg-inline">by last updated</span>
<% end %>
</a>
<a class="dropdown-item <% if params[:order] == 'views' %> active<% end %>" href="?order=views">
<i class="fa fa-eye"></i> <span class="d-lg-inline">by views</span>
</a>
<a class="dropdown-item <% if params[:order] == 'likes' %> active<% end %>" href="?order=likes">
<i class="fa fa-star"></i> <span class="d-lg-inline">by likes</span>
</a>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">View date range</h6>
<a class="dropdown-item" href="?start=<%= (@start || Time.now - 1.month).to_formatted_s(:long) %>&end=<%= (@end || Time.now).to_formatted_s(:long) %>" >past month</a>
<a class="dropdown-item" href="?start=<%= (@start || Time.now - 1.year).to_formatted_s(:long) %>&end=<%= (@end || Time.now).to_formatted_s(:long) %>" >past year</a>
<a class="dropdown-item" data-toggle="modal" data-target="#dateModal" >custom</a>
<% end %>
</div>
</div>

<div class="modal" id="dateModal">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">

<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Select Custom Range</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>

<!-- Modal body -->
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<label>From</label><br>
<input type="date" id="from">
</div>
<div class="col-sm-6">
<label>To</label><br>
<input type="date" id="to">
</div>
</div>
</div>

<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Save changes</button>
</div>

</div>
</div>
</div>

0 comments on commit 60b3c80

Please sign in to comment.