Commit Graph

1774 Commits

Author SHA1 Message Date
Ingo Schommer
6e0ef669be payloadSchema support in createEndpointFetcher()
Required for REST URLs which require data to be populated on call.
For example, PUT admin/campaigns/set/:id/publish to publish a campaign.
At the time when createEndpointFetcher() is called, the ":id" parameter can not be resolved,
since the "data" argument is passed in once the returned function is evaluated (since the component using it).
Since the whole idea of createEndpointFetcher() is that components shouldn't know about the backend internals,
its not the right place to interpolate urls.

I'm sending through any payload data in addition to replacing URLs, to keep the API simple for the component.
Again, it shouldn't worry about the presence URL interpolation. The trade off here is that data will be submitted
both in the payload (in case of a POST, PUT or DELETE request), as well as (optionally) in the URL.
2016-04-12 22:03:43 +12:00
Sam Minnee
8c469899d0 MINOR: Fix linting errors in tests.
Tests were previously excluded from eslint calls. This leads to messier
code inside tests, and potentially errors.

Now they all meet the listing rules, and so we don’t need to ignore
tests in .eslintignore.
2016-04-12 16:50:06 +12:00
Sam Minnee
b088efc6f9 MINOR: Test for backend.createEndpointFetcher() 2016-04-12 12:15:37 +12:00
Sam Minnee
21a1065329 NEW: Add createEndpointFetcher to backend
SilverStripeBackend now has a createEndpointFetcher method, described
in its docblock in more detail.

It’s based the asset-admin code for apiCallerFromEndpoint(). It’s
refactored and generalised into framework in order to provide a
general-purpose API for tying Javascript components to backend APIs.

@todo: tests
2016-04-11 21:43:21 +12:00
Ingo Schommer
429682e626 Remove <IE10 specific workarounds
We no longer support IE browsers older than IE10
2016-04-11 14:50:00 +12:00
Ingo Schommer
ce8ac58ddb Fix React DOM warnings about <form> attrs
"class" is a reserved word in JS, hence React uses "className".
"encType" has to be camel cased correctly, see https://facebook.github.io/react/docs/tags-and-attributes.html#html-attributes

Also marked less attrs on <form> as required
2016-04-11 09:16:32 +12:00
Sam Minnee
a17c5cb148 NEW: Expose silverstripe-backend for modules to access.
FIX: Ensure post has correct content-type header.

Exporting silverstripe-backend lets other modules (such as asset-admin)
use it.

In addition, the Content-type header of a post request of URL-encoded
data was being set to text/plain by default, which isn’t correct and
stopped PHP from interpreting it.
2016-04-08 10:14:24 +12:00
Ingo Schommer
3e575681ae Updated build artifacts 2016-04-07 23:50:12 +12:00
Ingo Schommer
097d7ee6d3 Removed unnecessary thunk wrapper in actions 2016-04-07 23:50:09 +12:00
Ingo Schommer
f9d5b0db97 More concise breadcrumb generation
Courtesy of @hafriedlander
2016-04-07 23:32:32 +12:00
Ingo Schommer
2f801f9319 Pass all field attributes via <FormBuilder>
Also make them immutable via deep-freeze
2016-04-07 23:32:32 +12:00
Ingo Schommer
e7d2e9b0b2 Allow user-defined <Form> attributes 2016-04-07 23:32:32 +12:00
Ingo Schommer
0fe330621c Only list existing <FormBuilder> data types 2016-04-07 23:32:32 +12:00
Ingo Schommer
3835291cdf More accurate variable naming
schema.schema is awkward
2016-04-07 23:32:31 +12:00
Ingo Schommer
ab874a0c8d Correct state handling in <FormBuilder> component 2016-04-07 23:32:31 +12:00
Ingo Schommer
874146afda Syntax fix 2016-04-07 23:32:31 +12:00
Ingo Schommer
a1ea239c8f Enforcing can*() in CampaignAdmin reads 2016-04-07 23:32:31 +12:00
Ingo Schommer
783d45cedd Added TODO elements to unimplemented CampaignAdmin functionality 2016-04-07 23:32:30 +12:00
scott1702
5c8df9f16e Updates to FormActionComponent 2016-04-06 10:57:54 +12:00
Ingo Schommer
34d40bed5f Add ESLint support
See https://github.com/silverstripe/silverstripe-framework/pull/5108
2016-04-06 10:43:33 +12:00
scott1702
6aa22c38ed Convert react grid-field from flexbox to table-based 2016-04-06 08:49:47 +12:00
Ingo Schommer
d27e3c2d34 Delete campaign feature 2016-04-06 08:49:47 +12:00
Ingo Schommer
0675f85d32 Use /index suffix for JS import statements
Otherwise browserify or gulp-sourcemaps doesn't include these
in the *.map file, which makes debugging impossible
2016-04-06 08:49:47 +12:00
Damian Mooyman
2cf5fbcfce Implement readCampaigns()
Renamed "item/items" urls to "set/sets" to distinguish between change sets and change set items.
2016-04-06 08:49:44 +12:00
scott1702
d1e4c563ce Move ActionComponent into FormActionComponent 2016-04-06 08:41:11 +12:00
Ingo Schommer
2a5c92e491 Generic state management for React GridField
Renaming state operations from 'campaign' to 'record'.
Implemented API endpoint retrieval of GridField data.

