From b918d9ff0369ecd308fe8b9c697eb154c64fcd79 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 23 Apr 2015 04:39:34 +0200 Subject: [PATCH] * Makefile: target set clarified * Profile.aspx: * AccountController.cs: Fixes the avatar display at edition time. * style.css: * UserPost.aspx: the users avatar as the page logo, floating at left * Web.config: * Global.asax.cs: Uses a new application parameter named "DefaultController", usage defaulting to "Blogs". * Web.csproj: * web.config: * Profile.cs: Fixes a default blog title using a null user's full name --- Makefile | 33 +++++++++++++++----------- web/Controllers/AccountController.cs | 6 ++++- web/Global.asax.cs | 14 +++++++++-- web/Theme/style.css | 4 ++++ web/Views/Account/Profile.aspx | 2 +- web/Views/Blogs/UserPost.aspx | 2 +- web/Web.config | 4 +--- web/Web.csproj | 15 +++++++++++- web/web.config | 3 --- yavscModel/RolesAndMemebers/Profile.cs | 6 ++++- 10 files changed, 62 insertions(+), 27 deletions(-) delete mode 100644 web/web.config diff --git a/Makefile b/Makefile index 6e65698c..1c6a33e1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION=1.1 CONFIG=Debug -DESTDIR=build/web/$(CONFIG) +LDYDESTDIR=build/web/$(CONFIG) COPYUNCHANGED="false" HOST_rsync_local=localhost @@ -10,8 +10,8 @@ DESTDIR_rsync_local=/srv/www/yavsc HOST_rsync_test=localhost DESTDIR_rsync_test=/srv/www/lua -HOST_rsync_preprod=lua.localdomain -DESTDIR_rsync_preprod=/srv/www/yavsc +HOST_rsync_pre=lua.localdomain +DESTDIR_rsync_pre=/srv/www/yavsc HOST_rsync_prod=lua.localdomain DESTDIR_rsync_prod=/srv/www/lua @@ -23,34 +23,29 @@ RSYNCCMD=rsync -ravu --chown=www-data:www-data all: deploy ddir: - mkdir -p $(DESTDIR) + mkdir -p $(LDYDESTDIR) deploy: ddir build - rm -rf $(DESTDIR) - xbuild /p:Configuration=$(CONFIG) /p:SkipCopyUnchangedFiles=$(COPYUNCHANGED) /p:DeployDir=../$(DESTDIR) /t:Deploy web/Web.csproj - mv $(DESTDIR)/Web.config $(DESTDIR)/Web.config.new + rm -rf $(LYDESTDIR) + xbuild /p:Configuration=$(CONFIG) /p:SkipCopyUnchangedFiles=$(COPYUNCHANGED) /p:DeployDir=../$(LDYDESTDIR) /t:Deploy web/Web.csproj + mv $(LDYDESTDIR)/Web.config $(LDYDESTDIR)/Web.config.new rsync_% : HOST = $(HOST_$@) rsync_% : DESTDIR = $(DESTDIR_$@) -rsync_% : +rsync_% : deploy echo "!Deploying to $(HOST)!" $(RSYNCCMD) build/web/$(CONFIG)/ root@$(HOST):$(DESTDIR) ssh root@$(HOST) apachectl restart -rsync: rsync_test - build: xbuild /p:Configuration=$(CONFIG) /t:Build Yavsc.sln clean: xbuild /t:Clean - rm -rf $(DESTDIR) - - -allrsync: rsync_local rsync_test rsync_preprod rsync_prod + rm -rf $(LDYDESTDIR) sourcepkg: git archive --format=tar --prefix=yavsc-$(CONFIG)/ $(CONFIG) | bzip2 > yavsc-$(CONFIG).tar.bz2 @@ -67,4 +62,14 @@ htmldoc: xmldoc docdeploy-prod: htmldoc rsync -ravu web/htmldoc root@$(PRODHOSTDIR) +rsync_local: + +rsync_test: + +rsync_pre: + +rsync_prod: + +bigrsync: rsync_test rsync_local rsync_pre rsync_prod + diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index bcbc9bc9..79b20181 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -261,7 +261,11 @@ namespace Yavsc.Controllers ProfileBase prf = ProfileBase .Create (model.UserName); prf.SetPropertyValue ("BlogVisible", model.BlogVisible); prf.SetPropertyValue ("BlogTitle", model.BlogTitle); - prf.SetPropertyValue ("avatar", model.avatar); + if (AvatarFile != null) { + prf.SetPropertyValue ("avatar", model.avatar); + } else { + model.avatar = (string) prf.GetPropertyValue ("avatar"); + } prf.SetPropertyValue ("Address", model.Address); prf.SetPropertyValue ("CityAndState", model.CityAndState); prf.SetPropertyValue ("Country", model.Country); diff --git a/web/Global.asax.cs b/web/Global.asax.cs index a4a20bd1..926911cd 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -12,6 +12,7 @@ using System.Web.Mvc; using System.Web.Http; using System.Web.WebPages.Scope; using System.Reflection; +using System.Web.Configuration; namespace Yavsc { @@ -21,13 +22,19 @@ namespace Yavsc /// public class MvcApplication : System.Web.HttpApplication { + /// /// Registers the routes. /// /// Routes. public static void RegisterRoutes (RouteCollection routes) { - + // Should be FrontOffice + string defaultController = WebConfigurationManager.AppSettings ["DefaultController"]; + if (defaultController == null) + { + defaultController = "Admin"; + } routes.IgnoreRoute ("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute ("Scripts/{*pathInfo}"); routes.IgnoreRoute ("Theme/{*pathInfo}"); @@ -58,7 +65,10 @@ namespace Yavsc routes.MapRoute ( "Default", "{controller}/{action}/{user}/{title}", - new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional } + new { controller = defaultController, + action = "Index", + user=UrlParameter.Optional, + title = UrlParameter.Optional } ); } diff --git a/web/Theme/style.css b/web/Theme/style.css index f42af7eb..4d25738f 100644 --- a/web/Theme/style.css +++ b/web/Theme/style.css @@ -27,6 +27,10 @@ fieldset { border-radius:5px; border: solid 1px #000060; float:left; } +#logo { + float: left; + + } .panel,.bshpanel,aside { background-color: rgba(32,16,16,0.8); diff --git a/web/Views/Account/Profile.aspx b/web/Views/Account/Profile.aspx index 1861f860..21843f2f 100644 --- a/web/Views/Account/Profile.aspx +++ b/web/Views/Account/Profile.aspx @@ -29,7 +29,7 @@ table.layout TR TD { max-width:40%; } <%= Html.ValidationMessage("WebSite", "*") %> -Avatar +Avatar <%= Html.ValidationMessage("AvatarFile", "*") %> diff --git a/web/Views/Blogs/UserPost.aspx b/web/Views/Blogs/UserPost.aspx index 1f00583e..f28a1da7 100644 --- a/web/Views/Blogs/UserPost.aspx +++ b/web/Views/Blogs/UserPost.aspx @@ -7,7 +7,7 @@ <%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %> - <% if (ViewData["Avatar"]!=null) { %> -" alt=""/> +" alt="" id="logo"/> <% } %> <%=Html.Encode(ViewData["BlogTitle"])%> - diff --git a/web/Web.config b/web/Web.config index c282c6d7..3e1c64ba 100644 --- a/web/Web.config +++ b/web/Web.config @@ -269,9 +269,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - - + diff --git a/web/Web.csproj b/web/Web.csproj index 7690cd1c..208867dc 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -120,6 +120,8 @@ + + @@ -177,6 +179,18 @@ + + + + + + + + + + + + @@ -665,7 +679,6 @@ - diff --git a/web/web.config b/web/web.config deleted file mode 100644 index 67113e62..00000000 --- a/web/web.config +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/yavscModel/RolesAndMemebers/Profile.cs b/yavscModel/RolesAndMemebers/Profile.cs index 3e0e2d28..2d2cb004 100644 --- a/yavscModel/RolesAndMemebers/Profile.cs +++ b/yavscModel/RolesAndMemebers/Profile.cs @@ -85,7 +85,11 @@ namespace Yavsc.Model.RolesAndMembers /// The blog title. [DisplayName ("Titre du blog")] [StringLength (255)] - public string BlogTitle { get { return blogTitle==null? Name+"'s blog":blogTitle; } set { blogTitle = value; } } + public string BlogTitle { get { + return string.IsNullOrWhiteSpace(blogTitle)? + (string.IsNullOrWhiteSpace(Name)? + UserName:Name)+"'s blog":blogTitle; } + set { blogTitle = value; } } /// /// Gets or sets the phone number.