* 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
106 lines
3.3 KiB
JavaScript
106 lines
3.3 KiB
JavaScript
|
|
|
|
var errspanid="msg";
|
|
var CirclesApiUrl = apiBaseUrl + "/Circle";
|
|
|
|
|
|
|
|
function editNewCircle() {
|
|
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
|
|
$('#lgdnvcirc').html("Creation d'un cercle");
|
|
$('#fncirc').removeClass("dirty");
|
|
$("#title").val( '' );
|
|
$('#btnnewcircle').show();
|
|
$('#btneditcircle').hide();
|
|
}
|
|
|
|
function selectCircle() {
|
|
if ($('#fncirc').hasClass('hidden')) $('#fncirc').removeClass('hidden')
|
|
var id = $(this).attr('cid');
|
|
$('#lgdnvcirc').html("Edition du cercle");
|
|
$('#btnnewcircle').hide();
|
|
$('#btneditcircle').show();
|
|
// get it from the server
|
|
|
|
$.getJSON(CirclesApiUrl+"/Get/"+id, function(json) {
|
|
$("#title").val( json.Title); });
|
|
$('#id').val(id);
|
|
$('#fncirc').removeClass("dirty");
|
|
}
|
|
|
|
function onCircleChanged()
|
|
{ $('#fncirc').addClass("dirty"); }
|
|
|
|
function removeCircle() {
|
|
Yavsc.message(false);
|
|
var id = $(this).attr('cid');
|
|
$.ajax({
|
|
url: CirclesApiUrl+"/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)
|
|
Yavsc.message(xhr.status+" : "+xhr.responseText);
|
|
else Yavsc.message(false);
|
|
}});
|
|
}
|
|
function modifyCircle() {
|
|
Yavsc.message(false);
|
|
var circle = { title: $("#title").val(), id: $('#id').val(), isprivate: $('#isprivate').val() } ;
|
|
}
|
|
|
|
function addCircle()
|
|
{
|
|
Yavsc.message(false);
|
|
var circle = { title: $("#title").val() } ;
|
|
$("#title").text('');
|
|
$.ajax({
|
|
url: CirclesApiUrl+"/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)
|
|
Yavsc.message(xhr.status+" : "+xhr.responseText);
|
|
else Yavsc.message(false);
|
|
}});
|
|
}
|