Set the path of theme preview image manually

This commit is contained in:
Szabó Gergő 2016-10-17 13:51:09 +02:00
parent dfccf7fc4e
commit 78d7436460
4 changed files with 24 additions and 5 deletions

View File

@ -58,6 +58,7 @@ class Theme
$theme = new static;
$theme->setDirName($dirName);
$theme->registerHalyconDatasource();
return $theme;
}
@ -133,6 +134,7 @@ class Theme
public function isActiveTheme()
{
$activeTheme = self::getActiveTheme();
return $activeTheme && $activeTheme->getDirName() == $this->getDirName();
}
@ -374,7 +376,12 @@ class Theme
*/
public function getPreviewImageUrl()
{
$previewPath = $this->getConfigValue('preview');
if (!$previewPath) {
$previewPath = '/assets/images/theme-preview.png';
}
if (File::exists($this->getPath().$previewPath)) {
return Url::asset('themes/'.$this->getDirName().$previewPath);
}
@ -390,6 +397,7 @@ class Theme
{
self::$activeThemeCache = false;
self::$editThemeCache = false;
Cache::forget(self::ACTIVE_KEY);
Cache::forget(self::EDIT_KEY);
}

View File

@ -45,3 +45,10 @@ tabs:
code:
label: cms::lang.theme.code_label
placeholder: cms::lang.theme.code_placeholder
span: auto
preview:
label: cms::lang.theme.preview_label
placeholder: cms::lang.theme.preview_placeholder
default: '/assets/images/theme-preview.png'
span: auto

View File

@ -11,14 +11,14 @@ return [
'error_deleting' => "Error deleting the template file ':name'. Please check write permissions.",
'delete_success' => 'Templates deleted: :count.',
'file_name_required' => 'The File Name field is required.',
'safe_mode_enabled' => 'Safe mode is currently enabled.',
'safe_mode_enabled' => 'Safe mode is currently enabled.'
],
'dashboard' => [
'active_theme' => [
'widget_title_default' => 'Website',
'online' => 'Online',
'maintenance' => 'In maintenance',
'manage_themes' => 'Manage themes',
'manage_themes' => 'Manage themes'
]
],
'theme' => [
@ -45,6 +45,8 @@ return [
'homepage_placeholder' => 'Website URL',
'code_label' => 'Code',
'code_placeholder' => 'A unique code for this theme used for distribution',
'preview_label' => 'Preview',
'preview_placeholder' => 'The path of theme preview image.',
'dir_name_label' => 'Directory name',
'dir_name_create_label' => 'The destination theme directory',
'theme_label' => 'Theme',
@ -88,14 +90,14 @@ return [
'dir_name_taken' => 'Desired theme directory already exists.',
'find_more_themes' => 'Find more themes',
'saving' => 'Saving theme...',
'return' => 'Return to themes list',
'return' => 'Return to themes list'
],
'maintenance' => [
'settings_menu' => 'Maintenance mode',
'settings_menu_description' => 'Configure the maintenance mode page and toggle the setting.',
'is_enabled' => 'Enable maintenance mode',
'is_enabled_comment' => 'Select the page to show when maintenance mode is activated.',
'hint' => 'Maintenance mode will display the maintenance page to visitors who are not signed in to the back-end area.',
'hint' => 'Maintenance mode will display the maintenance page to visitors who are not signed in to the back-end area.'
],
'page' => [
'not_found_name' => "The page ':name' is not found",

View File

@ -45,6 +45,8 @@ return [
'homepage_placeholder' => 'A honlap webcíme',
'code_label' => 'Kód',
'code_placeholder' => 'Egyedi azonosító ehhez a témához',
'preview_label' => 'Előnézet',
'preview_placeholder' => 'A téma előnézeti képének elérési útvonala.',
'dir_name_label' => 'Könyvtár',
'dir_name_create_label' => 'A célkönyvtár',
'theme_label' => 'Téma',