Commit 8862f399 authored by Raph El's avatar Raph El

Hotfix Survey

parent 374bf5ac
......@@ -29,7 +29,17 @@ var formObj = {
search : {},
views : {
forms : function(forms,fObj){
var str = "";
var str = '';
str += '<div class="col-md-12 col-sm-12 col-xs-12 labelTitleDir margin-bottom-15">'+
'<i class="fa fa-file-text-o fa-2x margin-right-10"></i>'+
'<i class="fa fa-angle-down"></i>'+Object.keys(forms).length+
'<b>Forms</b>'+
'<a href="javascript:;" class="createForm btn btn-sm btn-link bg-green-k pull-right "><i class="fa fa-plus"></i> Nouveau Formulaire</a>'+
'</div>';
fObj.forms = forms;
$.each(forms, function(idF, valForm){
str += fObj.views.form(idF, valForm);
......@@ -173,8 +183,8 @@ formObj.views.form = function(id, form){
str += "<br/>";
if(typeof form.active != "undefined" && form.active === true){
str += '<a href="#answer.index.id.new.form.'+id+'" class="btn btn-xs btn-primary col-md-4 col-sm-12 bold">'+
'<i class="fa fa-file-text-o"></i> RÉPONDRE '+
str += '<a href="javascript:;" data-id="'+id+'" class=" apply btn btn-xs btn-primary col-md-4 col-sm-12 bold">'+
'<i class="fa fa-file-text-o"></i> Apply '+
'</a>';
if(typeof form.canEditForm != "undefined" && form.canEditForm === true){
......@@ -197,7 +207,22 @@ formObj.views.form = function(id, form){
} ;
formObj.events.add = function(fObj){
$(fObj.container+' .createForm').off().click( function(){
dyFObj.openForm( fObj.dynForm.form(fObj) )
});
};
formObj.events.form = function(fObj){
$(fObj.container+' .apply').off().on("click",function(){
ajaxPost(fObj.container, baseUrl+'/survey/answer/index/id/new/form/'+$(this).data("id"),
null,
function(){
},"html");
});
$(fObj.container+' .config').off().on("click",function(){
mylog.log("here", $(this).data("id"));
ajaxPost(fObj.container, baseUrl+'/survey/form/edit/id/'+$(this).data("id"),
......@@ -206,6 +231,7 @@ formObj.events.form = function(fObj){
},"html");
});
$(fObj.container+' .editFormBtn').off().click( function(){
dyFObj.openForm( fObj.dynForm.form(fObj) , null, fObj.forms[$(this).data("id")] )
});
......@@ -240,3 +266,4 @@ formObj.events.form = function(fObj){
};
formObj.events.form(formObj);
formObj.events.add(formObj);
......@@ -63,17 +63,14 @@ class IndexAction extends CAction
$mode = "r";
}
}
// var_dump($canEditAnswer);
// var_dump($canSeeAnswer);
if($canEditAnswer === true || $canSeeAnswer === true){
$params["canEditForm"] = $canEditForm;
$params["canEdit"] = $canEditAnswer;
$params["canSee"] = $canSeeAnswer;
$params["mode"] = (!empty($mode) ? $mode : "r");
//$tpl=(!empty($tpl)) ? $tpl : "survey.views.tpls.forms.formWizard";
//Rest::json($params); exit;
$tpl=(!empty($this->getController()->costum["form"]["tpl"])) ? $this->getController()->costum["form"]["tpl"] : "survey.views.tpls.forms.formWizard";
$tpl=(!empty($form["tpl"])) ? $form["tpl"] : "survey.views.tpls.forms.formWizard";
echo $this->getController()->renderPartial($tpl,$params );
} else {
if(Yii::app()->request->isAjaxRequest)
......
......@@ -36,7 +36,6 @@ class EditAction extends CAction
$params["showForm"] = true;
$params["mode"] = "fa";
$tpl=(!empty($form["tpl"])) ? $form["tpl"] : "survey.views.tpls.forms.formWizard";
$tpl = "costum.views.custom.deal.form";
echo $this->getController()->renderPartial($tpl,$params );
} else {
if(Yii::app()->request->isAjaxRequest)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment