Merge pull request #507 from creative-commoners/pulls/3.0/vendorise-module

Review SS4 update
This commit is contained in:
Robbie Averill 2018-01-30 11:55:29 +13:00 committed by GitHub
commit b79f3db883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 996 additions and 754 deletions

View File

@ -10,7 +10,7 @@ indent_style = space
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[{*.yml,package.json}] [{*.yml,*.scss,*.js,package.json}]
indent_size = 2 indent_size = 2
# The indent size used in the package.json file cannot be changed: # The indent size used in the package.json file cannot be changed:

1
.eslintrc.js Normal file
View File

@ -0,0 +1 @@
module.exports = require('@silverstripe/eslint-config/.eslintrc');

1
.gitattributes vendored
View File

@ -4,3 +4,4 @@
/.gitignore export-ignore /.gitignore export-ignore
/.travis.yml export-ignore /.travis.yml export-ignore
/.scrutinizer.yml export-ignore /.scrutinizer.yml export-ignore
/codecov.yml export-ignore

5
.gitignore vendored
View File

@ -1,6 +1,5 @@
.ssh/*
.bash*
.profile
/vendor/* /vendor/*
.sass-cache/* .sass-cache/*
/node_modules/ /node_modules/
**/*.js.map
**/*.css.map

179
.sass-lint.yml Normal file
View File

@ -0,0 +1,179 @@
# sass-lint config to match the AirBNB style guide
# See silverstripe-admin
files:
include: '**/client/src/**/*.scss'
ignore:
- 'client/src/styles/legacy/*'
- 'src/**/*'
options:
formatter: stylish
merge-default-rules: false
rules:
# Warnings
# Things that require actual refactoring are marked as warnings
class-name-format:
- 1
- convention: hyphenatedbem
placeholder-name-format:
- 1
- convention: hyphenatedlowercase
nesting-depth:
- 1
- max-depth: 3
no-ids: 1
no-important: 1
no-misspelled-properties:
- 1
- extra-properties:
- "-moz-border-radius-topleft"
- "-moz-border-radius-topright"
- "-moz-border-radius-bottomleft"
- "-moz-border-radius-bottomright"
variable-name-format:
- 1
- allow-leading-underscore: true
convention: hyphenatedlowercase
no-extends: 1
# Warnings: these things are preferential rather than mandatory
no-css-comments: 1
# Errors
# Things that can be easily fixed are marked as errors
indentation:
- 2
- size: 2
final-newline:
- 2
- include: true
no-trailing-whitespace: 2
border-zero:
- 2
- convention: '0'
brace-style:
- 2
- allow-single-line: true
clean-import-paths:
- 2
- filename-extension: false
leading-underscore: false
no-debug: 2
no-empty-rulesets: 2
no-invalid-hex: 2
no-mergeable-selectors: 2
# no-qualifying-elements:
# - 1
# - allow-element-with-attribute: false
# allow-element-with-class: false
# allow-element-with-id: false
no-trailing-zero: 2
no-url-protocols: 2
quotes:
- 2
- style: double
space-after-bang:
- 2
- include: false
space-after-colon:
- 2
- include: true
space-after-comma:
- 2
- include: true
space-before-bang:
- 2
- include: true
space-before-brace:
- 2
- include: true
space-before-colon: 2
space-between-parens:
- 2
- include: false
trailing-semicolon: 2
url-quotes: 2
zero-unit: 2
single-line-per-selector: 2
one-declaration-per-line: 2
empty-line-between-blocks:
- 2
- ignore-single-line-rulesets: true
# Missing rules
# There are no sass-lint rules for the following AirBNB style items, but thess
# - Put comments on their own line
# - Put property delcarations before mixins
# Disabled rules
# These are other rules that we may wish to consider using in the future
# They are not part of the AirBNB CSS standard but they would introduce some strictness
# bem-depth: 0
# variable-for-property: 0
# no-transition-all: 0
# hex-length:
# - 1
# - style: short
# hex-notation:
# - 1
# - style: lowercase
# property-units:
# - 1
# - global:
# - ch
# - em
# - ex
# - rem
# - cm
# - in
# - mm
# - pc
# - pt
# - px
# - q
# - vh
# - vw
# - vmin
# - vmax
# - deg
# - grad
# - rad
# - turn
# - ms
# - s
# - Hz
# - kHz
# - dpi
# - dpcm
# - dppx
# - '%'
# per-property: {}
# force-attribute-nesting: 1
# force-element-nesting: 1
# force-pseudo-nesting: 1
# function-name-format:
# - 1
# - allow-leading-underscore: true
# convention: hyphenatedlowercase
# no-color-literals: 1
# no-duplicate-properties: 1
# mixin-name-format:
# - 1
# - allow-leading-underscore: true
# convention: hyphenatedlowercase
# shorthand-values:
# - 1
# - allowed-shorthands:
# - 1
# - 2
# - 3
# leading-zero:
# - 1
# - include: false
# no-vendor-prefixes:
# - 1
# - additional-identifiers: []
# excluded-identifiers: []
# placeholder-in-extend: 1
# no-color-keywords: 2

View File

@ -14,6 +14,8 @@ matrix:
env: DB=PGSQL PHPUNIT_TEST=1 env: DB=PGSQL PHPUNIT_TEST=1
- php: 7.1 - php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
- php: 7.2
env: DB=MYSQL PHPUNIT_TEST=1
before_script: before_script:
# Init PHP # Init PHP

View File

@ -20,7 +20,7 @@ mappings:
BlogAdminSidebar: SilverStripe\Blog\Forms\BlogAdminSidebar BlogAdminSidebar: SilverStripe\Blog\Forms\BlogAdminSidebar
GridFieldAddByDBField: SilverStripe\Blog\Forms\GridField\GridFieldAddByDBField GridFieldAddByDBField: SilverStripe\Blog\Forms\GridField\GridFieldAddByDBField
GridFieldBlogPostState: SilverStripe\Blog\Forms\GridField\GridFieldBlogPostState GridFieldBlogPostState: SilverStripe\Blog\Forms\GridField\GridFieldBlogPostState
GridFieldConfig_BlogPost: SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost GridFieldConfig_BlogPost: SilverStripe\Blog\Forms\GridField\GridFieldConfigBlogPost
BlogArchiveWidget: SilverStripe\Blog\Widgets\BlogArchiveWidget BlogArchiveWidget: SilverStripe\Blog\Widgets\BlogArchiveWidget
BlogArchiveWidget_Controller: SilverStripe\Blog\Widgets\BlogArchiveWidgetController BlogArchiveWidget_Controller: SilverStripe\Blog\Widgets\BlogArchiveWidgetController
BlogCategoriesWidget: SilverStripe\Blog\Widgets\BlogCategoriesWidget BlogCategoriesWidget: SilverStripe\Blog\Widgets\BlogCategoriesWidget

View File

