Implements the alternate style sheet publication

* style.css: this floating breaks my dark style

* Global.asax: the application object is now compiled at runtime,
its code is in App_Code

* YavscHelpers.cs: Implements a method helping to refer on themed
  stylesheets,
presenting the "alternate" stylesheet usage.

* App.master: Uses the new Helper function to refer on the
main style sheet `style.css`

* Web.config: * no more default controller, instead, modify the app
  code
* the client side javascript validation is custommized, and we do not
  need the M$ js for now

* Web.csproj: Global.asax.cs becomes a content, compiled at runtime,
  found in ~/App_Code

* Global.asax.cs: Now compiles at runtime.

* Makefile: adds my deployment targets
vnext
Paul Schneider 9 years ago
parent a62cff223c
commit 47285f8b83
10 changed files with 108 additions and 21 deletions

@ -1,3 +1,7 @@
2015-11-18 Paul Schneider <paul@pschneider.fr>
* Makefile: adds my deployment targets
2015-11-17 Paul Schneider <paul@pschneider.fr>
* Makefile: adds nuget targets

@ -4,11 +4,8 @@ CONFIG=Debug
LDYDESTDIR=dist/web/$(CONFIG)
COPYUNCHANGED="false"
HOST_rsync_yavsc=lua.pschneider.fr
DESTDIR_rsync_yavsc=/srv/www/yavsc
HOST_rsync_lua=lua.pschneider.fr
DESTDIR_rsync_lua=/srv/www/lua
HOST_rsync_dev=lua.pschneider.fr
DESTDIR_rsync_dev=/srv/www/yavscdev
HOST_rsync_pre=lua.pschneider.fr
DESTDIR_rsync_pre=/srv/www/yavscpre
@ -16,6 +13,18 @@ DESTDIR_rsync_pre=/srv/www/yavscpre
HOST_rsync_prod=lua.pschneider.fr
DESTDIR_rsync_prod=/srv/www/yavsc
HOST_rsync_lua=lua.pschneider.fr
DESTDIR_rsync_lua=/srv/www/lua
HOST_rsync_totemdev=lua.pschneider.fr
DESTDIR_rsync_totemdev=/srv/www/totemdev
HOST_rsync_totempre=lua.pschneider.fr
DESTDIR_rsync_totempre=/srv/www/totempre
HOST_rsync_totemprod=lua.pschneider.fr
DESTDIR_rsync_totemprod=/srv/www/totemprod
DOCASSBS=NpgsqlBlogProvider.dll WorkFlowProvider.dll Yavsc.WebControls.dll ITContentProvider.dll NpgsqlMRPProviders.dll Yavsc.dll SalesCatalog.dll YavscModel.dll
RSYNCCMD=rsync -ravu --chown=www-data:www-data

