Skip to content

Commit

Permalink
Sticky footer with version info
Browse files Browse the repository at this point in the history
  • Loading branch information
moonpyk committed Apr 14, 2013
1 parent 52f7bb7 commit ec5064d
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 73 deletions.
1 change: 1 addition & 0 deletions SQLServerBackupTool.Lib/SQLServerBackupTool.Lib.csproj
Expand Up @@ -51,6 +51,7 @@
<Compile Include="ISqlBackupProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
<Compile Include="Versioning\VersionInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="MSBuild\Version.targets" />
Expand Down
75 changes: 75 additions & 0 deletions SQLServerBackupTool.Lib/Versioning/VersionInfo.cs
@@ -0,0 +1,75 @@
using System;
using System.Reflection;

namespace SQLServerBackupTool.Lib.Versioning
{
/// <summary>
/// Utilitaire d'aide à l'affichage du numero de version
/// Compatible avec tous les SCM, il suffit juste de créer la bonne task de build
/// </summary>
public static class VersionInfo
{
private static Version _cachedVersion;
private static string _cachedVersionHash;
private static Assembly _cachedAssembly;

/// <summary>
/// Assembly en cours d'éxécution
/// </summary>
public static Assembly Assembly
{
get
{
return _cachedAssembly ?? (_cachedAssembly = Assembly.GetExecutingAssembly());
}
}

/// <summary>
/// Version de l'assembly pure
/// </summary>
public static Version Version
{
get
{
return _cachedVersion ?? (_cachedVersion = Assembly.GetName().Version);
}
}

/// <summary>
/// Hash de version Git/Hg ou numéro de révision SVN
/// </summary>
public static string InformalVersion
{
get
{
if (_cachedVersionHash == null)
{
_cachedVersionHash = String.Empty;

var attrs = Assembly
.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);

if (attrs.Length > 0)
{
_cachedVersionHash =
((AssemblyInformationalVersionAttribute)attrs[0]).InformationalVersion;
}
}

return _cachedVersionHash;
}
}

/// <summary>
/// Permet de récuperer un numéro de version simple sous forme d'int.
/// <remarks>V-1 n'est pas forcement > VCurrent !</remarks>
/// </summary>
public static int SimpleVersionToken
{
get
{
return Math.Abs(Version.GetHashCode());
}
}
}
}
20 changes: 20 additions & 0 deletions SQLServerBackupTool.Web/Content/Site.css
Expand Up @@ -4844,6 +4844,26 @@ a.label:hover, a.label:focus, a.badge:hover, a.badge:focus {
-moz-box-sizing: border-box;
box-sizing: border-box; }

html, body {
height: 100%; }

#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -30px; }

#push,
#footer {
height: 30px; }

#footer {
background-color: #eeeeee; }
#footer div {
font-size: 85%;
padding-left: 5px;
padding-top: 5px; }

.ss {
color: #999999; }

Expand Down
137 changes: 82 additions & 55 deletions SQLServerBackupTool.Web/Content/Site.scss
Expand Up @@ -4,119 +4,146 @@ $iconSpritePath: "img/glyphicons-halflings.png";
$iconWhiteSpritePath: "img/glyphicons-halflings-white.png";

$linkColor: $purple;
$footerHeight: 30px;

@import "bootstrap/bootstrap";

html, body {
height: 100%;
}

#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
//Negative indent footer by it's height
margin: 0 auto #{-1* $footerHeight};
}

#push,
#footer {
height: $footerHeight;
}

#footer {
background-color: $grayLighter;
div {
font-size: 85%;
padding-left: 5px;
padding-top: 5px;
}
}

.ss {
color: $grayLight;
color: $grayLight;
}

.boxed {
@include border-radius(4px);
border: 1px solid $tableBorder;
padding: 5px;
@include border-radius(4px);
border: 1px solid $tableBorder;
padding: 5px;
}

.userbox {
@extend .boxed;
padding: 3px 3px 3px 5px;
margin-bottom: 10px;
@extend .boxed;
padding: 3px 3px 3px 5px;
margin-bottom: 10px;
}

.purple {
color: $purple;
color: $purple;
}

