From 5f40448890e2dce071c57ef5b7ad7cd23220626f Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 1 Oct 2015 22:38:47 +0200 Subject: [PATCH] Fixes profile edition, refactoring profile property names, because of of weird NpgsqlException about the property group name. * style.css: more space * Web.config: * YavscHelpers.cs: * OAuth2.cs: * AccountController.cs: * Profile.cs: refactoring * BlogsController.cs: A new page, to become a media chooser * App.master: nice small parralax.js, could work on android browers * Web.config: unix line endings --- web/App_Themes/style.css | 26 ++++++------ web/ChangeLog | 16 +++++++ web/Controllers/AccountController.cs | 12 +++--- web/Controllers/BlogsController.cs | 5 +++ web/Helpers/Google/OAuth2.cs | 2 +- web/Helpers/YavscHelpers.cs | 2 +- web/Models/App.master | 61 ++++++++++++++++++++++----- web/Views/Web.config | 2 +- web/Web.config | 49 +++++++++------------ yavscModel/ChangeLog | 4 ++ yavscModel/RolesAndMembers/Profile.cs | 27 ++++++------ 11 files changed, 131 insertions(+), 75 deletions(-) diff --git a/web/App_Themes/style.css b/web/App_Themes/style.css index 2b885508..45438408 100644 --- a/web/App_Themes/style.css +++ b/web/App_Themes/style.css @@ -16,41 +16,43 @@ input, textarea, checkbox { header { border-radius:10px; - margin: .5em; - padding: .5em; + margin: 1em; + padding: 3em; + padding-top: 5em; display: block; background: url("/images/helix-nebula-1400x1400.s.jpg") 50% 0 repeat fixed; - min-height: 25em; + min-height: 10em; } nav { border-radius:10px; - margin: .5em; - padding: .5em; + margin: 1em; + padding: 1em; display: block; background: url("/images/live-concert-388160_1280.s.jpg") 50% 0 repeat fixed ; - min-height: 25em; + min-height: 10em; } main { border-radius:10px; - margin: .5em; - padding: .5em; + margin: 1em; + padding: 1em; display: block; background: url("/images/musician-923526_1280.s.jpg") 50% 0 repeat fixed ; - min-height: 25em; + min-height: 10em; } footer { border-radius:10px; - margin: .5em; - padding: .5em; + margin: 1em; + padding: 1em; display: block; background: url("/images/drummer-652345_1280.s.jpg") 50% 0 repeat fixed ; - min-height: 25em; + min-height: 10em; clear: both; display: flex; font-size: smaller; + justify-content: center; } fieldset { diff --git a/web/ChangeLog b/web/ChangeLog index 9a416b43..53fc61a9 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,19 @@ +2015-10-01 Paul Schneider + + * style.css: more space + + * Web.config: + * YavscHelpers.cs: + * OAuth2.cs: + * AccountController.cs: refactoring + + * BlogsController.cs: A new page, to become a media chooser + + * App.master: nice small parralax.js, could work on android + browers + + * Web.config: unix line endings + 2015-10-01 Paul Schneider * UserPost.aspx: Fixes the anonymous access ! diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index 3de7da21..02572bd0 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -38,7 +38,7 @@ namespace Yavsc.Controllers public ActionResult Avatar (string user) { ProfileBase pr = ProfileBase.Create (user); - string avpath = (string ) pr.GetPropertyValue("avatar") ; + string avpath = (string ) pr.GetPropertyValue("Avatar") ; if (avpath == null) { FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar)); return File (fia.OpenRead (), defaultAvatarMimetype); @@ -291,7 +291,7 @@ namespace Yavsc.Controllers string logdu = Membership.GetUser ().UserName; ViewData ["UserName"] = id; - bool editsMyName = (string.Compare(id,model.Name)==0); + bool editsMyName = (string.Compare(id,logdu)==0); if (!editsMyName) if (!Roles.IsUserInRole ("Admin")) if (!Roles.IsUserInRole ("FrontOffice")) @@ -312,7 +312,7 @@ namespace Yavsc.Controllers AvatarFile.ContentType, "image/png")); } /* Sync the property in the Profile model to display : - * string cAvat = HttpContext.Profile.GetPropertyValue ("avatar") as string; + * string cAvat = HttpContext.Profile.GetPropertyValue ("Avatar") as string; if (cAvat != null) if (model.avatar == null) model.avatar = cAvat; */ if (ModelState.IsValid) { @@ -321,9 +321,9 @@ namespace Yavsc.Controllers prf.SetPropertyValue ("BlogVisible", model.BlogVisible); prf.SetPropertyValue ("BlogTitle", model.BlogTitle); if (AvatarFile != null) { - prf.SetPropertyValue ("avatar", model.avatar); + prf.SetPropertyValue ("Avatar", model.avatar); } else { - model.avatar = (string) prf.GetPropertyValue ("avatar"); + model.avatar = (string) prf.GetPropertyValue ("Avatar"); } prf.SetPropertyValue ("Address", model.Address); prf.SetPropertyValue ("CityAndState", model.CityAndState); @@ -346,7 +346,7 @@ namespace Yavsc.Controllers UserManager.ChangeName (id, model.Name); FormsAuthentication.SetAuthCookie (model.Name, model.RememberMe); } - ViewData ["Message"] = "Profile enregistré"+((editsMyName)?", nom public inclus.":""); + ViewData ["Message"] = "Profile enregistré"+((editsMyName)?", nom public inclu.":""); } return View (model); } diff --git a/web/Controllers/BlogsController.cs b/web/Controllers/BlogsController.cs index 4176800a..aec2210b 100644 --- a/web/Controllers/BlogsController.cs +++ b/web/Controllers/BlogsController.cs @@ -69,6 +69,11 @@ namespace Yavsc.Controllers } } + public ActionResult ChooseMedia(long id) + { + return View (); + } + /// /// Blogs the list. /// diff --git a/web/Helpers/Google/OAuth2.cs b/web/Helpers/Google/OAuth2.cs index 40d4d1e4..559b7d2d 100644 --- a/web/Helpers/Google/OAuth2.cs +++ b/web/Helpers/Google/OAuth2.cs @@ -243,7 +243,7 @@ namespace Yavsc.Helpers.Google } pr.SetPropertyValue ("gtoken", token); pr.Save (); - // ASSERT gat.token_type == pr.GetPropertyValue("token_type") + // ASSERT gat.token_type == pr.GetPropertyValue("gtokentype") } return token_type + " " + token; } diff --git a/web/Helpers/YavscHelpers.cs b/web/Helpers/YavscHelpers.cs index faa356ff..cccc5545 100644 --- a/web/Helpers/YavscHelpers.cs +++ b/web/Helpers/YavscHelpers.cs @@ -166,7 +166,7 @@ namespace Yavsc.Helpers public static string AvatarUrl (this HtmlHelper helper, string username) { ProfileBase pr = ProfileBase.Create (username); - string avpath = (string ) pr.GetPropertyValue("avatar") ; + string avpath = (string ) pr.GetPropertyValue("Avatar") ; if (avpath != null) return helper.Encode (avpath); return "/avatars/" + helper.Encode(username)+".png"; diff --git a/web/Models/App.master b/web/Models/App.master index 9aa43b44..9bfc0497 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -19,12 +19,50 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>'; $(document).ready(function(){ var $window = $(window); + $('[data-type="background"]').each(function(){ var $bgobj = $(this); // assigning the object + // get the initial background position, assumes a "X% Yem" ? + var orgpos = $bgobj.css('backgroundPosition'); + var bgpos = orgpos.split(" "); + + var bgposx = bgpos[0]; + var bgposy = bgpos[1]; + if (/%$/.test(bgposx)){ + bgposx = bgposx.substr(0,bgposx.length-1); + $bgobj.attr('orgbgpxu','% '); + } + else if (/em$/.test(bgposx)){ + bgposx = bgposx.substr(0,bgposx.length-2); + $bgobj.attr('orgbgpxu','em '); + } + else if (/px$/.test(bgposx)){ + bgposx = bgposx.substr(0,bgposx.length-2); + $bgobj.attr('orgbgpxu','px '); + } + else { $bgobj.attr('orgbgpxu','px '); } + + if (/%$/.test(bgposy)){ + bgposy = bgposy.substr(0,bgposy.length-1); + $bgobj.attr('orgbgpyu','% '); + } + else if (/em$/.test(bgposy)){ + bgposy = bgposy.substr(0,bgposy.length-2); + $bgobj.attr('orgbgpyu','em '); + } + else if (/px$/.test(bgposy)){ + bgposy = bgposy.substr(0,bgposy.length-2); + $bgobj.attr('orgbgpyu','px '); + } + else { $bgobj.attr('orgbgpyu','px '); } + $bgobj.attr('orgbgpx',parseInt(bgposx)); + $bgobj.attr('orgbgpy',parseInt(bgposy)); + $(window).scroll(function() { - var yPos = -($window.scrollTop() / $bgobj.data('speed')); + var xPos = $bgobj.attr('orgbgpx') - ($window.scrollLeft() / $bgobj.data('speed')); + var yPos = $bgobj.attr('orgbgpy') - ($window.scrollTop() / $bgobj.data('speed')); // Put together our final background position - var coords = '50% '+ yPos + 'px'; + var coords = '' + xPos + $bgobj.attr('orgbgpxu') + yPos + $bgobj.attr('orgbgpyu'); // Move the background $bgobj.css({ backgroundPosition: coords }); }); @@ -37,7 +75,7 @@ $(document).ready(function(){ -
+
@@ -55,32 +93,32 @@ $(document).ready(function(){
-