* 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
vnext
Paul Schneider 10 years ago
parent 91df3f431d
commit b918d9ff03
10 changed files with 62 additions and 27 deletions

@ -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

@ -261,7 +261,11 @@ namespace Yavsc.Controllers
ProfileBase prf = ProfileBase .Create (model.UserName);
prf.SetPropertyValue ("BlogVisible", model.BlogVisible);
prf.SetPropertyValue ("BlogTitle", model.BlogTitle);
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);

@ -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
/// </summary>
public class MvcApplication : System.Web.HttpApplication
{
/// <summary>
/// Registers the routes.
/// </summary>
/// <param name="routes">Routes.</param>
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 }
);
}

@ -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);

@ -29,7 +29,7 @@ table.layout TR TD { max-width:40%; }
<%= Html.ValidationMessage("WebSite", "*") %></td></tr>
<tr><td align="right">
Avatar </td><td> <img class="avatar" src="<%=Model.avatar%>" alt=""/>
Avatar </td><td> <img class="avatar" src="<%=Model.avatar%>?version=<%=Html.Encode(DateTime.Now.ToString())%>" alt=""/>
<input type="file" id="AvatarFile" name="AvatarFile"/>
<%= Html.ValidationMessage("AvatarFile", "*") %></td></tr>

@ -7,7 +7,7 @@
<%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %> -
<a href="/Blog/<%=Model.UserName%>">
<% if (ViewData["Avatar"]!=null) { %>
<img class="avatar" src="<%=ViewData["Avatar"]%>" alt=""/>
<img class="avatar" src="<%=ViewData["Avatar"]%>" alt="" id="logo"/>
<% } %>
<%=Html.Encode(ViewData["BlogTitle"])%>
</a> -

@ -269,9 +269,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add key="AdminEMail" value="paulschneider@free.fr" />
<add key="OwnerEMail" value="paulschneider@free.fr" />
<add key="Name" value="Psc" />
<!-- do not point "/Home/index" with the value for the "StartPage",
it would result in a redirection infinite loop -->
<!-- <add key="StartPage" value="/Blog" /> -->
<add key="DefaultController" value="Blogs" />
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
<add key="ClientValidationEnabled" value="true" />

@ -120,6 +120,8 @@
<Folder Include="Views\PayPal\" />
<Folder Include="ApiControllers\" />
<Folder Include="Views\Modules\" />
<Folder Include="ApiControllers\NightFlash\" />
<Folder Include="ApiControllers\NightFlash\Model\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\HomeController.cs" />
@ -177,6 +179,18 @@
<Compile Include="TemplateException.cs" />
<Compile Include="IValueProvider.cs" />
<Compile Include="Formatters\EstimToPdfFormatter.MSAN.cs" />
<Compile Include="ApiControllers\NightFlash\Model\NFEvent.cs" />
<Compile Include="ApiControllers\NightFlash\Model\OpenDay.cs" />
<Compile Include="ApiControllers\NightFlash\Model\Period.cs" />
<Compile Include="ApiControllers\NightFlash\Model\Periodicity.cs" />
<Compile Include="ApiControllers\NightFlash\Model\Position.cs" />
<Compile Include="ApiControllers\NightFlash\Model\PositionAndKeyphrase.cs" />
<Compile Include="ApiControllers\NightFlash\Model\ProvidedEvent.cs" />
<Compile Include="ApiControllers\NightFlash\Model\Publishing.cs" />
<Compile Include="ApiControllers\NightFlash\Model\Schedule.cs" />
<Compile Include="ApiControllers\NightFlash\Model\ProviderPublicInfo.cs" />
<Compile Include="ApiControllers\NightFlash\Model\WeekDay.cs" />
<Compile Include="ApiControllers\NightFlash\NightFlashController.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Web.config" />
@ -665,7 +679,6 @@
<Content Include="Views\FrontOffice\Estimate.aspx" />
<Content Include="Theme\dark\croix.png" />
<Content Include="Views\Admin\RemoveRole..aspx" />
<Content Include="web.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>

@ -85,7 +85,11 @@ namespace Yavsc.Model.RolesAndMembers
/// <value>The blog title.</value>
[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; } }
/// <summary>
/// Gets or sets the phone number.

Loading…