* yavsc.js:

* yavsc.circles.js: js refactoring

* Credits.aspx: A credit about to add

* CircleBase.cs: The Circle base

* NpgsqlCircleProvider.cs: * refactoring
* updates the circle

* InputCircle.cs: using the new CircleBase class

* ResultPages.cs: Using a new "None" attribute

* CircleController.cs: refactoring : drops the NewCircle class The
  `List` method now resterns collection of circlebase

* style.css: * a new `dirty` css class, could be used to tag data to
  validate ala ajax
* removed quite all of the `float` usages

* AccountController.cs: xml doc

* BlogsController.cs: Avatar method moved to the Account controller

* YavscHelpers.cs: An avatar url

* App.master: Login div moved up

* Circles.aspx: a new `private` filed in the `Circle` object, in order
  to keep circle names from being published as user's information,
should be true by default

* Profile.aspx: removed the tables

* Index.aspx: Un message plus explicite

* Web.config: nothing to view

* Web.csproj: * new page : Credit
* new script: yavsc.circle.js

* instdbws.sql: circles are uniques for a given user against a given
  app

* Circle.cs: Now inherits CircleBase to implement a member list

* CircleProvider.cs: implements a circle update method

* LocalizedText.resx:
* LocalizedText.Designer.cs: no content!!!

* LocalizedText.fr.resx:
* LocalizedText.fr.Designer.cs: pas content

* YavscModel.csproj: a new CircleBAse class
This commit is contained in:
Paul Schneider 2015-09-10 00:55:19 +02:00
commit b7fa996dbc
30 changed files with 730 additions and 460 deletions

View file

