[frio] Add background-repeat attribute to background image options

- Update background image options names and labels
- Add background image option label tag
This commit is contained in:
Hypolite Petovan 2018-04-24 20:42:23 -04:00
parent 4307a87d6a
commit 86e4690b5f
5 changed files with 16 additions and 6 deletions

View file

@ -111,7 +111,7 @@ function frio_form($arr)
}
}
$background_image_help = '<strong>' . L10n::t('Note') . ': </strong>' . L10n::t('Check image permissions if all users are allowed to visit the image');
$background_image_help = '<strong>' . L10n::t('Note') . ': </strong>' . L10n::t('Check image permissions if all users are allowed to see the image');
$t = get_markup_template('theme_settings.tpl');
$ctx = [
@ -123,8 +123,9 @@ function frio_form($arr)
'$nav_icon_color' => array_key_exists('nav_icon_color', $disable) ? '' : ['frio_nav_icon_color', L10n::t('Navigation bar icon color '), $arr['nav_icon_color'], '', false],
'$link_color' => array_key_exists('link_color', $disable) ? '' : ['frio_link_color', L10n::t('Link color'), $arr['link_color'], '', false],
'$background_color' => array_key_exists('background_color', $disable) ? '' : ['frio_background_color', L10n::t('Set the background color'), $arr['background_color'], '', false],
'$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), ((isset($arr['contentbg_transp']) && $arr['contentbg_transp'] != '') ? $arr['contentbg_transp'] : 100), ''],
'$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), defaults($arr, 'contentbg_transp', 100), ''],
'$background_image' => array_key_exists('background_image', $disable) ? '' : ['frio_background_image', L10n::t('Set the background image'), $arr['background_image'], $background_image_help, false],
'$bg_image_options_title' => L10n::t('Background image style'),
'$bg_image_options' => Image::get_options($arr),
];

View file

@ -27,6 +27,7 @@ body {
background-color: $background_color;
background-image: url("$background_image");
background-size: $background_size_img;
background-repeat: $background_repeat;
background-attachment: fixed;
color: #777;
/*color: #555;*/

View file

@ -21,10 +21,10 @@ class Image
public static function get_options($arr)
{
$bg_image_options = [
'repeat' => ['frio_bg_image_option', L10n::t('Repeat the image'), 'repeat', L10n::t('Will repeat your image to fill the background.'), ($arr['bg_image_option'] == 'repeat')],
'stretch' => ['frio_bg_image_option', L10n::t('Stretch'), 'stretch', L10n::t('Will stretch to width/height of the image.'), ($arr['bg_image_option'] == 'stretch')],
'cover' => ['frio_bg_image_option', L10n::t('Resize fill and-clip'), 'cover', L10n::t('Resize to fill and retain aspect ratio.'), ($arr['bg_image_option'] == 'cover')],
'contain' => ['frio_bg_image_option', L10n::t('Resize best fit'), 'contain', L10n::t('Resize to best fit and retain aspect ratio.'), ($arr['bg_image_option'] == 'contain')],
'stretch' => ['frio_bg_image_option', L10n::t("Stretch"), "stretch", L10n::t("Resize image to the width of the screen and show background color below on long pages."), ($arr["bg_image_option"] == "stretch")],
'cover' => ['frio_bg_image_option', L10n::t("Resize, fill and clip"), "cover", L10n::t("Resize image to fill entire screen, clipping either the right or the bottom."), ($arr["bg_image_option"] == "cover")],
'repeat' => ['frio_bg_image_option', L10n::t("Repeat"), "repeat", L10n::t("Repeat image to fill the screen."), ($arr["bg_image_option"] == "repeat")],
'contain' => ['frio_bg_image_option', L10n::t("Repeat one row"), "contain", L10n::t("Resize image to repeat it on a single row, either vertical or horizontal."), ($arr["bg_image_option"] == "contain")],
];
return $bg_image_options;

View file

@ -152,22 +152,28 @@ if (!isset($link_hover_color)) {
if (!isset($bg_image_option)) {
$bg_image_option = null;
}
switch ($bg_image_option) {
case 'stretch':
$background_size_img = '100%';
$background_repeat = 'no-repeat';
break;
case 'cover':
$background_size_img = 'cover';
$background_repeat = 'no-repeat';
break;
case 'repeat':
$background_size_img = 'auto';
$background_repeat = 'repeat';
break;
case 'contain':
$background_size_img = 'contain';
$background_repeat = 'repeat';
break;
default:
$background_size_img = 'auto';
$background_repeat = 'no-repeat';
break;
}
@ -187,6 +193,7 @@ $options = [
'$contentbg_transp' => $contentbg_transp,
'$background_image' => $background_image,
'$background_size_img' => $background_size_img,
'$background_repeat' => $background_repeat,
'$login_bg_image' => $login_bg_image,
'$login_bg_color' => $login_bg_color
];

View file

@ -25,6 +25,7 @@
{{if $background_image}}{{include file="field_fileinput.tpl" field=$background_image}}{{/if}}
<div id="frio_bg_image_options" style="display: none;">
<label>{{$bg_image_options_title}}:</label>
{{foreach $bg_image_options as $options}}
{{include file="field_radio.tpl" field=$options}}
{{/foreach}}