Skip to content

Commit

Permalink
implemented versioning of content based on assembly version
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbeletsky committed Apr 16, 2011
1 parent 4b47492 commit ef38ebc
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 26 deletions.
5 changes: 3 additions & 2 deletions src/Web/Areas/Admin/Views/BlogManagement/AllPosts.aspx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/BlogManagement.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace = "Web.Helpers.Extensions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
Search: <input id="post-name" />
Expand All @@ -7,6 +8,6 @@
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
<script src="<%: Url.Content("~/Scripts/Controls/control.editposts.js") + "?ver=1013"%>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/Controllers/controller.editposts.js") + "?ver=1013"%>" type="text/javascript"></script>
<script src="<%: Url.ContentWithVersion("~/Scripts/Controls/control.editposts.js") %>" type="text/javascript"></script>
<script src="<%: Url.ContentWithVersion("~/Scripts/Controllers/controller.editposts.js") %>" type="text/javascript"></script>
</asp:Content>
3 changes: 2 additions & 1 deletion src/Web/Areas/Admin/Views/Login/Index.aspx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Web.Areas.Admin.Models.AdminLogin>" %>
<%@ Import Namespace = "Web.Helpers.Extensions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Admin | Login</title>
<link href="../../../../Content/admin-login.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="<% Url.ContentWithVersion("~/Content/admin.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="admin-login">
Expand Down
3 changes: 2 additions & 1 deletion src/Web/Areas/Admin/Views/Shared/Admin.Master
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@ Import Namespace = "Web.Helpers.Extensions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link href="../../../../Content/admin.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="<% Url.ContentWithVersion("~/Content/admin.css") %>" rel="stylesheet" type="text/css" />
<script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>

<asp:ContentPlaceHolder ID="HeadContent" runat="server" />
Expand Down
7 changes: 4 additions & 3 deletions src/Web/Areas/User/Views/Dashboard/Index.aspx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%@ Page Title="Trackyt.net | Dashboard" Language="C#" MasterPageFile="~/Areas/User/Views/Shared/Dashboard.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="Web.Helpers.Extensions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="maincontent" runat="server">
<%: Html.TextBox("apiToken", ViewData["ApiToken"], new { type = "hidden" }) %>
Expand Down Expand Up @@ -27,7 +28,7 @@
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="<%: Url.Content("~/Scripts/Api/api.js") + "?ver=1013" %>"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/Controls/control.tasks.js") + "?ver=1013" %>"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/Controllers/controller.dashboard.js") + "?ver=1013" %>"></script>
<script type="text/javascript" src="<%: Url.ContentWithVersion("~/Scripts/Api/api.js") %>"></script>
<script type="text/javascript" src="<%: Url.ContentWithVersion("~/Scripts/Controls/control.tasks.js") %>"></script>
<script type="text/javascript" src="<%: Url.ContentWithVersion("~/Scripts/Controllers/controller.dashboard.js") %>"></script>
</asp:Content>
4 changes: 3 additions & 1 deletion src/Web/Areas/User/Views/Share/Error.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@{
Layout = null;
}
@using Web.Helpers.Extensions

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
Expand All @@ -17,7 +19,7 @@
<meta name="description" content="trackyt.net shared tasks page">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../../../Content/share.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="@Url.ContentWithVersion("../../Content/share.css")" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
Expand Down
4 changes: 2 additions & 2 deletions src/Web/Areas/User/Views/Share/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@{
Layout = null;
}

@model IList<Trackyt.Core.DAL.DataModel.Task>
@using Web.Helpers.Extensions

<!doctype html>
<html lang="en" class="no-js">
Expand All @@ -14,7 +14,7 @@
<meta name="description" content="trackyt.net shared tasks page">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../../Content/share.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="@Url.ContentWithVersion("../../Content/share.css")" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
Expand Down
12 changes: 7 additions & 5 deletions src/Web/Areas/User/Views/Shared/Dashboard.Master
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@ Import Namespace="Web.Helpers.Extensions" %>

<!DOCTYPE html>
<html>
<head runat="server">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link href="../../../../Content/dashboard.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="../../../../Content/confirm.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="../../../../Content/custom-theme/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
<link href="<%: Url.ContentWithVersion("~/Content/dashboard.css") %>" rel="stylesheet" type="text/css" />
<link href="<%: Url.ContentWithVersion("~/Content/confirm.css") %>" rel="stylesheet" type="text/css" />
<link href="<%: Url.Content("~/Content/custom-theme/jquery-ui-1.8.10.custom.css") %>" rel="stylesheet" type="text/css" />

<script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/jquery-ui-1.8.10.custom.min.js")%>"></script>
<script type="text/javascript" src="<%: Url.Content("~/Scripts/jquery.confirm.js") + "?ver=109" %>"></script>
<script src="<%: Url.Content("~/Scripts/jquery-ui-1.8.10.custom.min.js")%>" type="text/javascript" ></script>
<script src="<%: Url.Content("~/Scripts/jquery.confirm.js")%>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.blockUI.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/json2.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.postJson.js") %>" type="text/javascript"></script>
Expand Down
33 changes: 33 additions & 0 deletions src/Web/Helpers/Extensions/UrlContentWithVersionExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Reflection;

