-
-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathstructure.js
More file actions
167 lines (149 loc) · 4.91 KB
/
Copy pathstructure.js
File metadata and controls
167 lines (149 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import Base from "@patternslib/patternslib/src/core/base";
import { ensureIntlSupport } from "../../core/intl-loader";
export default Base.extend({
name: "structure",
trigger: ".pat-structure",
parser: "mockup",
defaults: {
// for implementing history changes
// Example: {base: 'http://mysite.com', appended: '/folder_contents'}
urlStructure: null,
vocabularyUrl: null,
indexOptionsUrl: null, // for querystring widget
contextInfoUrl: null, // for add new dropdown and other info
setDefaultPageUrl: null,
menuOptions: null, // default action menu options per item.
backdropSelector: ".plone-modal", // Element upon which to apply backdrops used for popovers
activeColumnsCookie: "activeColumns",
attributes: [
"CreationDate",
"EffectiveDate",
"ExpirationDate",
"exclude_from_nav",
"getIcon",
"getMimeIcon",
"getObjSize",
"getURL",
"id",
"is_folderish",
"last_comment_date",
"ModificationDate",
"path",
"portal_type",
"review_state",
"Subject",
"Title",
"total_comments",
"UID",
],
activeColumns: ["ModificationDate", "EffectiveDate", "review_state"],
availableColumns: {
id: "ID",
ModificationDate: "Last modified",
EffectiveDate: "Published",
ExpirationDate: "Expiration",
CreationDate: "Created",
review_state: "Review state",
Subject: "Tags",
portal_type: "Type",
is_folderish: "Folder",
exclude_from_nav: "Excluded from navigation",
getObjSize: "Object Size",
last_comment_date: "Last comment date",
total_comments: "Total comments",
},
typeToViewAction: {
File: "/view",
Image: "/view",
Blob: "/view",
},
defaultPageTypes: ["Document", "Event", "News Item", "Collection"],
language: "en",
dateFormat: {
dateStyle: "medium",
timeStyle: "medium",
},
rearrange: {
properties: {
id: "ID",
sortable_title: "Title",
// icon: "plone-rearrange",
},
url: "/rearrange",
},
moveUrl: null,
buttons: [
{
tooltip: "Cut",
url: "/cut",
icon: "plone-cut",
},
{
tooltip: "Copy",
url: "/copy",
icon: "plone-copy",
},
{
tooltip: "Paste",
url: "/paste",
icon: "plone-paste",
},
{
tooltip: "Delete",
url: "/delete",
context: "danger",
icon: "plone-delete",
},
{
tooltip: "Workflow",
url: "/workflow",
icon: "plone-lock",
},
{
tooltip: "Tags",
url: "/tags",
icon: "tags",
},
{
tooltip: "Properties",
url: "/properties",
icon: "plone-edit",
},
{
tooltip: "Rename",
url: "/rename",
icon: "plone-rename",
},
],
datatables_options: {},
upload: {
uploadMultiple: true,
showTitle: true,
},
},
async init() {
import("./structure.scss");
(await import("bootstrap")).Dropdown;
// backbone paginator, loaded by app-view expects Backbone and
// Underscore to be in global namespace.
const _ = (await import("underscore")).default;
const Backbone = (await import("backbone")).default;
window._ = _;
window.Backbone = Backbone;
const AppView = (await import("./js/views/app")).default;
this.browsing = true; // so all queries will be correct with QueryHelper
this.options.collectionUrl = this.options.vocabularyUrl;
this.options.pattern = this;
this.options.language =
document.querySelector("html").getAttribute("lang") || "en";
await ensureIntlSupport(this.options.language);
// the ``attributes`` options key is not compatible with backbone,
// but queryHelper that will be constructed by the default
// ResultCollection will expect this to be passed into it.
this.options.queryHelperAttributes = this.options.attributes;
delete this.options.attributes;
const view = new AppView(this.options);
await view.render();
this.$el.append(view.$el);
},
});