@ -14,9 +14,10 @@
</thead>
<tbody id="tbcb">
<% int lc=0;
foreach (var ci in (IEnumerable<Circle>) ViewData["Circles"]) { lc++; %>
foreach (var ci in (IEnumerable<CircleBase>) ViewData["Circles"]) { lc++; %>
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>">
<td cid="<%=ci.Id%>" style="cursor: pointer;" class="btnselcircle" ><%=Html.FormatCircle(ci)%></td>
<td cid="<%=ci.Id%>" style="cursor: pointer;" class="btnselcircle" >
<%=ci.Title%></td>
<td>
<input type="button" value="<%=Html.Translate("Remove")%>"
class="btnremovecircle actionlink" cid="<%=ci.Id%>"/>
@ -42,149 +43,35 @@ $("#tbc").stupidtable();
<fieldset>
<legend id="lgdnvcirc"></legend>
<span id="msg" class="field-validation-valid error"></span>
<label for="title"><b><%=Html.Translate("Title")%></b></label>
<input type="text" id="title" name="title" class="inputtext" onchange="onTitleChanged"/>
<span id="Err_cr_title" class="field-validation-valid error"></span>
<table id="tbmbrs">
<thead>
<tr>
<th data-sort="string"><%=Html.Translate("Members")%>
<span id="Err_cr_users" class="field-validation-valid error"></span>
<yavsc:InputUserName
id="users"
name="users"
emptyvalue="[aucun]"
onchange="onmembersChange(this.value);"
multiple="true"
runat="server" >
</yavsc:InputUserName>
</th>
</tr>
</thead>
<tbody id="tbmbrsb">
</tbody>
</table>
<input type="button" id="btnnewcircle" value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
<label for="title"><b><%=Html.Translate("Title")%></b></label>
<input type="text" id="title" name="title" class="inputtext" onchange="onCircleChanged"/>
<span id="Err_cr_title" class="field-validation-valid error"></span>
<label for="isprivate"><b><%=Html.Translate("Private circle")%></b></label>
<input type="checkbox" name="isprivate" id="isprivate" onchange="onCircleChanged" />
<input type="button" id="btnnewcircle"
value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
<input type="button" id="btneditcircle"
value="<%=Html.Translate("Modify")%>" class="actionlink rowbtnct" />
<input type="hidden" name="id" id="id" />
</fieldset>
</form>
</div>
</div>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/yavsc.circles.js")%>" >
</script>
<script type="text/javascript">
<script>
var cformhidden=true;
var errspanid="msg";
function getCircle(id)
{
$.getJSON("<%=Url.Content("~/api/Circle/Get/")%>"+id,
function(json) { $("#title").val( json.Title); $("#users").val( json.Members ) ; });
}
function editNewCircle() {
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
$('#lgdnvcirc').html("Creation d'un cercle");
$('#btnnewcircle').val("Créer");
$('#fncirc').removeClass("dirty");
}
function selectCircle() {
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
var id = $(this).attr('cid');
$('#lgdnvcirc').html("Edition du cercle");
$('#btnnewcircle').val("Modifier");
// get it from the server
getCircle(id);
$('#fncirc').removeClass("dirty");
}
function onmembersChange(newval)
{$('#fncirc').addClass("dirty");}
function onTitleChanged()
{ $('#fncirc').addClass("dirty"); }
function removeCircle() {
message(false);
var id = $(this).attr('cid');
$.ajax({
url: "<%=Url.Content("~/api/Circle/Delete/")%>"+id,
type: "GET",
success: function (data) {
// Drops the row
$("#c_"+id).remove();
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
function addCircle()
{
message(false);
var circle = { title: $("#title").val(), members: $("#users").val() } ;
$("#title").text('');
$("#users").val('');
$.ajax({
url: "<%=Url.Content("~/api/Circle/Create")%>",
type: "POST",
data: circle,
success: function (id) {
// Adds a node rendering the new circle
$('<tr id="c_'+id+'"/>').addClass('selected row')
.appendTo('#tbcb');
$('<td>'+circle.title+' <br><i>'+
circle.members+
'</i></td></td>')
.appendTo('#c_'+id);
$('<td><input class="btnremovecircle actionlink" cid="'+id+'" type="button" value="Remove" onclick="removeCircle"></td>').appendTo('#c_'+id);
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
$(document).ready(function () {
$('#btednvcirc').click(editNewCircle);
$("#btnnewcircle").click(addCircle);
$("#btneditcircle").click(modifyCircle);
$(".btnremovecircle").click(removeCircle);
$(".btnselcircle").click(selectCircle);
});
</script>
</asp:Content>

View file

@ -17,145 +17,96 @@ table.layout TR TD { max-width:40%; }
<fieldset><legend>Informations publiques</legend>
<table class="layout">
<tr><td align="right" style="">
<%= Html.LabelFor(model => model.Name) %></td><td>
<%= Html.TextBox("Name") %>
<%= Html.ValidationMessage("Name", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.WebSite) %></td><td>
<%= Html.LabelFor(model => model.Name) %> :
<%= Html.TextBox("Name") %>
<%= Html.ValidationMessage("Name", "*") %>
<br>
<%= Html.LabelFor(model => model.WebSite) %> :
<%= Html.TextBox("WebSite") %>
<%= Html.ValidationMessage("WebSite", "*") %></td></tr>
<%= Html.ValidationMessage("WebSite", "*") %>
<br>
<tr><td align="right">
Avatar </td><td> <img class="avatar" src="<%=Model.avatar%>?version=<%=Html.Encode(DateTime.Now.ToString())%>" alt=""/>
Avatar : <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>
<%= Html.ValidationMessage("AvatarFile", "*") %>
</table>
</fieldset>
</fieldset>
<fieldset><legend>Blog</legend>
<table class="layout">
<tr><td align="right">
<%= Html.LabelFor(model => model.BlogVisible) %></td><td>
<%= Html.LabelFor(model => model.BlogVisible) %> :
<%= Html.CheckBox("BlogVisible") %>
<%= Html.ValidationMessage("BlogVisible", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.BlogTitle) %></td><td>
<%= Html.ValidationMessage("BlogVisible", "*") %>
<br>
<%= Html.LabelFor(model => model.BlogTitle) %> :
<%= Html.TextBox("BlogTitle") %>
<%= Html.ValidationMessage("BlogTitle", "*") %></td></tr>
</table>
<%= Html.ValidationMessage("BlogTitle", "*") %>
</fieldset>
<fieldset><legend>Contact</legend>
<table class="layout">
<tr><td align="right">
<%= Html.LabelFor(model => model.Phone) %></td><td>
<%= Html.LabelFor(model => model.Phone) %>
<%= Html.TextBox("Phone") %>
<%= Html.ValidationMessage("Phone", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.Mobile) %></td><td>
<%= Html.ValidationMessage("Phone", "*") %>
<%= Html.LabelFor(model => model.Mobile) %>
<%= Html.TextBox("Mobile") %>
<%= Html.ValidationMessage("Mobile", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.Address) %></td><td>
<%= Html.ValidationMessage("Mobile", "*") %>
<%= Html.LabelFor(model => model.Address) %>
<%= Html.TextBox("Address") %>
<%= Html.ValidationMessage("Address", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.CityAndState) %></td><td>
<%= Html.ValidationMessage("Address", "*") %>
<%= Html.LabelFor(model => model.CityAndState) %>
<%= Html.TextBox("CityAndState") %>
<%= Html.ValidationMessage("CityAndState", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.ZipCode) %></td><td>
<%= Html.ValidationMessage("CityAndState", "*") %>
<%= Html.LabelFor(model => model.ZipCode) %>
<%= Html.TextBox("ZipCode") %>
<%= Html.ValidationMessage("ZipCode", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.Country) %></td><td>
<%= Html.ValidationMessage("ZipCode", "*") %>
<%= Html.LabelFor(model => model.Country) %>
<%= Html.TextBox("Country") %>
<%= Html.ValidationMessage("Country", "*") %></td></tr>
</table>
</fieldset>
<fieldset><legend>Disponibilité</legend>
<table class="layout">
<tr><td align="right">
<%= Html.LabelFor(model => model.GoogleCalendar) %>:
</td>
<td> <%= Html.Encode(Model.GoogleCalendar) %>
<%= Html.ValidationMessage("Country", "*") %>
</fieldset>
<fieldset><legend>Disponibilité</legend>
<%= Html.LabelFor(model => model.GoogleCalendar) %> :
<%= Html.Encode(Model.GoogleCalendar) %>
<%= Html.ActionLink("Choisir l'agenda","ChooseCalendar","Google",new { returnUrl= Request.Url.AbsolutePath }, new { @class="actionlink" }) %>
</td>
</tr>
</table>
</fieldset>
<fieldset><legend>Informations de facturation</legend>
<table class="layout">
<tr>
<td align="right">
<%= Html.LabelFor(model => model.BankCode) %>
</td>
<td>
</fieldset>
<fieldset><legend>Informations de facturation</legend>
<%= Html.LabelFor(model => model.BankCode) %> :
<%= Html.TextBox("BankCode") %>
<%= Html.ValidationMessage("BankCode", "*") %>
</td>
</tr>
<tr>
<td align="right">
<%= Html.LabelFor(model => model.WicketCode) %></td>
<td>
<br>
<%= Html.LabelFor(model => model.WicketCode) %> :
<%= Html.TextBox("WicketCode") %>
<%= Html.ValidationMessage("WicketCode", "*") %>
</td>
</tr>
<tr>
<td align="right">
<%= Html.LabelFor(model => model.AccountNumber) %></td>
<td>
<br>
<%= Html.LabelFor(model => model.AccountNumber) %> :
<%= Html.TextBox("AccountNumber") %>
<%= Html.ValidationMessage("AccountNumber", "*") %>
</td>
</tr>
<tr>
<td align="right">
<%= Html.LabelFor(model => model.BankedKey) %></td>
<td>
<br>
<%= Html.LabelFor(model => model.BankedKey) %> :
<%= Html.TextBox("BankedKey") %>
<%= Html.ValidationMessage("BankedKey", "*") %>
</td>
</tr>
<tr>
<td align="right">
<%= Html.LabelFor(model => model.BIC) %></td>
<td>
<br>
<%= Html.LabelFor(model => model.BIC) %> :
<%= Html.TextBox("BIC") %>
<%= Html.ValidationMessage("BIC", "*") %>
</td>
</tr>
<tr>
<td align="right">
<%= Html.LabelFor(model => model.IBAN) %></td>
<td>
<br>
<%= Html.LabelFor(model => model.IBAN) %> :
<%= Html.TextBox("IBAN") %>
<%= Html.ValidationMessage("IBAN", "*") %>
</td>
</tr>
</table>
</fieldset>
</fieldset>
<input type="submit"/>
<% } %>

View file

@ -28,7 +28,9 @@ le <%=p.Posted.ToString("D") %>
<form runat="server" id="form1" method="GET">
<% rp1.ResultCount = Model.Count; rp1.ResultsPerPage = 50; %>
<% rp1.CurrentPage = (int) ViewData["PageIndex"]; %>
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server" ></yavsc:ResultPages>
<% rp1.None = Html.Translate("no content"); %>
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server" >
</yavsc:ResultPages>
</form>
</asp:Content>

View file

@ -0,0 +1,14 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="initContent" ContentPlaceHolderID="init" runat="server">
</asp:Content>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="overHeaderOneContent" ContentPlaceHolderID="overHeaderOne" runat="server">
</asp:Content>
<asp:Content ID="headerContent" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<div>Icons made by <a href="http://www.flaticon.com/authors/vectorgraphit" title="Vectorgraphit">Vectorgraphit</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0">CC BY 3.0</a></div>
</asp:Content>
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
</asp:Content>