Added more mock data into CampaignAdmin (rather than hardcoding in client),
to be replaced by CampaignAdmin API endpoint querying the real datamodel.

Using more native isomorphic-fetch instead of jQuery.ajax
to minimise dependencies and get into a more forward-thinking API.

Also catching errors in ReactJS API backend:
Emulate jQuery.ajax() behaviour. Might change at a later point
if we have a general purpose backend with a promise-based catch()
implementation.
2016-04-06 08:41:07 +12:00
Ingo Schommer
47dd7b48af Relative ES6 module paths
http://stackoverflow.com/questions/20158401/how-do-i-manage-relative-path-aliasing-in-multiple-grunt-browserify-bundles/23608416#23608416
https://github.com/substack/node-browserify/issues/767
http://stackoverflow.com/questions/28078780/relative-paths-in-package-json
https://github.com/npm/npm/issues/1558
http://stackoverflow.com/questions/31624567/webstorm-es6-named-import-getting-cannot-resolve-symbol-error/31631415
http://stackoverflow.com/questions/20158401/how-do-i-manage-relative-path-aliasing-in-multiple-grunt-browserify-bundles/23608416#23608416
https://github.com/vigetlabs/gulp-starter/issues/17#issuecomment-44292681
2016-04-06 08:36:38 +12:00
Ingo Schommer
c70590e50c Consolidated grid-field component
Every top-level folder in /components should be a standalone component.
This isn't the case for the grid-field-* ones, so they belong into the same folder.
See https://github.com/Automattic/wp-calypso/blob/master/docs/components.md

merge styles
2016-04-06 08:36:37 +12:00
scott1702
e550363c67 - Add GridfieldActionsComponent
- Add ability to set desired relative width on gridfield cells
2016-04-06 08:36:37 +12:00
David Craig
ef97e0b52f Consolidated bundles, sourcemaps and watching
We don't want a bundle for each section, unnecessary network overhead
and too much boilerplate in defining build tooling.
2016-04-06 08:36:34 +12:00
Ingo Schommer
b4e6d498c9 Simplified form schema structure and mocks
Keyed by URL instead of anonymous object maps which need to be iterated on
Removed the 'schema.forms' namespace, unnecessary since all 'schema' items should be forms
2016-04-06 08:35:53 +12:00
Paul Clarke
0ca090a391 Add generic React components
Includes moving some components from AssetAdmin
2016-04-06 08:35:50 +12:00
Ingo Schommer
b0ba742c1f Campaign form schema and edit form
Remove once we have a schema-driven GridField in place.
Edit form should be a GridFieldDetailForm, but there's more work to do for schema generation
from this component.
2016-04-05 22:43:30 +12:00
David Craig
d0ffa7771c Client config 2016-04-05 22:43:29 +12:00
scott1702
2abe24f818 GridField and header styles 2016-04-05 22:42:15 +12:00
David Craig
f8c17bed3b CampaignAdmin and GridField React sections
Also removes watchify because it wasn't working.
Add SilverStripeBackend class used to fetch data from endpoints for the front-end
2016-04-05 22:42:13 +12:00
Ingo Schommer
7337f26d3a Fix non-standard url encoding in CMS search form
jQuery uses encodeURIComponent, but also this line here:
return s.join( "&" ).replace( r20, "+" );
https://github.com/jquery/jquery/blob/1.7.2/src/ajax.js#L797

This breaks when passing the result through $.path.addSearchParams(),
which in turn uses jQuery.param - any '%20' would've been wrongly encoded as '+' by jQuery.serialise(),
which in turn gets rightly encoded as '%2B' by jQuery.param().