@ -28,11 +28,6 @@ namespace Yavsc
/// <param name="routes">Routes.</param>
public static void RegisterRoutes (RouteCollection routes)
{
// Should be FrontOffice in a POS,
string defaultController =
WebConfigurationManager.AppSettings ["DefaultController"];
if (defaultController == null)
defaultController = "Home";
routes.IgnoreRoute ("{resource}.axd/{*pathInfo}"); // not used
routes.IgnoreRoute ("Scripts/{*pathInfo}"); // web user side scripts
routes.IgnoreRoute ("App_Theme/{*pathInfo}"); // sites themes
@ -56,7 +51,7 @@ namespace Yavsc
"blog/{user}",
new { controller = "Blogs",
action = "UserPosts",
user="Paul Schneider" }
user= UrlParameter.Optional }
);
routes.MapRoute (

@ -97,7 +97,6 @@ main video, main img {
aside {
display: inline-block;
float: right;
}
.postpreview {

@ -1,3 +1,29 @@
2015-11-18 Paul Schneider <paul@pschneider.fr>
* style.css: this floating breaks my dark style
* Global.asax: the application object is now compiled at
runtime,
its code is in App_Code
* YavscHelpers.cs: Implements a method helping to refer on
themed stylesheets,
presenting the "alternate" stylesheet usage.
* App.master: Uses the new Helper function to refer on the
main style sheet `style.css`
* Web.config: * no more default controller, instead, modify
the app code
* the client side javascript validation is custommized, and we
do not need the M$ js for now
* Web.csproj: Global.asax.cs becomes a content, compiled at
runtime, found in ~/App_Code
* Global.asax.cs: Now compiles at runtime.
2015-11-18 Paul Schneider <paul@pschneider.fr>
* style.css:

@ -1 +1 @@
<%@ Application Inherits="Yavsc.MvcApplication" %>
<%@ Application Codebehind="Global.asax.cs" Inherits="Yavsc.MvcApplication" Language="C#" %>

@ -16,6 +16,7 @@ using System.Web.Script.Serialization;
using System.Web.Mvc;
using System.Text.RegularExpressions;
using Yavsc.Model.Messaging;
using System.Linq;
namespace Yavsc.Helpers
{
@ -338,7 +339,63 @@ namespace Yavsc.Helpers
}
return new MvcHtmlString(strwr.ToString());
}
/// <summary>
/// The available themes.
/// </summary>
public static string[] AvailableThemes = {
"clear", "dark", "blue", "green"
};
/// <summary>
/// Themes the CSS links.
/// </summary>
/// <returns>The CSS links.</returns>
/// <param name="html">Html.</param>
/// <param name="theme">Theme.</param>
/// <param name="baseName">Base name.</param>
public static IHtmlString ThemeCSSLinks (
this System.Web.Mvc.HtmlHelper html, string theme, string baseName) {
if (!AvailableThemes.Contains (theme))
throw new ArgumentException ("The given theme is not configured: " +
theme);
if (string.IsNullOrWhiteSpace(baseName))
throw new ArgumentException ("Specify a base name");
StringWriter strwr = new StringWriter ();
HtmlTextWriter writer = new HtmlTextWriter(strwr);
// refer to the global style
writer.AddAttribute ("rel", "stylesheet");
writer.AddAttribute ("title", theme);
writer.AddAttribute ("href",
string.Format(
"/App_Themes/{1}.css",
theme,baseName));
writer.RenderBeginTag ("link");
// refer to the themed style
writer.AddAttribute ("rel", "stylesheet");
writer.AddAttribute ("title", theme);
writer.AddAttribute ("href",
string.Format(
"/App_Themes/{0}/{1}.css",
theme,baseName));
writer.RenderBeginTag ("link");
// refer to alternate styles
foreach (string atheme in AvailableThemes) {
if (atheme != theme) {
writer.AddAttribute ("rel", "alternate stylesheet");
writer.AddAttribute ("title", atheme);
writer.AddAttribute ("href",
string.Format (
"/App_Themes/{0}/{1}.css",
atheme, baseName));
writer.RenderBeginTag ("link");
}
}
return new MvcHtmlString(strwr.ToString());
}
}
}

@ -11,8 +11,7 @@ Page.StyleSheetTheme = (string) Profile.UITheme; %>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/"+Page.StyleSheetTheme+"/style.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/style.css")%>" />
<%= Html.ThemeCSSLinks(Page.StyleSheetTheme,"style")%>
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/font-awesome.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/jquery-ui.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/prettify.css")%>" />

@ -266,11 +266,10 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add key="AdminEMail" value="paul@pschneider.fr" />
<add key="OwnerEMail" value="paul@pschneider.fr" />
<add key="Name" value="yavsc" />
<add key="DefaultController" value="Blogs" />
<add key="DefaultAvatar" value="/App_Themes/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<!-- <add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> -->
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger" />
<add key="GOOGLE_API_KEY" value="[YOUR_GOOGLE_API_KEY]" />
<add key="GOOGLE_CLIENT_ID" value="[YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com]" />

@ -144,12 +144,10 @@
<Folder Include="Views\PayPal\" />
<Folder Include="Views\Modules\" />
<Folder Include="xmldoc\" />
<Folder Include="App_Code\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\BlogsController.cs" />
<Compile Include="AssemblyInfo.cs" />
@ -490,6 +488,7 @@
<Content Include="Scripts\yavsc.skills.js" />
<Content Include="Views\FrontOffice\UserSkills.aspx" />
<Content Include="Views\FrontOffice\UserCard.ascx" />
<Content Include="App_Code\Global.asax.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

Loading…