Skip to content

Commit

Permalink
#3 implementation of the generic settings tool
Browse files Browse the repository at this point in the history
  • Loading branch information
1stthomas committed Oct 3, 2021
1 parent 6981176 commit dd8ca32
Show file tree
Hide file tree
Showing 54 changed files with 2,439 additions and 6 deletions.
58 changes: 58 additions & 0 deletions config/assets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

return [
'group' => [
'ht7-widgets/body-overlay' => [
['css', 'ht7-widgets/body-overlay'],
['javascript', 'ht7-widgets/body-overlay']
],
'ht7-tools/settings' => [
['css', 'ht7-tools/settings'],
['javascript', 'ht7-tools/settings']
]
],
'single' => [
[
'css',
'ht7-tools/settings',
'css/ht7.tools.settings.css',
['version' => '0.0.1', 'minify' => true, 'combine' => true]
],
[
'css',
'ht7-widgets/status-toggle',
'css/ht7.widgets.statustoggle.css',
['version' => '0.0.1', 'minify' => true, 'combine' => true]
],
[
'css',
'ht7-widgets/body-overlay',
'css/ht7.widgets.bodyoverlay.css',
['version' => '0.0.1', 'minify' => true, 'combine' => true],
],
[
'javascript',
'ht7-extenders',
'js/ht7.extenders.js',
['version' => '0.0.1', 'minify' => true, 'combine' => true],
],
[
'javascript',
'ht7-tools/settings',
'js/ht7.tools.settings.js',
['version' => '0.0.1', 'minify' => true, 'combine' => true]
],
[
'javascript',
'ht7-widgets/body-overlay',
'js/ht7.widgets.bodyoverlay.js',
['version' => '0.0.1', 'minify' => true, 'combine' => true]
],
[
'javascript',
'ht7-widgets/concrete5',
'js/ht7.widgets.c5.js',
['version' => '0.0.1', 'minify' => true, 'combine' => true],
]
]
];
84 changes: 84 additions & 0 deletions config/forms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

return [
'settings' => [
// 'fieldsets' => [
// 'styles' => tc('ht7_c5_base', 'Styles'),
// 'rows' => tc('ht7_c5_base', 'Row Appearance'),
// ],
// 'libraryFilePathBase' => [
// 'label' => tc('ht7_c5_library', 'File path base'),
// 'title' => tc('ht7_c5_library', 'Base file path of the library books which will be prepend to the file specific path.'),
// 'type' => 'text',
// ],
'saveByAjax' => [
'label' => tc('ht7_c5_library', 'Save these settings by AJAX request'),
'nsValue' => 'settings.general',
'tabId' => 'pane-general',
'title' => tc('ht7_c5_library', 'If active the saving of these settings will be done by AJAX. This will probably not show the latest changes.'),
'type' => 'boolean',
],
'showBsTooltips' => [
'label' => tc('ht7_c5_library', 'Show bootstrap tooltips'),
'nsValue' => 'settings.general',
'tabId' => 'pane-general',
'title' => tc('ht7_c5_library', 'If active the tooltips will be displayed with the l&f of the bootstrap framework.'),
'type' => 'boolean',
],
'tableStyleBordered' => [
// 'fieldset' => 'rows',
'label' => tc('ht7_c5_library', 'Settings with bordered l&f'),
'nsValue' => 'settings.styles',
'tabId' => 'pane-styles',
'title' => tc('ht7_c5_library', 'Display the settings with bordered look & feel.'),
'type' => 'boolean',
],
'tableStyleStripped' => [
// 'fieldset' => 'rows',
'label' => tc('ht7_c5_library', 'Settings with stripped l&f'),
'nsValue' => 'settings.styles',
'tabId' => 'pane-styles',
'title' => tc('ht7_c5_library', 'Display the settings with stripped look & feel.'),
'type' => 'boolean',
],
'tableRowHeightMin' => [
'attributes' => [
'max' => 50,
'min' => 20,
'step' => 1,
],
// 'fieldset' => 'styles',
'label' => tc('ht7_c5_library', 'Min Height of these rows'),
'nsValue' => 'settings.styles',
'tabId' => 'pane-styles',
'title' => tc('ht7_c5_library', 'This is the min height in pixels of these settings rows.'),
'type' => 'number',
],
'tablePaddingTop' => [
'attributes' => [
'max' => 10,
'min' => 0,
'step' => 1,
],
// 'fieldset' => 'styles',
'label' => tc('ht7_c5_library', 'Padding top of these rows'),
'nsValue' => 'settings.styles',
'tabId' => 'pane-styles',
'title' => tc('ht7_c5_library', 'This is the padding top in pixels of these settings rows.'),
'type' => 'number',
],
'tablePaddingBottom' => [
'attributes' => [
'max' => 10,
'min' => 0,
'step' => 1,
],
// 'fieldset' => 'styles',
'label' => tc('ht7_c5_library', 'Padding bottom of these rows'),
'nsValue' => 'settings.styles',
'tabId' => 'pane-styles',
'title' => tc('ht7_c5_library', 'This is the padding bottom in pixels of these settings rows.'),
'type' => 'number',
],
],
];
14 changes: 14 additions & 0 deletions config/header_items.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

