Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate toggle to es6 #1034

Closed
wants to merge 13 commits into from
1 change: 1 addition & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
devsrc/
js/
less/
lib/
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"backbone": "1.1.2",
"backbone.paginator": "1.0.0",
"cs-jqtree-contextmenu": "0.1.0",
"datatables.net": "^1.10.22",
"datatables.net": "^1.10.23",
"datatables.net-autofill": "^2.3.5",
"datatables.net-autofill-bs": "^2.0.0",
"datatables.net-bs": "^1.10.22",
"datatables.net-bs": "^1.10.23",
"datatables.net-buttons": "^1.6.5",
"datatables.net-buttons-bs": "^1.6.5",
"datatables.net-colreorder": "^1.5.2",
Expand Down Expand Up @@ -102,8 +102,8 @@
"underscore": "1.12.0",
"jqtree": "1.4.10",
"jquery": "3.5.1",
"datatables.net": "1.10.22",
"datatables.net-bs": "1.10.22"
"datatables.net": "1.10.23",
"datatables.net-bs": "1.10.23"
},
"scripts": {
"clean": "rimraf docs/_site",
Expand Down
16 changes: 8 additions & 8 deletions src/core/router.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* Pattern router
*/
define(["underscore", "backbone"], function (_, Backbone) {
"use strict";
import _ from "underscore";
import Backbone from "backbone";

var regexEscape = function (s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
};

var Router = Backbone.Router.extend({
const regexEscape = function (s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
};

const Router = Backbone.Router.extend({
actions: [],
redirects: {},
addRoute: function (
Expand Down Expand Up @@ -105,5 +106,4 @@ define(["underscore", "backbone"], function (_, Backbone) {
},
});

return new Router();
});
export default Router;
25 changes: 25 additions & 0 deletions src/pat/modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,28 @@ Modal with TinyMCE</a>
<textarea class="pat-tinymce"></textarea>
</div>
```


## Configuration

| Option | Type | Default | Description |
|:-:|:-:|:-:|:-:|
| height | string | '' | Set the height of the modal, for example: 250px |
| width | string | '' | Set the width of the modal, for example: 80% or 500px. |
| margin | function or integer| 20 | A function, Integer or String which will be used to set the margin of the modal in pixels. If a function is passed it must return an Integer. |
| position | string | 'center middle' | Position the modal relative to the window with the format: "<horizontal> <vertical>" -- allowed values: top, bottom, left, right, center, middle. |
| triggers | array | [] | Add event listeners to elements on the page which will open the modal when triggered. Pass an Array of strings with the format ``["EVENT SELECTOR"]`` or ``["EVENT"]``. For example, ``["click .someButton"]``. If you pass in only an event such as, ``["change"]``, the event listener will be added to the element on which the modal was initiated, usually a link or button. |
| title | string | null | A string to place in the modal header. If title is provided, titleSelector is not used. |
| titleSelector | string | 'h1:first' | Selector for an element to extract from the content provided to the modal and place in the modal header. |
| content | string | '#content' | Selector for an element within the content provided to the modal to use as the modal body. |
| prependContent | string | '.portalMessage' | Selector for elements within the content provided to the modal which will be collected and inserted, by default above, the modal content. This is useful for extracting things like alerts or status messages on forms and displaying them to the user after an AJAX response. |
| backdrop | string | 'body' | Selector for the element upon which the Backdrop pattern should be initiated. The Backdrop is a full width mask that will be apply above the content behind the modal which is useful for highlighting the modal dialog to the user. |
| backdropOptions | object | { zIndex: "1040", opacity: "0.8", className: "backdrop", classActiveName: "backdrop-active", closeOnEsc: true, closeOnClick: true } | Look at options at backdrop pattern. |
| buttons | string | '.formControls > input[type="submit"]' | Selector for matching elements, usually buttons, inputs or links, from the modal content to place in the modal footer. The original elements in the content will be hidden. |
| automaticallyAddButtonActions | boolean | true | Automatically create actions for elements matched with the buttons selector. They will use the options provided in actionOptions. |
| loadLinksWithinModal | boolean | true | Automatically load links inside of the modal using AJAX. |
| actionOptions | object | {} | A hash of selector to options. Where options can include any of the defaults from actionOptions. Allows for the binding of events to elements in the content and provides options for handling ajax requests and displaying them in the modal. |
| onSuccess | Function|string | | function which is called with parameters (modal, response, state, xhr, form) when form has been successfully submitted. if value is a string, this is the name of a function at window level |
| onFormError | Function|string | | function which is called with parameters (modal, response, state, xhr, form) when backend has sent an error after form submission. if value is a string, this is the name of a function at window level |
| onError | Function|string | | function which is called with parameters (xhr, textStatus, errorStatus) when form submission has failed. if value is a string, this is the name of a function at window level |

Loading