@ -2,12 +2,6 @@
[![Build Status](https://travis-ci.org/silverstripe/silverstripe-blog.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-blog) [![Build Status](https://travis-ci.org/silverstripe/silverstripe-blog.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-blog)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/?branch=master)
[![codecov.io](https://codecov.io/github/silverstripe/silverstripe-blog/coverage.svg?branch=master)](https://codecov.io/github/silverstripe/silverstripe-blog?branch=master) [![codecov.io](https://codecov.io/github/silverstripe/silverstripe-blog/coverage.svg?branch=master)](https://codecov.io/github/silverstripe/silverstripe-blog?branch=master)
![helpfulrobot](https://helpfulrobot.io/silverstripe/blog/badge)
[![Latest Stable Version](https://poser.pugx.org/silverstripe/blog/version)](https://packagist.org/packages/silverstripe/blog)
[![License](https://poser.pugx.org/silverstripe/blog/license)](https://packagist.org/packages/silverstripe/blog)
[![Monthly Downloads](https://poser.pugx.org/silverstripe/blog/d/monthly)](https://packagist.org/packages/silverstripe/blog)
## Documentation ## Documentation
@ -16,18 +10,18 @@
## Requirements ## Requirements
``` * SilverStripe CMS 4.0+
silverstripe/cms: ^4.0 * SilverStripe Lumberjack Module 2.0+
silverstripe/lumberjack: ^2.0 * SilverStripe Tag Field Module 2.0+
silverstripe/tagfield: ^2.0 * SilverStripe Assets 1.0+
``` * SilverStripe Asset Admin Module 1.0+
Note: this version is compatible with SilverStripe 4. For SilverStripe 3, please see [the 2.x release line](https://github.com/silverstripe/silverstripe-blog/tree/2).
### Suggested Modules ### Suggested Modules
``` * SilverStripe Widgets Module
silverstripe/widgets: * * SilverStripe Comments Module
silverstripe/comments: *
```
## Installation ## Installation

224
client/dist/js/main.bundle.js vendored Normal file
View File

@ -0,0 +1,224 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = jQuery;
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
$('.cms-content-fields > #Form_EditForm_error').entwine({
'onadd': function onadd() {
var $target = $('.blog-admin-outer');
if ($target.length == 1) {
$target.prepend(this);
}
}
});
$('.toggle-description').entwine({
'onadd': function onadd() {
var $this = $(this);
if ($this.hasClass('toggle-description-enabled')) {
return;
}
$this.addClass('toggle-description-enabled');
var shown = false;
var $helpInfo = $this.closest('.field').find('.form-text');
$this.on('click', function () {
$helpInfo[shown ? 'hide' : 'show']();
$this.toggleClass('toggle-description-shown');
shown = !shown;
});
$helpInfo.hide();
$this.parent().addClass('toggle-description-correct-right');
$this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
$this.parent().next('.description').addClass('toggle-description-correct-description');
}
});
$('.MergeAction').entwine({
'onadd': function onadd() {
var $this = $(this);
$this.on('click', 'select', function () {
return false;
});
$this.children('button').each(function (i, button) {
var $button = $(button);
var $select = $button.prev('select');
$button.before('<input type="hidden" name="' + $button.attr('data-target') + '" value="' + $select.val() + '" />');
});
$this.on('change', 'select', function (e) {
var $target = $(e.target);
$target.next('input').val($target.val());
});
$this.children('button, select').hide();
$this.on('click', '.MergeActionReveal', function (e) {
var $target = $(e.target);
$target.parent().children('button, select').show();
$target.hide();
return false;
});
}
});
$('.blog-admin-sidebar.cms-panel').entwine({
MinInnerWidth: 620,
onadd: function onadd() {
this._super();
this.updateLayout();
if (!this.hasClass('collapsed') && $(".blog-admin-outer").width() < this.getMinInnerWidth()) {
this.collapsePanel();
}
window.onresize = function () {
this.updateLayout();
}.bind(this);
},
togglePanel: function togglePanel(bool, silent) {
this._super(bool, silent);
this.updateLayout();
},
updateLayout: function updateLayout() {
$(this).css('height', '100%');
var currentHeight = $(this).outerHeight();
var bottomHeight = $('.cms-content-actions').eq(0).outerHeight();
$(this).css('height', currentHeight - bottomHeight + "px");
$(this).css('bottom', bottomHeight + "px");
$('.cms-container').updateLayoutOptions({
minContentWidth: 820 + this.width()
});
}
});
});
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
__WEBPACK_IMPORTED_MODULE_0_jquery___default.a.entwine('ss', function ($) {
$('.add-existing-autocompleter input.text').entwine({
'onkeydown': function onkeydown(e) {
if (e.which === 13) {
var $parent = $(this).parents('.add-existing-autocompleter');
$parent.find('button[type="submit"]').click();
e.preventDefault();
return false;
}
}
});
});
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bundles_cms__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_bundles_gridfieldaddbydbfield__ = __webpack_require__(2);
/***/ })
/******/ ]);
//# sourceMappingURL=main.bundle.js.map

2
client/dist/styles/main.css vendored Normal file
View File

@ -0,0 +1,2 @@
.no-sidebar .content-container.size3of4{width:75%}.blog-entry .post-image img{width:98.75%}.blog-sidebar .WidgetHolder ul{margin-left:0}.blog-sidebar .WidgetHolder ul li,ul.blogTagCloud{list-style-type:none}ul.blogTagCloud{clear:both}ul.blogTagCloud li{float:left;display:inline;padding-right:8px}ul.blogTagCloud li a span{float:left;line-height:30px;text-align:center;padding:0}ul.blogTagCloud .tagCount10{font-size:26pt}ul.blogTagCloud .tagCount9{font-size:24pt}ul.blogTagCloud .tagCount8{font-size:22pt}ul.blogTagCloud .tagCount7{font-size:20pt}ul.blogTagCloud .tagCount6{font-size:18pt}ul.blogTagCloud .tagCount5{font-size:16pt}ul.blogTagCloud .tagCount4{font-size:14pt}ul.blogTagCloud .tagCount3{font-size:12pt}ul.blogTagCloud .tagCount2{font-size:10pt}ul.blogTagCloud .tagCount1{font-size:8pt}#FeaturedImage .middleColumn{clear:none;float:left}.has-panel .cms-content-tools.blog-admin-sidebar{width:280px;border-right:0;border-left:1px solid #c0c0c2;position:absolute!important;right:0;top:0;height:100%}.has-panel .cms-content-tools.blog-admin-sidebar .cms-panel-toggle a{text-align:left;margin:0}.has-panel .cms-content-tools.blog-admin-sidebar .cms-panel-toggle.south{border-top:1px solid #aaa}.has-panel .cms-content-tools.blog-admin-sidebar~.blog-admin-outer{width:100%;padding-right:280px;position:absolute;height:100%;overflow-y:hidden;overflow-x:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}.has-panel .cms-content-tools.blog-admin-sidebar~.blog-admin-outer>.ss-tabset{position:relative;overflow:auto;height:100%;width:100%}.has-panel .cms-content-tools.blog-admin-sidebar~.blog-admin-outer>.ss-tabset #Title label{float:none}.has-panel .cms-content-tools.blog-admin-sidebar~.blog-admin-outer>.ss-tabset #Title .middleColumn,.has-panel .cms-content-tools.blog-admin-sidebar~.blog-admin-outer>.ss-tabset #Title input{width:100%;max-width:100%;margin-left:0}.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field+.field{margin-top:10px}.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field.urlsegment .preview{padding-top:0;line-height:25px}.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field.urlsegment .edit{float:right}.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field.datetime>.middleColumn>.date{width:60%}.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field.datetime>.middleColumn>.time{width:36%;float:right}.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field.datetime>.middleColumn .middleColumn,.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view>.field.datetime>.middleColumn input{width:100%}.has-panel .cms-content-tools.blog-admin-sidebar.collapsed~.blog-admin-outer{padding-right:41px}.has-panel .cms-content-tools.blog-admin-sidebar.collapsed~.blog-admin-outer #Root_Main{margin-right:15px}.has-panel .cms-content-tools.blog-admin-sidebar.cms-content-tools .cms-panel-content{width:auto}.toggle-description{display:inline-block;font-size:1.2rem;width:20px;height:20px;margin-top:1px;cursor:pointer}.middleColumn.toggle-description-correct-middle{margin-left:0;float:left;width:416px}.tab-content .field p.toggle-description-correct-right{display:inline-block;margin-left:0;padding-left:0;clear:none;float:left}.description.toggle-description-correct-description{width:416px;padding:12px 0}.custom-summary .ui-accordion-content,.custom-summary .ui-accordion-content .field{padding:0}.custom-summary .ui-icon-triangle-1-e{background-position:-16px -128px}.cms table.ss-gridfield-table tr td.MergeAction{width:225px}.cms table.ss-gridfield-table tr td.MergeAction a{display:block;height:100%;width:100%}.cms table.ss-gridfield-table tr td.MergeAction select{width:150px}.cms-content-actions,.cms-preview-controls{z-index:999}.blog-cms-categorisation .toolbar--content{margin-top:0}.blog-cms-categorisation .MergeActionReveal:after{content:"@";font-family:silverstripe;display:inline-block;position:relative;margin-left:10px;top:3px}.blog-cms-categorisation .blog-merge-action{margin-top:5px}
/*# sourceMappingURL=main.css.map*/

View File

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 550 B

142
client/src/bundles/cms.js Normal file
View File

@ -0,0 +1,142 @@
/* global window */
import jQuery from 'jquery';
jQuery.entwine('ss', ($) => {
/**
* The page success/error message sits outside of the html block
* containing the sidebar and cms fields. This means it overflows
* underneath the sidebar.
*
* @see https://github.com/silverstripe/silverstripe-blog/issues/210
*/
$('.cms-content-fields > #Form_EditForm_error').entwine({
'onadd': function () {
var $target = $('.blog-admin-outer');
if ($target.length == 1) {
$target.prepend(this);
}
}
});
/**
* Register expandable help text functions with fields.
*/
$('.toggle-description').entwine({
'onadd': function () {
var $this = $(this);
/**
* Prevent multiple events being added.
*/
if ($this.hasClass('toggle-description-enabled')) {
return;
}
$this.addClass('toggle-description-enabled');
/**
* Toggle next description when button is clicked.
*/
var shown = false;
var $helpInfo = $this.closest('.field').find('.form-text');
$this.on('click', function () {
$helpInfo[shown ? 'hide' : 'show']();
$this.toggleClass('toggle-description-shown');
shown = !shown;
});
/**
* Hide next description by default.
*/
$helpInfo.hide();
/**
* Add classes to correct inherited layout issues in a small context.
*/
$this.parent().addClass('toggle-description-correct-right');
$this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
$this.parent().next('.description').addClass('toggle-description-correct-description');
}
});
/**
* Custom merge actions for tags and categories
*/
$('.MergeAction').entwine({
'onadd': function () {
var $this = $(this);
$this.on('click', 'select', function () {
return false;
});
$this.children('button').each(function (i, button) {
var $button = $(button);
var $select = $button.prev('select');
$button.before('<input type="hidden" name="' + $button.attr('data-target') + '" value="' + $select.val() + '" />');
});
$this.on('change', 'select', function (e) {
var $target = $(e.target);
$target.next('input').val($target.val());
});
$this.children('button, select').hide();
$this.on('click', '.MergeActionReveal', function (e) {
var $target = $(e.target);
$target.parent().children('button, select').show();
$target.hide();
return false;
});
}
});
/**
* Customise the cms-panel behaviour for blog sidebar
*
* see LeftAndMain.Panel.js for base behaviour
*/
$('.blog-admin-sidebar.cms-panel').entwine({
MinInnerWidth: 620,
onadd: function () {
this._super();
this.updateLayout();
// If this panel is open and the left hand column is smaller than the minimum, contract it instead
if (!this.hasClass('collapsed') && ($(".blog-admin-outer").width() < this.getMinInnerWidth())) {
this.collapsePanel();
}
window.onresize = function () {
this.updateLayout();
}.bind(this);
},
togglePanel: function (bool, silent) {
this._super(bool, silent);
this.updateLayout();
},
/**
* Adjust minimum width of content to account for extra panel
*
* @returns {undefined}
*/
updateLayout: function () {
$(this).css('height', '100%');
var currentHeight = $(this).outerHeight();
var bottomHeight = $('.cms-content-actions').eq(0).outerHeight();
$(this).css('height', (currentHeight - bottomHeight) + "px");
$(this).css('bottom', bottomHeight + "px");
$('.cms-container').updateLayoutOptions({
minContentWidth: 820 + this.width()
});
}
});
});

View File

@ -0,0 +1,17 @@
import jQuery from 'jquery';
jQuery.entwine('ss', ($) => {
/**
* Prevent the CMS hijacking the return key
*/
$('.add-existing-autocompleter input.text').entwine({
'onkeydown': function (e) {
if (e.which === 13) {
const $parent = $(this).parents('.add-existing-autocompleter');
$parent.find('button[type="submit"]').click();
e.preventDefault();
return false;
}
}
});
});

2
client/src/main.js Normal file
View File

@ -0,0 +1,2 @@
import 'bundles/cms';
import 'bundles/gridfieldaddbydbfield';

2
client/src/main.scss Normal file
View File

@ -0,0 +1,2 @@
@import "styles/blog";
@import "styles/cms";

View File

@ -0,0 +1,76 @@
.no-sidebar .content-container.size3of4 {
width: 75%;
}
.blog-entry .post-image img {
width: 98.75%;
}
.blog-sidebar .WidgetHolder ul {
margin-left: 0;
li {
list-style-type: none;
}
}
// tag cloud related
$base_tag_font_size: 4pt;
ul.blogTagCloud {
list-style-type: none;
clear: both;
li {
float: left;
display: inline;
padding-right: 8px;
a span {
float: left;
line-height: 30px;
text-align: center;
padding: 0;
}
}
.tagCount10 {
font-size: $base_tag_font_size + 22pt;
}
.tagCount9 {
font-size: $base_tag_font_size + 20pt;
}
.tagCount8 {
font-size: $base_tag_font_size + 18pt;
}
.tagCount7 {
font-size: $base_tag_font_size + 16pt;
}
.tagCount6 {
font-size: $base_tag_font_size + 14pt;
}
.tagCount5 {
font-size: $base_tag_font_size + 12pt;
}
.tagCount4 {
font-size: $base_tag_font_size + 10pt;
}
.tagCount3 {
font-size: $base_tag_font_size + 8pt;
}
.tagCount2 {
font-size: $base_tag_font_size + 6pt;
}
.tagCount1 {
font-size: $base_tag_font_size + 4pt;
}
}

190
client/src/styles/cms.scss Executable file
View File

@ -0,0 +1,190 @@
/**
* CMS Styles
*/
#FeaturedImage .middleColumn {
clear: none;
float: left;
}
.has-panel .cms-content-tools.blog-admin-sidebar {
width: 280px;
border-right: 0;
border-left: 1px solid #C0C0C2;
position: absolute !important; /* overrides cms !imporant style */
right: 0;
top: 0;
height: 100%;
.cms-panel-toggle a {
text-align: left;
margin: 0;
}
.cms-panel-toggle.south {
border-top: 1px solid #aaaaaa;
}
~ .blog-admin-outer {
width: 100%;
padding-right: 280px;
position: absolute;
height: 100%;
overflow-y: hidden;
overflow-x: hidden;
box-sizing: border-box;
> .ss-tabset {
position: relative;
overflow: auto;
height: 100%;
width: 100%;
#Title {
label {
float: none;
}
.middleColumn,
input {
width: 100%;
max-width: 100%;
margin-left: 0;
}
}
}
}
.cms-content-view {
> .field {
+ .field {
margin-top: 10px;
}
&.urlsegment {
.preview {
padding-top: 0;
line-height: 25px;
}
.edit {
float: right;
}
}
&.datetime {
> .middleColumn {
> .date {
width: 60%;
}
> .time {
width: 36%;
float: right;
}
.middleColumn,
input {
width: 100%;
}
}
}
}
}
&.collapsed {
~ .blog-admin-outer {
padding-right: 41px;
#Root_Main {
margin-right: 15px;
}
}
}
&.cms-content-tools {
.cms-panel-content {
width: auto;
}
}
}
.toggle-description {
display: inline-block;
font-size: 1.2rem;
width: 20px;
height: 20px;
margin-top: 1px;
cursor: pointer;
}
.middleColumn.toggle-description-correct-middle {
margin-left: 0;
float: left;
width: 416px;
}
.tab-content .field p.toggle-description-correct-right {
display: inline-block;
margin-left: 0;
padding-left: 0;
clear: none;
float: left;
}
.description.toggle-description-correct-description {
width: 416px;
padding: 12px 0;
}
.custom-summary {
.ui-accordion-content,
.ui-accordion-content .field {
padding: 0;
}
// Change the caret to a plus icon
.ui-icon-triangle-1-e {
background-position: -16px -128px;
}
}
.cms table.ss-gridfield-table {
tr td.MergeAction {
width: 225px;
a {
display: block;
height: 100%;
width: 100%;
}
select {
width: 150px;
}
}
}
.cms-content-actions,
.cms-preview-controls {
z-index: 999;
}
.blog-cms-categorisation {
.toolbar--content {
margin-top: 0;
}
.MergeActionReveal:after {
content: "@";
font-family: silverstripe;
display: inline-block;
position: relative;
margin-left: 10px;
top: 3px;
}
.blog-merge-action {
margin-top: 5px;
}
}

View File

@ -6,7 +6,7 @@
"blog", "blog",
"news" "news"
], ],
"type": "silverstripe-module", "type": "silverstripe-vendormodule",
"require": { "require": {
"silverstripe/cms": "^4.0", "silverstripe/cms": "^4.0",
"silverstripe/lumberjack": "^2.0", "silverstripe/lumberjack": "^2.0",
@ -21,7 +21,11 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0.x-dev" "dev-master": "3.0.x-dev"
} },
"expose": [
"client/dist",
"client/images"
]
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -1,25 +0,0 @@
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :nested
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

View File

@ -1,43 +0,0 @@
.no-sidebar .content-container.size3of4 {
width: 75%; }
.blog-entry .post-image img {
width: 98.75%; }
.blog-sidebar .WidgetHolder ul {
margin-left: 0; }
.blog-sidebar .WidgetHolder ul li {
list-style-type: none; }
ul.blogTagCloud {
list-style-type: none;
clear: both; }
ul.blogTagCloud li {
float: left;
display: inline;
padding-right: 8px; }
ul.blogTagCloud li a span {
float: left;
line-height: 30px;
text-align: center;
padding: 0px; }
ul.blogTagCloud .tagCount10 {
font-size: 26pt; }
ul.blogTagCloud .tagCount9 {
font-size: 24pt; }
ul.blogTagCloud .tagCount8 {
font-size: 22pt; }
ul.blogTagCloud .tagCount7 {
font-size: 20pt; }
ul.blogTagCloud .tagCount6 {
font-size: 18pt; }
ul.blogTagCloud .tagCount5 {
font-size: 16pt; }
ul.blogTagCloud .tagCount4 {
font-size: 14pt; }
ul.blogTagCloud .tagCount3 {
font-size: 12pt; }
ul.blogTagCloud .tagCount2 {
font-size: 10pt; }
ul.blogTagCloud .tagCount1 {
font-size: 8pt; }

View File

@ -1,126 +0,0 @@
/**
* CMS Styles
*/
/**
* Include Compass framework
*/
/*
* Sprite maps & Icons
*/
#FeaturedImage .middleColumn {
clear: none;
float: left; }
.has-panel .cms-content-tools.blog-admin-sidebar {
width: 280px;
border-right: none;
border-left: 1px solid #C0C0C2;
position: absolute !important;
/* overrides cms !imporant style */
right: 0px;
top: 0;
height: 100%; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-panel-toggle a {
text-align: left;
margin: 0; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-panel-toggle.south {
border-top: 1px solid #aaaaaa; }
.has-panel .cms-content-tools.blog-admin-sidebar ~ .blog-admin-outer {
width: 100%;
padding-right: 280px;
position: absolute;
height: 100%;
overflow-y: hidden;
overflow-x: hidden;
box-sizing: border-box; }
.has-panel .cms-content-tools.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset {
position: relative;
overflow: auto;
height: 100%;
width: 100%; }
.has-panel .cms-content-tools.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title label {
float: none; }
.has-panel .cms-content-tools.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title .middleColumn, .has-panel .cms-content-tools.blog-admin-sidebar ~ .blog-admin-outer > .ss-tabset #Title input {
width: 100%;
max-width: 100%;
margin-left: 0; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field + .field {
margin-top: 10px; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field.urlsegment .preview {
padding-top: 0;
line-height: 25px; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field.urlsegment .edit {
float: right; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn > .date {
width: 60%; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn > .time {
width: 36%;
float: right; }
.has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn .middleColumn, .has-panel .cms-content-tools.blog-admin-sidebar .cms-content-view > .field.datetime > .middleColumn input {
width: 100%; }
.has-panel .cms-content-tools.blog-admin-sidebar.collapsed ~ .blog-admin-outer {
padding-right: 41px; }
.has-panel .cms-content-tools.blog-admin-sidebar.collapsed ~ .blog-admin-outer #Root_Main {
margin-right: 15px; }
.has-panel .cms-content-tools.blog-admin-sidebar.cms-content-tools .cms-panel-content {
width: auto; }
.toggle-description {
text-indent: -1000000px;
display: inline-block;
background: url("../images/information.png") no-repeat center center;
width: 20px;
height: 20px;
margin-left: 4px;
cursor: pointer; }
.middleColumn.toggle-description-correct-middle {
margin-left: 0;
float: left;
width: 416px; }
.tab-content .field p.toggle-description-correct-right {
display: inline-block;
margin-left: 0;
padding-left: 0;
clear: none;
float: left; }
.description.toggle-description-correct-description {
width: 416px;
padding: 12px 0; }
.custom-summary .ui-accordion-content .field {
margin: 0; }
.custom-summary .ui-accordion-content,
.custom-summary .ui-accordion-content .field {
padding: 0; }
.custom-summary .ui-icon-triangle-1-e {
background-position: -16px -128px; }
.cms table.ss-gridfield-table tr td.MergeAction {
width: 225px; }
.cms table.ss-gridfield-table tr td.MergeAction a {
display: block;
height: 100%;
width: 100%; }
.cms table.ss-gridfield-table tr td.MergeAction select {
width: 150px; }
.cms-content-actions,
.cms-preview-controls {
z-index: 999; }
.blog-cms-categorisation .MergeActionReveal {
margin-left: 10px; }
.blog-cms-categorisation .toolbar--content {
margin-top: 0; }
.blog-cms-categorisation .MergeActionReveal:after {
content: '';
background: url("../images/move-icon.png");
display: inline-block;
height: 16px;
width: 16px;
margin-left: 4px; }
.blog-cms-categorisation button.action {
margin-left: 5px; }

View File

@ -1,17 +0,0 @@
var sass = require("gulp-sass");
var gulp = require("gulp");
var watch = require('gulp-watch');
gulp.task("scss", function () {
gulp.src("./scss/*.scss")
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest("./css"));
});
gulp.task('watch', ['scss'], function () {
gulp.watch('./scss/*.scss', ['scss']);
});
gulp.task('default', ['scss'], function () {
// noop
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

144
js/cms.js
View File

@ -1,144 +0,0 @@
(function ($) {
$.entwine('ss', function ($) {
/**
* The page success/error message sits outside of the html block
* containing the sidebar and cms fields. This means it overflows
* underneath the sidebar.
*
* @see https://github.com/silverstripe/silverstripe-blog/issues/210
*/
$('.cms-content-fields > #Form_EditForm_error').entwine({
'onadd': function () {
var $target = $('.blog-admin-outer');
if ($target.length == 1) {
$target.prepend(this);
}
}
});
/**
* Register expandable help text functions with fields.
*/
$('.toggle-description').entwine({
'onadd': function () {
var $this = $(this);
/**
* Prevent multiple events being added.
*/
if ($this.hasClass('toggle-description-enabled')) {
return;
}
$this.addClass('toggle-description-enabled');
/**
* Toggle next description when button is clicked.
*/
var shown = false;
var $helpInfo = $this.closest('.field').find('.form-text');
$this.on('click', function () {
$helpInfo[shown ? 'hide' : 'show']();
$this.toggleClass('toggle-description-shown');
shown = !shown;
});
/**
* Hide next description by default.
*/
$helpInfo.hide();
/**
* Add classes to correct inherited layout issues in a small context.
*/
$this.parent().addClass('toggle-description-correct-right');
$this.parent().prev('.middleColumn').addClass('toggle-description-correct-middle');
$this.parent().next('.description').addClass('toggle-description-correct-description');
}
});
/**
* Custom merge actions for tags and categories
*/
$('.MergeAction').entwine({
'onadd': function () {
var $this = $(this);
$this.on('click', 'select', function () {
return false;
});
$this.children('button').each(function (i, button) {
var $button = $(button);
var $select = $button.prev('select');
$button.before('<input type="hidden" name="' + $button.attr('data-target') + '" value="' + $select.val() + '" />');
});
$this.on('change', 'select', function (e) {
var $target = $(e.target);
$target.next('input').val($target.val());
});
$this.children('button, select').hide();
$this.on('click', '.MergeActionReveal', function (e) {
var $target = $(e.target);
$target.parent().children('button, select').show();
$target.hide();
return false;
});
}
});
/**
* Customise the cms-panel behaviour for blog sidebar
*
* see LeftAndMain.Panel.js for base behaviour
*/
$('.blog-admin-sidebar.cms-panel').entwine({
MinInnerWidth: 620,
onadd: function () {
this._super();
this.updateLayout();
// If this panel is open and the left hand column is smaller than the minimum, contract it instead
if (!this.hasClass('collapsed') && ($(".blog-admin-outer").width() < this.getMinInnerWidth())) {
this.collapsePanel();
}
window.onresize = function () {
this.updateLayout();
}.bind(this);
},
togglePanel: function (bool, silent) {
this._super(bool, silent);
this.updateLayout();
},
/**
* Adjust minimum width of content to account for extra panel
*
* @returns {undefined}
*/
updateLayout: function () {
$(this).css('height', '100%');
var currentHeight = $(this).outerHeight();
var bottomHeight = $('.cms-content-actions').eq(0).outerHeight();
$(this).css('height', (currentHeight - bottomHeight) + "px");
$(this).css('bottom', bottomHeight + "px");
$('.cms-container').updateLayoutOptions({
minContentWidth: 820 + this.width()
});
}
});
});
})(jQuery);

View File

@ -1,16 +0,0 @@
(function ($) {
$.entwine('ss', function ($) {
/**
* Prevent the CMS hijacking the return key
*/
$('.add-existing-autocompleter input.text').entwine({
'onkeydown': function (e) {
if (e.which == 13) {
$parent = $(this).parents('.add-existing-autocompleter');
$parent.find('button[type="submit"]').click();
return false;
}
}
});
});
})(jQuery);

28
lang/en.yml Executable file → Normal file
View File

@ -41,6 +41,9 @@ en:
Tag: Tag Tag: Tag
Tagged: Tagged Tagged: Tagged
Tags: Tags Tags: Tags
UsersContributorsFieldDescription: "Contributors have the ability to create or edit BlogPosts, but are unable to publish without \n authorisation of an editor. They are also unable to assign other contributing authors to any of\n their BlogPosts.<br />\n <br />\n Contributors have these permissions:<br />\n <br />\n Update any BlogPost they have authored or have been assigned to"
UsersEditorsFieldDescription: "An editor has control over specific Blogs, and all posts included within it. \n Short of being able to assign other editors to a blog, they are able to handle most changes to\n their assigned blog. <br /><br />\n Editors have these permissions:<br />\n <br />\n Update or publish any BlogPost in their Blog<br />\n Update or publish their Blog<br />\n Assign/unassign writers to their Blog<br />\n Assign/unassign contributors to their Blog<br />\n Assign/unassign any member as an author of a particular BlogPost"
UsersWritersFieldDescription: "A writer has full control over creating, editing and publishing BlogPosts they have authored\n or have been assigned to. Writers are unable to edit BlogPosts to which they are not assigned.\n <br /><br />\n Writers have these permissions:<br />\n <br />\n Update or publish any BlogPost they have authored or have been assigned to<br />\n Assign/unassign any member as an author of a particular BlogPost they have authored or have been \n assigned to"
WRITER: Writer WRITER: Writer
SilverStripe\Blog\Model\BlogCategory: SilverStripe\Blog\Model\BlogCategory:
Duplicate: 'A blog category already exists with that name.' Duplicate: 'A blog category already exists with that name.'
@ -81,24 +84,49 @@ en:
ArchiveType: ArchiveType ArchiveType: ArchiveType
Blog: Blog Blog: Blog
NumberToDisplay: 'No. to Display' NumberToDisplay: 'No. to Display'
PLURALNAME: 'Blog Archive Widgets'
PLURALS:
one: 'A Blog Archive Widget'
other: '{count} Blog Archive Widgets'
SINGULARNAME: 'Blog Archive Widget'
SilverStripe\Blog\Widgets\BlogCategoriesWidget: SilverStripe\Blog\Widgets\BlogCategoriesWidget:
Blog: Blog Blog: Blog
Direction: Direction Direction: Direction
Direction_Description: 'Change the direction of ordering of categories shown by this widget.' Direction_Description: 'Change the direction of ordering of categories shown by this widget.'
Limit: Limit Limit: Limit
Limit_Description: 'Limit the number of categories shown by this widget (set to 0 to show all categories).' Limit_Description: 'Limit the number of categories shown by this widget (set to 0 to show all categories).'
PLURALNAME: 'Blog Categories Widgets'
PLURALS:
one: 'A Blog Categories Widget'
other: '{count} Blog Categories Widgets'
SINGULARNAME: 'Blog Categories Widget'
Sort: Sort Sort: Sort
Sort_Description: 'Change the order of categories shown by this widget.' Sort_Description: 'Change the order of categories shown by this widget.'
SilverStripe\Blog\Widgets\BlogRecentPostsWidget: SilverStripe\Blog\Widgets\BlogRecentPostsWidget:
Blog: Blog Blog: Blog
NumberOfPosts: 'Number of Posts' NumberOfPosts: 'Number of Posts'
PLURALNAME: 'Blog Recent Posts Widgets'
PLURALS:
one: 'A Blog Recent Posts Widget'
other: '{count} Blog Recent Posts Widgets'
SINGULARNAME: 'Blog Recent Posts Widget'
SilverStripe\Blog\Widgets\BlogTagsCloudWidget: SilverStripe\Blog\Widgets\BlogTagsCloudWidget:
Blog: Blog Blog: Blog
PLURALNAME: 'Blog Tags Cloud Widgets'
PLURALS:
one: 'A Blog Tags Cloud Widget'
other: '{count} Blog Tags Cloud Widgets'
SINGULARNAME: 'Blog Tags Cloud Widget'
SilverStripe\Blog\Widgets\BlogTagsWidget: SilverStripe\Blog\Widgets\BlogTagsWidget:
Blog: Blog Blog: Blog
Direction: Direction Direction: Direction
Direction_Description: 'Change the direction of ordering of tags shown by this widget.' Direction_Description: 'Change the direction of ordering of tags shown by this widget.'
Limit: Limit Limit: Limit
Limit_Description: 'Limit the number of tags shown by this widget (set to 0 to show all tags).' Limit_Description: 'Limit the number of tags shown by this widget (set to 0 to show all tags).'
PLURALNAME: 'Blog Tags Widgets'
PLURALS:
one: 'A Blog Tags Widget'
other: '{count} Blog Tags Widgets'
SINGULARNAME: 'Blog Tags Widget'
Sort: Sort Sort: Sort
Sort_Description: 'Change the order of tags shown by this widget.' Sort_Description: 'Change the order of tags shown by this widget.'

View File

@ -1,4 +1,4 @@
Copyright (c) 2017, Michael Strong Copyright (c) 2018, Michael Strong
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View File

@ -1,28 +1,30 @@
{ {
"name": "silverstripe-blog", "name": "silverstripe-blog",
"version": "3.0.0", "version": "3.0.0",
"description": "Silverstripe blog module", "description": "A fresh take on blogging in Silverstripe set out to tackle the issue of a cluttered Site Tree",
"main": "index.js",
"directories": {
"doc": "docs",
"test": "tests"
},
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "build": "yarn && NODE_ENV=production webpack -p --bail --progress",
"watch": "yarn && NODE_ENV=development webpack --watch --progress",
"css": "WEBPACK_CHILD=css npm run build",
"lint": "eslint client/src; sass-lint -v"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/silverstripe/silverstripe-blog.git" "url": "git+https://github.com/silverstripe/silverstripe-blog.git"
}, },
"author": "", "keywords": [
"license": "BSD-3", "silverstripe",
"blog"
],
"author": "SilverStripe Ltd",
"license": "BSD-2-Clause",
"bugs": { "bugs": {
"url": "https://github.com/silverstripe/silverstripe-blog/issues" "url": "https://github.com/silverstripe/silverstripe-blog/issues"
}, },
"homepage": "https://github.com/silverstripe/silverstripe-blog#readme", "homepage": "https://github.com/silverstripe/silverstripe-blog#readme",
"dependencies": [],
"devDependencies": { "devDependencies": {
"gulp": "^3.9.1", "@silverstripe/eslint-config": "^0.0.4",
"gulp-sass": "^2.3.1", "@silverstripe/webpack-config": "^0.5"
"gulp-watch": "^4.3.6"
} }
} }

View File

@ -7,16 +7,6 @@
<!-- Current exclusions --> <!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" /> <exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" /> <exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="Squiz.Scope.MethodScope" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
</rule> </rule>
</ruleset> </ruleset>

View File

@ -1,75 +0,0 @@
.no-sidebar .content-container.size3of4 {
width: 75%;
}
.blog-entry .post-image img {
width: 98.75%;
}
.blog-sidebar .WidgetHolder ul {
margin-left: 0;
li {
list-style-type: none;
}
}
// tag cloud related
$baseTagFontSize:4pt;
ul.blogTagCloud {
list-style-type: none;
clear: both;
li {
float: left;
display: inline;
padding-right: 8px;
a span {
float: left;
line-height: 30px; text-align: center;
padding: 0px;
}
}
.tagCount10 {
font-size: $baseTagFontSize+22pt;
}
.tagCount9 {
font-size: $baseTagFontSize+20pt;
}
.tagCount8 {
font-size: $baseTagFontSize+18pt;
}
.tagCount7 {
font-size: $baseTagFontSize+16pt;
}
.tagCount6 {
font-size: $baseTagFontSize+14pt;
}
.tagCount5 {
font-size: $baseTagFontSize+12pt;
}
.tagCount4 {
font-size: $baseTagFontSize+10pt;
}
.tagCount3 {
font-size: $baseTagFontSize+8pt;
}
.tagCount2 {
font-size: $baseTagFontSize+6pt;
}
.tagCount1 {
font-size: $baseTagFontSize+4pt;
}
}

View File

@ -1,206 +0,0 @@
/**
* CMS Styles
*/
/**
* Include Compass framework
*/
// @import "compass";
/*
* Sprite maps & Icons
*/
// @import "compass/utilities/sprites/base";
// @import "blog-icon/*.png";
// buttons
#FeaturedImage .middleColumn {
clear: none;
float: left;
}
.has-panel .cms-content-tools.blog-admin-sidebar {
width: 280px;
border-right: none;
border-left: 1px solid #C0C0C2;
position: absolute !important; /* overrides cms !imporant style */
right: 0px;
top: 0;
height: 100%;
.cms-panel-toggle a {
text-align: left;
margin: 0;
}
.cms-panel-toggle.south {
border-top: 1px solid #aaaaaa;
}
~ .blog-admin-outer {
width: 100%;
padding-right: 280px;
position: absolute;
height: 100%;
overflow-y: hidden;
overflow-x: hidden;
box-sizing: border-box;
> .ss-tabset {
position: relative;
overflow: auto;
height: 100%;
width: 100%;
#Title {
label {
float: none;
}
.middleColumn, input {
width: 100%;
max-width: 100%;
margin-left: 0;
}
}
}
}
.cms-content-view {
> .field {
+ .field {
margin-top: 10px;
}
&.urlsegment {
.preview {
padding-top: 0;
line-height: 25px;
}
.edit {
float: right;
}
}
&.datetime {
> .middleColumn {
> .date {
width: 60%;
}
> .time {
width: 36%;
float: right;
}
.middleColumn, input {
width: 100%;
}
}
}
}
}
&.collapsed {
~ .blog-admin-outer {
padding-right: 41px;
#Root_Main {
margin-right: 15px;
}
}
}
&.cms-content-tools {
.cms-panel-content {
width: auto;
}
}
}
.toggle-description {
text-indent: -1000000px;
display: inline-block;
background: url("../images/information.png") no-repeat center center;
width: 20px;
height: 20px;
margin-left: 4px;
cursor:pointer;
}
.middleColumn.toggle-description-correct-middle {
margin-left: 0;
float: left;
width: 416px;
}
.tab-content .field p.toggle-description-correct-right {
display: inline-block;
margin-left: 0;
padding-left: 0;
clear: none;
float: left;
}
.description.toggle-description-correct-description {
width: 416px;
padding: 12px 0;
}
.custom-summary {
.ui-accordion-content .field {
margin: 0;
}
.ui-accordion-content,
.ui-accordion-content .field {
padding: 0;
}
.ui-icon-triangle-1-e {
background-position: -16px -128px;
}
}
.cms table.ss-gridfield-table {
tr td.MergeAction {
width: 225px;
a {
display: block;
height: 100%;
width: 100%;
}
select {
width: 150px;
}
}
}
.cms-content-actions,
.cms-preview-controls {
z-index: 999;
}
.blog-cms-categorisation {
.MergeActionReveal {
margin-left: 10px;
}
.toolbar--content {
margin-top: 0;
}
.MergeActionReveal:after {
content: '';
background: url('../images/move-icon.png');
display: inline-block;
height: 16px;
width: 16px;
margin-left: 4px;
}
button.action {
margin-left: 5px;
}
}

View File

@ -3,9 +3,9 @@
namespace SilverStripe\Blog\Admin; namespace SilverStripe\Blog\Admin;
use SilverStripe\Blog\Forms\GridField\GridFieldAddByDBField; use SilverStripe\Blog\Forms\GridField\GridFieldAddByDBField;
use SilverStripe\Blog\Admin\GridFieldMergeAction;
use SilverStripe\Blog\Model\CategorisationObject; use SilverStripe\Blog\Model\CategorisationObject;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor; use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
{ {
@ -16,7 +16,7 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
* @param string $parentMethod * @param string $parentMethod
* @param string $childMethod * @param string $childMethod
*/ */
public function __construct($itemsPerPage = 15, $mergeRecords, $parentType, $parentMethod, $childMethod) public function __construct($itemsPerPage, $mergeRecords, $parentType, $parentMethod, $childMethod)
{ {
parent::__construct($itemsPerPage); parent::__construct($itemsPerPage);

View File

@ -2,13 +2,13 @@
namespace SilverStripe\Blog\Admin; namespace SilverStripe\Blog\Admin;
use SilverStripe\Blog\Admin\GridFieldFormAction;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use Silverstripe\Forms\DropdownField; use Silverstripe\Forms\DropdownField;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridField_ActionProvider; use SilverStripe\Forms\GridField\GridField_ActionProvider;
use SilverStripe\Forms\GridField\GridField_ColumnProvider; use SilverStripe\Forms\GridField\GridField_ColumnProvider;
use SilverStripe\ORM\SS_List;
class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider
{ {
@ -48,7 +48,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
* @param string $parentMethod * @param string $parentMethod
* @param string $childMethod * @param string $childMethod
*/ */
public function __construct($records = [], $parentType, $parentMethod, $childMethod) public function __construct($records, $parentType, $parentMethod, $childMethod)
{ {
$this->records = $records; $this->records = $records;
$this->parentType = $parentType; $this->parentType = $parentType;
@ -101,7 +101,10 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
'data-target' => $prefix . '-target-record-' . $record->ID 'data-target' => $prefix . '-target-record-' . $record->ID
]); ]);
return $dropdown->Field() . $action->Field() . '<a title="Move posts to" class="MergeActionReveal">move posts to</a>'; $action->addExtraClass('btn btn-primary btn-sm blog-merge-action');
return $dropdown->Field() . $action->Field() .
'<a title="Move posts to" class="MergeActionReveal">Move posts to</a>';
} }
return null; return null;

View File

@ -2,11 +2,9 @@
namespace SilverStripe\Blog\Forms\GridField; namespace SilverStripe\Blog\Forms\GridField;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Manifest\ModuleLoader;
use UnexpectedValueException;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridField_ActionProvider; use SilverStripe\Forms\GridField\GridField_ActionProvider;
use SilverStripe\Forms\GridField\GridField_FormAction; use SilverStripe\Forms\GridField\GridField_FormAction;
@ -16,6 +14,7 @@ use SilverStripe\ORM\ArrayList;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\View\ArrayData; use SilverStripe\View\ArrayData;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use UnexpectedValueException;
class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLProvider class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLProvider
{ {
@ -159,7 +158,7 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
*/ */
public function getHTMLFragments($gridField) public function getHTMLFragments($gridField)
{ {
Requirements::javascript(ModuleLoader::getModule('silverstripe/blog')->getRelativeResourcePath('js/gridfieldaddbydbfield.js')); Requirements::javascript('silverstripe/blog:client/dist/js/main.bundle.js');
/** /**
* @var DataList $dataList * @var DataList $dataList

View File

@ -3,10 +3,8 @@
namespace SilverStripe\Blog\Forms\GridField; namespace SilverStripe\Blog\Forms\GridField;
use SilverStripe\Blog\Model\BlogPost; use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState; use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\View\Requirements;
/** /**
* Provides a component to the {@link GridField} which tells the user whether or not a blog post * Provides a component to the {@link GridField} which tells the user whether or not a blog post
@ -21,7 +19,6 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
public function getColumnContent($gridField, $record, $columnName) public function getColumnContent($gridField, $record, $columnName)
{ {
if ($columnName == 'State') { if ($columnName == 'State') {
Requirements::css('silverstripe/blog:css/cms.css');
if ($record instanceof BlogPost) { if ($record instanceof BlogPost) {
$modifiedLabel = ''; $modifiedLabel = '';

View File

@ -10,7 +10,7 @@ use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState;
* GridField config necessary for managing a SiteTree object. * GridField config necessary for managing a SiteTree object.
* *
*/ */
class GridFieldConfig_BlogPost extends GridFieldConfig_Lumberjack class GridFieldConfigBlogPost extends GridFieldConfig_Lumberjack
{ {
/** /**
* @param null|int $itemsPerPage * @param null|int $itemsPerPage

View File

@ -4,11 +4,10 @@ namespace SilverStripe\Blog\Model;
use Page; use Page;
use SilverStripe\Blog\Admin\GridFieldCategorisationConfig; use SilverStripe\Blog\Admin\GridFieldCategorisationConfig;
use SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost; use SilverStripe\Blog\Forms\GridField\GridFieldConfigBlogPost;
use SilverStripe\CMS\Controllers\RootURLController; use SilverStripe\CMS\Controllers\RootURLController;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\LiteralField;
@ -127,7 +126,7 @@ class Blog extends Page implements PermissionProvider
*/ */
private static $description = 'Adds a blog to your website.'; private static $description = 'Adds a blog to your website.';
private static $icon = 'blog/images/site-tree-icon.png'; private static $icon = 'silverstripe/blog:client/images/site-tree-icon.png';
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -189,9 +188,8 @@ class Blog extends Page implements PermissionProvider
*/ */
protected function addCMSRequirements() protected function addCMSRequirements()
{ {
$module = ModuleLoader::getModule('silverstripe/blog'); Requirements::css('silverstripe/blog:client/dist/styles/main.css');
Requirements::css($module->getRelativeResourcePath('css/cms.css')); Requirements::javascript('silverstripe/blog:client/dist/js/main.bundle.js');
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -355,7 +353,10 @@ class Blog extends Page implements PermissionProvider
); );
$members = $this->getCandidateUsers()->map()->toArray(); $members = $this->getCandidateUsers()->map()->toArray();
$toggleButton = LiteralField::create('ToggleButton', '<a class="toggle-description"></a>'); $toggleButton = LiteralField::create(
'ToggleButton',
'<a class="font-icon-info-circled toggle-description"></a>'
);
$editorField = ListboxField::create('Editors', 'Editors', $members) $editorField = ListboxField::create('Editors', 'Editors', $members)
->setRightTitle($toggleButton) ->setRightTitle($toggleButton)
@ -609,7 +610,7 @@ class Blog extends Page implements PermissionProvider
*/ */
public function getLumberjackGridFieldConfig() public function getLumberjackGridFieldConfig()
{ {
return GridFieldConfig_BlogPost::create(); return GridFieldConfigBlogPost::create();
} }
/** /**

View File

@ -2,10 +2,6 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use SilverStripe\Blog\Model\Blog;
use SilverStripe\Blog\Model\BlogObject;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Blog\Model\CategorisationObject;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
/** /**

View File

@ -2,7 +2,6 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
/** /**

View File

@ -2,9 +2,7 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use SilverStripe\Blog\Model\Blog;
use SilverStripe\Blog\Model\BlogFilter\BlogFilterGridField; use SilverStripe\Blog\Model\BlogFilter\BlogFilterGridField;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
@ -12,8 +10,8 @@ use SilverStripe\Forms\Tab;
use SilverStripe\Lumberjack\Model\Lumberjack; use SilverStripe\Lumberjack\Model\Lumberjack;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Versioned\Versioned;
/** /**
* This class is responsible for filtering the SiteTree when necessary and also overlaps into * This class is responsible for filtering the SiteTree when necessary and also overlaps into

View File

@ -3,9 +3,7 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use SilverStripe\Assets\Image; use SilverStripe\Assets\Image;
use SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost; use SilverStripe\Blog\Forms\GridField\GridFieldConfigBlogPost;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\Tab; use SilverStripe\Forms\Tab;
@ -113,9 +111,8 @@ class BlogMemberExtension extends DataExtension
$fields->removeFieldFromTab('Root', 'BlogPosts'); $fields->removeFieldFromTab('Root', 'BlogPosts');
// Construct a better posts tab. // Construct a better posts tab.
$module = ModuleLoader::getModule('silverstripe/blog'); Requirements::css('silverstripe/blog:client/dist/styles/main.css');
Requirements::css($module->getRelativeResourcePath('css/cms.css')); Requirements::javascript('silverstripe/blog:client/dist/js/main.bundle.js');
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
$tab = Tab::create('BlogPosts', _t(__CLASS__ . '.TABBLOGPOSTS', 'Blog Posts')); $tab = Tab::create('BlogPosts', _t(__CLASS__ . '.TABBLOGPOSTS', 'Blog Posts'));
@ -123,7 +120,7 @@ class BlogMemberExtension extends DataExtension
'BlogPosts', 'BlogPosts',
_t(__CLASS__ . '.BLOGPOSTS', 'Blog Posts'), _t(__CLASS__ . '.BLOGPOSTS', 'Blog Posts'),
$this->owner->BlogPosts(), $this->owner->BlogPosts(),
GridFieldConfig_BlogPost::create() GridFieldConfigBlogPost::create()
); );
$tab->Fields()->add($gridField); $tab->Fields()->add($gridField);

View File

@ -3,7 +3,6 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Tab; use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TabSet; use SilverStripe\Forms\TabSet;

View File

@ -3,21 +3,15 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use Page; use Page;
use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image; use SilverStripe\Assets\Image;
use SilverStripe\Blog\Forms\BlogAdminSidebar;
use SilverStripe\Blog\Model\BlogCategory;
use SilverStripe\Blog\Model\BlogPostFilter;
use SilverStripe\Blog\Model\BlogTag;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\DatetimeField; use SilverStripe\Forms\DatetimeField;
use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField; use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Forms\ListboxField; use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\Forms\ToggleCompositeField; use SilverStripe\Forms\ToggleCompositeField;
use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\UnsavedRelationList; use SilverStripe\ORM\UnsavedRelationList;
@ -211,9 +205,8 @@ class BlogPost extends Page
*/ */
public function getCMSFields() public function getCMSFields()
{ {
$module = ModuleLoader::getModule('silverstripe/blog'); Requirements::css('silverstripe/blog:client/dist/styles/main.css');
Requirements::css($module->getRelativeResourcePath('css/cms.css')); Requirements::javascript('silverstripe/blog:client/dist/js/main.bundle.js');
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
$this->beforeUpdateCMSFields(function ($fields) { $this->beforeUpdateCMSFields(function ($fields) {
$uploadField = UploadField::create('FeaturedImage', _t(__CLASS__ . '.FeaturedImage', 'Featured Image')); $uploadField = UploadField::create('FeaturedImage', _t(__CLASS__ . '.FeaturedImage', 'Featured Image'));
@ -265,7 +258,8 @@ class BlogPost extends Page
)->setDescription( )->setDescription(
_t( _t(
__CLASS__ . '.AdditionalCredits_Description', __CLASS__ . '.AdditionalCredits_Description',
'If some authors of this post don\'t have CMS access, enter their name(s) here. You can separate multiple names with a comma.' 'If some authors of this post don\'t have CMS access, enter their name(s) here. '.
'You can separate multiple names with a comma.'
) )
); );

View File

@ -10,8 +10,8 @@ use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataQuery; use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Versioned\Versioned;
/** /**
* This is responsible for filtering only published posts to users who do not have permission to * This is responsible for filtering only published posts to users who do not have permission to

View File

@ -3,10 +3,6 @@
namespace SilverStripe\Blog\Model; namespace SilverStripe\Blog\Model;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Blog\Model\Blog;
use SilverStripe\Blog\Model\BlogObject;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Blog\Model\CategorisationObject;
/** /**
* A blog tag for keyword descriptions of a blog post. * A blog tag for keyword descriptions of a blog post.

View File

@ -8,6 +8,7 @@ if (!class_exists('\\SilverStripe\\Widgets\\Model\\Widget')) {
use SilverStripe\Blog\Model\Blog; use SilverStripe\Blog\Model\Blog;
use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\NumericField; use SilverStripe\Forms\NumericField;
use SilverStripe\Widgets\Model\Widget; use SilverStripe\Widgets\Model\Widget;

View File

@ -1,4 +1,4 @@
<% require themedCSS('blog', 'blog') %> <% require css('silverstripe/blog: client/dist/styles/main.css') %>
<div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>"> <div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>">

View File

@ -1,4 +1,4 @@
<% require themedCSS('blog', 'blog') %> <% require css('silverstripe/blog: client/dist/styles/main.css') %>
<div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>"> <div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>">
<article> <article>

View File

@ -1,4 +1,4 @@
<% require themedCSS('blog', 'blog') %> <% require css('silverstripe/blog: client/dist/styles/main.css') %>
<div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>"> <div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>">

View File

@ -360,7 +360,11 @@ class BlogTest extends SapphireTest
$this->fail('The "profile" action should throw a HTTPResponse_Exception when disable_profiles is enabled'); $this->fail('The "profile" action should throw a HTTPResponse_Exception when disable_profiles is enabled');
} catch (HTTPResponse_Exception $e) { } catch (HTTPResponse_Exception $e) {
$this->assertEquals(404, $e->getResponse()->getStatusCode(), 'The response status code should be 404 Not Found'); $this->assertEquals(
404,
$e->getResponse()->getStatusCode(),
'The response status code should be 404 Not Found'
);
} }
} }

55
webpack.config.js Normal file
View File

@ -0,0 +1,55 @@
const Path = require('path');
const webpack = require('webpack');
// Import the core config
const webpackConfig = require('@silverstripe/webpack-config');
const {
resolveJS,
externalJS,
moduleJS,
pluginJS,
moduleCSS,
pluginCSS,
} = webpackConfig;
const ENV = process.env.NODE_ENV;
const PATHS = {
ROOT: Path.resolve(),
MODULES: 'node_modules',
FILES_PATH: '../',
THIRDPARTY: 'thirdparty',
SRC: Path.resolve('client/src'),
DIST: Path.resolve('client/dist'),
};
const config = [
{
name: 'bundle',
entry: {
main: `${PATHS.SRC}/main.js`
},
output: {
path: PATHS.DIST,
filename: 'js/[name].bundle.js',
},
devtool: (ENV !== 'production') ? 'source-map' : '',
resolve: resolveJS(ENV, PATHS),
externals: externalJS(ENV, PATHS),
module: moduleJS(ENV, PATHS),
plugins: pluginJS(ENV, PATHS),
},
{
name: 'bundle',
entry: {
main: `${PATHS.SRC}/main.scss`
},
output: {
path: PATHS.DIST,
filename: 'styles/[name].css'
},
devtool: (ENV !== 'production') ? 'source-map' : '',
module: moduleCSS(ENV, PATHS),
plugins: pluginCSS(ENV, PATHS),
},
];
module.exports = config;