Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Oct 8, 2017
2 parents c968f25 + c294270 commit 00831d0
Show file tree
Hide file tree
Showing 10 changed files with 395 additions and 225 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-mailchimp
*/

// Define Module Constants:

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

if (!defined('SILVERWARE_MAILCHIMP_PATH')) {
define('SILVERWARE_MAILCHIMP_PATH', realpath(__DIR__));
}
2 changes: 1 addition & 1 deletion _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name: silverware-mailchimp

SilverStripe\CMS\Controllers\ContentController:
required_js:
- silverware-mailchimp/client/dist/js/bundle.js
- "silverware/mailchimp: client/dist/js/bundle.js"

# Configure Site Configuration:

Expand Down
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.

9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "silverware/mailchimp",
"type": "silverstripe-module",
"type": "silverstripe-vendormodule",
"description": "SilverWare MailChimp Module.",
"homepage": "https://github.com/praxisnetau/silverware-mailchimp",
"keywords": [
Expand All @@ -21,7 +21,7 @@
"require": {
"php": ">=5.6.0",
"drewm/mailchimp-api": "^2.4",
"silverware/silverware": "^1.2",
"silverware/silverware": "^1.3",
"silverware/validator": "^1.1"
},
"autoload": {
Expand All @@ -33,7 +33,10 @@
"branch-alias": {
"dev-master": "1.0.x-dev"
},
"installer-name": "silverware-mailchimp"
"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 @@ -34,26 +34,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
11 changes: 9 additions & 2 deletions src/Components/MailChimpSignup.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MailChimpSignup extends BaseComponent
* @var string
* @config
*/
private static $icon = 'silverware-mailchimp/admin/client/dist/images/icons/MailChimpSignup.png';
private static $icon = 'silverware/mailchimp: admin/client/dist/images/icons/MailChimpSignup.png';

/**
* Defines an ancestor class to hide from the admin interface.
Expand All @@ -89,6 +89,7 @@ class MailChimpSignup extends BaseComponent
'ShowLastName' => 'Boolean',
'RequireFirstName' => 'Boolean',
'RequireLastName' => 'Boolean',
'UsePlaceholders' => 'Boolean',
'ButtonLabel' => 'Varchar(64)',
'OnErrorMessage' => 'Varchar(255)',
'OnSubscribeMessage' => 'Varchar(255)',
Expand All @@ -103,7 +104,8 @@ class MailChimpSignup extends BaseComponent
*/
private static $defaults = [
'ShowFirstName' => 1,
'RequireFirstName' => 1
'RequireFirstName' => 1,
'UsePlaceholders' => 0
];

/**
Expand Down Expand Up @@ -187,6 +189,10 @@ public function getCMSFields()
TextField::create(
'ButtonLabel',
$this->fieldLabel('ButtonLabel')
),
CheckboxField::create(
'UsePlaceholders',
$this->fieldLabel('UsePlaceholders')
)
]
),
Expand Down Expand Up @@ -255,6 +261,7 @@ public function fieldLabels($includerelations = true)
$labels['IntroContent'] = _t(__CLASS__ . '.INTROCONTENT', 'Intro content');
$labels['RequireFields'] = _t(__CLASS__ . '.REQUIREFIELDS', 'Require fields');
$labels['ButtonLabel'] = _t(__CLASS__ . '.BUTTONLABEL', 'Button label');
$labels['UsePlaceholders'] = _t(__CLASS__ . '.USEPLACEHOLDERS', 'Use placeholders');

// Define Message Field Labels:

Expand Down
18 changes: 15 additions & 3 deletions src/Components/MailChimpSignupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,48 @@ public function Form()
// Create Form Fields:

$fields = FieldList::create(
EmailField::create(
$email = EmailField::create(
'Email',
_t(__CLASS__ . '.EMAILADDRESS', 'Email Address')
)
);

if ($this->UsePlaceholders) {
$email->setAttribute('placeholder', $email->Title())->setTitle('');
}

// Create First Name Field:

if ($this->ShowFirstName) {

$fields->push(
TextField::create(
$fname = TextField::create(
'FirstName',
_t(__CLASS__ . '.FIRSTNAME', 'First Name')
)
);

if ($this->UsePlaceholders) {
$fname->setAttribute('placeholder', $fname->Title())->setTitle('');
}

}

// Create Last Name Field:

if ($this->ShowLastName) {

$fields->push(
TextField::create(
$lname = TextField::create(
'LastName',
_t(__CLASS__ . '.LASTNAME', 'Last Name')
)
);

if ($this->UsePlaceholders) {
$lname->setAttribute('placeholder', $lname->Title())->setTitle('');
}

}

// Create Form Actions:
Expand Down
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-mailchimp/admin/client/dist/'
PUBLIC: '/resources/silverware/mailchimp/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-mailchimp/client/dist/',
PUBLIC: '/resources/silverware/mailchimp/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 00831d0

Please sign in to comment.