This had the effect of breaking CMS searches with spaces in them.
2016-04-05 22:30:50 +12:00
Damian Mooyman
5a86f4232e BUG Fix error when using search bar 2016-04-05 17:10:21 +12:00
Damian Mooyman
3c2b53157e API Update Versioned methods 2016-04-04 14:50:16 +12:00
Damian Mooyman
77b47bac92 Merge pull request #5063 from benmanu/pulls/add-npm-json-js
Moving thirdparty module to npm dependency - json-js
2016-04-04 10:13:33 +12:00
Sean Harvey
b1b85b539e TinyMCE 4 optimisations. Use TinyMCE_Compressor. 2016-04-04 07:58:45 +12:00
Ben Manu
5c7a6166b6 Moving thirdparty module to npm dependency - json-js. 2016-04-01 15:43:09 +13:00
Ingo Schommer
d93da92c37 Merge pull request #5243 from open-sausages/pulls/4.0/client-routing
Implement client-side routing with Page.js
2016-04-01 14:53:17 +13:00
Steve Boyd
7887be704e Changed CMS close from an 'x' to a silverstripe font icon 2016-04-01 13:52:28 +13:00
Damian Mooyman
501b2f1809 API CMSMenu::get_cms_classes() is now sorted 2016-04-01 13:46:33 +13:00
David Craig
aa1aebd007 Implement client-side routing with Page.js
- Removes thirdparty dependency History.js
- Adds thirdparty dependency Page.js to manage client-side routing
- Adds a wrapper around Page.js for SilverStripe specific behaviour
- Increased minimum browser requirement to IE10. Native HTML History API routing requires IE10 or newer (necessitated by removal of History.js)
- PJAX pannel loading via now uses promises rather than callbacks
- Adds getClientConfig method to LeftAndMain which can be used to pass config from to the front-end client
2016-04-01 13:45:14 +13:00
Damian Mooyman
0fa7271ec2 Merge pull request #5239 from open-sausages/pulls/4.0/form-schema-fixes
Form schema fixes
2016-03-31 09:49:55 +13:00
Sam Minnée
b4526ec554 Merge pull request #5237 from open-sausages/pulls/4.0/bootstrap-include-default
Include Bootstrap by default
2016-03-30 14:57:32 +13:00
Ingo Schommer
2ba4e1dabe Removed duplicate bootstrap lib
Now generated on the fly through framework/admin/scss
2016-03-29 11:28:40 +13:00
scott1702
6b1444709f Fix menu dropdown icon 2016-03-29 11:28:38 +13:00
David Craig
d4ad1504a9 Fix bottom toolbar height 2016-03-29 11:28:05 +13:00
Paul Clarke
dce31d7235 initial updates to main nav styles for 4.0
Conflicts:
	admin/css/ie7.css
	admin/css/ie7.css.map
	admin/css/ie8.css.map
	admin/css/screen.css
	admin/css/screen.css.map
	admin/javascript/dist/bundle-leftandmain.js
	admin/javascript/src/LeftAndMain.Menu.js
	admin/scss/_spritey.scss
	css/GridField.css
2016-03-29 10:29:33 +13:00
Ingo Schommer
884c44f596 Removed sourcemaps
Will be part of .gitignore in a subsequent commit
2016-03-29 10:29:32 +13:00
scott1702
13d581dea5 Include bootstrap throughout the CMS 2016-03-29 10:29:27 +13:00
Ingo Schommer
c3a8159e80 Default to schema response part in LeftAndMain->schema()
More of a standard API approach to return data by default, and make customisation
via HTTP headers an optional mode.
2016-03-28 21:54:42 +13:00
David Craig
97176581eb Tidy grunt file
- Don't watch in prod mode
- Use gulp-if instead of if statements
2016-03-28 21:02:15 +13:00
Sam Minnee
aeccb8b8e0 API: Move DBField subclasses into SilverStripe\Model\FieldType namespace
API: Deprecate SS_Datetime.

The DBField subclasses are have all been renamed to start with “DB” and
be in the SilverStripe\Model\FieldType namespace. To keep DataObject
definitions concise, the original short variations of their names are
preserved as service definitions. Most of the field generation code
doesn’t need to change, but where field classes are referenced directly,
changes will be needed.

SS_Datetime, which is commonly referenced outside the model system
itself, has been preserved as a subclass of DBDatetime. This has been
marked as deprecated and can be removed in SilverStripe 5.

