diff --git a/addon/components/document-view.js b/addon/components/document-view.js index f680f7e0..96372597 100644 --- a/addon/components/document-view.js +++ b/addon/components/document-view.js @@ -15,7 +15,7 @@ export default class DocumentViewComponent extends Component { @tracked isDragOver = false; @tracked dragCounter = 0; - @tracked listView = true; + @tracked listView = this.args.listView === "true"; @tracked sort = "title"; @tracked sortDirection = ""; // Needed for ember-resource @@ -38,9 +38,13 @@ export default class DocumentViewComponent extends Component { @action toggleView() { this.listView = !this.listView; + this.router.transitionTo(this.router.currentRouteName, { + queryParams: { listView: this.listView }, + }); } @action setSort(sortAttribute) { + debugger; if (this.sort === sortAttribute) { this.sortDirection = this.sortDirection === "" ? "-" : ""; } else { diff --git a/addon/controllers/index.js b/addon/controllers/index.js index b391ab28..a2070413 100644 --- a/addon/controllers/index.js +++ b/addon/controllers/index.js @@ -11,6 +11,7 @@ export default class IndexController extends Controller { "document", "activeGroup", "sort", + "listView", ]; @service("alexandria-config") config; @@ -22,6 +23,7 @@ export default class IndexController extends Controller { @tracked document; @tracked activeGroup; @tracked sort; + @tracked listView = "true"; get documentFilters() { let filters = { diff --git a/addon/routes/index.js b/addon/routes/index.js index a2d56b14..b28c43dc 100644 --- a/addon/routes/index.js +++ b/addon/routes/index.js @@ -12,6 +12,7 @@ export default class IndexRoute extends Route { search: PARAM_OPTIONS, document: PARAM_OPTIONS, activeGroup: PARAM_OPTIONS, + listView: PARAM_OPTIONS, }; @service("alexandria-config") config; diff --git a/addon/templates/index.hbs b/addon/templates/index.hbs index 4aa0d750..eba05e43 100644 --- a/addon/templates/index.hbs +++ b/addon/templates/index.hbs @@ -7,6 +7,7 @@