Skip to content

Commit

Permalink
Fix frontend editing styling
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Lodder committed May 3, 2017
1 parent ae3b0a4 commit b9643e0
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 156 deletions.
226 changes: 107 additions & 119 deletions components/com_config/view/modules/tmpl/default.php
Expand Up @@ -33,34 +33,25 @@
");
?>

<form
action="<?php echo JRoute::_('index.php?option=com_config'); ?>"
method="post" name="adminForm" id="modules-form"
class="form-validate">

<form action="<?php echo JRoute::_('index.php?option=com_config'); ?>" method="post" name="adminForm" id="modules-form" class="form-validate">
<div class="row">

<!-- Begin Content -->
<div class="col-md-12">

<div class="btn-toolbar">
<div>
<div class="btn-group">
<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('config.save.modules.apply')">
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('config.save.modules.apply')">
<span class="icon-apply"></span>
<?php echo JText::_('JAPPLY') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('config.save.modules.save')">
<button type="button" class="btn btn-secondary" onclick="Joomla.submitbutton('config.save.modules.save')">
<span class="icon-save"></span>
<?php echo JText::_('JSAVE') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn"
onclick="Joomla.submitbutton('config.cancel.modules')">
<button type="button" class="btn btn-danger" onclick="Joomla.submitbutton('config.cancel.modules')">
<span class="icon-cancel"></span>
<?php echo JText::_('JCANCEL') ?>
</button>
Expand All @@ -82,109 +73,108 @@ class="form-validate">

<div class="row">
<div class="col-md-12">
<fieldset class="form-horizontal">
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('title'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('title'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('showtitle'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('showtitle'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('position'); ?>
</div>
<div class="controls">
<?php echo $this->loadTemplate('positions'); ?>
</div>
</div>

<hr>

<?php
if (JFactory::getUser()->authorise('core.edit.state', 'com_modules.module.' . $this->item['id'])) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('published'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('published'); ?>
</div>
</div>
<?php endif ?>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('publish_up'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('publish_up'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('publish_down'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('publish_down'); ?>
</div>
</div>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('access'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('access'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('ordering'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('ordering'); ?>
</div>
</div>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('language'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('language'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('note'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('note'); ?>
</div>
</div>

<hr>

<div id="options">
<?php echo $this->loadTemplate('options'); ?>
</div>

<?php if ($hasContent) : ?>
<div class="tab-pane" id="custom">
<?php echo $this->form->getInput('content'); ?>
</div>
<?php endif; ?>
</fieldset>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('title'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('title'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('showtitle'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('showtitle'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('position'); ?>
</div>
<div class="controls">
<?php echo $this->loadTemplate('positions'); ?>
</div>
</div>

<hr>

<?php
if (JFactory::getUser()->authorise('core.edit.state', 'com_modules.module.' . $this->item['id'])) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('published'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('published'); ?>
</div>
</div>
<?php endif ?>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('publish_up'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('publish_up'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('publish_down'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('publish_down'); ?>
</div>
</div>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('access'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('access'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('ordering'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('ordering'); ?>
</div>
</div>

<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('language'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('language'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('note'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('note'); ?>
</div>
</div>

<hr>

<div id="options">
<?php echo $this->loadTemplate('options'); ?>
</div>

<?php if ($hasContent) : ?>
<div class="tab-pane" id="custom">
<?php echo $this->form->getInput('content'); ?>
</div>
<?php endif; ?>
</div>

<input type="hidden" name="id" value="<?php echo $this->item['id']; ?>">
Expand All @@ -195,7 +185,5 @@ class="form-validate">
</div>

</div>
<!-- End Content -->
</div>

</form>
Expand Up @@ -26,7 +26,7 @@
?>
<?php echo JHtml::_('bootstrap.addSlide', 'collapseTypes', JText::_($label), 'collapse' . ($i++)); ?>

<ul class="nav nav-tabs nav-stacked">
<ul class="nav flex-column">
<?php foreach ($this->form->getFieldset($name) as $field) : ?>

<li>
Expand Down
Expand Up @@ -10,14 +10,16 @@
defined('_JEXEC') or die;
$positions = $this->model->getPositions();

JHtml::_('formbehavior.chosen', '#jform_position', null, array('disable_search_threshold' => 0 ));

// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');

// Build field
$attr = array(
'id' => 'jform_position',
'list.select' => $this->item['position'],
'list.attr' => 'class="chzn-custom-value" '
'list.attr' => 'class="chzn-custom-value custom-select" '
. 'data-custom_group_text="' . $customGroupText . '" '
. 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
. 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" '
Expand Down
14 changes: 6 additions & 8 deletions components/com_config/view/templates/tmpl/default.php
Expand Up @@ -25,19 +25,19 @@
?>

<form action="<?php echo JRoute::_('index.php?option=com_config'); ?>" method="post" name="adminForm" id="templates-form" class="form-validate">

<div class="row">
<!-- Begin Content -->

<div class="btn-toolbar">
<div>
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('config.save.templates.apply')">
<span class="icon-ok"></span> <?php echo JText::_('JSAVE') ?>
<span class="icon-ok"></span>
<?php echo JText::_('JSAVE') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn" onclick="Joomla.submitbutton('config.cancel')">
<span class="icon-cancel"></span> <?php echo JText::_('JCANCEL') ?>
<button type="button" class="btn btn-danger" onclick="Joomla.submitbutton('config.cancel')">
<span class="icon-cancel"></span>
<?php echo JText::_('JCANCEL') ?>
</button>
</div>
</div>
Expand All @@ -54,7 +54,5 @@
<input type="hidden" name="task" value="">
<?php echo JHtml::_('form.token'); ?>

<!-- End Content -->
</div>

</form>
46 changes: 19 additions & 27 deletions components/com_config/view/templates/tmpl/default_options.php
Expand Up @@ -9,39 +9,31 @@

defined('_JEXEC') or die;

// Load chosen.css


?>
<?php

$fieldSets = $this->form->getFieldsets('params');
$fieldSets = $this->form->getFieldsets('params');
?>

<legend><?php echo JText::_('COM_CONFIG_TEMPLATE_SETTINGS'); ?></legend>

<?php

// Search for com_config field set
if (!empty($fieldSets['com_config'])) : ?>
// Search for com_config field set
if (!empty($fieldSets['com_config']))
{
echo $this->form->renderFieldset('com_config');
}
else
{
// Fall-back to display all in params
foreach ($fieldSets as $name => $fieldSet)
{
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_CONFIG_' . $name . '_FIELDSET_LABEL';

<fieldset class="form-horizontal">
<?php echo $this->form->renderFieldset('com_config'); ?>
</fieldset>
if (isset($fieldSet->description) && trim($fieldSet->description))
{
echo '<p class="tip">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
}

<?php else :
echo $this->form->renderFieldset($name);

// Fall-back to display all in params
foreach ($fieldSets as $name => $fieldSet) :
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_CONFIG_' . $name . '_FIELDSET_LABEL';

if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '<p class="tip">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
endif;
?>

<fieldset class="form-horizontal">
<?php echo $this->form->renderFieldset($name); ?>
</fieldset>
<?php endforeach;
endif;
}
}

0 comments on commit b9643e0

Please sign in to comment.