A few places that referred to $db and $casting values weren’t using
the Injector to instantiate the relevant classes. This meant that the
remapping we have created as part of moving classes into a namespace
didn’t work.
2016-03-22 18:09:30 +13:00
Damian Mooyman
2d56ea278a API Move ss buttons plugin out of thirdparty
BUG Fix incorrect parsing of shortcode properties
2016-03-21 13:51:33 +13:00
Ingo Schommer
8ae794ee99 API TinyMCE Image shortcodes 2016-03-21 09:23:40 +13:00
Damian Mooyman
0848aca462 API Massive refactor of Versioned
API Implemented recursive versioned actions (publish, etc)
API Un-deprecate delete batch action
API Changed Versioned getters and setters for stages
BUG Inject query parameters during DataObject construction to prevent incorrect lazy loading
2016-03-17 13:43:53 +13:00
Daniel Hensby
a7a23afe38 Merge pull request #5163 from mikenz/patch-5
Build dist assets and added console.warn
2016-03-14 16:38:28 +00:00
Paul Clarke
ae31619695 New styles for main nav 2016-03-14 10:18:32 +13:00
Mike Cochrane
3673a5e141 FIX Inserting a 'Download a file' without selecting an image
In the html editor, when inserting a 'Download a file' link without selecting a file to link to, no link should be inserted. Currently is inserting a link to an undefined file id: [file_link,id=undefined]
2016-03-11 00:35:13 +00:00
Mike Cochrane
0b81bbef22 FIX attempt to access https iframe from http interface 2016-03-09 21:36:39 +13:00
Mike Cochrane
a3ee9ece90 FIX avoid javascript error when preview is https
When the admin interface is http but the preview is https, javascript isn't able to read the contentDocument of the secure preview iframe. This currently results in a javascript error. Patch wraps try/catches around the two instances,
2016-03-09 21:19:26 +13:00
Damian Mooyman
6d88caa9b3 Merge pull request #5132 from open-sausages/features/form-schema
API Form schema
2016-03-07 14:08:36 +13:00
Ingo Schommer
3b11d73c46 Merge remote-tracking branch 'origin/3'
# Conflicts:
#	forms/gridfield/GridFieldDetailForm.php
#	javascript/GridField.js
2016-03-07 09:26:35 +13:00
Ingo Schommer
f36b110db3 Merge remote-tracking branch 'origin/3.3' 2016-03-04 17:06:04 +13:00
Ingo Schommer
466ed29f0e Merge remote-tracking branch 'origin/3.3' into 3 2016-03-04 14:55:08 +13:00
Ingo Schommer
3c53da0890 Merge remote-tracking branch 'origin/3.2' into 3.3 2016-03-04 14:05:06 +13:00
Ingo Schommer
7bb6295c79 Fix TreeDropdownField auto-close regression
Causes build failures due to Behat not being able to select
a link from a dropdown in "Insert Media".

Follow on effect from triggering a window.resize event
when the window wasn't actually resized (in order to force a layout redraw).

