pageflow 15.1.1 → 15.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +337 -162
- data/README.md +1 -2
- data/admins/pageflow/accounts.rb +13 -35
- data/admins/pageflow/entry.rb +21 -1
- data/admins/pageflow/entry_templates.rb +140 -0
- data/admins/pageflow/membership.rb +12 -0
- data/admins/pageflow/user.rb +5 -3
- data/app/assets/javascripts/pageflow/admin/accounts.js +3 -3
- data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
- data/app/assets/javascripts/pageflow/admin/users.js +1 -1
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
- data/app/assets/javascripts/pageflow/base.js +0 -12
- data/app/assets/javascripts/pageflow/components.js +2 -6
- data/app/assets/javascripts/pageflow/dist/ui.js +56 -14
- data/app/assets/javascripts/pageflow/vendor.js +13 -10
- data/app/assets/stylesheets/pageflow/base.scss +0 -7
- data/app/assets/stylesheets/pageflow/editor/base.scss +2 -0
- data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
- data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/background_image.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +5 -0
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
- data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
- data/app/helpers/pageflow/pages_helper.rb +1 -0
- data/app/helpers/pageflow/structured_data_helper.rb +0 -2
- data/app/models/pageflow/account.rb +26 -0
- data/app/models/pageflow/draft_entry.rb +13 -3
- data/app/models/pageflow/entry.rb +16 -2
- data/app/models/pageflow/entry_duplicate.rb +1 -0
- data/app/models/pageflow/entry_template.rb +69 -0
- data/app/models/pageflow/published_entry.rb +13 -3
- data/app/models/pageflow/revision.rb +1 -1
- data/app/models/pageflow/theming.rb +8 -47
- data/app/policies/pageflow/account_policy.rb +10 -0
- data/app/policies/pageflow/entry_template_policy.rb +22 -0
- data/app/policies/pageflow/theming_policy.rb +0 -4
- data/app/views/admin/accounts/_configuration_label.html.erb +5 -0
- data/app/views/admin/accounts/_entry_template_details.html.arb +19 -0
- data/app/views/admin/accounts/_form.html.erb +5 -31
- data/app/views/admin/accounts/_share_providers_label.html.erb +5 -0
- data/app/views/admin/accounts/_theming_details.html.arb +0 -12
- data/app/views/admin/entries/_attributes_table.html.arb +5 -0
- data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
- data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
- data/app/views/admin/entry_templates/_form.html.erb +58 -0
- data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
- data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
- data/app/views/pageflow/themes/_theme.json.jbuilder +1 -0
- data/config/initializers/admin_resource_tabs.rb +5 -0
- data/config/initializers/help_entries.rb +1 -5
- data/config/locales/de.yml +100 -162
- data/config/locales/en.yml +91 -150
- data/db/migrate/20200122115400_create_pageflow_entry_templates.rb +75 -0
- data/db/migrate/20200206134400_convert_legacy_scrolled_content_element_types.rb +48 -0
- data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
- data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1465 -1348
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9218 -0
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +8 -0
- data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
- data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +2 -2
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +2 -2
- data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
- data/entry_types/paged/config/initializers/features.rb +1 -1
- data/entry_types/paged/config/initializers/help_entries.rb +17 -0
- data/entry_types/paged/config/locales/new/help.de.yml +162 -0
- data/entry_types/paged/config/locales/new/help.en.yml +153 -0
- data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
- data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
- data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +15 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +8 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +10 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +4 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/i18n_helper.rb +35 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +33 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +8 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +38 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +32 -4
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +13 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +7 -0
- data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
- data/entry_types/scrolled/config/locales/new/de.yml +565 -10
- data/entry_types/scrolled/config/locales/new/en.yml +472 -11
- data/entry_types/scrolled/config/routes.rb +1 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +31 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +4 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +93 -28
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +133 -0
- data/entry_types/scrolled/package/contentElements-editor.js +469 -0
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements-frontend.js +878 -0
- data/entry_types/scrolled/package/editor.js +2725 -2590
- data/entry_types/scrolled/package/frontend-server.js +228 -0
- data/entry_types/scrolled/package/frontend/EditableText-4264c349.js +1993 -0
- data/entry_types/scrolled/package/frontend/Wavesurfer-c3c45324.js +378 -0
- data/entry_types/scrolled/package/frontend/components-cfe6a479.js +2115 -0
- data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
- data/entry_types/scrolled/package/frontend/index.css +9 -0
- data/entry_types/scrolled/package/frontend/index.js +4425 -0
- data/entry_types/scrolled/package/package.json +28 -7
- data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
- data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +20 -9
- data/lib/pageflow/ability_mixin.rb +15 -2
- data/lib/pageflow/configuration.rb +6 -5
- data/lib/pageflow/engine.rb +1 -0
- data/lib/pageflow/entry_type_configuration.rb +1 -0
- data/lib/pageflow/global_config_api.rb +5 -4
- data/lib/pageflow/react.rb +4 -2
- data/lib/pageflow/seeds.rb +0 -2
- data/lib/pageflow/theme.rb +4 -0
- data/lib/pageflow/themes.rb +5 -1
- data/lib/pageflow/version.rb +1 -1
- data/{packages/pageflow → package}/config/jest/index.js +2 -2
- data/{packages/pageflow → package}/config/jest/transformers/jst.js +1 -1
- data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
- data/package/config/webpack.js +22 -0
- data/{packages/pageflow → package}/editor.js +493 -1122
- data/package/frontend.js +2525 -0
- data/{packages/pageflow → package}/package.json +5 -1
- data/package/testHelpers.js +732 -0
- data/{packages/pageflow → package}/ui.js +56 -14
- data/spec/factories/accounts.rb +9 -1
- data/spec/factories/entry_templates.rb +9 -0
- data/spec/factories/published_entries.rb +8 -1
- data/spec/factories/themings.rb +0 -1
- metadata +74 -27
- data/app/assets/javascripts/pageflow/dist/editor.js +0 -11890
- data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5798
- data/config/initializers/entry_types.rb +0 -4
- data/entry_types/scrolled/package/frontend.js +0 -3404
- data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
- data/packages/pageflow/config/webpack.js +0 -15
- data/packages/pageflow/testHelpers.js +0 -268
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = require('jest-css-modules-transform');
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
externals: {
|
3
|
-
'backbone': 'Backbone',
|
4
|
-
'backbone.babysitter': 'Backbone.ChildViewContainer',
|
5
|
-
'cocktail': 'Cocktail',
|
6
|
-
'jquery': 'jQuery',
|
7
|
-
'jquery-ui': 'jQuery',
|
8
|
-
'jquery.minicolors': 'jQuery',
|
9
|
-
'underscore': '_',
|
10
|
-
'backbone.marionette': 'Backbone.Marionette',
|
11
|
-
'i18n-js': 'I18n',
|
12
|
-
'iscroll': 'IScroll',
|
13
|
-
'wysihtml5': 'wysihtml5'
|
14
|
-
}
|
15
|
-
};
|
@@ -1,268 +0,0 @@
|
|
1
|
-
import Backbone from 'backbone';
|
2
|
-
import _ from 'underscore';
|
3
|
-
import { Entry, Theme, FileTypes, FilesCollection, SubsetCollection, ImageFile, WidgetTypes, EditorApi, VideoFile, TextTrackFile } from 'pageflow/editor';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Build editor Backbone models for tests.
|
7
|
-
*/
|
8
|
-
|
9
|
-
var factories = {
|
10
|
-
/**
|
11
|
-
* Build an entry model.
|
12
|
-
*
|
13
|
-
* @param {Function} model - Entry type specific entry model
|
14
|
-
* @param {Object} [attributes] - Model attributes
|
15
|
-
* @param {Object} [options]
|
16
|
-
* @param {Object} [options.entryTypeSeed] - Seed data passed to `Entry#setupFromEntryTypeSeed`.
|
17
|
-
* @param {FileTypes} [options.fileTypes] - Use {@link #factoriesfiletypes factories.fileTypes} to construct this object.
|
18
|
-
* @param {Object} [options.filesAttributes] - An object mapping (underscored) file collection names to arrays of file attributes.
|
19
|
-
* @returns {Entry} - An entry Backbone model.
|
20
|
-
*
|
21
|
-
* @example
|
22
|
-
*
|
23
|
-
* import {factories} from 'pageflow/testHelpers';
|
24
|
-
* import {PagedEntry} from 'editor/models/PagedEntry';
|
25
|
-
*
|
26
|
-
* const entry = factories.entry(PagedEntry, {slug: 'some-entry'}, {
|
27
|
-
* entryTypeSeed: {some: 'data'},
|
28
|
-
* fileTypes: factories.fileTypes(f => f.withImageFileType()),
|
29
|
-
* filesAttributes: {
|
30
|
-
* image_files: [{id: 100, perma_id: 1, basename: 'image'}]
|
31
|
-
* }
|
32
|
-
* });
|
33
|
-
*/
|
34
|
-
entry: function entry(model, attributes) {
|
35
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
36
|
-
|
37
|
-
if (typeof model !== 'function') {
|
38
|
-
return factories.entry(Entry, model, attributes);
|
39
|
-
}
|
40
|
-
|
41
|
-
ensureFileTypes(options);
|
42
|
-
ensureFilesCollections(options);
|
43
|
-
var entry = new model(attributes, _.extend({
|
44
|
-
storylines: new Backbone.Collection(),
|
45
|
-
chapters: new Backbone.Collection()
|
46
|
-
}, options));
|
47
|
-
|
48
|
-
if (entry.setupFromEntryTypeSeed && options.entryTypeSeed) {
|
49
|
-
entry.setupFromEntryTypeSeed(options.entryTypeSeed);
|
50
|
-
}
|
51
|
-
|
52
|
-
return entry;
|
53
|
-
},
|
54
|
-
theme: function theme(attributes, options) {
|
55
|
-
return new Theme(attributes, options);
|
56
|
-
},
|
57
|
-
|
58
|
-
/**
|
59
|
-
* Construct a file type registry that can be passed to {@link
|
60
|
-
* #factoriesentry factories.entry}.
|
61
|
-
*
|
62
|
-
* The passed function receives a builder object with the following
|
63
|
-
* methods that register a corresponding file type:
|
64
|
-
*
|
65
|
-
* - `withImageFileType([options])`: Registers a file type with collection name `image_files`.
|
66
|
-
* - `withVideoFileType([options])`: Registers a file type with collection name `video_files`.
|
67
|
-
* - `withTextTrackFileType([options])`: Registers a file type with collection name `text_track_files`.
|
68
|
-
*
|
69
|
-
* @param {Function} fn - Build function.
|
70
|
-
* @returns {FileTypes} - A file Type registry
|
71
|
-
*/
|
72
|
-
fileTypes: function fileTypes(fn) {
|
73
|
-
var fileTypes = new FileTypes();
|
74
|
-
var fileTypesSetupArray = [];
|
75
|
-
var builder = {
|
76
|
-
withImageFileType: function withImageFileType(options) {
|
77
|
-
fileTypes.register('image_files', _.extend({
|
78
|
-
model: ImageFile,
|
79
|
-
matchUpload: /^image/,
|
80
|
-
topLevelType: true
|
81
|
-
}, options));
|
82
|
-
fileTypesSetupArray.push({
|
83
|
-
collectionName: 'image_files',
|
84
|
-
typeName: 'Pageflow::ImageFile',
|
85
|
-
i18nKey: 'pageflow/image_files'
|
86
|
-
});
|
87
|
-
return this;
|
88
|
-
},
|
89
|
-
withVideoFileType: function withVideoFileType(options) {
|
90
|
-
fileTypes.register('video_files', _.extend({
|
91
|
-
model: VideoFile,
|
92
|
-
matchUpload: /^video/,
|
93
|
-
topLevelType: true
|
94
|
-
}, options));
|
95
|
-
fileTypesSetupArray.push({
|
96
|
-
collectionName: 'video_files',
|
97
|
-
typeName: 'Pageflow::VideoFile',
|
98
|
-
i18nKey: 'pageflow/video_files',
|
99
|
-
nestedFileTypes: [{
|
100
|
-
collectionName: 'text_track_files'
|
101
|
-
}]
|
102
|
-
});
|
103
|
-
return this;
|
104
|
-
},
|
105
|
-
withTextTrackFileType: function withTextTrackFileType(options) {
|
106
|
-
fileTypes.register('text_track_files', _.extend({
|
107
|
-
model: TextTrackFile,
|
108
|
-
matchUpload: /vtt$/
|
109
|
-
}, options));
|
110
|
-
fileTypesSetupArray.push({
|
111
|
-
collectionName: 'text_track_files',
|
112
|
-
typeName: 'Pageflow::TextTrackFile',
|
113
|
-
i18nKey: 'pageflow/text_track_files'
|
114
|
-
});
|
115
|
-
return this;
|
116
|
-
}
|
117
|
-
};
|
118
|
-
fn.call(builder, builder);
|
119
|
-
fileTypes.setup(fileTypesSetupArray);
|
120
|
-
return fileTypes;
|
121
|
-
},
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Shorthand for calling {@link #factoriesfiletypes
|
125
|
-
* factories.fileTypes} with a builder function that calls
|
126
|
-
* `withImageFileType`.
|
127
|
-
*
|
128
|
-
* @param {Object} options - File type options passed to withImageFileType,
|
129
|
-
* @returns {FileTypes} - A file Type registry.
|
130
|
-
*/
|
131
|
-
fileTypesWithImageFileType: function fileTypesWithImageFileType(options) {
|
132
|
-
return this.fileTypes(function () {
|
133
|
-
this.withImageFileType(options);
|
134
|
-
});
|
135
|
-
},
|
136
|
-
imageFileType: function imageFileType(options) {
|
137
|
-
return factories.fileTypesWithImageFileType(options).first();
|
138
|
-
},
|
139
|
-
fileType: function fileType(options) {
|
140
|
-
return factories.imageFileType(options);
|
141
|
-
},
|
142
|
-
filesCollection: function filesCollection(options) {
|
143
|
-
return FilesCollection.createForFileType(options.fileType, [{}, {}]);
|
144
|
-
},
|
145
|
-
nestedFilesCollection: function nestedFilesCollection(options) {
|
146
|
-
return new SubsetCollection({
|
147
|
-
parentModel: factories.file({
|
148
|
-
file_name: options.parentFileName
|
149
|
-
}),
|
150
|
-
filter: function filter() {
|
151
|
-
return true;
|
152
|
-
},
|
153
|
-
parent: factories.filesCollection({
|
154
|
-
fileType: options.fileType
|
155
|
-
})
|
156
|
-
});
|
157
|
-
},
|
158
|
-
videoFileWithTextTrackFiles: function videoFileWithTextTrackFiles(options) {
|
159
|
-
var fileTypes = this.fileTypes(function () {
|
160
|
-
this.withVideoFileType(options.videoFileTypeOptions);
|
161
|
-
this.withTextTrackFileType(options.textTrackFileTypeOptions);
|
162
|
-
});
|
163
|
-
var fileAttributes = {
|
164
|
-
video_files: [_.extend({
|
165
|
-
id: 1,
|
166
|
-
state: 'encoded'
|
167
|
-
}, options.videoFileAttributes)],
|
168
|
-
text_track_files: _.map(options.textTrackFilesAttributes, function (attributes) {
|
169
|
-
return _.extend({
|
170
|
-
parent_file_id: 1,
|
171
|
-
parent_file_model_type: 'Pageflow::VideoFile'
|
172
|
-
}, attributes);
|
173
|
-
})
|
174
|
-
};
|
175
|
-
var entry = factories.entry({}, {
|
176
|
-
files: FilesCollection.createForFileTypes(fileTypes, fileAttributes || {}),
|
177
|
-
fileTypes: fileTypes
|
178
|
-
});
|
179
|
-
var videoFiles = entry.getFileCollection(fileTypes.findByCollectionName('video_files'));
|
180
|
-
var textTrackFiles = entry.getFileCollection(fileTypes.findByCollectionName('text_track_files'));
|
181
|
-
return {
|
182
|
-
entry: entry,
|
183
|
-
videoFile: videoFiles.first(),
|
184
|
-
videoFiles: videoFiles,
|
185
|
-
textTrackFiles: textTrackFiles
|
186
|
-
};
|
187
|
-
},
|
188
|
-
imageFilesFixture: function imageFilesFixture(options) {
|
189
|
-
var fileTypes = this.fileTypes(function () {
|
190
|
-
this.withImageFileType(options.fileTypeOptions);
|
191
|
-
});
|
192
|
-
var fileAttributes = {
|
193
|
-
image_files: [_.extend({
|
194
|
-
id: 1,
|
195
|
-
state: 'processed'
|
196
|
-
}, options.imageFileAttributes)]
|
197
|
-
};
|
198
|
-
var entry = factories.entry({}, {
|
199
|
-
files: FilesCollection.createForFileTypes(fileTypes, fileAttributes || {}),
|
200
|
-
fileTypes: fileTypes
|
201
|
-
});
|
202
|
-
var imageFiles = entry.getFileCollection(fileTypes.findByCollectionName('image_files'));
|
203
|
-
return {
|
204
|
-
entry: entry,
|
205
|
-
imageFile: imageFiles.first(),
|
206
|
-
imageFiles: imageFiles
|
207
|
-
};
|
208
|
-
},
|
209
|
-
imageFile: function imageFile(attributes, options) {
|
210
|
-
return new ImageFile(attributes, _.extend({
|
211
|
-
fileType: this.imageFileType()
|
212
|
-
}, options));
|
213
|
-
},
|
214
|
-
file: function file(attributes, options) {
|
215
|
-
return this.imageFile(attributes, options);
|
216
|
-
},
|
217
|
-
widgetTypes: function widgetTypes(attributesList, beforeSetup) {
|
218
|
-
var widgetTypes = new WidgetTypes();
|
219
|
-
var attributesListsByRole = {};
|
220
|
-
|
221
|
-
_(attributesList).each(function (attributes) {
|
222
|
-
attributesListsByRole[attributes.role] = attributesListsByRole[attributes.role] || [];
|
223
|
-
attributesListsByRole[attributes.role].push(_.extend({
|
224
|
-
translationKey: 'widget_name.' + attributes.name
|
225
|
-
}, attributes));
|
226
|
-
});
|
227
|
-
|
228
|
-
if (beforeSetup) {
|
229
|
-
beforeSetup(widgetTypes);
|
230
|
-
}
|
231
|
-
|
232
|
-
widgetTypes.setup(attributesListsByRole);
|
233
|
-
return widgetTypes;
|
234
|
-
},
|
235
|
-
editorApi: function editorApi(beforeSetup) {
|
236
|
-
var api = new EditorApi();
|
237
|
-
|
238
|
-
if (beforeSetup) {
|
239
|
-
beforeSetup(api);
|
240
|
-
}
|
241
|
-
|
242
|
-
api.pageTypes.setup(_.map(api.pageTypes.clientSideConfigs, function (config, name) {
|
243
|
-
return {
|
244
|
-
name: name,
|
245
|
-
translation_key_prefix: 'pageflow.' + name,
|
246
|
-
translation_key: 'pageflow.' + name + '.name',
|
247
|
-
category_translation_key: 'pageflow.' + name + '.category',
|
248
|
-
description_translation_key: 'pageflow.' + name + '.description'
|
249
|
-
};
|
250
|
-
}));
|
251
|
-
return api;
|
252
|
-
}
|
253
|
-
};
|
254
|
-
|
255
|
-
function ensureFileTypes(options) {
|
256
|
-
if (!options.fileTypes) {
|
257
|
-
options.fileTypes = new FileTypes();
|
258
|
-
options.fileTypes.setup([]);
|
259
|
-
}
|
260
|
-
}
|
261
|
-
|
262
|
-
function ensureFilesCollections(options) {
|
263
|
-
if (!options.files) {
|
264
|
-
options.files = FilesCollection.createForFileTypes(options.fileTypes, options.filesAttributes);
|
265
|
-
}
|
266
|
-
}
|
267
|
-
|
268
|
-
export { factories };
|