
"use strict";

let params = undefined;
let route = undefined;
let modal = undefined;
let _page = 1;
let filter = {};

/**
 * Default "list" controller. Usually good enough if all you need is a
 * clickable list of items in a Component.
 */
export default class ListController {

    /**
     * Class constructor.
     *
     * @param object $scope Injected scope.
     * @param object moDelete Injected moDelete service.
     * @return void
     */
    constructor(moDelete) {
        if (!this.items) {
            this.page = _page;
        }
        this.filter = {};
        filter = {};
        this['delete'] = item => moDelete.ask(item);
    }

    /**
     * Reset ("reload") the current page.
     *
     * @return void
     */
    reset() {
        route.reset();
        this.page = 1;
    }

    /**
     * Getter for the current page number.
     *
     * @return integer Current page number.
     */
    get page() {
        return _page;
    }

    /**
     * Setter for the current page. Automatically refreshes the current
     * collection via the registered resource.
     *
     * @return void
     */
    set page(page) {
        _page = page;
        this.items = this.resource.query({filter: this.filter, limit: 10, offset: (page - 1) * 10});
    }

    applyFilter() {
        this.filter = filter;
        this.reset();
    }

    get isFilterApplied() {
        return this.filter == filter;
    }

};

ListController.$inject = ['moDelete'];


@@ -539,16 +539,61 @@
       %7D%0A
+        this.pageSize = this.pageSize %7C%7C 10;%0A
         
@@ -1274,18 +1274,29 @@
  limit: 
-10
+this.pageSize
 , offset
@@ -1310,18 +1310,29 @@
  - 1) * 
-10
+this.pageSize
 %7D);%0A    
@@ -1350,24 +1350,44 @@
 yFilter() %7B%0A
+        alert('!');%0A
         this

add customisable pageSize