Commit Graph

17211 Commits

Author SHA1 Message Date
Ingo Schommer
30174db459 FIx i18n JS regression about locale selection
When rewriting the i18n.js file from ES5 to ES6, the detectLocale()
call in the constructor was missed - meaning the lang files were loaded by the browser,
but never actually used.
2016-09-16 13:46:11 +12:00
Ingo Schommer
8f23fa99a5 API Moved CMS-specific JavaScript to admin/thirdparty
The 'admin' module will be split off from 'framework',
where 'framework' only provides (mostly) frontend-agnostic PHP classes.
For example, HTMLEditorField.php has a TinyMCEConfig.php driver,
but doesn't come with its own JS includes.
2016-09-16 13:46:10 +12:00
Ingo Schommer
7d67b24c25 API Removed legacy Jasmine JS Unit tests
They were used for TreeDropdownField JavaScript tests but were never run
on CI, hence have been a bit of a wasted effort.

We're using a different JS unit testing solution now (geared towards React),
and running Jasmine in parallel on Travis for a few test cases
doesn't warrant the setup effort involved.

The TreeDropdownField component will eventually move to a React solution
which can be developed in a test-driven fashion.
2016-09-16 13:46:10 +12:00
Ingo Schommer
686c167793 Removed TinyMCE NPM dep
We don't have an easy way to copy over those files automatically into the thirdparty/ dir,
where they are accessible on the webroot (not the case in node_modules).

To avoid confusion, we don't duplicate into node_modules for now.
See https://github.com/silverstripe/silverstripe-framework/pull/5918#issuecomment-244910280
2016-09-16 13:46:10 +12:00
Ingo Schommer
8eac22c628 Separate CSS bundling in Webpack
Multiple entry points can't result in a single bundle.css with a fixed filename, see
https://github.com/webpack/extract-text-webpack-plugin/issues/179

Until that's resolved, it's easier to keep the 'css' task separate in Webpack,
and have a single entry point for all CSS (bundle.scss).

Also partially reverting "Moved frontend assets into admin/ "module"",
which moved too many files: debug.css and install.css need to remain
as framework (not admin) deps. Split out into a separate `framework-css` Webpack
task in preparation for splitting off the module.
2016-09-16 13:46:09 +12:00
Ingo Schommer
8e5dd58c43 Removed unused dist files
Storing in fonts/, not font/fonts
2016-09-16 13:46:09 +12:00
Damian Mooyman
abaebbe1d7 FIX Manually fix issue in jquery-ui 1.9 2016-09-16 13:46:09 +12:00
Ingo Schommer
2316b0da9f API Remove i18n::js_i18n option
The JavaScript i18n functionality in SilverStripe is used in the CMS as well as form field implementations.
Form fields used to include their own JavaScript for usage outside of CMS. This now requires custom build tooling in a project.
Hence there's no need for an i18n shim (i18nx.js), since the CMS always uses i18n support.
2016-09-16 13:46:09 +12:00
Ingo Schommer
ee10dbb680 API Moved frontend assets into admin/ "module"
We've removed the ability to directly reference JS and CSS files
for form fields and other SilverStripe features in favour of a common bundle built by Webpack.

