Skip to content

Commit

Permalink
Numerous fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed May 8, 2017
1 parent 476fcef commit d3e515f
Show file tree
Hide file tree
Showing 26 changed files with 978 additions and 316 deletions.
2 changes: 2 additions & 0 deletions _config/controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SilverStripe\CMS\Controllers\ContentController:
load_css: true
load_themed_js: true
load_themed_css: false
load_custom_css: true
load_component_requirements: true
disable_cache: true

Expand All @@ -48,5 +49,6 @@ SilverStripe\CMS\Controllers\ContentController:
load_css: false
load_themed_js: true
load_themed_css: true
load_custom_css: true
load_component_requirements: false
disable_cache: false
16 changes: 12 additions & 4 deletions _config/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ SilverWare\Dev\FixtureFactory:

SilverWare\Dev\FixtureBlueprint:
default_parents:
SilverWare\Model\Template: `\SilverWare\Folders\TemplateFolder::find()->ID`
SilverWare\Model\Layout: `\SilverWare\Folders\LayoutFolder::find()->ID`
SilverWare\Model\Panel: `\SilverWare\Folders\PanelFolder::find()->ID`
SilverWare\Model\Template:
class: SilverWare\Folders\TemplateFolder
method: find
SilverWare\Model\Layout:
class: SilverWare\Folders\LayoutFolder
method: find
SilverWare\Model\Panel:
class: SilverWare\Folders\PanelFolder
method: find
default_relations:
SilverStripe\SiteConfig\SiteConfig: `\SilverStripe\SiteConfig\SiteConfig::current_site_config()->ID`
SilverStripe\SiteConfig\SiteConfig:
class: SilverStripe\SiteConfig\SiteConfig
method: current_site_config
default_identifiers:
SilverWare\Model\PageType: PageClass
verbose: false
5 changes: 5 additions & 0 deletions _config/styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Name: silverware-styles
# Bootstrap Styles:

SilverWare\Grid\Frameworks\Bootstrap\Framework:
breakpoints:
small: 576px
medium: 768px
large: 992px
huge: 1200px
style_mappings:
align:
left: left
Expand Down
2 changes: 1 addition & 1 deletion admin/client/dist/styles/bundle.css

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions admin/client/src/styles/forms/ViewportsField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

.field {

&.viewports .dropdown {
min-width: 140px;
&.viewports {

.text, .dropdown {
min-width: 140px;
max-width: 140px;
}

}

}
2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions client/src/styles/components/ListComponent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
}

> section.content {
flex: 1;
order: 2;
margin-left: $spacer;
}
Expand All @@ -105,6 +106,7 @@
}

> section.content {
flex: 1;
order: 1;
margin-right: $spacer;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"
"dev-master": "0.2.x-dev"
},
"installer-name": "silverware"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "silverware",
"version": "0.1.0",
"version": "0.2.0",
"description": "SilverWare Component Framework.",
"homepage": "https://github.com/praxisnetau/silverware",
"keywords": [
Expand Down
157 changes: 157 additions & 0 deletions src/Components/BaseListComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<?php

/**
* This file is part of SilverWare.
*
* PHP version >=5.6.0
*
* For full copyright and license information, please view the
* LICENSE.md file that was distributed with this source code.
*
* @package SilverWare\Components
* @author Colin Tucker <colin@praxis.net.au>
* @copyright 2017 Praxis Interactive
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @link https://github.com/praxisnetau/silverware
*/

namespace SilverWare\Components;

use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\DropdownField;
use SilverWare\Extensions\Lists\ListSourceExtension;
use SilverWare\Extensions\Model\ImageResizeExtension;

/**
* An extension of the base component class for a base list component.
*
* @package SilverWare\Components
* @author Colin Tucker <colin@praxis.net.au>
* @copyright 2017 Praxis Interactive
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @link https://github.com/praxisnetau/silverware
*/
class BaseListComponent extends BaseComponent
{
/**
* Define image link constants.
*/
const IMAGE_LINK_ITEM = 'item';
const IMAGE_LINK_FILE = 'file';

/**
* Maps field names to field types for this object.
*
* @var array
* @config
*/
private static $db = [
'ImageLinksTo' => 'Varchar(8)',
'LinkImages' => 'Boolean'
];

/**
* Defines the default values for the fields of this object.
*
* @var array
* @config
*/
private static $defaults = [
'ImageLinksTo' => 'item',
'LinkImages' => 1
];

/**
* Defines the extension classes to apply to this object.
*
* @var array
* @config
*/
private static $extensions = [
ListSourceExtension::class,
ImageResizeExtension::class
];

/**
* Answers a list of field objects for the CMS interface.
*
* @return FieldList
*/
public function getCMSFields()
{
// Obtain Field Objects (from parent):

$fields = parent::getCMSFields();

// Create Options Fields:

$fields->addFieldsToTab(
'Root.Options',
[
CompositeField::create([
DropdownField::create(
'ImageLinksTo',
$this->fieldLabel('ImageLinksTo'),
$this->getImageLinksToOptions()
),
CheckboxField::create(
'LinkImages',
$this->fieldLabel('LinkImages')
)
])->setName('ListImageOptions')->setTitle($this->fieldLabel('ListImageOptions'))
]
);

// Answer Field Objects:

return $fields;
}

/**
* Answers the labels for the fields of the receiver.
*
* @param boolean $includerelations Include labels for relations.
*
* @return array
*/
public function fieldLabels($includerelations = true)
{
// Obtain Field Labels (from parent):

$labels = parent::fieldLabels($includerelations);

// Define Field Labels:

$labels['LinkImages'] = _t(__CLASS__ . '.LINKIMAGES', 'Link images');
$labels['ImageLinksTo'] = _t(__CLASS__ . '.IMAGELINKSTO', 'Image links to');
$labels['ListImageOptions'] = _t(__CLASS__ . '.LISTIMAGES', 'List images');

// Answer Field Labels:

return $labels;
}

/**
* Answers a message string to be shown when no data is available.
*
* @return string
*/
public function getNoDataMessage()
{
return _t(__CLASS__ . '.NODATAAVAILABLE', 'No data available.');
}

/**
* Answers an array of options for the image links to field.
*
* @return array
*/
public function getImageLinksToOptions()
{
return [
self::IMAGE_LINK_ITEM => _t(__CLASS__ . '.ITEM', 'Item'),
self::IMAGE_LINK_FILE => _t(__CLASS__ . '.FILE', 'File')
];
}
}
Loading

0 comments on commit d3e515f

Please sign in to comment.