Commits

Yuya Nishihara committed 385cc17

sampleapp: add "tags" drop down menu

  • Participants
  • Parent commits c1f7094

Comments (0)

Files changed (2)

File extra/sample_app/app.rb

 $hg = Hglib.open
 HG_VERSION = $hg.version
 
+before do
+  @tags = $hg.tags
+end
+
 get '/' do
   @title = 'Home'
   @recent_changes = $hg.log :limit => 5

File extra/sample_app/views/layout.erb

           <ul class="nav">
             <%== nav_link '/', 'Home' %>
             <%== nav_link '/changesets', 'Commits' %>
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+                Tags
+                <b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <% @tags.each do |name, cid| %>
+                <li><a href="<%= url("/changesets/#{cid}") %>"><%= name %></a></li>
+                <% end %>
+              </ul>
+            </li>
             <%== nav_link '/incoming', 'Incoming' %>
             <%== nav_link '/outgoing', 'Outgoing' %>
           </ul>