namespace Web.Helpers.Extensions
{
public static class UrlContentWithVersionExtension
{
private static string _currentAssemblyVersion;

public static string ContentWithVersion(this UrlHelper helper, string path)
{
var contentPath = helper.Content(path);
var assemblyVersionString = GetAssemblyVersionString();

return string.Format("{0}?ver={1}", contentPath, assemblyVersionString);
}

private static string GetAssemblyVersionString()
{
if (_currentAssemblyVersion == null)
{
var currentAssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
_currentAssemblyVersion = currentAssemblyVersion.ToString().Replace(".", "");
}

return _currentAssemblyVersion;
}
}
}
3 changes: 2 additions & 1 deletion src/Web/Views/Error/GenericError.aspx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@Import Namespace = "Web.Helpers.Extensions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link href="../../Content/public-login.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="<%: Url.ContentWithVersion("~/Content/public-login.css") %>" rel="stylesheet" type="text/css" />
<title>Trackyt.net | Ooops</title>
</head>
<body>
Expand Down
3 changes: 2 additions & 1 deletion src/Web/Views/Login/Index.aspx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<%@ Page Title="Trackyt.net | Sign In" Language="C#" Inherits="System.Web.Mvc.ViewPage<Web.Models.LoginModel>" %>
<%@Import Namespace = "Web.Helpers.Extensions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<link href="../../Content/public-login.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="<%: Url.ContentWithVersion("~/Content/public-login.css") %>" rel="stylesheet" type="text/css" />

<link rel="shortcut icon" href="~/Content/Images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="~/Content/Images/favicon.ico" type="image/ico" />
Expand Down
5 changes: 3 additions & 2 deletions src/Web/Views/Registration/Index.aspx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<%@ Page Title="Trackyt.net | Sign Up" Language="C#" Inherits="System.Web.Mvc.ViewPage<Web.Models.RegisterUserModel>" %>
<%@Import Namespace = "Web.Helpers.Extensions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<link href="../../Content/public-login.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="<%: Url.ContentWithVersion("~/Content/public-login.css") %>" rel="stylesheet" type="text/css" />
<script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/Controllers/controller.registration.js") + "?ver=1013" %>" type="text/javascript"></script>
<script src="<%: Url.ContentWithVersion("~/Scripts/Controllers/controller.registration.js")%>" type="text/javascript"></script>

<link rel="shortcut icon" href="~/Content/Images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="~/Content/Images/favicon.ico" type="image/ico" />
Expand Down
7 changes: 3 additions & 4 deletions src/Web/Views/Registration/Mobile.cshtml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
@{
Layout = null;
}

@model Web.Models.RegisterUserModel
@using Web.Helpers.Extensions

<!DOCTYPE html>

<html>
<head>
<title>Trackyt.net | Registration</title>
<link rel="shortcut icon" href="~/Content/Images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="~/Content/Images/favicon.ico" type="image/ico" />

<link href="../Content/public-login.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="@(Url.ContentWithVersion("~/Content/public-login.css"))" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="content">
Expand Down Expand Up @@ -42,6 +41,6 @@
</div>

<script src="@Url.Content("~/Scripts/jquery-1.4.1.min.js")" type="text/javascript"></script>
<script src="@(Url.Content("~/Scripts/Controllers/controller.registration.js") + "?ver=1013")" type="text/javascript"></script>
<script src="@(Url.ContentWithVersion("~/Scripts/Controllers/controller.registration.js"))" type="text/javascript"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion src/Web/Views/Registration/Success.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@{
Layout = null;
}
@using Web.Helpers.Extensions

<!DOCTYPE html>

Expand All @@ -10,7 +11,7 @@
<link rel="shortcut icon" href="~/Content/Images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="~/Content/Images/favicon.ico" type="image/ico" />

<link href="../Content/public-login.css?ver=1013" rel="stylesheet" type="text/css" />
<link href="@(Url.ContentWithVersion("~/Content/public-login.css"))" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="content">
Expand Down
5 changes: 3 additions & 2 deletions src/Web/Views/Shared/Public.Master
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<%@ Master Language="C#" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@Master Language="C#" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@Import Namespace="Web.Helpers.Extensions" %>

<!DOCTYPE html>
<html>
<head runat="server">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../Content/public.css?ver=1013" type="text/css" media="all" />
<link rel="stylesheet" href="<%: Url.ContentWithVersion("~/Content/public.css") %>" type="text/css" media="all" />

<script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/ga.js") %>" type="text/javascript"></script>
Expand Down
1 change: 1 addition & 0 deletions src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<Compile Include="Controllers\RegistrationController.cs" />
<Compile Include="Helpers\BlogPostsHelper.cs" />
<Compile Include="Helpers\BlogPostProcessor.cs" />
<Compile Include="Helpers\Extensions\UrlContentWithVersionExtension.cs" />
<Compile Include="Infrastructure\Error\HandleJsonError.cs" />
<Compile Include="Infrastructure\Exceptions\UserNotAuthorized.cs" />
<Compile Include="Infrastructure\TrackyNotificationServiceProvider.cs" />
Expand Down

0 comments on commit ef38ebc

Please sign in to comment.