Skip to content

Commit

Permalink
Main menu as Bootstrap navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaquette committed Jan 26, 2015
1 parent 76a428a commit 82c1927
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 165 deletions.
8 changes: 8 additions & 0 deletions src/BugTracker.Web/BugTracker.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<Content Include="Content\style\jquery.mobile.custom.structure.min.css" />
<Content Include="Content\style\jquery.mobile.custom.theme.css" />
<Content Include="Content\style\jquery.mobile.custom.theme.min.css" />
<Content Include="Controls\Footer.ascx" />
<Content Include="Controls\MainMenu.ascx" />
<Content Include="edit_area\edit_area_full.gz" />
<Content Include="fonts\glyphicons-halflings-regular.svg" />
Expand Down Expand Up @@ -744,6 +745,13 @@
<Compile Include="BasePage.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Controls\Footer.ascx.cs">
<DependentUpon>Footer.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Controls\Footer.ascx.designer.cs">
<DependentUpon>Footer.ascx</DependentUpon>
</Compile>
<Compile Include="LoggedIn.Master.cs">
<DependentUpon>LoggedIn.Master</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
Expand Down
17 changes: 17 additions & 0 deletions src/BugTracker.Web/Controls/Footer.ascx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Footer.ascx.cs" Inherits="btnet.Controls.Footer" %>
<footer class="page-footer">
<div class="container">
<ul class="text-muted">
<li>BugTracker.NET</li>
<li>·</li>
<li><a target="_blank" href="http://ifdefined.com/README.html">Help</a></li>
<li>·</li>
<li><a target="_blank" href="mailto:ctrager@yahoo.com">Feedback</a></li>
<li>·</li>
<li><a target="_blank" href="about.html">About</a></li>
<li>·</li>
<li><a target="_blank" href="http://ifdefined.com/README.html">Donate</a></li>
</ul>
</div>
<% Response.Write(Application["custom_footer"]); %>
</footer>
17 changes: 17 additions & 0 deletions src/BugTracker.Web/Controls/Footer.ascx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace btnet.Controls
{
public partial class Footer : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
}
17 changes: 17 additions & 0 deletions src/BugTracker.Web/Controls/Footer.ascx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

211 changes: 101 additions & 110 deletions src/BugTracker.Web/Controls/MainMenu.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,108 @@
<%@ Import Namespace="btnet" %>
<%@ Import Namespace="btnet.Security" %>
<%= Util.context.Application["custom_header"]%>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/bugs.aspx">
<%= Util.context.Application["custom_logo"] %>
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="bugs.aspx"><%:btnet.Util.get_setting("PluralBugLabel", "bugs") %></a></li>
<% if (Page.User.Identity.GetCanSearch())
{ %>
<li><a href="search.aspx">search</a> </li>
<% } %>
<% if (Util.get_setting("EnableWhatsNewPage", "0") == "1")
{ %>
<li><a href="view_whatsnew.aspx">news</a> </li>
<% } %>

<% if (!Page.User.IsInRole(BtnetRoles.Guest))
{ %>
<li>
<a href="queries.aspx">queries</a>
</li>
<% } %>

<% if (Page.User.IsInRole(BtnetRoles.Admin) || Page.User.Identity.GetCanUseReports() || Page.User.Identity.GetCanEditReports())
{ %>
<li>
<a href="reports.aspx">reports</a>
</li>
<% } %>


<% if (Util.get_setting("CustomMenuLinkLabel", "") != "")
{ %>
<li>
<a href="<%:Util.get_setting("CustomMenuLinkUrl", "") %>"><%:Util.get_setting("CustomMenuLinkLabel", "") %></a>
</li>
<% } %>
<% if (Page.User.IsInRole(BtnetRoles.Admin))
{ %>
<li>
<a href="admin.aspx">admin</a>
</li>
<% }
else if (Page.User.IsInRole(BtnetRoles.ProjectAdmin))
{%>
<li>
<a href="users.aspx">users</a>
</li>
<% } %>
</ul>
<form class="navbar-form navbar-left" action="edit_bug.aspx" method="get">
<div class="form-group">
<input class="form-control" size="4" type="text" name="id" accesskey="g" placeholder="bug id">
</div>
<button type="submit" class="btn btn-default">go</button>
</form>

<% if (Util.get_setting("EnableSearch", "1") == "1" && Page.User.Identity.GetCanSearch())
{ %>

<form class="navbar-form navbar-left" role="search" action="search_text.aspx" method="get" onsubmit='return on_submit_search()'>
<div class="form-group">
<input type="text" class="form-control" id='lucene_input' name="query" accesskey="s" placeholder="Search">
</div>
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
<a href='lucene_syntax.html' target='_blank'>?</a>
</form>
<% } %>
<ul class="nav navbar-nav navbar-right">

<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-user"></span> <%:Page.User.Identity.Name %> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<% if (!Page.User.IsInRole(BtnetRoles.Guest))
{ %>
<li>
<a href="edit_self.aspx">settings</a>
</li>
<% } %>
<li>
<a href="logoff.aspx">logoff</a>
</li>

</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
</nav>
<span id="debug" style='position: absolute; top: 0; left: 0;'></span>
<script type='text/javascript' src='scripts/require.js'></script>
<script>
function dbg(s) {
document.getElementById('debug').innerHTML += (s + '<br>');
}
function on_submit_search() {
el = document.getElementById('lucene_input');
if (el.value == '') {
Expand All @@ -22,113 +117,9 @@
}
</script>
<script type='text/javascript'>
require.config({
baseUrl: 'scripts',
paths: {
jquery: 'jquery-1.11.1'
}
});
require(['jquery'], function ($) {
$(function () {
$('a').filter(function () { return this.hostname && this.hostname !== location.hostname; }).addClass('external-link');
$(function () {
$('a').filter(function () { return this.hostname && this.hostname !== location.hostname; }).addClass('external-link');
$('td.menu_td span:contains("<%:SelectedItem%>")').addClass("selected_menu_item");
});
$('li:has(a:contains("<%:SelectedItem%>"))').addClass("active");
});
</script>
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="menubar">
<tr>

<%= Util.context.Application["custom_logo"] %>
<td width="20">&nbsp;</td>
<td class='menu_td'>
<a href="bugs.aspx"><span class='menu_item warn' style='margin-left: 3px;'><%:btnet.Util.get_setting("PluralBugLabel", "bugs") %></span></a>
</td>



<% if (Page.User.Identity.GetCanSearch())
{ %>
<td class='menu_td'>
<a href="search.aspx"><span class='menu_item warn' style='margin-left: 3px;'>search</span></a>
</td>
<% } %>


<% if (Util.get_setting("EnableWhatsNewPage", "0") == "1")
{ %>
<td class='menu_td'>
<a href="view_whatsnew.aspx"><span class='menu_item warn' style='margin-left: 3px;'>news</span></a>
</td>
<% } %>

<% if (!Page.User.IsInRole(BtnetRoles.Guest))
{ %>
<td class='menu_td'>
<a href="queries.aspx"><span class='menu_item warn' style='margin-left: 3px;'>queries</span></a>
</td>
<% } %>

<% if (Page.User.IsInRole(BtnetRoles.Admin) || Page.User.Identity.GetCanUseReports() || Page.User.Identity.GetCanEditReports())
{ %>
<td class='menu_td'>
<a href="reports.aspx"><span class='menu_item warn' style='margin-left: 3px;'>reports</span></a>
</td>
<% } %>

<% if (Util.get_setting("CustomMenuLinkLabel", "") != "")
{ %>
<td class='menu_td'>
<a href="<%:Util.get_setting("CustomMenuLinkUrl", "") %>"><span class='menu_item warn' style='margin-left: 3px;'><%:Util.get_setting("CustomMenuLinkLabel", "") %></span></a>
</td>
<% } %>
<% if (Page.User.IsInRole(BtnetRoles.Admin))
{ %>
<td class='menu_td'>
<a href="admin.aspx"><span class='menu_item warn' style='margin-left: 3px;'>admin</span></a>
</td>
<% }
else if (Page.User.IsInRole(BtnetRoles.ProjectAdmin))
{%>
<td class='menu_td'>
<a href="users.aspx"><span class='menu_item warn' style='margin-left: 3px;'>users</span></a>
</td>
<% } %>

<td nowrap valign="middle">
<form style='margin: 0px; padding: 0px;' action="edit_bug.aspx" method="get">
<input class="menubtn" type="submit" value='go to ID'>
<input class="menuinput" size="4" type="text" class="txt" name="id" accesskey="g">
</form>
</td>
<% if (Util.get_setting("EnableSearch", "1") == "1" && Page.User.Identity.GetCanSearch())
{ %>
<td nowrap valign="middle">
<form style='margin: 0px; padding: 0px;' action="search_text.aspx" method="get" onsubmit='return on_submit_search()'>
<input class='menubtn' type='submit' value='search text'>
<input class='menuinput' id='lucene_input' size='24' type='text' class='txt'
value='<%:(string) HttpContext.Current.Session["query"] %>' name="query" accesskey="s">
<a href='lucene_syntax.html' target='_blank' style='font-size: 7pt;'>advanced</a>
</form>
</td>
<% }%>
<td nowrap valign="middle">
<span class="smallnote">logged in as <%:Page.User.Identity.Name %><br>
</span></td>
<td class='menu_td'>
<a href="logoff.aspx"><span class='menu_item warn' style='margin-left: 3px;'>logoff</span></a>
</td>

<% if (!Page.User.IsInRole(BtnetRoles.Guest))
{ %>
<td class='menu_td'>
<a href="edit_self.aspx"><span class='menu_item warn' style='margin-left: 3px;'>settings</span></a>
</td>
<% } %>
<td>
<a target='_blank' href='about.html'><span class='menu_item' style='margin-left: 3px;'>about</span></a></td>
<td>
<a target="_blank" href="http://ifdefined.com/README.html"><span class='menu_item' style='margin-left: 3px;'>help</span></a></td>
</tr>
</table>
<br>
9 changes: 5 additions & 4 deletions src/BugTracker.Web/LoggedIn.Master
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="LoggedIn.master.cs" Inherits="btnet.LoggedIn" %>

<%@ Register Src="~/Controls/MainMenu.ascx" TagPrefix="uc1" TagName="MainMenu" %>
<%@ Register Src="~/Controls/Footer.ascx" TagPrefix="uc1" TagName="Footer" %>


<!DOCTYPE html>

Expand All @@ -15,19 +17,18 @@
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<link href="Content/btnet-bootstrap-theme.css" rel="stylesheet" />
<script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="JavaScript" src="scripts/jquery-ui.min.js"></script>
<script type="text/javascript" language="JavaScript" src="datejs/date.js"></script>
<script type="text/javascript" src="scripts/jquery-ui.min.js"></script>
<script type="text/javascript" src="datejs/date.js"></script>

<asp:ContentPlaceHolder runat="server" ID="headerScripts"></asp:ContentPlaceHolder>

</head>
<body>
<uc1:MainMenu runat="server" ID="MainMenu" />
<asp:ContentPlaceHolder runat="server" ID="body"></asp:ContentPlaceHolder>
<uc1:Footer runat="server" ID="Footer" />
<script src="Scripts/bootstrap.min.js"></script>
</body>

<asp:contentplaceholder runat="server" id="footerScripts"></asp:contentplaceholder>

<% Response.Write(Application["custom_footer"]); %>
</html>
9 changes: 9 additions & 0 deletions src/BugTracker.Web/LoggedIn.Master.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 4 additions & 16 deletions src/BugTracker.Web/LoggedOut.Master
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="LoggedIn.master.cs" Inherits="btnet.LoggedIn" %>
<%@ Register Src="~/Controls/Footer.ascx" TagPrefix="uc1" TagName="Footer" %>


<!DOCTYPE html>

Expand All @@ -24,25 +26,11 @@
<div class="container" style="margin-top: 40px">
<asp:ContentPlaceHolder runat="server" ID="body"></asp:ContentPlaceHolder>
</div>
<footer class="page-footer">
<div class="container">
<ul class="text-muted">
<li>BugTracker.NET</li>
<li>·</li>
<li><a target="_blank" href="http://ifdefined.com/README.html">Help</a></li>
<li>·</li>
<li><a target="_blank" href="mailto:ctrager@yahoo.com">Feedback</a></li>
<li>·</li>
<li><a target="_blank" href="about.html">About</a></li>
<li>·</li>
<li><a target="_blank" href="http://ifdefined.com/README.html">Donate</a></li>
</ul>
</div>
</footer>
<uc1:Footer runat="server" id="Footer" />
<script src="Scripts/bootstrap.min.js"></script>
</body>

<asp:contentplaceholder runat="server" id="footerScripts"></asp:contentplaceholder>

<% Response.Write(Application["custom_footer"]); %>

</html>
Loading

0 comments on commit 82c1927

Please sign in to comment.