The logical next step is to make the framework module free of frontend dependencies,
which should simplify its operation, and avoid another time intensive "npm install" on a module.
2016-09-16 13:46:06 +12:00
Damian Mooyman
e5df794a04 Move incorrect lang file location 2016-09-16 13:44:15 +12:00
Ingo Schommer
6be25f3b52 Entry point for UploadField_select.js
Used in iframe, so can't be rolled into other code.
Moved in admin/ since that's easier for now with Webpack entry points,
and we'll move all JS/CSS into admin/ anyway soon.
2016-09-16 13:44:14 +12:00
Ingo Schommer
25f4741142 Removed ModelAdmin/SecurityAdmin Webpack entry points
There's not a lot of benefit in packaging these separately in terms of initial CMS load size,
so let's simplify the setup. They'll eventually become lazy loaded chunks in a React-based setup
2016-09-16 13:44:12 +12:00
Damian Mooyman
b87c668bf4 API support dblib (#5996) 2016-09-16 11:39:29 +12:00
Thomas Portelange
995d07756d cache currentUser query (#6007)
* cache currentUser query

Various modules can call a lot of time Member::currentUser(). We can avoid querying the database multiple times. Cache is implemented as a static array inside the method and store the data byID, in case the currentUserID changes within the same request (not very likely, but..)
2016-09-15 15:45:40 +01:00
Ingo Schommer
701c700d4c Fixed UploadField JS dependencies
When adding the deps straight into the file (recommended),
the onchange handler in file-upload isn't firing properly when a file is uploaded through
the <input type=file> button - it falls back to default behaviour, which submits the
containing form, failing because the upload is handled by a different URL.
2016-09-15 22:19:15 +12:00
Ingo Schommer
25b511f3d5 Build React in production mode by default
https://facebook.github.io/react/downloads.html says:
"By default, React will be in development mode. To use React in production mode, set the environment variable NODE_ENV to production (using envify or webpack's DefinePlugin). A minifier that performs dead-code elimination such as UglifyJS is recommended to completely remove the extra code present in development mode."
2016-09-15 22:19:15 +12:00
Ingo Schommer
9cb9a05ec0 API Removed duplicated thirdparty deps
These were originally copied from node_modules via an "npm run thirdparty" task,
in order to have them loadable with oldschool <script> tags.
Since webpack supports CommonJS-style loading, that's no longer required,
we can simply inline those scripts into the bundle.

We need to use imports-loader though, in order to ensure
that "define" is not available in some module scopes,
which triggers AMD behavior that's not compatible with Webpack's loaders.
See http://webpack.github.io/docs/shimming-modules.html

I've had to pin to the exact versions used in the 3.x CMS,
since jquery-upload has introduced an AMD wrapper sometime
between 6.0 and 6.9 (the latest version NPM automatically pulls in).
This AMD wrapper confuses Webpack, since it's trying to resolve the
dependencies contained in it. We could create shims for those instead,
but the easiest way was to simply revert to the versions already used
before the Webpack migration (since the newer versions in node_modules
were never actually copied into thirdparty, they weren't used before).
2016-09-15 22:19:12 +12:00
Ingo Schommer
0a380a94cd API Removed unused UMD builds of individual JS files
This has been made obsolete, since those files are all included in the main bundle (see bundle-lib.js).
They should not be referenced individually (e.g. through Requirements::block() or Requirements::javascript()).
2016-09-15 22:19:10 +12:00
Ingo Schommer
5f7b13ee49 API Removed unused images across CMS UI
Many of these are now inline via Webpack's url-loader plugin (https://github.com/webpack/url-loader),
and a tonne were legacy references (e.g. leftovers from ComplexTableField).

Some of these might still be used in other modules like userforms,
but we're removing support for "hotlinking" images in core - they're not an API.
2016-09-15 22:19:10 +12:00
Ingo Schommer
c9d964ff0d Fix HTMLEditorField image reference
Regression from moving images into client/src/ subfolder a while ago
2016-09-15 22:19:10 +12:00
Ingo Schommer
aea96f2f9a Enable UglifyJS mangling
We've disabled this previously because it was interfering with JS sourcemaps and breakpoints.
After some spot tests, this no longer seems to be the case with webpack generated sourcemaps.
2016-09-15 22:19:10 +12:00
Ingo Schommer
2bd4857260 Add new FormBuilderModal (required for asset-admin) 2016-09-15 22:19:09 +12:00
Ingo Schommer
08adac8770 Updated npm-shrinkwrap in order to build lock file
Throw "extraneous modules" errors on npm-shrinkwrap@5.x,
even after `rm -rf node_modules; npm install`
2016-09-15 22:19:09 +12:00
Sam Minnee
1b527fca3f FIX Webpack handles images & fonts.
Responsibility for finding and referencing images and fonts is now
given to webpack. All the url references are now relative to the
component scss file, and point to font & images files in src/, rather
than assuming someone else will place them in dist.

This makes the source more modular, and makes it easier to, for
example, inline images are data URIs, or create a new build script that
builds several modules for a project in a single pass.

Workaround for bad font path in bundle.css:
ExtactTextPlugin didn’t work as well with a subfolder reference in the
filename. This is just a short-term fix and could probably be improved
to put bundle.css back in the styles subfolder.

Webpack handles images & fonts:
Responsibility for finding and referencing images and fonts is now
given to webpack. All the url references are now relative to the
component scss file, and point to font & images files in src/, rather
than assuming someone else will place them in dist.

This makes the source more modular, and makes it easier to, for
example, inline images are data URIs, or create a new build script that
builds several modules for a project in a single pass.

Clarify docs on spriting and webfonts:
We've decided to remove sprity since it comes with hundreds of dependencies,
and needs compilation within the "npm install" - dragging out the already overweight
install process, and making the resulting node_modules/ folder less portable between systems.
2016-09-15 22:19:09 +12:00
Sam Minnee
8e89d08e7b API: Remove js/css requirements include from form fields.
API: Remove InlineFormAction::includeDefaultJS()

Developers must now take responsibility for including the necessary JS
and CSS themselves. This has been implemented in the admin, but not
in other use-cases.
2016-09-15 22:19:09 +12:00
Sam Minnee
a6049ec383 FIX: Use chosen from npm package.
Downloading the package from github makes npm install a lot slower and
complicates the webpack build.
2016-09-15 22:19:09 +12:00
Sam Minnee
2e577ddb1d API Use Webpack
The bundle is generated by running “webpack” directly - gulp is no
longer needed as an intermediary. The resulting config is a lot shorter,
although more configuration is pushed into lib.js.

Modules are shared between javascript files as global variables.
Although this global state pollution is a bit messy, I don’t think it’s
practically any worse than the previous state, and it highlights the
heavy coupling between the different packages we have in place.
Reducing the width of the coupling between the core javascript and
add-on modules would probably be a better way of dealing with this than
replacing global variables with some other kind of global state.

The web pack execution seems roughly twice as fast - if I clear out my
framework/client/dist/js folder, it takes 13.3s to rebuild. However,
it’s not rebuilding other files inside dist, only the bundle files.

CSS files are now included from javascript and incorporated into
bundle.css by the webpack. Although the style-loader is helpful in some
dev workflows (it allows live reload), it introduces a flash of
unstyled content which makes it inappropriate for production.

Instead ExtractTextPlugin is used to write all the aggregated CSS
into a single bundle.css file. A style-loader-based configuration could
be introduced for dev environments, if we make use of the webpack live
reloader in the future.

Note that the following features have been removed as they don't appear to be
necessary when using Webpack:
 - UMD module generation
 - thirdparty dist file copying

LeftAndMain.js deps: Without it, ssui.core.js gets loaded too late,
which leads e.g. to buttons being initialised without this added behaviour.
2016-09-15 22:19:05 +12:00
3Dgoo
cd8904e045 Fixing button destroy bug
When you want to add a button to the CMS but don't want LeftAndMain to apply jQuery UI button to it we add the `data-button="true"` attribute to our button. 

The `onadd` function checks that this attribute does not exist before calling `this.button()`.

The `onremove` incorrectly checks that this attribute does exist before calling `this.button('destroy')`. This should be checking that this attribute does not exist, just like the `onadd` function.

What this causes is when you have a button with the `data-button` attribute a button is not created, but when you leave the page `destory` gets called on an item which doesn't exist. We end up with the following error:

> Uncaught Error: cannot call methods on button prior to initialization; attempted to call method 'destroy'

The other issue with this logic is buttons are never getting destroyed when `onremove` is called.

The whole issue is caused by a missing `!` in the if statement. This change adds it in to fix the problem.
2016-09-15 08:23:22 +09:30
Daniel Hensby
f25b88b146 showqueries debugging tool now inserts parameters in place (#5885) 2016-09-15 09:15:19 +12:00
Daniel Hensby
4e1d38c209
Merge branch '3' 2016-09-14 11:49:07 +01:00
Daniel Hensby
a9df28c791
Merge branch '3.4' into 3 2016-09-14 11:40:15 +01:00
Daniel Hensby
8c23b67b9f
Merge branch '3.3' into 3.4 2016-09-14 11:39:49 +01:00
Daniel Hensby
64de2223f8
Merge branch '3.2' into 3.3 2016-09-14 11:39:28 +01:00
Daniel Hensby
90a01870ea
Merge branch '3.1' into 3.2 2016-09-14 11:39:00 +01:00
Ingo Schommer
c2292a4cc1 Merge pull request #6003 from open-sausages/pulls/4.0/readonly-field-icon
Adjustment for icons within readonly fields
2016-09-14 16:06:20 +12:00
Paul Clarke
440a3073fe improve class naming to be more generic 2016-09-14 15:09:45 +12:00
Paul Clarke
d2cabce852 Added icon style for readonly fields containing icons 2016-09-14 15:09:16 +12:00
Ingo Schommer
4d8fb16c3e Merge pull request #5964 from open-sausages/pulls/4.0/tabify
Tabs and CompositeField added to React formfields
2016-09-14 14:12:52 +12:00
Ingo Schommer
294644ce1a Updated dist files 2016-09-14 14:12:04 +12:00
Paul Clarke
d51c46dc89 Increase consistency of tab styles across legacy and bootstrap tabs
Using BS variables where possible for all tabs
2016-09-14 14:10:41 +12:00
Paul Clarke
660aa20dad Remove tab styles from legacy stylesheet 2016-09-14 14:09:02 +12:00
Paul Clarke
82eea479e8 Adjust tab height (was a mix of 2px and 3px) 2016-09-14 14:09:02 +12:00
Christopher Joe
190ed628bc API PreviewThumbnail now uses ScaleMaxWidth
This will mean that if a thumbnail image is smaller than the preview_width defined, then it will no longer get blown up to the defined size.
2016-09-14 14:09:01 +12:00
Christopher Joe
ee5b4fd8d3 Tabs support in new file/image editor
Introducing <Tabs> component based on react-bootstrap
Better support for nested fields in FormBuilder
Tweaks to get FormBuilder working with frameworktest BasicFieldsPage fields
Added exception in FormBuilder when Component is defined but not found
Added check in SingleSelectField for empty value before adding one in
Added temporary workaround for CompositeFields with no name (another story to address the actual problem)
Added asset_preview_height for File image preview, matches the defined CSS max-height
Added documentation to DBFile::PreviewLink() method
2016-09-14 14:08:59 +12:00
Paul
955d75b219 Insert media into TinyMCE modal, styling fixes and improvements (#5967)
* Remove interference of nested for__fieldgroup-item

* Adjust position of dropdown field

* Remove divider lines, adjust position of upload area

Clean up styles a bit too

* Adjust position of image

* Mostly css tidy up, added use of a few variables

* Toggle arrow was showing other icon because of icon height

* All buttons in toolbars remove margin below, adjust button link color

* Reorder sort and filter, add toolbar styles

* Add button styles to toolbar

* Remove some of the linting issues

* Added new panel variables

* Simplify variable

* Replace panel variable, insert media dialog positioning

* Update with new variable name, reduce space below toolbar

* Build

* Uploading file spacing, toolbar styles added

* Visual uploads, error upload fixes, edit details panel spacing

* Add toolbar to upload modal

* build

* Build

* increase width of pagination on gridfield

* Add height to uploading items only

* Build

* Added class back for beat test to pass
2016-09-14 13:48:33 +12:00
Damian Mooyman
014d6db8d8 Merge pull request #5989 from dhensby/pulls/3.1/fix-sake-lf
FIX Force line endings to LF on sake file
2016-09-14 10:21:41 +12:00
Damian Mooyman
360d3bc331 Merge pull request #5988 from dhensby/pulls/many-many-fixture-fix
API Allow has_many fixtures to be declared with array format as well …
2016-09-14 09:57:56 +12:00
Sam Minnee
aecf5260fc API: Remove TextParser and BBCodeParser
These have been archived at
https://github.com/silverstripe-archive/silverstripe-bbcodeparser
2016-09-14 09:10:49 +12:00
Daniel Hensby
60250903cb Merge pull request #5994 from open-sausages/pulls/4.0/preview-panel
API Move preview panel to CMS module
2016-09-13 15:11:57 +01:00
Damian Mooyman
9b1c24cf4c API Move preview panel to CMS module
BUG Fix preview area flashing on section navigation
Fix source file issue
2016-09-13 13:20:17 +12:00