Merge branch 'develop' into table-widget

This commit is contained in:
alekseybobkov 2014-11-11 19:50:16 -08:00
commit 228253fdf6
38 changed files with 591 additions and 287 deletions

View File

@ -67,7 +67,7 @@ Route::filter('guest', function () {
*/
Route::filter('csrf', function () {
if (Session::token() != Input::get('_token')) {
if (Session::token() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException;
}
});

View File

@ -8978,7 +8978,9 @@ label {
margin-top: -5px;
}
.form-group.no-padding.span-left,
.form-group.no-padding.span-right {
.form-group.field-slim.span-left,
.form-group.no-padding.span-right,
.form-group.field-slim.span-right {
width: 50%;
}
.form-group.input-sidebar-control {
@ -10013,10 +10015,10 @@ table.table.data tr.list-tree-level-25 td.list-cell-index-1 {
.report-widget .table-container table.table.data tbody tr:nth-child(even) th {
background-color: transparent;
}
#layout-flash-messages + .list-header {
.list-header:first-of-type {
margin-top: -20px;
}
#layout-flash-messages + .list-header > .control-toolbar {
.list-header:first-of-type > .control-toolbar {
padding-top: 20px;
}
@media only screen and (max-width: 960px) {
@ -11788,6 +11790,12 @@ body.dropdown-open .dropdown-overlay {
.control-tabs > div.tab-content > div.tab-pane.active.layout-cell {
display: table-cell;
}
.control-tabs > div.tab-content > div.tab-pane.pane-compact {
padding: 0;
}
.control-tabs > div.tab-content > div.tab-pane.pane-padded {
padding: 20px 20px 0 20px;
}
.control-tabs[data-closable] > ul.nav-tabs > li,
.control-tabs[data-closable] > div > ul.nav-tabs > li,
.control-tabs[data-closable] > div > div > ul.nav-tabs > li {
@ -11796,8 +11804,8 @@ body.dropdown-open .dropdown-overlay {
.control-tabs[data-closable] > ul.nav-tabs > li a,
.control-tabs[data-closable] > div > ul.nav-tabs > li a,
.control-tabs[data-closable] > div > div > ul.nav-tabs > li a {
padding-left: 20px!important;
padding-right: 0!important;
padding-left: 20px !important;
padding-right: 0 !important;
}
.control-tabs[data-closable] > ul.nav-tabs > li span.tab-close,
.control-tabs[data-closable] > div > ul.nav-tabs > li span.tab-close,
@ -11988,6 +11996,12 @@ body.dropdown-open .dropdown-overlay {
background-position: -61px 0;
z-index: 107;
}
.control-tabs.primary.tabs-offset > ul.nav-tabs,
.control-tabs.primary.tabs-offset > div > ul.nav-tabs,
.control-tabs.primary.tabs-offset > div > div > ul.nav-tabs {
margin-left: 0;
margin-right: 0;
}
.control-tabs.secondary > ul.nav-tabs > li,
.control-tabs.secondary > div > ul.nav-tabs > li,
.control-tabs.secondary > div > div > ul.nav-tabs > li {
@ -12631,7 +12645,8 @@ ul.status-list li span.status.info {
.control-breadcrumb + .padded-container {
margin-top: -20px;
}
.control-breadcrumb.no-bottom-margin {
.control-breadcrumb.no-bottom-margin,
.control-breadcrumb.breadcrumb-flush {
margin-bottom: 0;
}
body.slim-container .control-breadcrumb {
@ -13352,8 +13367,8 @@ div.popover-overlay {
.fancy-layout.control-tabs.primary > .tab-content > .tab-pane {
padding: 15px 15px 0 15px;
}
.fancy-layout .control-tabs.primary > .tab-content > .tab-pane.full-size,
.fancy-layout.control-tabs.primary > .tab-content > .tab-pane.full-size {
.fancy-layout .control-tabs.primary > .tab-content > .tab-pane.pane-compact,
.fancy-layout.control-tabs.primary > .tab-content > .tab-pane.pane-compact {
padding: 0;
}
.fancy-layout .control-tabs.primary > .tab-content > .tab-pane .form-control,

View File

@ -62,7 +62,7 @@
return
this.$container.removeClass('in')
this.$overlay.removeClass('in')
if (this.$overlay) this.$overlay.removeClass('in')
$.support.transition && this.$container.hasClass('fade')
? this.$container
@ -148,7 +148,7 @@
* Display the popover
*/
this.$container.addClass('in')
this.$overlay.addClass('in')
if (this.$overlay) this.$overlay.addClass('in')
$(document.body).addClass('popover-open')
var showEvent = jQuery.Event('show.oc.popover', { relatedTarget: this.$container.get(0) })

View File

@ -44,7 +44,9 @@
margin-top: -20px;
}
&.no-bottom-margin {
// Breadcrumb to sit flush to the element below
&.no-bottom-margin, // @deprecated remove if year >= 2015
&.breadcrumb-flush {
margin-bottom: 0;
}
}

View File

@ -293,12 +293,12 @@
> div > ul.nav-tabs {
background: @color-fancy-form-tabless-fields-bg;
> li {
a {
color: white;
}
&.active a {
color: #2b3e50;
}
@ -384,7 +384,7 @@
> .tab-content > .tab-pane {
padding: 15px 15px 0 15px;
&.full-size {
&.pane-compact {
padding: 0;
}

View File

@ -140,7 +140,8 @@ label {
margin-top: -5px;
}
&.no-padding {
&.no-padding, // @deprecated remove if year >= 2015
&.field-slim {
&.span-left, &.span-right {
width: 50%;
}

View File

@ -404,7 +404,7 @@ table.table.data {
}
}
#layout-flash-messages + .list-header {
.list-header:first-of-type {
margin-top: -20px;
> .control-toolbar {
padding-top: 20px;

View File

@ -101,6 +101,13 @@
display: table-cell;
}
}
&.pane-compact {
padding: 0;
}
&.pane-padded {
padding: 20px 20px 0 20px;
}
}
}
@ -110,8 +117,8 @@
margin-right: 5px;
a {
padding-left: 20px!important;
padding-right: 0!important;
padding-left: 20px !important;
padding-right: 0 !important;
}
span.tab-close {
@ -123,7 +130,7 @@
left: -5px;
text-align: right;
font-size: 12px;
color: @color-tab-inactive-text!important;
color: @color-tab-inactive-text !important;
cursor: pointer;
i {
display: inline-block;
@ -167,7 +174,7 @@
}
&.active {
a {border-bottom: @color-tab-active-border 4px solid;}
a { border-bottom: @color-tab-active-border 4px solid; }
}
}
}
@ -262,18 +269,18 @@
background-color: @color-body-bg;
}
&.active a{
&.active a {
z-index: 107;
> span.title {
z-index: 105;
border-top-color: #d6d6d6;
&:before {
background-position: left 0;
z-index: 107;
}
&:after {
background-position: -61px 0;
z-index: 107;
@ -285,6 +292,14 @@
> div.tab-content {
}
// Tabs to sit in by the standard offset (0px)
&.tabs-offset {
> ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
margin-left: 0;
margin-right: 0;
}
}
}
&.secondary {
@ -397,7 +412,9 @@
&.hide-tabs {
.control-tabs {
ul.nav-tabs {display: none;}
ul.nav-tabs {
display: none;
}
> div.tab-content > div.tab-pane {
padding-top: 0;
@ -411,4 +428,4 @@
background: transparent;
}
}
}
}

View File

@ -47,12 +47,14 @@ body {
vertical-align: top;
height: 100%;
&.width-100 {width: 100px;}
&.width-120 {width: 120px;}
&.width-200 {width: 200px;}
&.width-300 {width: 300px;}
&.width-100 { width: 100px; }
&.width-120 { width: 120px; }
&.width-200 { width: 200px; }
&.width-300 { width: 300px; }
&.layout-container, .layout-container, &.padded-container, .padded-container {padding: 20px 20px 0 20px;}
&.layout-container, .layout-container, &.padded-container, .padded-container {
padding: 20px 20px 0 20px;
}
.layout-relative {
position: relative;

View File

@ -432,7 +432,7 @@ class FormController extends ControllerBehavior
* Helper for custom layouts. Renders Secondary Tabs.
* @return string The tab HTML markup.
*/
public function formRenderSecondaryTabs($suppressTabs = false)
public function formRenderSecondaryTabs()
{
return $this->formRender(['section' => 'secondary']);
}

View File

@ -275,7 +275,6 @@ class FormField
if (isset($config['path'])) {
$this->path = $config['path'];
}
if (array_key_exists('required', $config)) {
$this->required = $config['required'];
}

View File

@ -0,0 +1,180 @@
<?php namespace Backend\Classes;
use Str;
use HTML;
use Lang;
use IteratorAggregate;
use ArrayIterator;
use ArrayAccess;
/**
* Form Tabs definition
* A translation of the form field tab configuration
*
* @package october\backend
* @author Alexey Bobkov, Samuel Georges
*/
class FormTabs implements IteratorAggregate, ArrayAccess
{
const SECTION_OUTSIDE = 'outside';
const SECTION_PRIMARY = 'primary';
const SECTION_SECONDARY = 'secondary';
/**
* @var string Specifies the form section these tabs belong to.
*/
public $section = 'outside';
/**
* @var array Collection of panes fields to these tabs.
*/
public $fields = [];
/**
* @var bool Should these tabs stretch to the bottom of the page layout.
*/
public $stretch = null;
/**
* @var boolean If set to TRUE, fields will not be displayed in tabs.
*/
public $suppressTabs = false;
/**
* @var string Specifies a CSS class to attach to the tab container.
*/
public $cssClass;
/**
* Constructor.
* Specifies a tabs rendering section. Supported sections are:
* - outside - stores a section of "tabless" fields.
* - primary - tabs section for primary fields.
* - secondary - tabs section for secondary fields.
* @param string $section Specifies a section as described above.
* @param array $config A list of render mode specific config.
*/
public function __construct($section, $config = [])
{
$this->section = strtolower($section) ?: $this->section;
$this->config = $this->evalConfig($config);
if ($this->section == self::SECTION_OUTSIDE) {
$this->suppressTabs = true;
}
}
/**
* Process options and apply them to this object.
* @param array $config
* @return array
*/
protected function evalConfig($config)
{
if (array_key_exists('stretch', $config)) {
$this->stretch = $config['stretch'];
}
if (array_key_exists('suppressTabs', $config)) {
$this->suppressTabs = $config['suppressTabs'];
}
if (array_key_exists('cssClass', $config)) {
$this->cssClass = $config['cssClass'];
}
}
/**
* Add a field to the collection of tabs.
* @param string $name
* @param FormField $field
* @param string $tab
*/
public function addField($name, FormField $field, $tab = null)
{
if (!$tab) {
$tab = Lang::get('backend::lang.form.undefined_tab');
}
$this->fields[$tab][$name] = $field;
}
/**
* Returns an array of the registered fields, without tabs.
* @return array
*/
public function getFields()
{
$tablessFields = [];
foreach ($this->getTabs() as $tab) {
$tablessFields += $tab;
}
return $tablessFields;
}
/**
* Returns true if any fields have been registered for these tabs
* @return boolean
*/
public function hasFields()
{
return count($this->fields) > 0;
}
/**
* Returns an array of the registered fields, including tabs.
* @return array
*/
public function getTabs()
{
return $this->fields;
}
/**
* Get an iterator for the items.
* @return ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->suppressTabs
? $this->getFields()
: $this->getTabs()
);
}
/**
* ArrayAccess implementation
*/
public function offsetSet($offset, $value)
{
$this->fields[$offset] = $value;
}
/**
* ArrayAccess implementation
*/
public function offsetExists($offset)
{
return isset($this->fields[$offset]);
}
/**
* ArrayAccess implementation
*/
public function offsetUnset($offset)
{
unset($this->fields[$offset]);
}
/**
* ArrayAccess implementation
*/
public function offsetGet($offset)
{
return isset($this->fields[$offset]) ? $this->fields[$offset] : null;
}
}

View File

@ -1,38 +1,40 @@
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="row">
<div class="col-md-5" id="editorSettingsForm">
<div class="form-preview">
<?= $this->formRender() ?>
<div class="layout-row">
<div class="row">
<div class="col-md-5" id="editorSettingsForm">
<div class="form-preview">
<?= $this->formRender() ?>
</div>
</div>
</div>
<div class="col-md-7">
<div class="col-md-7">
<div
id="editorpreferencesCodeeditor"
class="field-codeeditor size-large layout-relative"
data-control="codeeditor"
data-font-size="<?= $fontSize ?>"
data-word-wrap="<?= $wordWrap ?>"
data-code-folding="<?= $codeFolding ?>"
data-tab-size="<?= $tabSize ?>"
data-theme="<?= $theme ?>"
data-show-invisibles="<?= $showInvisibles ?>"
data-highlight-active-line="<?= $highlightActiveLine ?>"
data-use-soft-tabs="<?= $useSoftTabs ?>"
data-show-gutter="<?= $showGutter ? 'true' : 'false' ?>"
data-language="<?= $language ?>"
data-margin="<?= $margin ?>"
data-vendor-path="<?= URL::to('/modules/backend/formwidgets/codeeditor/assets/vendor/ace') ?>/">
<textarea name="editorpreferences_codeeditor"><?= e($this->makePartial('example_code')) ?></textarea>
</div>
<div
id="editorpreferencesCodeeditor"
class="field-codeeditor size-large layout-relative"
data-control="codeeditor"
data-font-size="<?= $fontSize ?>"
data-word-wrap="<?= $wordWrap ?>"
data-code-folding="<?= $codeFolding ?>"
data-tab-size="<?= $tabSize ?>"
data-theme="<?= $theme ?>"
data-show-invisibles="<?= $showInvisibles ?>"
data-highlight-active-line="<?= $highlightActiveLine ?>"
data-use-soft-tabs="<?= $useSoftTabs ?>"
data-show-gutter="<?= $showGutter ? 'true' : 'false' ?>"
data-language="<?= $language ?>"
data-margin="<?= $margin ?>"
data-vendor-path="<?= URL::to('/modules/backend/formwidgets/codeeditor/assets/vendor/ace') ?>/">
<textarea name="editorpreferences_codeeditor"><?= e($this->makePartial('example_code')) ?></textarea>
</div>
</div>
</div>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -8,11 +8,13 @@
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= Form::open(['class'=>'layout']) ?>
<?= $this->formRender() ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -8,11 +8,13 @@
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= Form::open(['class'=>'layout']) ?>
<?= $this->formRender() ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -8,35 +8,39 @@
<?php if (!$this->fatalError): ?>
<?php Block::put('form-contents') ?>
<div class="layout">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
<div class="form-buttons layout-item fix">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('backend/users') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
<div class="layout-row">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
</div>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.creating')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('backend/users') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
</div>
<?php Block::endPut() ?>
<?php Block::put('form-sidebar') ?>

View File

@ -1,31 +1,36 @@
<?php if (!$this->fatalError): ?>
<?php Block::put('form-contents') ?>
<div class="layout">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
<div class="form-buttons layout-item fix">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<div class="layout-row">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
</div>
</div>
</div>
<?php Block::endPut() ?>

View File

@ -8,43 +8,47 @@
<?php if (!$this->fatalError): ?>
<?php Block::put('form-contents') ?>
<div class="layout">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
<div class="form-buttons layout-item fix">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('backend/users') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.user.delete_confirm')) ?>">
</button>
<div class="layout-row">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
</div>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('backend/users') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.user.delete_confirm')) ?>">
</button>
</div>
</div>
</div>
<?php Block::endPut() ?>
<?php Block::put('form-sidebar') ?>

View File

@ -34,15 +34,17 @@
<div class="layout-row">
<div class="layout-cell">
<div class="outer-form-container">
<div id="layout-flash-messages"><?= $this->makeLayoutPartial('flash_messages') ?></div>
<?= Block::placeholder('body') ?>
</div>
</div>
</div>
</div>
</div><!-- /layout-canvas -->
</div>
<!-- Flash Messages -->
<div id="layout-flash-messages"><?= $this->makeLayoutPartial('flash_messages') ?></div>
</body>
</html>

View File

@ -28,17 +28,20 @@
<!-- Content Body -->
<div class="layout-cell layout-container" id="layout-body" >
<div class="layout-relative">
<!-- Flash Messages -->
<div id="layout-flash-messages"><?= $this->makeLayoutPartial('flash_messages') ?></div>
<!-- Breadcrumb -->
<?php if ($breadcrumbContent = Block::placeholder('breadcrumb')): ?>
<div class="control-breadcrumb">
<?= $breadcrumbContent ?>
<div class="layout">
<!-- Breadcrumb -->
<?php if ($breadcrumbContent = Block::placeholder('breadcrumb')): ?>
<div class="control-breadcrumb">
<?= $breadcrumbContent ?>
</div>
<?php endif ?>
<div class="layout-row">
<?= Block::placeholder('body') ?>
</div>
<?php endif ?>
</div>
<?= Block::placeholder('body') ?>
</div>
</div>
@ -47,5 +50,9 @@
</div>
</div>
<!-- Flash Messages -->
<div id="layout-flash-messages"><?= $this->makeLayoutPartial('flash_messages') ?></div>
</body>
</html>

View File

@ -1,15 +1,21 @@
<div class="layout responsive-sidebar">
<div class="layout-cell">
<!-- Breadcrumb -->
<?php if ($breadcrumbContent = Block::placeholder('breadcrumb')): ?>
<div class="control-breadcrumb">
<?= $breadcrumbContent ?>
</div>
<?php endif ?>
<div class="padded-container">
<?= Block::placeholder('form-contents') ?>
<div class="layout">
<!-- Breadcrumb -->
<?php if ($breadcrumbContent = Block::placeholder('breadcrumb')): ?>
<div class="control-breadcrumb breadcrumb-flush">
<?= $breadcrumbContent ?>
</div>
<?php endif ?>
<div class="layout-row">
<div class="padded-container layout-cell">
<?= Block::placeholder('form-contents') ?>
</div>
</div>
</div>
</div>
<div class="layout-cell width-300 form-sidebar control-scrollpanel">
<div class="layout-relative">
@ -22,4 +28,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -125,6 +125,18 @@ div.control-componentlist {
}
}
.fancy-layout {
.control-tabs, &.control-tabs {
&.primary {
> div > ul.nav-tabs {
&.component-area {
background: @color-component-list-bg;
}
}
}
}
}
//
// File List
//

View File

@ -3,5 +3,8 @@
# ===================================
fields:
name:
label: backend::lang.user.group.name_field
name:
label: backend::lang.user.group.name_field
tabs:
stretch: true

View File

@ -6,6 +6,7 @@ use Lang;
use Form as FormHelper;
use Input;
use Event;
use Backend\Classes\FormTabs;
use Backend\Classes\FormField;
use Backend\Classes\WidgetBase;
use Backend\Classes\WidgetManager;
@ -54,19 +55,19 @@ class Form extends WidgetBase
protected $formWidgets = [];
/**
* @var array Collection of fields not contained in a tab.
* @var Backend\Classes\FormTabs Collection of fields not contained in a tab.
*/
protected $outsideFields = [];
protected $outsideTabs;
/**
* @var array Collection of fields inside the primary tabs.
* @var Backend\Classes\FormTabs Collection of fields inside the primary tabs.
*/
protected $primaryTabs = [];
protected $primaryTabs;
/**
* @var array Collection of fields inside the secondary tabs.
* @var Backend\Classes\FormTabs Collection of fields inside the secondary tabs.
*/
protected $secondaryTabs = [];
protected $secondaryTabs;
/**
* @var string If the field element names should be contained in an array.
@ -133,9 +134,9 @@ class Form extends WidgetBase
* - preview: Render this form as an uneditable preview. Default: false
* - useContainer: Wrap the result in a container, used by AJAX. Default: true
* - section: Which form section to render. Default: null
* - outside: Renders the Outside Fields area.
* - primary: Renders the Primary Tabs area.
* - secondary: Renders the Secondary Tabs area.
* - outside: Renders the Outside Fields section.
* - primary: Renders the Primary Tabs section.
* - secondary: Renders the Secondary Tabs section.
* - null: Renders all sections
*/
public function render($options = [])
@ -160,19 +161,17 @@ class Form extends WidgetBase
switch (strtolower($section)) {
case 'outside':
$sectionPartial = 'section_outside-fields';
$extraVars['tabs'] = $this->outsideTabs;
break;
case 'primary':
$sectionPartial = 'section_primary-tabs';
$extraVars['tabs'] = $this->primaryTabs;
break;
case 'secondary':
$sectionPartial = 'section_secondary-tabs';
break;
default:
$extraVars['tabs'] = $this->secondaryTabs;
break;
}
$targetPartial = $sectionPartial;
$targetPartial = 'section';
$extraVars['renderSection'] = $section;
}
@ -247,7 +246,7 @@ class Form extends WidgetBase
{
$this->defineFormFields();
$this->vars['sessionKey'] = $this->getSessionKey();
$this->vars['outsideFields'] = $this->outsideFields;
$this->vars['outsideTabs'] = $this->outsideTabs;
$this->vars['primaryTabs'] = $this->primaryTabs;
$this->vars['secondaryTabs'] = $this->secondaryTabs;
}
@ -355,6 +354,7 @@ class Form extends WidgetBase
$this->config->fields = [];
}
$this->outsideTabs = new FormTabs(FormTabs::SECTION_OUTSIDE, $this->config);
$this->addFields($this->config->fields);
/*
@ -364,7 +364,8 @@ class Form extends WidgetBase
$this->config->tabs['fields'] = [];
}
$this->addFields($this->config->tabs['fields'], 'primary');
$this->primaryTabs = new FormTabs(FormTabs::SECTION_PRIMARY, $this->config->tabs);
$this->addFields($this->config->tabs['fields'], FormTabs::SECTION_PRIMARY);
/*
* Secondary Tabs + Fields
@ -373,7 +374,8 @@ class Form extends WidgetBase
$this->config->secondaryTabs['fields'] = [];
}
$this->addFields($this->config->secondaryTabs['fields'], 'secondary');
$this->secondaryTabs = new FormTabs(FormTabs::SECTION_SECONDARY, $this->config->secondaryTabs);
$this->addFields($this->config->secondaryTabs['fields'], FormTabs::SECTION_SECONDARY);
/*
* Extensibility
@ -384,16 +386,37 @@ class Form extends WidgetBase
/*
* Convert automatic spanned fields
*/
$this->processAutoSpan($this->outsideFields);
foreach ($this->primaryTabs as $fields) {
foreach ($this->outsideTabs->getTabs() as $fields) {
$this->processAutoSpan($fields);
}
foreach ($this->secondaryTabs as $fields) {
foreach ($this->primaryTabs->getTabs() as $fields) {
$this->processAutoSpan($fields);
}
foreach ($this->secondaryTabs->getTabs() as $fields) {
$this->processAutoSpan($fields);
}
/*
* At least one tab section should stretch
*/
if (
$this->secondaryTabs->stretch === null
&& $this->primaryTabs->stretch === null
&& $this->outsideTabs->stretch === null
) {
if ($this->secondaryTabs->hasFields()) {
$this->secondaryTabs->stretch = true;
}
elseif ($this->primaryTabs->hasFields()) {
$this->primaryTabs->stretch = true;
}
else {
$this->outsideTabs->stretch = true;
}
}
/*
* Bind all form widgets to controller
*/
@ -437,18 +460,8 @@ class Form extends WidgetBase
{
foreach ($fields as $name => $config) {
$defaultTab = Lang::get('backend::lang.form.undefined_tab');
if (!is_array($config)) {
$tab = $defaultTab;
}
elseif (!isset($config['tab'])) {
$tab = $config['tab'] = $defaultTab;
}
else {
$tab = $config['tab'];
}
$fieldObj = $this->makeFormField($name, $config);
$fieldTab = is_array($config) ? array_get($config, 'tab') : null;
/*
* Check that the form field matches the active context
@ -463,14 +476,14 @@ class Form extends WidgetBase
$this->fields[$name] = $fieldObj;
switch (strtolower($addToArea)) {
case 'primary':
$this->primaryTabs[$tab][$name] = $fieldObj;
case FormTabs::SECTION_PRIMARY:
$this->primaryTabs->addField($name, $fieldObj, $fieldTab);
break;
case 'secondary':
$this->secondaryTabs[$tab][$name] = $fieldObj;
case FormTabs::SECTION_SECONDARY:
$this->secondaryTabs->addField($name, $fieldObj, $fieldTab);
break;
default:
$this->outsideFields[$name] = $fieldObj;
$this->outsideTabs->addField($name, $fieldObj, $fieldTab);
break;
}
}

View File

@ -1,12 +1,12 @@
<?php if ($outsideFields): ?>
<?= $this->makePartial('section_outside-fields') ?>
<?php if ($outsideTabs->hasFields()): ?>
<?= $this->makePartial('section', ['tabs' => $outsideTabs]) ?>
<?php endif ?>
<?php if ($primaryTabs): ?>
<?= $this->makePartial('section_primary-tabs') ?>
<?php if ($primaryTabs->hasFields()): ?>
<?= $this->makePartial('section', ['tabs' => $primaryTabs]) ?>
<?php endif ?>
<?php if ($secondaryTabs): ?>
<?= $this->makePartial('section_secondary-tabs') ?>
<?php if ($secondaryTabs->hasFields()): ?>
<?= $this->makePartial('section', ['tabs' => $secondaryTabs]) ?>
<?php endif ?>

View File

@ -1,8 +1,17 @@
<?php
// @todo Should use config instead
$isStretch = ($type=='secondary');
$type = $tabs->section;
$navCss = '';
$contentCss = '';
$paneCss = '';
if ($tabs->stretch) {
$navCss = 'layout-row min-size';
$contentCss = 'layout-row';
$paneCss = 'layout-cell';
}
?>
<div class="<?= $isStretch?'layout-row min-size':'' ?>">
<div class="<?= $navCss ?>">
<ul class="nav nav-tabs">
<?php $index = 0; foreach ($tabs as $name => $fields): ?>
<li class="<?= $index++==0?'active':''?>"><a href="#<?= $type.'tab-'.$index ?>"><?= e(trans($name)) ?></a></li>
@ -10,10 +19,10 @@
</ul>
</div>
<div class="tab-content <?= $isStretch?'layout-row ':'' ?>">
<div class="tab-content <?= $contentCss ?>">
<?php $index = 0; foreach ($tabs as $name => $fields): ?>
<div
class="tab-pane <?= $index++==0?'active':''?> <?= $isStretch?'layout-cell':'' ?>"
class="tab-pane <?= $index++==0?'active':''?> <?= $paneCss ?>"
id="<?= $type.'tab-'.$index ?>">
<?= $this->makePartial('form_fields', ['fields' => $fields]) ?>
</div>

View File

@ -6,15 +6,15 @@
id="<?= $this->getId($renderSection.'Container') ?>">
<?php if ($renderSection == 'outside'): ?>
<?= $this->makePartial('section_outside-fields') ?>
<?= $this->makePartial('section', ['tabs' => $outsideTabs]) ?>
<?php endif ?>
<?php if ($renderSection == 'primary'): ?>
<?= $this->makePartial('section_primary-tabs') ?>
<?= $this->makePartial('section', ['tabs' => $primaryTabs]) ?>
<?php endif ?>
<?php if ($renderSection == 'secondary'): ?>
<?= $this->makePartial('section_secondary-tabs') ?>
<?= $this->makePartial('section', ['tabs' => $secondaryTabs]) ?>
<?php endif ?>
</div>

View File

@ -0,0 +1,31 @@
<?php
$type = $tabs->section;
$containerCss = 'layout-row min-size';
if ($tabs->stretch) {
$containerCss = 'layout-row';
}
?>
<!-- <?= ucfirst($type) ?> Tabs -->
<div class="<?= $containerCss ?>">
<?php if ($tabs->suppressTabs): ?>
<div
id="<?= $this->getId($type.'Tabs') ?>"
class="form-tabless-fields <?= $tabs->cssClass ?>">
<?= $this->makePartial('form_fields', ['fields' => $tabs]) ?>
</div>
<?php else: ?>
<div
id="<?= $this->getId($type.'Tabs') ?>"
class="control-tabs <?= $type ?> layout <?= $tabs->cssClass ?>"
data-control="tab"
data-slidable>
<?= $this->makePartial('form_tabs', ['tabs' => $tabs]) ?>
</div>
<?php endif ?>
</div>

View File

@ -1,9 +0,0 @@
<!-- Outside Tabs -->
<div
id="<?= $this->getId('outsideFields') ?>"
class="layout-row min-size">
<div class="form-tabless-fields">
<?= $this->makePartial('form_fields', ['fields' => $outsideFields]) ?>
</div>
</div>

View File

@ -1,11 +0,0 @@
<!-- Primary Tabs -->
<div class="layout-row min-size">
<div
id="<?= $this->getId('primaryTabs') ?>"
class="control-tabs primary layout-row min-size"
data-control="tab"
data-slidable>
<?= $this->makePartial('form_tabs', ['tabs' => $primaryTabs, 'type' => 'primary', 'suppressTabs' => (isset($suppressTabs) ? $suppressTabs : false)]) ?>
</div>
</div>

View File

@ -1,11 +0,0 @@
<!-- Secondary Tabs -->
<div class="layout-row">
<div
id="<?= $this->getId('secondaryTabs') ?>"
class="control-tabs secondary layout"
data-control="tab"
data-slidable>
<?= $this->makePartial('form_tabs', ['tabs' => $secondaryTabs, 'type' => 'secondary']) ?>
</div>
</div>

View File

@ -7,11 +7,13 @@
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= Form::open(['class'=>'layout']) ?>
<?= $this->formRender() ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -7,20 +7,24 @@
<?php if (!$this->fatalError): ?>
<div class="scoreboard">
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.mail_templates.layout')) ?></h4>
<p><?= $formModel->code ?></p>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row min-size">
<div class="scoreboard">
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.mail_templates.layout')) ?></h4>
<p><?= $formModel->code ?></p>
</div>
</div>
</div>
</div>
</div>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<?= $this->formRender() ?>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -7,11 +7,13 @@
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= Form::open(['class'=>'layout']) ?>
<?= $this->formRender() ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -7,20 +7,24 @@
<?php if (!$this->fatalError): ?>
<div class="scoreboard">
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.mail_templates.template')) ?></h4>
<p><?= $formModel->code ?></p>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row min-size">
<div class="scoreboard">
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.mail_templates.template')) ?></h4>
<p><?= $formModel->code ?></p>
</div>
</div>
</div>
</div>
</div>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<?= $this->formRender() ?>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -1,10 +1,12 @@
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout-item stretch layout-column']) ?>
<?= Form::open(['class'=>'layout']) ?>
<?= $this->formRender() ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons layout-item fix">
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"

View File

@ -100,6 +100,8 @@ return [
'method' => 'Mail Method',
'sender_name' => 'Sender Name',
'sender_email' => 'Sender Email',
'php_mail' => 'PHP mail',
'sendmail' => 'Sendmail',
'smtp' => 'SMTP',
'smtp_address' => 'SMTP Address',
'smtp_authorization' => 'SMTP authorization required',
@ -111,9 +113,10 @@ return [
'sendmail' => 'Sendmail',
'sendmail_path' => 'Sendmail Path',
'sendmail_path_comment' => 'Please specify the path of the sendmail program.',
'mailgun' => 'Mailgun',
'mailgun_domain' => 'Mailgun Domain',
'mailgun_domain_comment' => 'Please specify the Mailgun domain name.',
'mailgun_secret' => 'mailgun_secret',
'mailgun_secret' => 'Mailgun Secret',
'mailgun_domain_secret' => 'Enter your Mailgun API key.',
],
'mail_templates' => [

View File

@ -38,10 +38,10 @@ class MailSettings extends Model
public function getSendModeOptions()
{
return [
static::MODE_MAIL => 'PHP mail',
static::MODE_SENDMAIL => 'Sendmail',
static::MODE_SMTP => 'SMTP',
static::MODE_MAILGUN => 'Mailgun',
static::MODE_MAIL => 'system::lang.mail.php_mail',
static::MODE_SENDMAIL => 'system::lang.mail.sendmail',
static::MODE_SMTP => 'system::lang.mail.smtp',
static::MODE_MAILGUN => 'system::lang.mail.mailgun',
];
}