Skip to content

Commit

Permalink
#35 : affichage visiteur (cf.page de test) JsEditCmsBlock pour l'admi…
Browse files Browse the repository at this point in the history
…n et jsCmsBlock pour le visiteur
  • Loading branch information
oceanBigOne committed Mar 15, 2017
1 parent 89e451b commit c5c379e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
3 changes: 0 additions & 3 deletions pages/admin/cms/save.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@


if(isset($_POST["ref"])){
$aResponse["message"]["text"]="01";
$oListeCms=new CmsListe();
$oListeCms->applyRules4GetBlock($_POST["ref"]);
$aCms= $oListeCms->getPage();
$aResponse["message"]["text"]="02";
if(count($aCms)==1){
$aResponse["message"]["text"]="03";
$oCms= new Cms(array("id"=>$aCms[0]["id"]));
$aResponse["type"] = "no-reponse";
$oCms->setContent($_POST["content"]);
Expand Down
9 changes: 7 additions & 2 deletions templates/admin/cms/test.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
<div class="wrapper-page">
<div class="container">
<div class="row">
<div class="col-xs-12 markdown jsEditCmsBlock" data-block-ref="homeadmin">
{{ CMS.homeadmin }}
<div class="col-xs-12 {% if oMe.type=='admin' %}jsEditCmsBlock{% else %}jsCmsBlock{% endif %}" data-block-ref="homeadmin">
{{ CMS.homeadmin }}
</div>
</div>
<div class="row">
<div class="col-xs-12 {% if oMe.type=='admin' %}jsEditCmsBlock{% else %}jsCmsBlock{% endif %}" data-block-ref="nouveaublock">
{{ CMS.nouveaublock }}
</div>
</div>
</div>
Expand Down
22 changes: 20 additions & 2 deletions web/js/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,26 @@ $(document).ready(function () {

});

var $markdownBlocks=$(".markdown");
$markdownBlocks.html( markdown.toHTML( $markdownBlocks.html() ));
var $markdownEditBlocks=$(".jsEditCmsBlock");
$markdownEditBlocks.each(function(){
var str=$.trim($(this).text());
if(str==""){
$(this).html(markdown.toHTML("Vide")) ;
}else {
$(this).html(markdown.toHTML($.trim($(this).text())));
}
});

var $markdownBlocks=$(".jsCmsBlock");
$markdownBlocks.each(function(){
var str=$.trim($(this).text());
if(str==""){

}else {
$(this).html(markdown.toHTML($.trim($(this).text())));
}
});



});
Expand Down

0 comments on commit c5c379e

Please sign in to comment.