return [
'settings' => [
[
'selector' => '.ht7-tools-settings .ht7-settings-list > li',
'items' => [
'min-height' => ['settings.styles.tableRowHeightMin', 'px'],
'padding-bottom' => ['settings.styles.tablePaddingBottom', 'px'],
'padding-top' => ['settings.styles.tablePaddingTop', 'px']
]
]
]
];
16 changes: 16 additions & 0 deletions config/ht7_settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

return [
'general' => [
'saveByAjax' => true,
'showBsTooltips' => true,
'libraryFilePathBase' => '',
],
'styles' => [
'tableStyleBordered' => true,
'tableStyleStripped' => true,
'tablePaddingBottom' => 5,
'tablePaddingTop' => 5,
'tableRowHeightMin' => 30,
],
];
36 changes: 36 additions & 0 deletions config/ht7_tabs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

return [
'settings' => [
'items' => [
[
'content' => [
'model_type' => 'settings-simple',
'src' => 'settings.general',
],
'id' => 'pane-general',
'name' => tc('ht7_c5_library', 'General'),
],
[
'content' => [
'model_type' => 'settings-simple',
'src' => 'settings.styles',
],
'id' => 'pane-styles',
'name' => tc('ht7_c5_library', 'Look&Feel'),
'selected' => true,
],
],
'markup' => [
'content' => [
'container' => [
'attributes' => [
'class' => 'ccm-tab-content',
'id' => 'ccm-tab-content'
],
'tag' => 'article',
]
]
]
],
];
19 changes: 19 additions & 0 deletions config/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

return [
'general' => [
// 'messageTypeError' => 'alert',
// 'messageTypeInfo' => 'notify',
// 'messageTypeSuccess' => 'notify',
// 'messageTypeWarning' => 'notify',
'saveByAjax' => false,
'showBsTooltips' => true,
],
'styles' => [
'tableStyleBordered' => true,
'tableStyleStripped' => true,
'tablePaddingBottom' => 5,
'tablePaddingTop' => 5,
'tableRowHeightMin' => 50,
],
];
30 changes: 30 additions & 0 deletions config/tabs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

return [
'settings' => [
'items' => [
[
'content' => 'settings.general',
'id' => 'pane-general',
'name' => tc('ht7_c5_library', 'General'),
],
[
'content' => 'settings.styles',
'id' => 'pane-styles',
'name' => tc('ht7_c5_library', 'Look&Feel'),
'selected' => true,
],
],
'markup' => [
'content' => [
'container' => [
'attributes' => [
'class' => 'ccm-tab-content',
'id' => 'ccm-tab-content'
],
'tag' => 'article',
]
]
]
],
];
8 changes: 6 additions & 2 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use \Concrete\Core\Package\PackageService;
use \Concrete\Core\User\Group\Group;
use \Concrete\Package\Ht7C5Base\ServiceProvider;
use \Concrete\Package\Ht7C5Base\Ht7Tools\Tabs\ServiceProvider as TabsToolServiceProvider;

defined('C5_EXECUTE') or die('Access Denied.');

