diff --git a/bl-kernel/admin/views/editor.php b/bl-kernel/admin/views/editor.php index 674c6c8e..5ad58fbe 100644 --- a/bl-kernel/admin/views/editor.php +++ b/bl-kernel/admin/views/editor.php @@ -135,12 +135,21 @@ // Ctrl+S or Command+S if ((event.ctrlKey || event.metaKey) && event.which == 83) { event.preventDefault(); + + // Parse all custom fields inputs var customFields = {} $('input[name^="custom"]').each(function() { var field = $(this).data('field') var value = $(this).val() customFields[field] = value }); + $('select[name^="custom"]').each(function() { + var field = $(this).data('field'); + var value = $(this).val(); + customFields[field] = value; + }); + + // Create array with all inputs var args = { slug: $('#friendlyURL').val(), title: $('#title').val(), @@ -190,12 +199,20 @@ }); $('#btnSave').on('click', function() { + // Parse all custom fields inputs var customFields = {} $('input[name^="custom"]').each(function() { var field = $(this).data('field') var value = $(this).val() customFields[field] = value }); + $('select[name^="custom"]').each(function() { + var field = $(this).data('field'); + var value = $(this).val(); + customFields[field] = value; + }); + + // Create array with all inputs var args = { slug: $('#friendlyURL').val(), title: $('#title').val(), @@ -393,13 +410,20 @@ return false; } + // Parse all custom fields inputs var customFields = {} $('input[name^="custom"]').each(function() { var field = $(this).data('field') var value = $(this).val() customFields[field] = value }); + $('select[name^="custom"]').each(function() { + var field = $(this).data('field'); + var value = $(this).val(); + customFields[field] = value; + }); + // Create array with all inputs var args = { slug: $('#friendlyURL').val(), title: $('#title').val(), @@ -697,12 +721,12 @@ 'data' => array('field' => $field) )); } elseif ($options['type']=="bool") { - echo Bootstrap::formCheckbox(array( - 'name'=>'custom['.$field.']', - 'label'=>(isset($options['label'])?$options['label']:''), - 'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), - 'checked'=>(($pageKey && $page->custom($field))?true:false), - 'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''), + echo Bootstrap::formSelectBlock(array( + 'name' => 'custom['.$field.']', + 'label' => (isset($options['label'])?$options['label']:''), + 'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')), + 'selected' => (($pageKey && $page->custom($field))?'true':'false'), + 'tip' => (isset($options['tip'])?$options['tip']:''), 'data' => array('field' => $field) )); } @@ -732,12 +756,12 @@ 'data' => array('field' => $field) )); } elseif ($options['type']=="bool") { - echo Bootstrap::formCheckbox(array( - 'name'=>'custom['.$field.']', - 'label'=>(isset($options['label'])?$options['label']:''), - 'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), - 'checked'=>(($pageKey && $page->custom($field))?true:false), - 'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''), + echo Bootstrap::formSelectBlock(array( + 'name' => 'custom['.$field.']', + 'label' => (isset($options['label'])?$options['label']:''), + 'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')), + 'selected' => (($pageKey && $page->custom($field))?'true':'false'), + 'tip' => (isset($options['tip'])?$options['tip']:''), 'data' => array('field' => $field) )); } @@ -810,6 +834,37 @@ + + + customFields(); + foreach ($customFields as $field=>$options) { + if ( isset($options['position']) && ($options['position']=='menu') ) { + if ($options['type']=="string") { + echo '
'.(isset($options['label'])?$options['label']:'').'
'; + echo Bootstrap::formInputTextBlock(array( + 'name'=>'custom['.$field.']', + 'value'=>(($pageKey && $page->custom($field))?$page->custom($field):''), + 'tip'=>(isset($options['tip'])?$options['tip']:''), + 'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), + 'class'=>'', + 'data' => array('field' => $field) + )); + } elseif ($options['type']=="bool") { + echo '
'.(isset($options['label'])?$options['label']:'').'
'; + echo Bootstrap::formSelectBlock(array( + 'name' => 'custom['.$field.']', + 'label' => '', + 'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')), + 'selected' => (($pageKey && $page->custom($field))?true:false), + 'tip' => (isset($options['tip'])?$options['tip']:''), + 'data' => array('field' => $field) + )); + } + } + } + ?> +
p('More options') ?>