diff --git a/app/components/breadcrumb/base.js b/app/components/breadcrumb/base.js new file mode 100644 index 0000000000000000000000000000000000000000..e7773a6917fc2a2685b33f76368c254f698580cd --- /dev/null +++ b/app/components/breadcrumb/base.js @@ -0,0 +1,32 @@ +import { A } from '@ember/array'; +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { action } from '@ember/object'; + + +export default class BaseBreadcrumbComponent extends Component { + + get nodes() { + let current, + _nodes = []; + + current = this.args.node; + + while (current && current.get('id')) { + _nodes.push(current); + current = current.get('parent'); + } + + return _nodes.reverse(); + } + + get query() { + if (this.args.extranode) { + return { + extranode_id: this.args.extranode.id + } + } + + return {}; + } +} diff --git a/app/components/breadcrumb/left.hbs b/app/components/breadcrumb/left.hbs new file mode 100644 index 0000000000000000000000000000000000000000..13aae704793f57e24d6ca13820b66e0b750c2b93 --- /dev/null +++ b/app/components/breadcrumb/left.hbs @@ -0,0 +1,22 @@ +<nav aria-label="breadcrumb" class="m-2"> + <ol class="breadcrumb"> + {{#each this.nodes as |node|}} + <li class="breadcrumb-item"> + {{#if @extranode}} + <LinkTo + @route="authenticated.nodes" + @model={{node.id}} + @query={{hash extranode_id=@extranode.id}}> + {{node.title}} + </LinkTo> + {{else}} + <LinkTo + @route="authenticated.nodes" + @model={{node.id}}> + {{node.title}} + </LinkTo> + {{/if}} + </li> + {{/each}} + </ol> +</nav> \ No newline at end of file diff --git a/app/components/breadcrumb/left.js b/app/components/breadcrumb/left.js new file mode 100644 index 0000000000000000000000000000000000000000..4d0c60fcd37989a1220cce58e2a651fe7bda16cc --- /dev/null +++ b/app/components/breadcrumb/left.js @@ -0,0 +1,16 @@ +import BaseBreadcrumbComponent from "./base"; + + +class LeftBreadcrumbComponent extends BaseBreadcrumbComponent { + url(extranode) { + let node = this.args.node; + + if (extranode) { + return `/nodes/${node.id}?extranode_id=${extranode.id}` + } + + return `/nodes/${node.id}`; + } +} + +export default LeftBreadcrumbComponent; diff --git a/app/components/breadcrumb/right.hbs b/app/components/breadcrumb/right.hbs new file mode 100644 index 0000000000000000000000000000000000000000..9b68727a9539da0f94d158c7ec92dd8e5d7f8409 --- /dev/null +++ b/app/components/breadcrumb/right.hbs @@ -0,0 +1,14 @@ +<nav aria-label="breadcrumb" class="m-2"> + <ol class="breadcrumb"> + {{#each this.nodes as |node|}} + <li class="breadcrumb-item"> + <LinkTo + @route="authenticated.nodes" + @model={{@extranode.id}} + @query={{hash extranode_id=node.id}}> + {{node.title}} + </LinkTo> + </li> + {{/each}} + </ol> +</nav> \ No newline at end of file diff --git a/app/components/breadcrumb/right.js b/app/components/breadcrumb/right.js new file mode 100644 index 0000000000000000000000000000000000000000..010788688c5856e2ab30e4cf4dc33c9f797b6f12 --- /dev/null +++ b/app/components/breadcrumb/right.js @@ -0,0 +1,10 @@ +import BaseBreadcrumbComponent from "./base"; + + +class RightBreadcrumbComponent extends BaseBreadcrumbComponent { + get url() { + + } +} + +export default RightBreadcrumbComponent; diff --git a/app/components/panel.js b/app/components/commander/base.js similarity index 81% rename from app/components/panel.js rename to app/components/commander/base.js index cf2e8e6ef4bb0337b47676ee56a69dbcf20a70f8..254094876c70b3bf83b35c58806c44a10f08ec68 100644 --- a/app/components/panel.js +++ b/app/components/commander/base.js @@ -4,7 +4,7 @@ import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; -export default class PanelComponent extends Component { +export default class BaseCommanderComponent extends Component { @tracked show_new_folder_modal = false; @action @@ -16,4 +16,7 @@ export default class PanelComponent extends Component { closeNewFolderModal() { this.show_new_folder_modal = false; } + + get url() { + } } diff --git a/app/components/commander/left.hbs b/app/components/commander/left.hbs new file mode 100644 index 0000000000000000000000000000000000000000..26ef15aa13decd664447a93560462a2ba522454e --- /dev/null +++ b/app/components/commander/left.hbs @@ -0,0 +1,44 @@ +<div class="panel commander"> + <div> + <button class="btn btn-bordered btn-light btn-flat" + type="button"> + <i class="fa fa-upload mr-1 text-success"></i> + Upload + </button> + + <button class="btn btn-bordered btn-light btn-flat" + type="button" {{on "click" this.openNewFolderModal }}> + <i class="fa fa-plus mr-1 text-success"></i> + New Folder + </button> + </div> + + <Modal::NewFolder + id="new-folder" + @node={{@node}} + @onClose={{this.closeNewFolderModal}} + {{show-when this.show_new_folder_modal}} /> + + <Breadcrumb::Left + @node={{@node}} + @extranode={{@extranode}} /> + + {{#each @nodes as |node|}} + <Folder @model={{node}}> + {{#if @extranode}} + <LinkTo + @route="authenticated.nodes" + @model={{node.id}} + @query={{hash extranode_id=@extranode.id}}> + {{node.title}} + </LinkTo> + {{else}} + <LinkTo + @route="authenticated.nodes" + @model={{node.id}}> + {{node.title}} + </LinkTo> + {{/if}} + </Folder> + {{/each}} +</div> diff --git a/app/components/commander/left.js b/app/components/commander/left.js new file mode 100644 index 0000000000000000000000000000000000000000..4529820856d88bce525a701d1f766baaa93ffada --- /dev/null +++ b/app/components/commander/left.js @@ -0,0 +1,7 @@ +import BaseCommanderComponent from "./base"; + + +class LeftCommanderComponent extends BaseCommanderComponent { +} + +export default LeftCommanderComponent; diff --git a/app/components/panel.hbs b/app/components/commander/right.hbs similarity index 63% rename from app/components/panel.hbs rename to app/components/commander/right.hbs index eedc625dd75499067624a18a5afad1f1a3180115..04dcd035a622f9cebbcb99f19da965fda2965a05 100644 --- a/app/components/panel.hbs +++ b/app/components/commander/right.hbs @@ -1,4 +1,4 @@ -<div class="panel"> +<div class="panel commander"> <div> <button class="btn btn-bordered btn-light btn-flat" type="button"> @@ -19,9 +19,18 @@ @onClose={{this.closeNewFolderModal}} {{show-when this.show_new_folder_modal}} /> - <Breadcrumb @node={{@node}} @extranode={{@extranode}} /> + <Breadcrumb::Right + @node={{@node}} + @extranode={{@extranode}} /> {{#each @nodes as |node|}} - <Folder @model={{node}} @extranode={{@extranode}} /> + <Folder @model={{node}}> + <LinkTo + @route="authenticated.nodes" + @model={{@extranode.id}} + @query={{hash extranode_id=node.id}}> + {{node.title}} + </LinkTo> + </Folder> {{/each}} -</div> \ No newline at end of file +</div> diff --git a/app/components/commander/right.js b/app/components/commander/right.js new file mode 100644 index 0000000000000000000000000000000000000000..7e2368a13bb1481733cb38abbd49147fe162f6b5 --- /dev/null +++ b/app/components/commander/right.js @@ -0,0 +1,7 @@ +import BaseCommanderComponent from "./base"; + + +class RightCommanderComponent extends BaseCommanderComponent { +} + +export default RightCommanderComponent; diff --git a/app/components/folder.hbs b/app/components/folder.hbs index b417d257373c1d90e1c6af822ebbc787dc570494..1ee179b76500855f5f7c05bd2b2ded4e59b35c9e 100644 --- a/app/components/folder.hbs +++ b/app/components/folder.hbs @@ -1,11 +1,6 @@ <div class="node folder"> - <div class="icon folder"></div> - <div class="title"> - <LinkTo - @route="authenticated.nodes" - @model={{@model.id}} - @query={{this.query}}> - {{@model.title}} - </LinkTo> - </div> + <div class="icon folder"></div> + <div class="title"> + {{yield}} + </div> </div> \ No newline at end of file diff --git a/app/components/folder.js b/app/components/folder.js index 1e2015b2457ded4fce82fb9f429fb4106189288f..747f45433e3fea5285909ba9bffea079f864889b 100644 --- a/app/components/folder.js +++ b/app/components/folder.js @@ -15,4 +15,8 @@ export default class FolderComponent extends Component { return {}; } + + get model() { + return this.args.model; + } } diff --git a/app/components/role/add.js b/app/components/role/add.js index 708dad838b4c4cfa69e08a5605a0a31fc99e334e..48c903d1ee0e3d2069a9406a4704e4f20cea79eb 100644 --- a/app/components/role/add.js +++ b/app/components/role/add.js @@ -4,6 +4,7 @@ import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; import { group_perms_by_model } from 'papermerge/utils'; + class AddRoleComponent extends Component { @service store; @service router; diff --git a/app/components/viewer/base.hbs b/app/components/viewer/base.hbs new file mode 100644 index 0000000000000000000000000000000000000000..bcb08529b5e944ccb8beeca5871f009c6e878e49 --- /dev/null +++ b/app/components/viewer/base.hbs @@ -0,0 +1 @@ +Document Viewer \ No newline at end of file diff --git a/app/components/viewer/base.js b/app/components/viewer/base.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/components/viewer/left.js b/app/components/viewer/left.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/components/viewer/right.js b/app/components/viewer/right.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/templates/authenticated/nodes.hbs b/app/templates/authenticated/nodes.hbs index 370225244253b3457faa954a426dad0cf87fb837..5c171561ba69ed4103977c8dd4cb975ff0f075c3 100644 --- a/app/templates/authenticated/nodes.hbs +++ b/app/templates/authenticated/nodes.hbs @@ -1,13 +1,17 @@ <div class="panels d-flex"> - <Panel + <Commander::Left @node={{this.mainnode}} @nodes={{this.mainnode.children}} @extranode={{this.extranode}} /> {{#if this.extranode}} - <Panel + <Commander::Right @node={{this.extranode}} @nodes={{this.extranode.children}} - @mainnode={{this.mainnode}} /> + @extranode={{this.mainnode}} /> + {{else this.extradoc}} + <Viewer::Right + @doc={{this.extradoc}} + @extranode={{this.mainnode}} /> {{/if}} </div> \ No newline at end of file