Expand Down Expand Up @@ -52,11 +53,13 @@ public function install()
{
// Install the current package and create the defined db entities.
$this->pkg = parent::install();
// Create all pages through the content XML.
$this->installContentFile('install.xml');

$this->setupAutoloader();
// Make sure the package helper can be accessed by later installation
// process' of this package.
$this->registerServices();
// Create all pages through the content XML.
$this->installContentFile('install.xml');
// If the path uses "-" to separate words and the filename
// uses "_", the cFilename on the Pages table is empty.
// Therefor we need to update this field.
Expand Down Expand Up @@ -138,6 +141,7 @@ private function registerServices()
{
$list = new ProviderList($this->app);
$list->registerProvider(ServiceProvider::class);
$list->registerProvider(TabsToolServiceProvider::class);
}

private function setupAutoloader()
Expand Down
2 changes: 1 addition & 1 deletion controllers/single_page/dashboard/ht7/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Concrete\Package\Ht7C5Base\Controller\SinglePage\Dashboard\Ht7;

use \Concrete\Package\Ht7C5Base\Controller\SinglePage\AbstractRedirectToFirstChild;
use \Concrete\Package\Ht7C5Base\Ht7Tools\Controllers\AbstractRedirectToFirstChild;

defined('C5_EXECUTE') or die('Access Denied.');

Expand Down
12 changes: 12 additions & 0 deletions controllers/single_page/dashboard/ht7/tools.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Concrete\Package\Ht7C5Base\Controller\SinglePage\Dashboard\Ht7;

use \Concrete\Package\Ht7C5Base\Ht7Tools\Controllers\AbstractRedirectToFirstChild;

defined('C5_EXECUTE') or die('Access Denied.');

class Tools extends AbstractRedirectToFirstChild
{

}
42 changes: 42 additions & 0 deletions controllers/single_page/dashboard/ht7/tools/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Concrete\Package\Ht7C5Base\Controller\SinglePage\Dashboard\Ht7\Tools;

use \Concrete\Core\Page\Page;
use \Concrete\Package\Ht7C5Base\Ht7Tools\Controllers\AbstractHt7ToolsSettings;
use \Concrete\Package\Ht7C5Base\Ht7Tools\Settings\Elements\PageDefinitions;
use \Concrete\Package\Ht7C5Base\Ht7Tools\Settings\PageDefinitionTypes;

defined('C5_EXECUTE') or die('Access Denied.');

class Settings extends AbstractHt7ToolsSettings
{

public function __construct(Page $c)
{
parent::__construct($c);

/* @var $pkgH \Concrete\Package\Ht7C5Base\Services\PackageBase */
$pkgH = $this->app->make('helper/ht7/package/base');
$pkgFileConfig = $pkgH->getPackageFileConfig($this);
$pkgHandle = $pkgH->getPackageHandle($this);

$this->definitions = new PageDefinitions(
[
'definitions' => ['forms.settings', $pkgFileConfig],
'elements' => [
'label' => ['tools/settings/label', $pkgHandle],
'setting' => ['tools/settings/attributes', $pkgHandle]
],
'tabs' => ['ht7_tabs.settings', $pkgFileConfig],
'urls' => [
'form_abort' => $this->action(),
'form_save' => $this->action('save'),
],
'values' => ['settings', $pkgFileConfig],
],
PageDefinitionTypes::SIMPLE
);
}

}
28 changes: 28 additions & 0 deletions css/ht7.tools.settings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ccm-dashboard-page .ht7-dashboard.ht7-tools-settings.bordered-settings ul.ht7-settings-list li {
border-bottom: 1px solid #ddd;
}
#ccm-dashboard-page .ht7-dashboard.ht7-tools-settings.stripped-settings ul.ht7-settings-list li:nth-child(even) {
position: relative;
}
#ccm-dashboard-page .ht7-dashboard.ht7-tools-settings.stripped-settings ul.ht7-settings-list li:nth-child(even) .styler {
background-color: #efefef;
bottom: 0;
left: 0;
opacity: 0.5;
position: absolute;
right: 0;
top: 0;
}
#ccm-dashboard-page .ht7-dashboard.ht7-tools-settings ul.ht7-settings-list {
list-style: none;
margin: 0;
padding: 0;
}
#ccm-dashboard-page .ht7-dashboard.ht7-tools-settings ul.ht7-settings-list li {
/* .styler {
}*/
}
#ccm-dashboard-page .ht7-dashboard.ht7-tools-settings ul.ht7-settings-list li .control-label {
margin-bottom: 0;
}
Loading

0 comments on commit dd8ca32

Please sign in to comment.