* yavsc.js: factorize some javascript
* InputCircle.cs: this class is about to be removed * BlogsController.cs: removes Html used as text * App.master: removes the bsd css class script * Circles.aspx: fixes the Javascript circle selection * Index.aspx: * AssemblyInfo.aspx: `Indexe` is not a french word, sorry for the trouble * Web.csproj: includes yavsc Javascript in the project * LocalizedText.Designer.cs: alphabetic order in ressource names * LocalizedText.resx: * alphabetic order in ressource names * RegisterModel.cs: disposes a duplicated resource string "UserName" (uses now User_name) * style.css: panels float left
This commit is contained in:
@ -25,6 +25,7 @@ main {
|
||||
background-color: rgba(64,64,64,0.6);
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
background-color: rgba(32,16,16,0.8);
|
||||
border-radius:5px; border: solid 1px #000060;
|
||||
@ -68,6 +69,7 @@ footer {
|
||||
border-radius:5px;
|
||||
margin:.5em;
|
||||
padding: .5em;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.bsh { float: right; }
|
||||
@ -95,6 +97,7 @@ header {
|
||||
margin:0em;
|
||||
padding:0em;
|
||||
}
|
||||
|
||||
h1 img { vertical-align: text-top; }
|
||||
|
||||
a {
|
||||
|
@ -1,3 +1,21 @@
|
||||
2015-08-22 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* yavsc.js: factorize some javascript
|
||||
|
||||
* BlogsController.cs: removes Html used as text
|
||||
|
||||
* App.master: removes the bsd css class script
|
||||
|
||||
* Circles.aspx: fixes the Javascript circle selection
|
||||
|
||||
* Index.aspx:
|
||||
* AssemblyInfo.aspx: `Indexe` is not a french word, sorry for
|
||||
the trouble
|
||||
|
||||
* Web.csproj: includes yavsc Javascript in the project
|
||||
|
||||
* style.css: panels float left
|
||||
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* CircleController.cs: * Authorize some Http methods
|
||||
|
@ -303,7 +303,7 @@ namespace Yavsc.Controllers
|
||||
|
||||
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
||||
Value = x.Id.ToString(),
|
||||
Text = YavscHelpers.FormatCircle(x).ToHtmlString(),
|
||||
Text = x.Title,
|
||||
Selected = e.AllowedCircles.Contains (x.Id)
|
||||
});
|
||||
return View (e);
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<asp:ContentPlaceHolder id="init" runat="server">
|
||||
</asp:ContentPlaceHolder><%
|
||||
ViewState["orgtitle"] = T.GetString(Page.Title);
|
||||
ViewState["orgtitle"] = Html.Translate(Page.Title);
|
||||
Page.Title = ViewState["orgtitle"] + " - " + YavscHelpers.SiteName;
|
||||
%><head runat="server">
|
||||
<meta charset="utf-8">
|
||||
@ -55,7 +55,8 @@ ViewState["orgtitle"] = T.GetString(Page.Title);
|
||||
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, null) %>
|
||||
<% } %></div>
|
||||
<footer>
|
||||
<script src="https://apis.google.com/js/platform.js" async defer>
|
||||
<script src="/Scripts/yavsc.js" async defer>
|
||||
<script src="https://apis.google.com/js/platform.js" defer>
|
||||
{lang: 'fr'}
|
||||
</script>
|
||||
<%= Html.ActionLink("Contact","Contact","Home",null, new { @class="thanks" }) %>
|
||||
@ -70,15 +71,6 @@ ViewState["orgtitle"] = T.GetString(Page.Title);
|
||||
<script type="text/javascript">
|
||||
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
|
||||
</script>
|
||||
<script>
|
||||
$( ".bshd" ).on("click",function(e) {
|
||||
if (e.target == "[object HTMLElement]") {
|
||||
var panel = $(this).children(".bshpanel");
|
||||
if (panel.hasClass("hidden")) panel.css("cursor","zoom-out");
|
||||
else panel.css("cursor","zoom-in");
|
||||
panel.toggleClass("hidden");
|
||||
$(this).children(".bsh").toggleClass("hidden");
|
||||
} });
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
23
web/Scripts/yavsc.js
Normal file
23
web/Scripts/yavsc.js
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
function showHide() {
|
||||
var id = $(this).attr('did');
|
||||
var target = $('#'+id);
|
||||
if (target.hasClass('hidden')) {
|
||||
target.removeClass('hidden');
|
||||
if (typeof this.oldhtml == "undefined")
|
||||
this.oldhtml = $(this).html();
|
||||
$(this).html('['+this.oldhtml+']');
|
||||
}
|
||||
else {
|
||||
target.addClass('hidden');
|
||||
$(this).html(this.oldhtml);
|
||||
}
|
||||
}
|
||||
|
||||
function message(msg) {
|
||||
if (msg) {
|
||||
$("#msg").removeClass("hidden");
|
||||
$("#msg").text(msg);
|
||||
} else { $("#msg").addClass("hidden"); } }
|
||||
|
@ -8,21 +8,25 @@
|
||||
<table id="tbc">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-sort="string"><%=Html.Translate("Title")%></th>
|
||||
<th data-sort="string"><%=Html.Translate("Title")%>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbcb">
|
||||
<% int lc=0;
|
||||
foreach (var ci in (IEnumerable<Circle>) ViewData["Circles"]) { lc++; %>
|
||||
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>">
|
||||
<td><%=Html.FormatCircle(ci)%></td>
|
||||
<td cid="<%=ci.Id%>" style="cursor: pointer;" class="btnselcircle" ><%=Html.FormatCircle(ci)%></td>
|
||||
<td>
|
||||
<input type="button" value="<%=Html.Translate("Remove")%>" class="btnremovecircle actionlink" cid="<%=ci.Id%>"/>
|
||||
<input type="button" value="<%=Html.Translate("Remove")%>"
|
||||
class="btnremovecircle actionlink" cid="<%=ci.Id%>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="actionlink" id="btednvcirc" did="fncirc">Ajouter un cercle</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#tbc").stupidtable();
|
||||
@ -30,19 +34,13 @@ $("#tbc").stupidtable();
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
|
||||
<div id="fncirc" class="hidden">
|
||||
|
||||
<div id="dfnuser" class="hidden panel">
|
||||
<%= Html.Partial("~/Views/Account/Register.ascx",new RegisterClientModel(),new ViewDataDictionary(ViewData)
|
||||
{
|
||||
TemplateInfo = new System.Web.Mvc.TemplateInfo
|
||||
{
|
||||
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"ur":ViewData.TemplateInfo.HtmlFieldPrefix+"_ur"
|
||||
}
|
||||
}) %>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>Nouveau cercle</legend>
|
||||
<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"/>
|
||||
@ -55,37 +53,58 @@ $("#tbc").stupidtable();
|
||||
<yavsc:InputUserName
|
||||
id="users"
|
||||
name="users"
|
||||
emptyvalue="[nouvel utilisateur]"
|
||||
emptyvalue="[aucun]"
|
||||
onchange="onmembersChange(this.value);"
|
||||
multiple="true"
|
||||
runat="server" >
|
||||
</yavsc:InputUserName>
|
||||
<script>
|
||||
function message(msg) {
|
||||
if (msg) {
|
||||
$("#msg").removeClass("hidden");
|
||||
$("#msg").text(msg);
|
||||
} else { $("#msg").addClass("hidden"); } }
|
||||
</yavsc:InputUserName>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbmbrsb">
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="button" id="btnnewcircle" value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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");
|
||||
}
|
||||
|
||||
function selectCircle() {
|
||||
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
|
||||
var id = $(this).attr('cid');
|
||||
$('#lgdnvcirc').html("Edition du cercle");
|
||||
// get it from the server
|
||||
getCircle(id);
|
||||
}
|
||||
|
||||
function onmembersChange(newval)
|
||||
{
|
||||
if (newval=='')
|
||||
$("#dfnuser").removeClass("hidden");
|
||||
else
|
||||
$("#dfnuser").addClass("hidden");
|
||||
}
|
||||
function clearRegistrationValidation(){
|
||||
$("#Err_ur_Name").text("");
|
||||
$("#Err_ur_UserName").text("");
|
||||
$("#Err_ur_Mobile").text("");
|
||||
$("#Err_ur_Phone").text("");
|
||||
$("#Err_ur_Email").text("");
|
||||
$("#Err_ur_Address").text("");
|
||||
$("#Err_ur_ZipCode").text("");
|
||||
$("#Err_ur_CityAndState").text("");
|
||||
$("#Err_ur_IsApprouved").text("");
|
||||
}
|
||||
function clearCircleValidation() {}
|
||||
|
||||
function removeCircle() {
|
||||
message(false);
|
||||
var id = $(this).attr('cid');
|
||||
@ -93,8 +112,8 @@ $("#tbc").stupidtable();
|
||||
url: "<%=Url.Content("~/api/Circle/Delete/")%>"+id,
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
// Drops the detroyed circle row
|
||||
$("c_"+id).remove();
|
||||
// Drops the row
|
||||
$("#c_"+id).remove();
|
||||
},
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
@ -125,9 +144,18 @@ $("#tbc").stupidtable();
|
||||
url: "<%=Url.Content("~/api/Circle/Create")%>",
|
||||
type: "POST",
|
||||
data: circle,
|
||||
success: function (data) {
|
||||
success: function (id) {
|
||||
// Adds a node rendering the new circle
|
||||
$("#tbcb").append("<tr><td>"+circle.title+" <br><i>"+circle.users+"</i></td></tr>");
|
||||
$('<tr id="c_'+id+'"/>').addClass('selected row')
|
||||
.appendTo('#tbcb');
|
||||
|
||||
$('<td>'+circle.title+'<br><i>'+
|
||||
circle.users+
|
||||
'</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) {
|
||||
@ -147,64 +175,11 @@ $("#tbc").stupidtable();
|
||||
else message(false);
|
||||
}});
|
||||
}
|
||||
|
||||
function addUser()
|
||||
{
|
||||
message(false);
|
||||
var user={
|
||||
UserName: $("#ur_UserName").val(),
|
||||
Name: $("#ur_Name").val(),
|
||||
Password: $("#ur_Password").val(),
|
||||
Email: $("#ur_Email").val(),
|
||||
Address: $("#ur_Address").val(),
|
||||
CityAndState: $("#ur_CityAndState").val(),
|
||||
ZipCode: $("#ur_ZipCode").val(),
|
||||
Phone: $("#ur_Phone").val(),
|
||||
Mobile: $("#ur_Mobile").val(),
|
||||
IsApprouved: true
|
||||
};
|
||||
clearRegistrationValidation();
|
||||
$.ajax({
|
||||
url: "<%=Url.Content("~/api/FrontOffice/Register")%>",
|
||||
type: "POST",
|
||||
data: user,
|
||||
success: function (data) {
|
||||
$("#users option:last").after($('<option>'+user.UserName+'</option>'));
|
||||
},
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
$.each(data.responseJSON, function (key, value) {
|
||||
var errspanid = "Err_ur_" + 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);
|
||||
}});
|
||||
}
|
||||
</script>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbmbrsb">
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="button" id="btnnewcircle" value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
|
||||
</fieldset>
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#btnnewuser").click(addUser);
|
||||
$('#btednvcirc').click(editNewCircle);
|
||||
$("#btnnewcircle").click(addCircle);
|
||||
$(".btnremovecircle").click(removeCircle);
|
||||
$(".btnselcircle").click(selectCircle);
|
||||
});
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%@ Page Title="Blogs - Indexe" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master" EnableTheming="True" StylesheetTheme="dark" %>
|
||||
<%@ Page Title="Blogs - Index" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master" EnableTheming="True" StylesheetTheme="dark" %>
|
||||
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%@ Page Title="Yavsc - indexe" Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<System.Reflection.AssemblyName>>" MasterPageFile="~/Models/App.master"%>
|
||||
<%@ Page Title="Yavsc - index" Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<System.Reflection.AssemblyName>>" MasterPageFile="~/Models/App.master"%>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<p>
|
||||
Running assembly :
|
||||
|
@ -336,6 +336,7 @@
|
||||
<Content Include="App_Themes\mdd_styles.css" />
|
||||
<Content Include="Scripts\jquery-2.1.4.min.js" />
|
||||
<Content Include="Scripts\MarkdownDeepLib.min.js" />
|
||||
<Content Include="Scripts\yavsc.js" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
Reference in New Issue
Block a user