Skip to content

Commit

Permalink
Updated to vendormodule standard
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Oct 8, 2017
1 parent b456844 commit d3c8e47
Show file tree
Hide file tree
Showing 12 changed files with 488 additions and 255 deletions.
10 changes: 0 additions & 10 deletions _config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,3 @@
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @link https://github.com/praxisnetau/silverware-blog
*/

// Define Module Constants:

if (!defined('SILVERWARE_BLOG_DIR')) {
define('SILVERWARE_BLOG_DIR', basename(__DIR__));
}

if (!defined('SILVERWARE_BLOG_PATH')) {
define('SILVERWARE_BLOG_PATH', realpath(__DIR__));
}
4 changes: 2 additions & 2 deletions _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Name: silverware-blog

SilverStripe\CMS\Controllers\ContentController:
required_js:
- silverware-blog/client/dist/js/bundle.js
- "silverware/blog: client/dist/js/bundle.js"
required_css:
- silverware-blog/client/dist/styles/bundle.css
- "silverware/blog: client/dist/styles/bundle.css"
2 changes: 1 addition & 1 deletion admin/client/dist/js/bundle.js

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

2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

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

10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "silverware/blog",
"type": "silverstripe-module",
"type": "silverstripe-vendormodule",
"description": "SilverWare Blog Module.",
"homepage": "https://github.com/praxisnetau/silverware-blog",
"keywords": [
Expand All @@ -27,7 +27,13 @@
}
},
"extra": {
"installer-name": "silverware-blog"
"branch-alias": {
"dev-master": "1.0.x-dev"
},
"expose": [
"admin/client/dist",
"client/dist"
]
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@
},
"dependencies": {},
"devDependencies": {
"autoprefixer": "^7.1.3",
"autoprefixer": "^7.1.5",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"clean-webpack-plugin": "^0.1.16",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.5",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"babel-preset-env": "^1.6.0",
"clean-webpack-plugin": "^0.1.17",
"copy-webpack-plugin": "^4.1.1",
"css-loader": "^0.28.7",
"extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"url-loader": "^0.5.9",
"webpack": "^3.5.5"
"style-loader": "^0.19.0",
"url-loader": "^0.6.2",
"webpack": "^3.6.0"
},
"babel": {
"presets": [
[
"es2015",
"env",
{
"modules": false
}
Expand Down
19 changes: 13 additions & 6 deletions src/Pages/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Blog extends Page implements ListSource, TagSource
* @var string
* @config
*/
private static $icon = 'silverware-blog/admin/client/dist/images/icons/Blog.png';
private static $icon = 'silverware/blog: admin/client/dist/images/icons/Blog.png';

/**
* Defines the default child class for this object.
Expand Down Expand Up @@ -108,11 +108,18 @@ class Blog extends Page implements ListSource, TagSource
*/
private static $defaults = [
'FeedEnabled' => 1,
'FeedNumberOfPosts' => 10,
'ListConfig' => [
'PaginateItems' => 1,
'ItemsPerPage' => 10
]
'FeedNumberOfPosts' => 10
];

/**
* Defines the default values for the list view component.
*
* @var array
* @config
*/
private static $list_view_defaults = [
'PaginateItems' => 1,
'ItemsPerPage' => 10
];

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Pages/BlogCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class BlogCategory extends Page implements ListSource, TagSource
* @var string
* @config
*/
private static $icon = 'silverware-blog/admin/client/dist/images/icons/BlogCategory.png';
private static $icon = 'silverware/blog: admin/client/dist/images/icons/BlogCategory.png';

/**
* Defines the default child class for this object.
Expand All @@ -92,6 +92,7 @@ class BlogCategory extends Page implements ListSource, TagSource
* @config
*/
private static $defaults = [
'ListInherit' => 1,
'HideFromMainMenu' => 1
];

Expand Down
72 changes: 71 additions & 1 deletion src/Pages/BlogPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use SilverStripe\Forms\DatetimeField;
use SilverWare\Blog\Model\BlogTag;
use SilverWare\Extensions\Model\DetailFieldsExtension;
use SilverWare\Forms\TagField;
use Page;

Expand Down Expand Up @@ -63,7 +64,7 @@ class BlogPost extends Page
* @var string
* @config
*/
private static $icon = 'silverware-blog/admin/client/dist/images/icons/BlogPost.png';
private static $icon = 'silverware/blog: admin/client/dist/images/icons/BlogPost.png';

/**
* Defines the default sort field and order for this object.
Expand Down Expand Up @@ -129,6 +130,32 @@ class BlogPost extends Page
*/
private static $allowed_children = 'none';

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

/**
* Defines the format for the meta date field.
*
* @var string
* @config
*/
private static $meta_date_format = 'd MMMM Y h:mma';

/**
* Defines the asset folder for uploaded meta images.
*
* @var string
* @config
*/
private static $meta_image_folder = 'Blog';

/**
* Defines the list item details to show for this object.
*
Expand All @@ -142,6 +169,49 @@ class BlogPost extends Page
]
];

/**
* Defines the detail fields to show for the object.
*
* @var array
* @config
*/
private static $detail_fields = [
'date' => [
'name' => 'Date',
'icon' => 'calendar',
'text' => '$MetaDateFormatted'
],
'category' => [
'name' => 'Category',
'icon' => 'folder-o',
'text' => '$CategoryLink'
]
];

/**
* Defines the setting for showing the detail fields inline.
*
* @var boolean
* @config
*/
private static $detail_fields_inline = true;

/**
* Defines the setting for hiding the detail fields header.
*
* @var boolean
* @config
*/
private static $detail_fields_hide_header = true;

/**
* Defines the setting for hiding the detail field names.
*
* @var boolean
* @config
*/
private static $detail_fields_hide_names = true;

/**
* Answers a list of field objects for the CMS interface.
*
Expand Down
13 changes: 7 additions & 6 deletions templates/SilverWare/Blog/Pages/Layout/BlogPost.ss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<article>
<% include Page\Header %>
<% include Page\Image %>
<% include Page\Content %>
<% include SilverWare\Blog\Pages\BlogPost\Tags %>
</article>
<article>
<% include Page\Header %>
<% include Page\Image %>
<% include SilverWare\Extensions\Model\DetailFieldsExtension\Details %>
<% include Page\Content %>
<% include SilverWare\Blog\Pages\BlogPost\Tags %>
</article>
21 changes: 14 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');

// Load Plugin Modules:

Expand All @@ -19,13 +20,13 @@ const PATHS = {
SRC: path.resolve(__dirname, 'admin/client/src'),
DIST: path.resolve(__dirname, 'admin/client/dist'),
BUNDLES: path.resolve(__dirname, 'admin/client/src/bundles'),
PUBLIC: '/silverware-blog/admin/client/dist/'
PUBLIC: '/resources/silverware/blog/admin/client/dist/'
},
MODULE: {
SRC: path.resolve(__dirname, 'client/src'),
DIST: path.resolve(__dirname, 'client/dist'),
BUNDLES: path.resolve(__dirname, 'client/src/bundles'),
PUBLIC: '/silverware-blog/client/dist/',
PUBLIC: '/resources/silverware/blog/client/dist/',
},
MODULES: path.resolve(__dirname, 'node_modules')
};
Expand Down Expand Up @@ -59,7 +60,10 @@ const rules = (env) => {
loader: 'css-loader'
},
{
loader: 'postcss-loader'
loader: 'postcss-loader',
options: {
plugins: [ autoprefixer ] // see "browserslist" in package.json
}
}
])
},
Expand All @@ -70,7 +74,10 @@ const rules = (env) => {
loader: 'css-loader'
},
{
loader: 'postcss-loader'
loader: 'postcss-loader',
options: {
plugins: [ autoprefixer ] // see "browserslist" in package.json
}
},
{
loader: 'sass-loader',
Expand Down Expand Up @@ -173,7 +180,7 @@ const config = (env) => {
plugins: plugins(env, PATHS.ADMIN.SRC, PATHS.ADMIN.DIST),
resolve: {
alias: {
'silverstripe-admin': path.resolve(process.env.PWD, '../silverstripe-admin/client/src')
'silverstripe-admin': path.resolve(process.env.PWD, '../../silverstripe/admin/client/src')
},
modules: [
PATHS.ADMIN.SRC,
Expand All @@ -200,8 +207,8 @@ const config = (env) => {
plugins: plugins(env, PATHS.MODULE.SRC, PATHS.MODULE.DIST),
resolve: {
alias: {
'bootstrap': path.resolve(process.env.PWD, '../themes/silverware-theme/node_modules/bootstrap'),
'silverware-theme': path.resolve(process.env.PWD, '../themes/silverware-theme/source')
'bootstrap': path.resolve(process.env.PWD, '../../../themes/silverware-theme/node_modules/bootstrap'),
'silverware-theme': path.resolve(process.env.PWD, '../../../themes/silverware-theme/source')
},
modules: [
PATHS.MODULE.SRC,
Expand Down
Loading

0 comments on commit d3c8e47

Please sign in to comment.