@girder/core 3.2.7 → 5.0.0-a6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/package.json +79 -31
- package/assets/Girder_Mark.png +0 -0
- package/auth.js +0 -152
- package/collections/ApiKeyCollection.js +0 -9
- package/collections/AssetstoreCollection.js +0 -9
- package/collections/Collection.js +0 -295
- package/collections/CollectionCollection.js +0 -9
- package/collections/FileCollection.js +0 -11
- package/collections/FolderCollection.js +0 -11
- package/collections/GroupCollection.js +0 -9
- package/collections/ItemCollection.js +0 -11
- package/collections/UserCollection.js +0 -24
- package/collections/index.js +0 -21
- package/constants.js +0 -33
- package/dialog.js +0 -128
- package/events.js +0 -6
- package/index.js +0 -31
- package/main.js +0 -21
- package/misc.js +0 -260
- package/models/AccessControlledModel.js +0 -76
- package/models/ApiKeyModel.js +0 -31
- package/models/AssetstoreModel.js +0 -43
- package/models/CollectionCreationPolicyModel.js +0 -20
- package/models/CollectionModel.js +0 -12
- package/models/FileModel.js +0 -310
- package/models/FolderModel.js +0 -33
- package/models/GroupModel.js +0 -197
- package/models/ItemModel.js +0 -72
- package/models/MetadataMixin.js +0 -88
- package/models/Model.js +0 -187
- package/models/UserModel.js +0 -189
- package/models/index.js +0 -25
- package/pluginUtils.js +0 -11
- package/rest.js +0 -216
- package/router.js +0 -58
- package/routes.js +0 -231
- package/stylesheets/apidocs/apidocs.styl +0 -50
- package/stylesheets/body/adminConsole.styl +0 -21
- package/stylesheets/body/assetstores.styl +0 -46
- package/stylesheets/body/collectionList.styl +0 -39
- package/stylesheets/body/collectionPage.styl +0 -6
- package/stylesheets/body/frontPage.styl +0 -48
- package/stylesheets/body/groupList.styl +0 -43
- package/stylesheets/body/groupPage.styl +0 -116
- package/stylesheets/body/itemPage.styl +0 -81
- package/stylesheets/body/plugins.styl +0 -61
- package/stylesheets/body/searchResultsList.styl +0 -51
- package/stylesheets/body/systemConfig.styl +0 -56
- package/stylesheets/body/userAccount.styl +0 -57
- package/stylesheets/body/userList.styl +0 -79
- package/stylesheets/body/userPage.styl +0 -6
- package/stylesheets/layout/footer.styl +0 -19
- package/stylesheets/layout/global.styl +0 -154
- package/stylesheets/layout/globalNav.styl +0 -89
- package/stylesheets/layout/header.styl +0 -29
- package/stylesheets/layout/headerUser.styl +0 -33
- package/stylesheets/layout/layout.styl +0 -75
- package/stylesheets/layout/layoutVars.styl +0 -9
- package/stylesheets/layout/loading.styl +0 -37
- package/stylesheets/layout/progressArea.styl +0 -17
- package/stylesheets/widgets/accessWidget.styl +0 -106
- package/stylesheets/widgets/browserWidget.styl +0 -9
- package/stylesheets/widgets/hierarchyWidget.styl +0 -188
- package/stylesheets/widgets/markdownWidget.styl +0 -92
- package/stylesheets/widgets/metadataWidget.styl +0 -92
- package/stylesheets/widgets/searchFieldWidget.styl +0 -70
- package/stylesheets/widgets/taskProgress.styl +0 -41
- package/stylesheets/widgets/timelineWidget.styl +0 -41
- package/stylesheets/widgets/uploadWidget.styl +0 -43
- package/stylesheets/widgets/userOtpManagementWidget.styl +0 -159
- package/templates/body/adminConsole.pug +0 -13
- package/templates/body/assetstores.pug +0 -98
- package/templates/body/collectionList.pug +0 -40
- package/templates/body/collectionPage.pug +0 -36
- package/templates/body/filesystemImport.pug +0 -41
- package/templates/body/frontPage.pug +0 -83
- package/templates/body/groupList.pug +0 -30
- package/templates/body/groupPage.pug +0 -116
- package/templates/body/itemPage.pug +0 -61
- package/templates/body/plugins.pug +0 -20
- package/templates/body/s3Import.pug +0 -35
- package/templates/body/searchResults.pug +0 -15
- package/templates/body/searchResultsType.pug +0 -13
- package/templates/body/systemConfiguration.pug +0 -221
- package/templates/body/userAccount.pug +0 -83
- package/templates/body/userList.pug +0 -43
- package/templates/body/userPage.pug +0 -40
- package/templates/layout/alert.pug +0 -5
- package/templates/layout/layout.pug +0 -12
- package/templates/layout/layoutFooter.pug +0 -11
- package/templates/layout/layoutGlobalNav.pug +0 -7
- package/templates/layout/layoutHeader.pug +0 -8
- package/templates/layout/layoutHeaderUser.pug +0 -26
- package/templates/layout/layoutProgressArea.pug +0 -1
- package/templates/layout/loginDialog.pug +0 -30
- package/templates/layout/registerDialog.pug +0 -35
- package/templates/layout/resetPasswordDialog.pug +0 -25
- package/templates/widgets/accessEditor.pug +0 -23
- package/templates/widgets/accessEditorMixins.pug +0 -57
- package/templates/widgets/accessEditorNonModal.pug +0 -11
- package/templates/widgets/accessEntry.pug +0 -32
- package/templates/widgets/apiKeyList.pug +0 -50
- package/templates/widgets/browserWidget.pug +0 -32
- package/templates/widgets/checkedActionsMenu.pug +0 -46
- package/templates/widgets/collectionInfoDialog.pug +0 -37
- package/templates/widgets/confirmDialog.pug +0 -14
- package/templates/widgets/dateTimeRangeWidget.pug +0 -20
- package/templates/widgets/dateTimeWidget.pug +0 -8
- package/templates/widgets/editApiKeyWidget.pug +0 -43
- package/templates/widgets/editAssetstoreWidget.pug +0 -78
- package/templates/widgets/editCollectionWidget.pug +0 -27
- package/templates/widgets/editFileWidget.pug +0 -21
- package/templates/widgets/editFolderWidget.pug +0 -27
- package/templates/widgets/editGroupWidget.pug +0 -54
- package/templates/widgets/editItemWidget.pug +0 -27
- package/templates/widgets/fileInfoDialog.pug +0 -33
- package/templates/widgets/fileList.pug +0 -33
- package/templates/widgets/folderInfoDialog.pug +0 -42
- package/templates/widgets/folderList.pug +0 -21
- package/templates/widgets/groupAdminList.pug +0 -33
- package/templates/widgets/groupInviteDialog.pug +0 -76
- package/templates/widgets/groupInviteList.pug +0 -14
- package/templates/widgets/groupMemberList.pug +0 -39
- package/templates/widgets/groupModList.pug +0 -23
- package/templates/widgets/hierarchyBreadcrumb.pug +0 -37
- package/templates/widgets/hierarchyPaginated.pug +0 -19
- package/templates/widgets/hierarchyWidget.pug +0 -96
- package/templates/widgets/itemBreadcrumb.pug +0 -16
- package/templates/widgets/itemList.pug +0 -27
- package/templates/widgets/jsonMetadatumEditWidget.pug +0 -13
- package/templates/widgets/jsonMetadatumView.pug +0 -6
- package/templates/widgets/loadingAnimation.pug +0 -4
- package/templates/widgets/markdownWidget.pug +0 -34
- package/templates/widgets/metadataWidget.pug +0 -16
- package/templates/widgets/metadatumEditWidget.pug +0 -15
- package/templates/widgets/metadatumView.pug +0 -5
- package/templates/widgets/newAssetstore.pug +0 -118
- package/templates/widgets/paginateWidget.pug +0 -7
- package/templates/widgets/pluginConfigBreadcrumb.pug +0 -13
- package/templates/widgets/rootSelectorWidget.pug +0 -13
- package/templates/widgets/searchField.pug +0 -10
- package/templates/widgets/searchHelp.pug +0 -12
- package/templates/widgets/searchModeSelect.pug +0 -9
- package/templates/widgets/searchResults.pug +0 -14
- package/templates/widgets/sortCollectionWidget.pug +0 -14
- package/templates/widgets/taskProgress.pug +0 -16
- package/templates/widgets/timeline.pug +0 -15
- package/templates/widgets/uploadWidget.pug +0 -15
- package/templates/widgets/uploadWidgetMixins.pug +0 -31
- package/templates/widgets/uploadWidgetNonModal.pug +0 -10
- package/templates/widgets/userOtpBegin.pug +0 -4
- package/templates/widgets/userOtpDisable.pug +0 -6
- package/templates/widgets/userOtpEnable.pug +0 -44
- package/utilities/EventStream.js +0 -177
- package/utilities/PluginUtils.js +0 -36
- package/utilities/S3UploadHandler.js +0 -303
- package/utilities/index.js +0 -9
- package/utilities/jquery/girderEnable.js +0 -19
- package/utilities/jquery/girderModal.js +0 -48
- package/version.js +0 -10
- package/views/App.js +0 -359
- package/views/View.js +0 -78
- package/views/body/AdminView.js +0 -29
- package/views/body/AssetstoresView.js +0 -235
- package/views/body/CollectionView.js +0 -188
- package/views/body/CollectionsView.js +0 -120
- package/views/body/FilesystemImportView.js +0 -83
- package/views/body/FolderView.js +0 -54
- package/views/body/FrontPageView.js +0 -47
- package/views/body/GroupView.js +0 -336
- package/views/body/GroupsView.js +0 -106
- package/views/body/ItemView.js +0 -177
- package/views/body/PluginsView.js +0 -73
- package/views/body/S3ImportView.js +0 -80
- package/views/body/SearchResultsView.js +0 -162
- package/views/body/SystemConfigurationView.js +0 -196
- package/views/body/UserAccountView.js +0 -179
- package/views/body/UserView.js +0 -165
- package/views/body/UsersView.js +0 -124
- package/views/body/index.js +0 -37
- package/views/index.js +0 -13
- package/views/layout/FooterView.js +0 -29
- package/views/layout/GlobalNavView.js +0 -103
- package/views/layout/HeaderUserView.js +0 -45
- package/views/layout/HeaderView.js +0 -83
- package/views/layout/LoginView.js +0 -100
- package/views/layout/ProgressListView.js +0 -70
- package/views/layout/RegisterView.js +0 -101
- package/views/layout/ResetPasswordView.js +0 -70
- package/views/layout/index.js +0 -19
- package/views/widgets/AccessWidget.js +0 -427
- package/views/widgets/ApiKeyListWidget.js +0 -140
- package/views/widgets/BrowserWidget.js +0 -317
- package/views/widgets/CheckedMenuWidget.js +0 -68
- package/views/widgets/CollectionInfoWidget.js +0 -40
- package/views/widgets/DateTimeRangeWidget.js +0 -179
- package/views/widgets/DateTimeWidget.js +0 -109
- package/views/widgets/EditApiKeyWidget.js +0 -122
- package/views/widgets/EditAssetstoreWidget.js +0 -148
- package/views/widgets/EditCollectionWidget.js +0 -93
- package/views/widgets/EditFileWidget.js +0 -56
- package/views/widgets/EditFolderWidget.js +0 -116
- package/views/widgets/EditGroupWidget.js +0 -125
- package/views/widgets/EditItemWidget.js +0 -110
- package/views/widgets/FileInfoWidget.js +0 -26
- package/views/widgets/FileListWidget.js +0 -151
- package/views/widgets/FolderInfoWidget.js +0 -39
- package/views/widgets/FolderListWidget.js +0 -106
- package/views/widgets/GroupAdminsWidget.js +0 -88
- package/views/widgets/GroupInvitesWidget.js +0 -56
- package/views/widgets/GroupMembersWidget.js +0 -185
- package/views/widgets/GroupModsWidget.js +0 -77
- package/views/widgets/HierarchyWidget.js +0 -1097
- package/views/widgets/ItemBreadcrumbWidget.js +0 -38
- package/views/widgets/ItemListWidget.js +0 -345
- package/views/widgets/LoadingAnimation.js +0 -17
- package/views/widgets/MarkdownWidget.js +0 -217
- package/views/widgets/MetadataWidget.js +0 -504
- package/views/widgets/NewAssetstoreWidget.js +0 -81
- package/views/widgets/PaginateWidget.js +0 -37
- package/views/widgets/PluginConfigBreadcrumbWidget.js +0 -33
- package/views/widgets/RootSelectorWidget.js +0 -192
- package/views/widgets/SearchFieldWidget.js +0 -365
- package/views/widgets/SearchPaginateWidget.js +0 -149
- package/views/widgets/SortCollectionWidget.js +0 -53
- package/views/widgets/TaskProgressWidget.js +0 -91
- package/views/widgets/TimelineWidget.js +0 -155
- package/views/widgets/UploadWidget.js +0 -340
- package/views/widgets/UserOtpManagementWidget.js +0 -105
- package/views/widgets/index.js +0 -75
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
|
|
3
|
-
import GroupModel from '@girder/core/models/GroupModel';
|
|
4
|
-
import View from '@girder/core/views/View';
|
|
5
|
-
import { getCurrentUser } from '@girder/core/auth';
|
|
6
|
-
import { handleClose, handleOpen } from '@girder/core/dialog';
|
|
7
|
-
|
|
8
|
-
import EditGroupWidgetTemplate from '@girder/core/templates/widgets/editGroupWidget.pug';
|
|
9
|
-
|
|
10
|
-
import '@girder/core/utilities/jquery/girderModal';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* This widget is used to create a new group or edit an existing one.
|
|
14
|
-
*/
|
|
15
|
-
var EditGroupWidget = View.extend({
|
|
16
|
-
events: {
|
|
17
|
-
'submit #g-group-edit-form': function (e) {
|
|
18
|
-
e.preventDefault();
|
|
19
|
-
|
|
20
|
-
var fields = {
|
|
21
|
-
name: this.$('#g-name').val(),
|
|
22
|
-
description: this.$('#g-description').val(),
|
|
23
|
-
public: this.$('#g-access-public').is(':checked')
|
|
24
|
-
};
|
|
25
|
-
if (this.$('#g-add-to-group').length) {
|
|
26
|
-
fields.addAllowed = this.$('#g-add-to-group').val();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (this.model) {
|
|
30
|
-
this.updateGroup(fields);
|
|
31
|
-
} else {
|
|
32
|
-
this.createGroup(fields);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this.$('button.g-save-group').girderEnable(false);
|
|
36
|
-
this.$('.g-validation-failed-message').text('');
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
'change .g-public-container .radio input': 'privacyChanged'
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
initialize: function (settings) {
|
|
43
|
-
this.model = settings.model || null;
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
render: function () {
|
|
47
|
-
var pub = this.model ? this.model.get('public') : false;
|
|
48
|
-
var groupAddAllowed;
|
|
49
|
-
var addToGroupPolicy = this.model ? this.model.get('_addToGroupPolicy') : null;
|
|
50
|
-
if (getCurrentUser().get('admin')) {
|
|
51
|
-
if (addToGroupPolicy === 'nomod' || addToGroupPolicy === 'yesmod') {
|
|
52
|
-
groupAddAllowed = 'mod';
|
|
53
|
-
} else if (addToGroupPolicy === 'noadmin' || addToGroupPolicy === 'yesadmin') {
|
|
54
|
-
groupAddAllowed = 'admin';
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var modal = this.$el.html(EditGroupWidgetTemplate({
|
|
58
|
-
group: this.model,
|
|
59
|
-
publicFlag: pub,
|
|
60
|
-
addToGroupPolicy: addToGroupPolicy,
|
|
61
|
-
groupAddAllowed: groupAddAllowed,
|
|
62
|
-
addAllowed: this.model ? this.model.get('addAllowed') : false
|
|
63
|
-
})).girderModal(this).on('shown.bs.modal', () => {
|
|
64
|
-
this.$('#g-name').trigger('focus');
|
|
65
|
-
if (this.model) {
|
|
66
|
-
handleOpen('edit');
|
|
67
|
-
} else {
|
|
68
|
-
handleOpen('create');
|
|
69
|
-
}
|
|
70
|
-
}).on('hidden.bs.modal', () => {
|
|
71
|
-
if (this.create) {
|
|
72
|
-
handleClose('create');
|
|
73
|
-
} else {
|
|
74
|
-
handleClose('edit');
|
|
75
|
-
}
|
|
76
|
-
}).on('ready.girder.modal', () => {
|
|
77
|
-
if (this.model) {
|
|
78
|
-
this.$('#g-name').val(this.model.get('name'));
|
|
79
|
-
this.$('#g-description').val(this.model.get('description'));
|
|
80
|
-
this.create = false;
|
|
81
|
-
} else {
|
|
82
|
-
this.create = true;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
modal.trigger($.Event('ready.girder.modal', { relatedTarget: modal }));
|
|
86
|
-
this.$('#g-name').trigger('focus');
|
|
87
|
-
|
|
88
|
-
this.privacyChanged();
|
|
89
|
-
|
|
90
|
-
return this;
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
createGroup: function (fields) {
|
|
94
|
-
var group = new GroupModel();
|
|
95
|
-
group.set(fields);
|
|
96
|
-
group.on('g:saved', function () {
|
|
97
|
-
this.$el.modal('hide');
|
|
98
|
-
this.trigger('g:saved', group);
|
|
99
|
-
}, this).on('g:error', function (err) {
|
|
100
|
-
this.$('.g-validation-failed-message').text(err.responseJSON.message);
|
|
101
|
-
this.$('button.g-save-group').girderEnable(true);
|
|
102
|
-
this.$('#g-' + err.responseJSON.field).trigger('focus');
|
|
103
|
-
}, this).save();
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
updateGroup: function (fields) {
|
|
107
|
-
this.model.set(fields);
|
|
108
|
-
this.model.off().on('g:saved', function () {
|
|
109
|
-
this.$el.modal('hide');
|
|
110
|
-
this.trigger('g:saved', this.model);
|
|
111
|
-
}, this).on('g:error', function (err) {
|
|
112
|
-
this.$('.g-validation-failed-message').text(err.responseJSON.message);
|
|
113
|
-
this.$('button.g-save-group').girderEnable(true);
|
|
114
|
-
this.$('#g-' + err.responseJSON.field).trigger('focus');
|
|
115
|
-
}, this).save();
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
privacyChanged: function () {
|
|
119
|
-
this.$('.g-public-container .radio').removeClass('g-selected');
|
|
120
|
-
var selected = this.$('.g-public-container .radio input:checked');
|
|
121
|
-
selected.parents('.radio').addClass('g-selected');
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
export default EditGroupWidget;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
import _ from 'underscore';
|
|
3
|
-
|
|
4
|
-
import ItemModel from '@girder/core/models/ItemModel';
|
|
5
|
-
import MarkdownWidget from '@girder/core/views/widgets/MarkdownWidget';
|
|
6
|
-
import View from '@girder/core/views/View';
|
|
7
|
-
import { handleClose, handleOpen } from '@girder/core/dialog';
|
|
8
|
-
|
|
9
|
-
import EditItemWidgetTemplate from '@girder/core/templates/widgets/editItemWidget.pug';
|
|
10
|
-
|
|
11
|
-
import '@girder/core/utilities/jquery/girderEnable';
|
|
12
|
-
import '@girder/core/utilities/jquery/girderModal';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This widget is used to create a new item or edit an existing one.
|
|
16
|
-
*/
|
|
17
|
-
var EditItemWidget = View.extend({
|
|
18
|
-
events: {
|
|
19
|
-
'submit #g-item-edit-form': function () {
|
|
20
|
-
var fields = {
|
|
21
|
-
name: this.$('#g-name').val(),
|
|
22
|
-
description: this.descriptionEditor.val()
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
if (this.item) {
|
|
26
|
-
this.updateItem(fields);
|
|
27
|
-
} else {
|
|
28
|
-
this.createItem(fields);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.descriptionEditor.saveText();
|
|
32
|
-
this.$('button.g-save-item').girderEnable(false);
|
|
33
|
-
this.$('.g-validation-failed-message').empty();
|
|
34
|
-
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
initialize: function (settings) {
|
|
40
|
-
this.item = settings.item || null;
|
|
41
|
-
this.parentModel = settings.parentModel;
|
|
42
|
-
this.descriptionEditor = new MarkdownWidget({
|
|
43
|
-
text: this.item ? this.item.get('description') : '',
|
|
44
|
-
prefix: 'item-description',
|
|
45
|
-
placeholder: 'Enter a description',
|
|
46
|
-
enableUploads: false,
|
|
47
|
-
parentView: this
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
render: function () {
|
|
52
|
-
var modal = this.$el.html(EditItemWidgetTemplate({
|
|
53
|
-
item: this.item
|
|
54
|
-
})).girderModal(this).on('shown.bs.modal', () => {
|
|
55
|
-
this.$('#g-name').trigger('focus');
|
|
56
|
-
if (this.item) {
|
|
57
|
-
handleOpen('itemedit');
|
|
58
|
-
} else {
|
|
59
|
-
handleOpen('itemcreate');
|
|
60
|
-
}
|
|
61
|
-
}).on('hidden.bs.modal', () => {
|
|
62
|
-
if (this.create) {
|
|
63
|
-
handleClose('itemcreate');
|
|
64
|
-
} else {
|
|
65
|
-
handleClose('itemedit');
|
|
66
|
-
}
|
|
67
|
-
}).on('ready.girder.modal', () => {
|
|
68
|
-
if (this.item) {
|
|
69
|
-
this.$('#g-name').val(this.item.get('name'));
|
|
70
|
-
this.$('#g-description').val(this.item.get('description'));
|
|
71
|
-
this.create = false;
|
|
72
|
-
} else {
|
|
73
|
-
this.create = true;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
modal.trigger($.Event('ready.girder.modal', { relatedTarget: modal }));
|
|
77
|
-
this.descriptionEditor.setElement(this.$('.g-description-editor-container')).render();
|
|
78
|
-
|
|
79
|
-
return this;
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
createItem: function (fields) {
|
|
83
|
-
var item = new ItemModel();
|
|
84
|
-
item.set(_.extend(fields, {
|
|
85
|
-
folderId: this.parentModel.get('_id')
|
|
86
|
-
}));
|
|
87
|
-
item.on('g:saved', function () {
|
|
88
|
-
this.$el.modal('hide');
|
|
89
|
-
this.trigger('g:saved', item);
|
|
90
|
-
}, this).on('g:error', function (err) {
|
|
91
|
-
this.$('.g-validation-failed-message').text(err.responseJSON.message);
|
|
92
|
-
this.$('button.g-save-item').girderEnable(true);
|
|
93
|
-
this.$('#g-' + err.responseJSON.field).trigger('focus');
|
|
94
|
-
}, this).save();
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
updateItem: function (fields) {
|
|
98
|
-
this.item.set(fields);
|
|
99
|
-
this.item.off().on('g:saved', function () {
|
|
100
|
-
this.$el.modal('hide');
|
|
101
|
-
this.trigger('g:saved', this.item);
|
|
102
|
-
}, this).on('g:error', function (err) {
|
|
103
|
-
this.$('.g-validation-failed-message').text(err.responseJSON.message);
|
|
104
|
-
this.$('button.g-save-item').girderEnable(true);
|
|
105
|
-
this.$('#g-' + err.responseJSON.field).trigger('focus');
|
|
106
|
-
}, this).save();
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
export default EditItemWidget;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import View from '@girder/core/views/View';
|
|
2
|
-
import { formatDate, DATE_SECOND } from '@girder/core/misc';
|
|
3
|
-
|
|
4
|
-
import FileInfoDialogTemplate from '@girder/core/templates/widgets/fileInfoDialog.pug';
|
|
5
|
-
|
|
6
|
-
import '@girder/core/utilities/jquery/girderModal';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This widget shows information about a single file in a modal dialog.
|
|
10
|
-
*/
|
|
11
|
-
var FileInfoWidget = View.extend({
|
|
12
|
-
initialize: function (settings) {
|
|
13
|
-
this.parentItem = settings.parentItem;
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
render: function () {
|
|
17
|
-
this.$el.html(FileInfoDialogTemplate({
|
|
18
|
-
file: this.model,
|
|
19
|
-
formatDate: formatDate,
|
|
20
|
-
DATE_SECOND: DATE_SECOND
|
|
21
|
-
})).girderModal(this);
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export default FileInfoWidget;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
|
|
3
|
-
import EditFileWidget from '@girder/core/views/widgets/EditFileWidget';
|
|
4
|
-
import FileCollection from '@girder/core/collections/FileCollection';
|
|
5
|
-
import FileInfoWidget from '@girder/core/views/widgets/FileInfoWidget';
|
|
6
|
-
import UploadWidget from '@girder/core/views/widgets/UploadWidget';
|
|
7
|
-
import View from '@girder/core/views/View';
|
|
8
|
-
import { AccessType } from '@girder/core/constants';
|
|
9
|
-
import { confirm } from '@girder/core/dialog';
|
|
10
|
-
import { formatSize } from '@girder/core/misc';
|
|
11
|
-
import events from '@girder/core/events';
|
|
12
|
-
|
|
13
|
-
import FileListTemplate from '@girder/core/templates/widgets/fileList.pug';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This widget shows a list of files in a given item.
|
|
17
|
-
*/
|
|
18
|
-
var FileListWidget = View.extend({
|
|
19
|
-
events: {
|
|
20
|
-
'click a.g-show-more-files': function () {
|
|
21
|
-
this.collection.fetchNextPage();
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
'click a.g-show-info': function (e) {
|
|
25
|
-
var cid = $(e.currentTarget).attr('file-cid');
|
|
26
|
-
new FileInfoWidget({
|
|
27
|
-
el: $('#g-dialog-container'),
|
|
28
|
-
model: this.collection.get(cid),
|
|
29
|
-
parentItem: this.parentItem,
|
|
30
|
-
parentView: this
|
|
31
|
-
}).render();
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
'click a.g-update-contents': function (e) {
|
|
35
|
-
var cid = $(e.currentTarget).parent().attr('file-cid');
|
|
36
|
-
this.uploadDialog(cid);
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
'click a.g-update-info': function (e) {
|
|
40
|
-
var cid = $(e.currentTarget).parent().attr('file-cid');
|
|
41
|
-
this.editFileDialog(cid);
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
'click a.g-delete-file': function (e) {
|
|
45
|
-
var cid = $(e.currentTarget).parent().attr('file-cid');
|
|
46
|
-
var file = this.collection.get(cid);
|
|
47
|
-
|
|
48
|
-
confirm({
|
|
49
|
-
text: 'Are you sure you want to delete the file <b>' +
|
|
50
|
-
file.escape('name') + '</b>?',
|
|
51
|
-
yesText: 'Delete',
|
|
52
|
-
escapedHtml: true,
|
|
53
|
-
confirmCallback: () => {
|
|
54
|
-
file.once('g:deleted', function () {
|
|
55
|
-
events.trigger('g:alert', {
|
|
56
|
-
icon: 'ok',
|
|
57
|
-
type: 'success',
|
|
58
|
-
text: 'File deleted.',
|
|
59
|
-
timeout: 4000
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
this.render();
|
|
63
|
-
}, this).once('g:error', function () {
|
|
64
|
-
events.trigger('g:alert', {
|
|
65
|
-
icon: 'cancel',
|
|
66
|
-
text: 'Failed to delete file.',
|
|
67
|
-
type: 'danger',
|
|
68
|
-
timeout: 4000
|
|
69
|
-
});
|
|
70
|
-
}).destroy();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
initialize: function (settings) {
|
|
77
|
-
this.upload = settings.upload;
|
|
78
|
-
this.fileEdit = settings.fileEdit;
|
|
79
|
-
this.checked = [];
|
|
80
|
-
this.collection = new FileCollection();
|
|
81
|
-
this.collection.altUrl = 'item/' +
|
|
82
|
-
(settings.itemId || settings.item.get('_id')) + '/files';
|
|
83
|
-
this.collection.append = true; // Append, don't replace pages
|
|
84
|
-
this.collection.on('g:changed', function () {
|
|
85
|
-
this.render();
|
|
86
|
-
this.trigger('g:changed');
|
|
87
|
-
}, this).fetch();
|
|
88
|
-
|
|
89
|
-
this.parentItem = settings.item;
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
editFileDialog: function (cid) {
|
|
93
|
-
this.editFileWidget = new EditFileWidget({
|
|
94
|
-
el: $('#g-dialog-container'),
|
|
95
|
-
file: this.collection.get(cid),
|
|
96
|
-
parentView: this
|
|
97
|
-
}).off('g:saved', null, this).on('g:saved', function () {
|
|
98
|
-
this.render();
|
|
99
|
-
}, this);
|
|
100
|
-
this.editFileWidget.render();
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
uploadDialog: function (cid) {
|
|
104
|
-
new UploadWidget({
|
|
105
|
-
el: $('#g-dialog-container'),
|
|
106
|
-
title: 'Replace file contents',
|
|
107
|
-
parent: this.collection.get(cid),
|
|
108
|
-
parentType: 'file',
|
|
109
|
-
parentView: this
|
|
110
|
-
}).on('g:uploadFinished', function () {
|
|
111
|
-
events.trigger('g:alert', {
|
|
112
|
-
icon: 'ok',
|
|
113
|
-
text: 'File contents updated.',
|
|
114
|
-
type: 'success',
|
|
115
|
-
timeout: 4000
|
|
116
|
-
});
|
|
117
|
-
}, this).render();
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
render: function () {
|
|
121
|
-
this.checked = [];
|
|
122
|
-
this.$el.html(FileListTemplate({
|
|
123
|
-
files: this.collection.toArray(),
|
|
124
|
-
hasMore: this.collection.hasNextPage(),
|
|
125
|
-
AccessType: AccessType,
|
|
126
|
-
formatSize: formatSize,
|
|
127
|
-
parentItem: this.parentItem
|
|
128
|
-
}));
|
|
129
|
-
|
|
130
|
-
if (this.fileEdit) {
|
|
131
|
-
this.editFileDialog(this.fileEdit);
|
|
132
|
-
this.fileEdit = false;
|
|
133
|
-
} else if (this.upload) {
|
|
134
|
-
this.uploadDialog(this.upload);
|
|
135
|
-
this.upload = false;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return this;
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Insert a file into the collection and re-render it.
|
|
143
|
-
*/
|
|
144
|
-
insertFile: function (file) {
|
|
145
|
-
this.collection.add(file);
|
|
146
|
-
this.render();
|
|
147
|
-
this.trigger('g:changed');
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export default FileListWidget;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import View from '@girder/core/views/View';
|
|
2
|
-
import { formatDate, formatSize, DATE_SECOND, renderMarkdown } from '@girder/core/misc';
|
|
3
|
-
|
|
4
|
-
import FolderInfoDialogTemplate from '@girder/core/templates/widgets/folderInfoDialog.pug';
|
|
5
|
-
|
|
6
|
-
import '@girder/core/utilities/jquery/girderModal';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This view shows a dialog container detailed folder information.
|
|
10
|
-
*/
|
|
11
|
-
var FolderInfoWidget = View.extend({
|
|
12
|
-
initialize: function () {
|
|
13
|
-
this.needToFetch = !this.model.has('nItems') || !this.model.has('nFolders');
|
|
14
|
-
if (this.needToFetch) {
|
|
15
|
-
this.model.once('g:fetched.details', function () {
|
|
16
|
-
this.needToFetch = false;
|
|
17
|
-
this.render();
|
|
18
|
-
}, this).fetch({ extraPath: 'details' });
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
render: function () {
|
|
23
|
-
if (this.needToFetch) {
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.$el.html(FolderInfoDialogTemplate({
|
|
28
|
-
folder: this.model,
|
|
29
|
-
formatDate: formatDate,
|
|
30
|
-
formatSize: formatSize,
|
|
31
|
-
renderMarkdown: renderMarkdown,
|
|
32
|
-
DATE_SECOND: DATE_SECOND
|
|
33
|
-
})).girderModal(this);
|
|
34
|
-
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export default FolderInfoWidget;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
import _ from 'underscore';
|
|
3
|
-
|
|
4
|
-
import FolderCollection from '@girder/core/collections/FolderCollection';
|
|
5
|
-
import LoadingAnimation from '@girder/core/views/widgets/LoadingAnimation';
|
|
6
|
-
import View from '@girder/core/views/View';
|
|
7
|
-
|
|
8
|
-
import FolderListTemplate from '@girder/core/templates/widgets/folderList.pug';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This widget shows a list of folders under a given parent.
|
|
12
|
-
* Initialize this with a "parentType" and "parentId" value, which will
|
|
13
|
-
* be passed to the folder GET endpoint.
|
|
14
|
-
*/
|
|
15
|
-
var FolderListWidget = View.extend({
|
|
16
|
-
events: {
|
|
17
|
-
'click a.g-folder-list-link': function (event) {
|
|
18
|
-
event.preventDefault();
|
|
19
|
-
var cid = $(event.currentTarget).attr('g-folder-cid');
|
|
20
|
-
this.trigger('g:folderClicked', this.collection.get(cid));
|
|
21
|
-
},
|
|
22
|
-
'click a.g-show-more-folders': function () {
|
|
23
|
-
this.collection.fetchNextPage();
|
|
24
|
-
},
|
|
25
|
-
'change .g-list-checkbox': function (event) {
|
|
26
|
-
const target = $(event.currentTarget);
|
|
27
|
-
const cid = target.attr('g-folder-cid');
|
|
28
|
-
if (target.prop('checked')) {
|
|
29
|
-
this.checked.push(cid);
|
|
30
|
-
} else {
|
|
31
|
-
const idx = this.checked.indexOf(cid);
|
|
32
|
-
if (idx !== -1) {
|
|
33
|
-
this.checked.splice(idx, 1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
this.trigger('g:checkboxesChanged');
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
initialize: function (settings) {
|
|
41
|
-
this.checked = [];
|
|
42
|
-
this._checkboxes = settings.checkboxes;
|
|
43
|
-
|
|
44
|
-
new LoadingAnimation({
|
|
45
|
-
el: this.$el,
|
|
46
|
-
parentView: this
|
|
47
|
-
}).render();
|
|
48
|
-
|
|
49
|
-
this.collection = new FolderCollection();
|
|
50
|
-
this.collection.append = true; // Append, don't replace pages
|
|
51
|
-
this.collection.filterFunc = settings.folderFilter;
|
|
52
|
-
|
|
53
|
-
this.collection.on('g:changed', function () {
|
|
54
|
-
this.render();
|
|
55
|
-
this.trigger('g:changed');
|
|
56
|
-
}, this).fetch({
|
|
57
|
-
parentType: settings.parentType || 'folder',
|
|
58
|
-
parentId: settings.parentId
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
render: function () {
|
|
63
|
-
this.checked = [];
|
|
64
|
-
this.$el.html(FolderListTemplate({
|
|
65
|
-
folders: this.collection.toArray(),
|
|
66
|
-
hasMore: this.collection.hasNextPage(),
|
|
67
|
-
checkboxes: this._checkboxes
|
|
68
|
-
}));
|
|
69
|
-
return this;
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Insert a folder into the collection and re-render it.
|
|
74
|
-
*/
|
|
75
|
-
insertFolder: function (folder) {
|
|
76
|
-
this.collection.add(folder);
|
|
77
|
-
this.trigger('g:changed');
|
|
78
|
-
this.render();
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Set all folder checkboxes to a certain checked state. The event
|
|
83
|
-
* g:checkboxesChanged is triggered once after checking/unchecking everything.
|
|
84
|
-
* @param {bool} checked The checked state.
|
|
85
|
-
*/
|
|
86
|
-
checkAll: function (checked) {
|
|
87
|
-
this.$('.g-list-checkbox').prop('checked', checked);
|
|
88
|
-
|
|
89
|
-
this.checked = [];
|
|
90
|
-
if (checked) {
|
|
91
|
-
this.collection.each(function (model) {
|
|
92
|
-
this.checked.push(model.cid);
|
|
93
|
-
}, this);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
this.trigger('g:checkboxesChanged');
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
recomputeChecked: function () {
|
|
100
|
-
this.checked = _.map(this.$('.g-list-checkbox:checked'), function (checkbox) {
|
|
101
|
-
return $(checkbox).attr('g-folder-cid');
|
|
102
|
-
}, this);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
export default FolderListWidget;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import $ from 'jquery';
|
|
2
|
-
import _ from 'underscore';
|
|
3
|
-
|
|
4
|
-
import UserModel from '@girder/core/models/UserModel';
|
|
5
|
-
import UserView from '@girder/core/views/body/UserView';
|
|
6
|
-
import View from '@girder/core/views/View';
|
|
7
|
-
import { AccessType } from '@girder/core/constants';
|
|
8
|
-
import { confirm } from '@girder/core/dialog';
|
|
9
|
-
import events from '@girder/core/events';
|
|
10
|
-
|
|
11
|
-
import GroupAdminListTemplate from '@girder/core/templates/widgets/groupAdminList.pug';
|
|
12
|
-
|
|
13
|
-
import 'bootstrap/js/dropdown';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This view shows a list of administrators of a group.
|
|
17
|
-
*/
|
|
18
|
-
var GroupAdminsWidget = View.extend({
|
|
19
|
-
events: {
|
|
20
|
-
'click .g-demote-moderator': function (e) {
|
|
21
|
-
var li = $(e.currentTarget).parents('.g-group-admins>li');
|
|
22
|
-
var userid = li.attr('userid');
|
|
23
|
-
|
|
24
|
-
confirm({
|
|
25
|
-
text: 'Are you sure you want to demote <b>' +
|
|
26
|
-
_.escape(li.attr('username')) + '</b> to a moderator?',
|
|
27
|
-
escapedHtml: true,
|
|
28
|
-
confirmCallback: () => {
|
|
29
|
-
var user = new UserModel({ _id: userid });
|
|
30
|
-
this.model.off('g:promoted').on('g:promoted', () => {
|
|
31
|
-
this.trigger('g:moderatorAdded');
|
|
32
|
-
}, this).promoteUser(user, AccessType.WRITE);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
'click .g-demote-member': function (e) {
|
|
38
|
-
var li = $(e.currentTarget).parents('.g-group-admins>li');
|
|
39
|
-
|
|
40
|
-
confirm({
|
|
41
|
-
text: 'Are you sure you want to remove admin privileges ' +
|
|
42
|
-
'from <b>' + _.escape(li.attr('username')) + '</b>?',
|
|
43
|
-
escapedHtml: true,
|
|
44
|
-
confirmCallback: () => {
|
|
45
|
-
this.trigger('g:demoteUser', li.attr('userid'));
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
'click a.g-group-admin-remove': function (e) {
|
|
51
|
-
var li = $(e.currentTarget).parents('li');
|
|
52
|
-
|
|
53
|
-
confirm({
|
|
54
|
-
text: 'Are you sure you want to remove <b> ' +
|
|
55
|
-
_.escape(li.attr('username')) +
|
|
56
|
-
'</b> from this group?',
|
|
57
|
-
escapedHtml: true,
|
|
58
|
-
confirmCallback: () => {
|
|
59
|
-
this.trigger('g:removeMember', li.attr('userid'));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
'click a.g-member-name': function (e) {
|
|
65
|
-
events.trigger('g:navigateTo', UserView, {
|
|
66
|
-
id: $(e.currentTarget).parents('li').attr('userid')
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
initialize: function (settings) {
|
|
72
|
-
this.model = settings.group;
|
|
73
|
-
this.admins = settings.admins;
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
render: function () {
|
|
77
|
-
this.$el.html(GroupAdminListTemplate({
|
|
78
|
-
group: this.model,
|
|
79
|
-
level: this.model.get('_accessLevel'),
|
|
80
|
-
admins: this.admins,
|
|
81
|
-
accessType: AccessType
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export default GroupAdminsWidget;
|