diff --git a/gui/app/components/document/document-attachments.js b/gui/app/components/document/view-attachment.js
similarity index 72%
rename from gui/app/components/document/document-attachments.js
rename to gui/app/components/document/view-attachment.js
index be4e464f..68725615 100644
--- a/gui/app/components/document/document-attachments.js
+++ b/gui/app/components/document/view-attachment.js
@@ -13,14 +13,11 @@ import { computed } from '@ember/object';
import { notEmpty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
-import NotifierMixin from '../../mixins/notifier';
-import TooltipMixin from '../../mixins/tooltip';
import DropdownMixin from '../../mixins/dropdown';
-export default Component.extend(NotifierMixin, TooltipMixin, DropdownMixin, {
+export default Component.extend(DropdownMixin, {
documentService: service('document'),
appMeta: service(),
- dropdown: null,
hasAttachments: notEmpty('files'),
deleteAttachment: {
id: "",
@@ -29,7 +26,8 @@ export default Component.extend(NotifierMixin, TooltipMixin, DropdownMixin, {
canShow: computed('permissions', 'files', function() {
return this.get('files.length') > 0 || this.get('permissions.documentEdit');
}),
-
+ showDialog: false,
+
init() {
this._super(...arguments);
@@ -64,7 +62,6 @@ export default Component.extend(NotifierMixin, TooltipMixin, DropdownMixin, {
init: function () {
this.on("success", function (file /*, response*/ ) {
- self.showNotification(`Attached ${file.name}`);
});
this.on("queuecomplete", function () {
@@ -85,7 +82,6 @@ export default Component.extend(NotifierMixin, TooltipMixin, DropdownMixin, {
willDestroyElement() {
this._super(...arguments);
- this.destroyDropdown();
},
getAttachments() {
@@ -95,43 +91,17 @@ export default Component.extend(NotifierMixin, TooltipMixin, DropdownMixin, {
},
actions: {
- onConfirmDelete(id, name) {
- this.set('deleteAttachment', {
- id: id,
- name: name
- });
+ onShowDialog(id, name) {
+ this.set('deleteAttachment', { id: id, name: name });
- $(".delete-attachment-dialog").css("display", "block");
-
- this.closeDropdown();
-
- let dropOptions = Object.assign(this.get('dropDefaults'), {
- target: $(".delete-attachment-" + id)[0],
- content: $(".delete-attachment-dialog")[0],
- classes: 'drop-theme-basic',
- position: "bottom right",
- remove: false});
-
- let drop = new Drop(dropOptions);
- this.set('dropdown', drop);
- },
-
- onCancel() {
- this.closeDropdown();
-
- this.set('deleteAttachment', {
- id: "",
- name: ""
- });
+ this.set('showDialog', true);
},
onDelete() {
- this.closeDropdown();
+ this.set('showDialog', false);
let attachment = this.get('deleteAttachment');
-
- this.showNotification(`Deleted ${name}`);
-
+
this.get('documentService').deleteAttachment(this.get('document.id'), attachment.id).then(() => {
this.getAttachments();
this.set('deleteAttachment', {
diff --git a/gui/app/components/document/document-view.js b/gui/app/components/document/view-content.js
similarity index 100%
rename from gui/app/components/document/document-view.js
rename to gui/app/components/document/view-content.js
diff --git a/gui/app/pods/document/index/controller.js b/gui/app/pods/document/index/controller.js
index 1cade833..425b9124 100644
--- a/gui/app/pods/document/index/controller.js
+++ b/gui/app/pods/document/index/controller.js
@@ -26,9 +26,13 @@ export default Controller.extend(NotifierMixin, TooltipMixin, {
toggled: false,
queryParams: ['pageId', 'tab'],
pageId: '',
- tab: 'index',
+ tab: 'content',
actions: {
+ onTabChange(tab) {
+ this.set('tab', tab);
+ },
+
onSaveDocument(doc) {
this.get('documentService').save(doc);
diff --git a/gui/app/pods/document/index/template.hbs b/gui/app/pods/document/index/template.hbs
index 9d08d91d..508d151e 100644
--- a/gui/app/pods/document/index/template.hbs
+++ b/gui/app/pods/document/index/template.hbs
@@ -8,18 +8,24 @@
{{document/document-meta document=model.document folder=model.folder folders=model.folders permissions=model.permissions onSaveDocument=(action 'onSaveDocument')}}
- - Content
- - Attachments
- - Activity
- - Revisions
+ - Content
+ - Attachments
+ - Activity
+ - Revisions
- {{document/document-view
- document=model.document links=model.links pages=model.pages
- folder=model.folder folders=model.folders sections=model.sections permissions=model.permissions pageId=pageId
- onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
- onSavePageAsBlock=(action 'onSavePageAsBlock') onDeleteBlock=(action 'onDeleteBlock') onGotoPage=(action 'onGotoPage')
- onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted')}}
+ {{#if (eq tab 'content')}}
+ {{document/view-content
+ document=model.document links=model.links pages=model.pages
+ folder=model.folder folders=model.folders sections=model.sections permissions=model.permissions pageId=pageId
+ onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
+ onSavePageAsBlock=(action 'onSavePageAsBlock') onDeleteBlock=(action 'onDeleteBlock') onGotoPage=(action 'onGotoPage')
+ onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted')}}
+ {{/if}}
+
+ {{#if (eq tab 'attachment')}}
+ {{document/view-attachment document=model.document permissions=model.permissions}}
+ {{/if}}
{{document/document-sidebar tab=tab
@@ -28,4 +34,4 @@
onGotoPage=(action 'onGotoPage')}}
-
+
\ No newline at end of file
diff --git a/gui/app/styles/view/document/all.scss b/gui/app/styles/view/document/all.scss
index e4e5a075..bbf80906 100644
--- a/gui/app/styles/view/document/all.scss
+++ b/gui/app/styles/view/document/all.scss
@@ -1,5 +1,4 @@
@import "history.scss";
@import "activity.scss";
-@import "attachments.scss";
@import "toc.scss";
@import "new-section.scss";
diff --git a/gui/app/styles/view/document/document.scss b/gui/app/styles/view/document/document.scss
index c53b188c..b662481f 100644
--- a/gui/app/styles/view/document/document.scss
+++ b/gui/app/styles/view/document/document.scss
@@ -2,3 +2,4 @@
@import "doc-structure.scss";
@import "section-editor.scss";
@import "wysiwyg.scss";
+@import "view-attachment.scss";
\ No newline at end of file
diff --git a/gui/app/styles/view/document/attachments.scss b/gui/app/styles/view/document/view-attachment.scss
similarity index 56%
rename from gui/app/styles/view/document/attachments.scss
rename to gui/app/styles/view/document/view-attachment.scss
index c37d1491..cf985f47 100644
--- a/gui/app/styles/view/document/attachments.scss
+++ b/gui/app/styles/view/document/view-attachment.scss
@@ -1,10 +1,5 @@
-.document-attachments {
+.view-attachment {
margin: 0 0 50px 0;
- // @include content-container();
-
- > h2 {
- color: $color-gray;
- }
> .upload-document-files {
margin: 10px 0 0 0;
@@ -23,13 +18,9 @@
color: $color-off-black;
margin: 0;
padding: 10px 0;
- font-size: 0.9rem;
+ font-size: 1rem;
list-style-type: none;
- &:last-of-type {
- border-bottom: none !important;
- }
-
> .icon {
margin-right: 10px;
}
@@ -51,27 +42,6 @@
vertical-align: text-top;
}
}
-
- > .action {
- float: right;
- margin-top: -2px;
- margin-right: 5px;
- @extend .cursor-pointer;
- @extend .transition-all;
- display: none;
- color: $color-gray;
- }
-
- &:hover {
- .action {
- display: inline-block;
- }
- }
}
}
}
-
-.delete-attachment-dialog,
-.delete-page-dialog {
- display: none;
-}
diff --git a/gui/app/templates/components/document/document-attachments.hbs b/gui/app/templates/components/document/document-attachments.hbs
deleted file mode 100644
index 029aa8a7..00000000
--- a/gui/app/templates/components/document/document-attachments.hbs
+++ /dev/null
@@ -1,44 +0,0 @@
-{{#if canShow}}
-
-
Attachments
- {{#if hasAttachments}}
-
- {{#each files key="id" as |a index|}}
- -
-
-
- {{ a.filename }}
-
- {{#if permissions.documentEdit}}
-
- delete
-
- {{/if}}
-
- {{/each}}
-
- {{/if}}
- {{#if permissions.documentEdit}}
-
- {{/if}}
-
-
-
-
-
Are you sure you want to delete {{deleteAttachment.name}}?
-
-
-
- cancel
-
-
- delete
-
-
-
-
-{{/if}}
\ No newline at end of file
diff --git a/gui/app/templates/components/document/document-meta.hbs b/gui/app/templates/components/document/document-meta.hbs
index d8c44443..c0c7a9ae 100644
--- a/gui/app/templates/components/document/document-meta.hbs
+++ b/gui/app/templates/components/document/document-meta.hbs
@@ -14,7 +14,7 @@
{{#if canSelectCategory}}
<select>
{{else}}
- {{#link-to 'folder.category' folder.id folder.slug class='non-printable'}}Manage{{/link-to}}
+ {{#link-to 'folder.category' folder.id folder.slug class='non-printable'}}<manage>{{/link-to}}
{{/if}}
{{/if}}
{{/each}}
diff --git a/gui/app/templates/components/document/view-attachment.hbs b/gui/app/templates/components/document/view-attachment.hbs
new file mode 100644
index 00000000..072c0fd1
--- /dev/null
+++ b/gui/app/templates/components/document/view-attachment.hbs
@@ -0,0 +1,31 @@
+{{#if canShow}}
+
+ {{#if hasAttachments}}
+
+ {{#each files key="id" as |a index|}}
+ -
+
+
+ {{ a.filename }}
+
+ {{#if permissions.documentEdit}}
+
+ delete
+
+ {{/if}}
+
+ {{/each}}
+
+ {{/if}}
+ {{#if permissions.documentEdit}}
+
+ {{/if}}
+
+
+ {{#ui/ui-dialog title="Delete Attachment" confirmCaption="Delete" buttonType="btn-danger" show=showDialog onAction=(action 'onDelete')}}
+ Are you sure you want to delete {{deleteAttachment.name}}?
+ {{/ui/ui-dialog}}
+
+{{/if}}
\ No newline at end of file
diff --git a/gui/app/templates/components/document/document-view.hbs b/gui/app/templates/components/document/view-content.hbs
similarity index 98%
rename from gui/app/templates/components/document/document-view.hbs
rename to gui/app/templates/components/document/view-content.hbs
index f5849e09..df4f714f 100644
--- a/gui/app/templates/components/document/document-view.hbs
+++ b/gui/app/templates/components/document/view-content.hbs
@@ -92,5 +92,3 @@
{{/if}}
-
-{{document/document-attachments document=document permissions=permissions}}