From 13e343c6ffcf7ca77a13fc8944fb7e9d5bb8f779 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 29 Dec 2016 15:29:23 +0100 Subject: [PATCH] continuing changement css --- adm/helpers/HelperFormBootstrap.php | 81 +++++++++--- adm/helpers/includes/css/custom.css | 30 ++++- adm/helpers/includes/js/custom.js | 16 ++- js/admin.js | 3 - .../privatesales/AdminPrivateSalesSales.php | 120 +++++++++++------- .../privatesales_extrafields.php | 29 +++-- .../privatesales_shipping.php | 13 +- .../privatesales_tags/privatesales_tags.php | 9 +- 8 files changed, 206 insertions(+), 95 deletions(-) diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 90b9740a..40544d0a 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -315,23 +315,23 @@ class HelperFormBootstrap{ } public function inputSimpleDate($p = array()) { - if($p['period']) { + if(isset($p['period']) && $p['period']) { $this->_html .='
'; } $this->_html .='
- '.(isset($p['label']) && $p['label'] ?'':'').' + '.(isset($p['label']) && $p['label'] ?'':'').'
'.(isset($p['before']) && $p['before'] ?'
'.$p['before'].'
':'').' '.(isset($p['after']) && $p['after'] ?'
'.$p['after'].'
':'').'
'; - if($p['period']) { + if(isset($p['period']) && $p['period']) { $this->_html .='
- '.(isset($p['label-to']) && $p['label-to'] ?'':'').' + '.(isset($p['label-to']) && $p['label-to'] ?'':'').'
'.(isset($p['before-to']) && $p['before-to'] ?'
'.$p['before-to'].'
':'').' @@ -415,6 +415,9 @@ class HelperFormBootstrap{ } public function inputUploadImage($p = array()) { + if(isset($p['lang']) && $p['lang']) { + return $this->inputUploadImageL($p); + } $this->_html .='
'.(isset($p['label'])?'':'').' @@ -433,6 +436,44 @@ class HelperFormBootstrap{
+ '.(isset($p['help'])?'

'.$p['help'].'

':'').' +
'; + } + + public function inputUploadImageL($p = array()) { + $defaultLanguage = (isset($p['default_language']) && $p['default_language'])? $p['default_language'] : 2; + $this->_html .=' +
+ '; + //$this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img'],'table'); + //$this->_html .= ' + foreach ($p['languages'] as $language) { + $this->_html .=' +
+
+ + + +
+ + Ouvrir + +
+
+
'; + if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) { + $this->_html .='

Image '.$language['iso_code'].'

'; + } + $this->_html .='
'; + } + $this->_html .= '
+ '.((isset($p['help']) && $p['help']) ? ''.$p['help'].'' : '').'
'; } @@ -443,7 +484,7 @@ class HelperFormBootstrap{
@@ -475,7 +516,11 @@ class HelperFormBootstrap{ $defaultLanguage = $p['default_language'] ? $p['default_language'] : 2; $this->_html .= '
- +
'; foreach ($p['languages'] as $language) { $default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value; @@ -484,7 +529,6 @@ class HelperFormBootstrap{
'; } - $this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']); $this->_html .= '
'.((isset($p['help']) && $p['help']) ? ''.$p['help'].'' : '').'
@@ -502,7 +546,11 @@ class HelperFormBootstrap{ $defaultLanguage = $p['default_language'] ? $p['default_language'] : 2; $this->_html .= '
- +
'; foreach ($p['languages'] as $language) { $default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value; @@ -511,7 +559,6 @@ class HelperFormBootstrap{
'; } - $this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']); $this->_html .= '
'; @@ -523,10 +570,10 @@ class HelperFormBootstrap{
-
'; } - public function displayFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false, $link_flag_img = "../img/l/") + public function displayFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false, $link_flag_img = "../img/l/", $display ='block') { if (sizeof($languages) == 1) return false; - $output = ' + $output = '
-
+
Choose language:
'; foreach ($languages as $language) { if($use_vars_instead_of_ids) - $output .= ''.$language['name'].' '; + $output .= ''.$language['name'].' '; else - $output .= ''.$language['name'].' '; + $output .= ''.$language['name'].' '; } - $output .= '
'; + $output .= '
'; if ($return) return $output; diff --git a/adm/helpers/includes/css/custom.css b/adm/helpers/includes/css/custom.css index b3310361..58feccd9 100644 --- a/adm/helpers/includes/css/custom.css +++ b/adm/helpers/includes/css/custom.css @@ -174,6 +174,17 @@ div.tagsinput span.tag a { color: #fff; } +.select2-container--default .select2-selection--multiple .select2-selection__choice{ + border: 1px solid #504d8b; + background: #796dc7; + color: #fff; + padding: 3px; + border-radius: 2px; +} +.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{ + color: #fff; +} + #content .alert { width: 100%; margin: 0; @@ -193,8 +204,8 @@ div.tagsinput span.tag a { border-color: #d6e9c6; } -/* form */ -.form-control { +/* form img */ +.form-control.image-preview-filename { height: 28px; line-height: 28px; } @@ -224,6 +235,8 @@ div.tagsinput span.tag a { .image-preview-input-title { margin-left:2px; } + +/* switch */ .checkbox.input-switch label, .radio.input-switch label { padding-left: 0px; width: auto; @@ -266,4 +279,17 @@ table.table tr th { .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #504d8b; color: white; +} + +/* Language choice box */ +.flags_custom{ + float: left; + position: relative; +} +.language_flags.language_flags_custom{ + position: absolute; + z-index: 999; + margin: 0; + width: 120px; + right: 0; } \ No newline at end of file diff --git a/adm/helpers/includes/js/custom.js b/adm/helpers/includes/js/custom.js index 38cf6ce9..04750720 100644 --- a/adm/helpers/includes/js/custom.js +++ b/adm/helpers/includes/js/custom.js @@ -1,4 +1,3 @@ - $(document).on('click', '#close-preview', function(){ $('.image-preview').popover('hide'); $('.image-preview').hover( @@ -60,4 +59,17 @@ $(function() { elems.forEach(function(html) { var switchery = new Switchery(html, { size: 'small', color: '#504d8b' }); }); -}); \ No newline at end of file +}); + +function changeLang(field, fieldsString, id_language_new, iso_code, display) +{ + var fields = fieldsString.split('¤'); + for (var i = 0; i < fields.length; ++i) + { + getE(fields[i] + '_' + id_language).style.display = 'none'; + getE(fields[i] + '_' + id_language_new).style.display = display; + getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg'; + } + getE('languages_' + field).style.display = 'none'; + id_language = id_language_new; +} \ No newline at end of file diff --git a/js/admin.js b/js/admin.js index dba1aac3..f05aace3 100755 --- a/js/admin.js +++ b/js/admin.js @@ -176,12 +176,9 @@ function toggleLanguageFlags(elt) // Kept for retrocompatibility only (out of AdminProducts & AdminCategories) function changeLanguage(field, fieldsString, id_language_new, iso_code) { - console.log(field); - console.log(fieldsString); var fields = fieldsString.split('¤'); for (var i = 0; i < fields.length; ++i) { - console.log(fields[i] + '_' + id_language); getE(fields[i] + '_' + id_language).style.display = 'none'; getE(fields[i] + '_' + id_language_new).style.display = 'block'; getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg'; diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index dd345f5b..62ef33b8 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -29,11 +29,13 @@ class AdminPrivateSalesSales extends AdminTab { foreach(array_keys($this->imagelist) as $img) { $images[] = 'img_'.$img; } - $divLangName = 'description¤video¤'.implode('¤', $images); + $divLangName = 'description¤video'; + $divLangImgName = implode('¤', $images); $helperForm = new HelperFormBootstrap(); $helperForm->_select2 = true; $helperForm->_inputMask = true; + $helperForm->_inputSwitch = true; $helperForm->_js .='
-
'; + + '; } }