From 571d8086c85babc6b833f174c7449e8a0e8322c2 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 16 Feb 2016 09:49:12 +0100 Subject: [PATCH] update umbContentGrid docs to match latest directive changes --- .../components/umbcontentgrid.directive.js | 54 +++++++++++++------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcontentgrid.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcontentgrid.directive.js index 35b0b9e4d6..ad5c435754 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcontentgrid.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcontentgrid.directive.js @@ -12,10 +12,10 @@ Use this directive to generate a list of content items presented as a flexbox gr
+ content="vm.contentItems" + content-properties="vm.includeProperties" + on-click="vm.selectItem" + on-click-name="vm.clickItem">
@@ -26,15 +26,36 @@ Use this directive to generate a list of content items presented as a flexbox gr (function () { "use strict"; - function Controller(myService) { + function Controller() { var vm = this; - vm.contentItems = []; - vm.includeProperties = { - { - "alias": "sortOrder", - "header": "Sort" + vm.contentItems = [ + { + "name": "Cape", + "published": true, + "icon": "icon-document", + "updateDate": "15-02-2016", + "owner": "Mr. Batman", + "selected": false }, + { + "name": "Utility Belt", + "published": true, + "icon": "icon-document", + "updateDate": "15-02-2016", + "owner": "Mr. Batman", + "selected": false + }, + { + "name": "Cave", + "published": true, + "icon": "icon-document", + "updateDate": "15-02-2016", + "owner": "Mr. Batman", + "selected": false + } + ]; + vm.includeProperties = [ { "alias": "updateDate", "header": "Last edited" @@ -43,20 +64,17 @@ Use this directive to generate a list of content items presented as a flexbox gr "alias": "owner", "header": "Created by" } - }; + ]; vm.clickItem = clickItem; vm.selectItem = selectItem; - myService.getContentItems().then(function(contentItems){ - vm.contentItems = contentItems; - }); - function clickItem(item){ + function clickItem(item, $event, $index){ // do magic here } - function selectItem(item, event, index) { + function selectItem(item, $event, $index) { // set item.selected = true; to select the item // do magic here } @@ -73,8 +91,10 @@ Use this directive to generate a list of content items presented as a flexbox gr

The callback returns:

-@param {callback=} onSelect (binding): Callback method to handle click events on the checkmark icon. +@param {callback=} onClickName (binding): Callback method to handle click events on the checkmark icon.

The callback returns: