Skip to content

Commit

Permalink
Fixed issue: Manifest Templates have no preview alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Oct 30, 2017
1 parent 2da6aa0 commit 2831843
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
17 changes: 17 additions & 0 deletions application/models/TemplateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ protected function getDependsPackages($oTemplate)
return $packages;
}

// For list, so no "setConfiguration" before
public function getPreview()
{
if (empty($this->sPreviewImgTag)){

$previewPath = Template::getTemplatePath($this->template->name);

if (file_exists($previewPath.'/preview.png')){
$previewUrl = Template::getTemplateURL($this->template->name);
$this->sPreviewImgTag = '<img src="'.$previewUrl.'/preview.png" alt="template preview" height="200"/>';
}else{
$this->sPreviewImgTag = '<em>'.gT('No preview available').'</em>';
}

}
return $this->sPreviewImgTag;
}


/**
Expand Down
17 changes: 0 additions & 17 deletions application/models/TemplateConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,6 @@ public static function model($className=__CLASS__)
return $model;
}

// For list, so no "setConfiguration" before
public function getPreview()
{
if (empty($this->sPreviewImgTag)){

$previewPath = Template::getTemplatePath($this->template->name);

if (file_exists($previewPath.'/preview.png')){
$previewUrl = Template::getTemplateURL($this->template->name);
$this->sPreviewImgTag = '<img src="'.$previewUrl.'/preview.png" alt="template preview" height="200"/>';
}else{
$this->sPreviewImgTag = '<em>'.gT('No preview available').'</em>';
}

}
return $this->sPreviewImgTag;
}

/**
* Create a new entry in {{templates}} and {{template_configuration}} table using the template manifest
Expand Down
11 changes: 1 addition & 10 deletions application/models/TemplateManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,6 @@ public function getOtherFiles()
}


public function getPreview()
{
if (empty($this->sPreviewImgTag)){
$previewUrl = $this->getTemplateURL();// $this->getTemplateURL();//Template::getTemplateURL($this->template->name);
$this->sPreviewImgTag = '<img src="'.$previewUrl.'/preview.png" alt="template preview" height="200"/>';
}
return $this->sPreviewImgTag;
}

/**
*
*/
Expand Down Expand Up @@ -556,7 +547,7 @@ private function setTemplateName($sTemplateName='', $iSurveyId='')
} else {
$this->sTemplateName = Template::templateNameFilter(App()->getConfig('defaulttemplate','default'));
}
}
}
}


Expand Down

0 comments on commit 2831843

Please sign in to comment.