.table-vmiddle {
tr {
td, th {
vertical-align: middle;
}
tr {
td, th {
vertical-align: middle;
}
}
}

.vmiddle {
vertical-align: middle;
vertical-align: middle;
}

.fullcenter {
@extend .vmiddle;
text-align: center;
@extend .vmiddle;
text-align: center;
}

.table-bordered th, .table-bordered td {
&.fullcenter {
@extend .fullcenter;
}
&.fullcenter {
@extend .fullcenter;
}
}

.title {
text-transform: lowercase;
text-transform: lowercase;
}

#top-bar {
@include border-radius(0 0 6px 6px);
padding: 1px 10px;
margin-bottom: 10px;
background-color: #F7F7F7;
border: 1px solid $grayLighter;
@include border-radius(0 0 6px 6px);
padding: 1px 10px;
margin-bottom: 10px;
background-color: #F7F7F7;
border: 1px solid $grayLighter;
}

.alert {
margin-bottom: 10px;
margin-bottom: 10px;
}

#nav {
margin-top: 11px;
margin-top: 11px;
}

.loading {
display: none;
.message {
text-align: center;
}
.pldr {
/**/
}
display: none;
.message {
text-align: center;
}
.pldr {
/**/
}
}

.backup-delete {
/**/
/**/
}

.backup-do {
/**/
/**/
}

.no-row td {
text-align: center;
text-align: center;
}

@media (max-width: 767px) {
#top-bar {
h1 {
font-size: 25px;
}
}
.container-fluid {
padding-right: 10px;
padding-left: 10px;
}
.btn span {
display: none;
#top-bar {
h1 {
font-size: 25px;
}
}
.container-fluid {
padding-right: 10px;
padding-left: 10px;
}
.btn span {
display: none;
}
}

@media (max-width: 480px) {
#top-bar {
h1 {
font-size: 15px;
line-height: 28px;
}
}
#nav {
margin-top: 6px;
#top-bar {
h1 {
font-size: 15px;
line-height: 28px;
}
}
#nav {
margin-top: 6px;
}
}

@import "select2";
45 changes: 27 additions & 18 deletions SQLServerBackupTool.Web/Views/Shared/_Layout.cshtml
@@ -1,30 +1,39 @@
<!DOCTYPE HTML>
@using SQLServerBackupTool.Lib.Versioning
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SQLServer Backup Tool @(!string.IsNullOrWhiteSpace(ViewBag.Title) ? " - " + ViewBag.Title : null)</title>
@Styles.Render("~/Content/css")
</head>
<body>
<div class="container-fluid">
<div id="top-bar">
<ul id="nav" class="nav nav-pills pull-right">
<li class="@(ViewBag.ControllerName == "Home" ? "active" : null)">
<a href="@Url.Action("Index", "Home")"><i class="icon-home"></i>&nbsp;Home</a>
</li>
@if (User.IsInRole("Admin"))
{
<li class="@(ViewBag.ControllerName == "Users" ? "active" : null)">
<a href="@Url.Action("Index", "Users")"><i class="icon-user"></i>&nbsp;Users</a>
<div id="wrap">
<div class="container-fluid">
<div id="top-bar">
<ul id="nav" class="nav nav-pills pull-right">
<li class="@(ViewBag.ControllerName == "Home" ? "active" : null)">
<a href="@Url.Action("Index", "Home")"><i class="icon-home"></i>&nbsp;Home</a>
</li>
}
</ul>
<h1>
<span class="ss">SS</span>BT<span class="purple">.web</span> - <span class="title">@ViewBag.Title</span>
</h1>
@if (User.IsInRole("Admin"))
{
<li class="@(ViewBag.ControllerName == "Users" ? "active" : null)">
<a href="@Url.Action("Index", "Users")"><i class="icon-user"></i>&nbsp;Users</a>
</li>
}
</ul>
<h1>
<span class="ss">SS</span>BT<span class="purple">.web</span> - <span class="title">@ViewBag.Title</span>
</h1>
</div>
@Html.RenderFlashMessages()
@RenderBody()
</div>
<div id="push"></div>
</div>
<div id="footer">
<div>
Backed with love by <a target="_blank" href="http://www.moonpyk.net">@@moonpyk</a> - ssbt.web | v@(VersionInfo.Version) (@VersionInfo.InformalVersion)
</div>
@Html.RenderFlashMessages()
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery", "~/bundles/ssbtw")
@RenderSection("scripts", false)
Expand Down

0 comments on commit ec5064d

Please sign in to comment.