X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;ds=inline;f=js%2FpageAdmin.js;h=d7d735a5de5fc3a719b292ec6103e3b24b02d252;hb=cd30bb86848bd5b52c46b8a0ff40cea6398de60e;hp=9be3ca13fa199c2373f7105e87bac7344f9211d4;hpb=3ea00589df90388456e8587b1bebdeab0f7e99fa;p=euphorik.git
diff --git a/js/pageAdmin.js b/js/pageAdmin.js
index 9be3ca1..d7d735a 100644
--- a/js/pageAdmin.js
+++ b/js/pageAdmin.js
@@ -12,11 +12,17 @@ function PageAdmin(client, formateur, util)
PageAdmin.prototype.contenu = function()
{
return '
Un troll est un sujet à débat, en général une question.
\
Chaque semaine un troll est choisit au hasard parmis les trolls proposés et devient le troll de la semaine.
\
- ' +
- '
' + thisTrolls.formateur.traitementComplet(data["trolls"][i]["content"], data["trolls"][i]["author"]) + '' +
- '
' + thisTrolls.formateur.traitementComplet(data["trolls"][i]["author"]) + '' +
+ '
' +
+ '' + thisTrolls.formateur.traitementComplet(troll.content, troll.author) + '' +
+ ' - ' + thisTrolls.formateur.traitementComplet(troll.author) + '' +
(data["trolls"][i]["author_id"] == thisTrolls.client.id ? 'éditerSupprimer' : '') +
'
'
}
@@ -187,6 +274,16 @@ Trolls.prototype.rafraichirTrolls = function()
{
var troll = this
var id = parseInt($(this).attr("id").substr(5))
+
+ $("a[@rel*=lightbox]", this).lightBox()
+
+ $(this).keypress(
+ function(e)
+ {
+ if (e.which == 13) // return
+ $(".modifier", this).click()
+ }
+ )
$(".delTroll", this).click(
function()
{
@@ -208,14 +305,18 @@ Trolls.prototype.rafraichirTrolls = function()
{
$("span", troll).css("display", "none")
$(troll).append(
- '
'
+ '
'
)
+ $("form input.content").focus()
+
var virerLeFormulaire = function()
{
$("form", troll).remove()
- $("span", troll).css("display", "inline")
+ $('span', troll).css("display", "inline")
}
- $("button.modifier", troll).click(
+ $("span.modifier", troll).click(
function()
{
var content = $("form input.content", troll).val()
@@ -223,7 +324,7 @@ Trolls.prototype.rafraichirTrolls = function()
thisTrolls.modifier(id, content)
}
)
- $("button.annuler", troll).click( virerLeFormulaire )
+ $("span.annuler", troll).click( virerLeFormulaire )
$("form", troll).submit(function(){ return false})
}
)
@@ -234,11 +335,16 @@ Trolls.prototype.rafraichirTrolls = function()
thisTrolls.dernierTroll = data["trolls"][data["trolls"].length - 1]["troll_id"]
break
case "troll_modified" :
- $("#trolls #troll" + data["troll_id"] + " .content").html(data["content"])
+ $("#trolls #troll" + data["troll_id"] + " .content").html(thisTrolls.formateur.traitementComplet(data["content"], thisTrolls.trolls[data["troll_id"]].author))
+ $("#trolls #troll" + data["troll_id"] + " a[@rel*=lightbox]").lightBox()
+ thisTrolls.trolls[data["troll_id"]].content = data["content"]
break
case "troll_deleted" :
$("#trolls #troll"+data["troll_id"]).remove()
break
+ case "error" :
+ thisTrolls.util.messageDialogue(data["error_message"])
+ break
}
}
)