See https://github.com/silverstripe/silverstripe-framework/pull/5087 for context
2016-03-03 17:54:07 +13:00
Ingo Schommer
61a8529d76 More reuseable FormSchema logic, return on save 2016-03-03 13:36:51 +13:00
Ingo Schommer
746322a9f1 Replace CMSForm use with new setValidationResponseCallback() API
Preparing for form schema API, see https://github.com/silverstripe/silverstripe-framework/issues/4938
2016-03-03 08:20:55 +13:00
David Craig
404ac4ae43 Initial schemaState implementation 2016-03-03 08:20:54 +13:00
David Craig
afccef718c Initial Form Field Schema implementation
- Adds FormSchema class
- Adds FormSchema dependency to LeftAndMain via Injector
- Adds schema allowed_action method to LeftAndMain for generating Form schemas
- Adds FormFieldSchemaTrait to for schema getters and setters on FormFields
2016-03-03 08:20:54 +13:00
Nicola Fontana
29b35c7ccf Do not hang on nested parameters in search context
Backport of 0b5a57389b for 3.2 that does not add a new API, as
required by #5056 to be semver compatible.
2016-02-28 21:40:34 +01:00
David Craig
40723aaa58 Fix undeclared variable in UploadField.js 2016-02-26 14:43:14 +13:00
Damian Mooyman
c4f850003b Merge pull request #5089 from jakedaleweb/3
added if statement to catch NULL validators
2016-02-26 09:29:53 +13:00
Damian Mooyman
3b0a9f4ba2 Merge remote-tracking branch 'origin/3'
# Conflicts:
#	admin/javascript/LeftAndMain.Menu.js
#	control/HTTPRequest.php
#	css/GridField.css
#	css/GridField.css.map
#	docs/en/02_Developer_Guides/03_Forms/Field_types/01_Common_Subclasses.md
#	docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md
#	docs/en/02_Developer_Guides/06_Testing/index.md
#	docs/en/02_Developer_Guides/14_Files/01_File_Management.md
#	docs/en/02_Developer_Guides/14_Files/02_Images.md
#	filesystem/Upload.php
#	javascript/HtmlEditorField.js
#	model/Image.php
#	model/connect/MySQLDatabase.php
#	model/fieldtypes/Enum.php
#	model/versioning/Versioned.php
#	scss/GridField.scss
2016-02-25 14:51:59 +13:00
Damian Mooyman
9fed5561f4 Merge remote-tracking branch 'origin/3.3' into 3
# Conflicts:
#	core/Constants.php
#	dev/DevelopmentAdmin.php
2016-02-24 17:39:04 +13:00
Damian Mooyman
5f2d3f31d7 Merge remote-tracking branch 'origin/3.2' into 3.3
# Conflicts:
#	dev/DevelopmentAdmin.php
#	docs/en/02_Developer_Guides/08_Performance/02_HTTP_Cache_Headers.md
#	lang/cs.yml
#	lang/lt.yml
2016-02-24 17:29:06 +13:00
Jake Ovenden
48ecb8d8f4 added if statement to catch NULL validators 2016-02-24 15:13:00 +13:00
scott1702
a67b8144b0 Fix incorrect height on main nav after toggle 2016-02-24 10:23:16 +13:00
David Craig
5a42a4181a Added Bootstrap Alpha.2
- Managed by npm
- Created an `npm run css` task to compile
- Updated shrinkwrap
- Updated changelog
2016-02-23 11:11:24 +13:00
Damian Mooyman
f20ad434ce API Update TinyMCE to 4.x
API Allow HtmlEditorField to be individually configured
BUG Fix incorrect change detection
BUG Fix missing i18n files
2016-02-23 10:10:02 +13:00
Damian Mooyman
3738436d0e Update translations 2016-02-19 10:54:36 +13:00
scott1702
38b1c0a162 Replace Compass with gulp-sass 2016-02-16 18:35:57 +13:00
Damian Mooyman
b82d585b57 Merge pull request #5019 from open-sausages/require-react
Include React and related libraries in framework
2016-02-15 16:25:39 +13:00
scott1702
2bf802a8cd Include React and related libraries in framework 2016-02-15 16:05:55 +13:00
Damian Mooyman
230d017677 Merge remote-tracking branch 'origin/3'
# Conflicts:
#	admin/css/ie7.css.map
#	admin/css/screen.css
#	admin/css/screen.css.map
#	admin/font/icon-reference.html
#	admin/font/silverstripe.eot
#	admin/font/silverstripe.svg
#	admin/font/silverstripe.ttf
#	admin/font/silverstripe.woff
#	admin/scss/_forms.scss
#	admin/scss/_style.scss
2016-02-12 15:41:45 +13:00
Damian Mooyman
d5b4c90cb4 Merge remote-tracking branch 'origin/3.3' into 3
# Conflicts:
#	admin/css/screen.css
#	admin/css/screen.css.map
#	admin/scss/_fonts.scss
#	admin/scss/_retina.scss
2016-02-09 18:25:47 +13:00
Damian Mooyman
35b5c03fbc Merge branch 3.3.0 into 3.3 2016-02-09 18:22:58 +13:00
Damian Mooyman
adc7a59108 Update translations 2016-02-09 17:45:21 +13:00
Daniel Hensby
cb39c41872 Merge pull request #5015 from webbuilders-group/3.3-datetime-search-fix
BUGFIX: Fixed issue #5002 DatetimeField styles in the new filter panel
2016-02-05 15:31:37 +00:00
UndefinedOffset
0c252af334 BUGFIX: Fixed issue #5002 DatetimeField styles in the new filter panel 2016-02-05 10:53:35 -04:00
Loz Calver
70f8343475 Re-instate back button for item edit forms 2016-02-05 09:39:57 +00:00
Damian Mooyman
d754884214 Update translations 2016-02-04 11:03:41 +13:00
scott1702
f39989a396 Add new font icons to set
Add .no-text class for icons which have no text
2016-02-04 10:34:30 +13:00
Daniel Hensby
316d5ef967 Set the stage reading mode in LeftAndMain 2016-02-03 21:27:13 +00:00
scott1702
15fba5a4cb Remove old logout icon on retina screens
Remove background rules for old preview icons
2016-02-03 16:36:21 +13:00