From 48a58d9278fb727dd0345a0efa4bfab9d1325f68 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 13 Dec 2013 09:52:09 -0600 Subject: [PATCH] removed link-item and onSelect --- dist/css/ionic.css | 5 + dist/js/ionic-angular.js | 108 +--------------------- examples/starters/list/index.html | 2 +- js/ext/angular/src/directive/ionicList.js | 108 +--------------------- js/ext/angular/test/list.html | 4 +- scss/_items.scss | 6 ++ 6 files changed, 22 insertions(+), 211 deletions(-) diff --git a/dist/css/ionic.css b/dist/css/ionic.css index 99da61707c..76b7b1e29f 100644 --- a/dist/css/ionic.css +++ b/dist/css/ionic.css @@ -3857,6 +3857,11 @@ button.item.item-complex { border: none; background-color: white; } +a.item-content { + display: block; + text-decoration: none; + color: inherit; } + .item-text-wrap, .item-text-wrap h1, .item-text-wrap h2, diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 63b510aeec..f8b3c27415 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -814,18 +814,17 @@ angular.module('ionic.ui.list', ['ngAnimate']) canDelete: '@', canReorder: '@', canSwipe: '@', - onSelect: '&', onDelete: '&', optionButtons: '&', deleteIcon: '@', reorderIcon: '@' }, - template: '
\ + template: '
\
\ \
\ -
\ + \
\ \
\ @@ -840,104 +839,6 @@ angular.module('ionic.ui.list', ['ngAnimate']) var $parentScope = list.scope; var $parentAttrs = list.attrs; - // Set this item's class, first from the item directive attr, and then the list attr if item not set - $scope.itemClass = $scope.itemType || $parentScope.itemType; - - // Decide if this item can do stuff, and follow a certain priority - // depending on where the value comes from - if(($attr.canDelete ? $scope.canDelete : $parentScope.canDelete) !== "false") { - if($attr.onDelete || $parentAttrs.onDelete) { - - // only assign this method when we need to - // and use its existence to decide if the delete should show or not - $scope.deleteClick = function() { - if($attr.onDelete) { - // this item has an on-delete attribute - $scope.onDelete($scope.item); - } else if($parentAttrs.onDelete) { - // run the parent list's onDelete method - // if it doesn't exist nothing will happen - $parentScope.onDelete($scope.item); - } - }; - - // Set which icons to use for deleting - $scope.deleteIconClass = $scope.deleteIcon || $parentScope.deleteIcon || 'ion-minus-circled'; - } - } - - if($attr.onSelect || $parentAttrs.onSelect) { - // only assign this method when we need to - $scope.selectClick = function() { - if($attr.onSelect) { - // this item has an on-delete attribute - $scope.onSelect($scope.item); - } else if($parentAttrs.onSelect) { - // run the parent list's onDelete method - // if it doesn't exist nothing will happen - $parentScope.onSelect($scope.item); - } - }; - } - - // set the reorder Icon Class only if the item or list set can-reorder="true" - if(($attr.canReorder ? $scope.canReorder : $parentScope.canReorder) === "true") { - $scope.reorderIconClass = $scope.reorderIcon || $parentScope.reorderIcon || 'ion-navicon'; - } - - // Set the option buttons which can be revealed by swiping to the left - // if canSwipe was set to false don't even bother - if(($attr.canSwipe ? $scope.canSwipe : $parentScope.canSwipe) !== "false") { - $scope.itemOptionButtons = $scope.optionButtons(); - if(typeof $scope.itemOptionButtons === "undefined") { - $scope.itemOptionButtons = $parentScope.optionButtons(); - } - } - - } - }; -}]) - -.directive('linkItem', [function() { - return { - restrict: 'E', - require: '?^list', - replace: true, - transclude: true, - - scope: { - item: '=', - itemType: '@', - canDelete: '@', - canReorder: '@', - canSwipe: '@', - onSelect: '&', - onDelete: '&', - optionButtons: '&', - deleteIcon: '@', - reorderIcon: '@', - href: '@' - }, - - template: '\ -
\ - \ -
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
', - - link: function($scope, $element, $attr, list) { - if(!list) return; - - var $parentScope = list.scope; - var $parentAttrs = list.attrs; - $attr.$observe('href', function(value) { if(value) $scope.href = value.trim(); }); @@ -955,11 +856,11 @@ angular.module('ionic.ui.list', ['ngAnimate']) $scope.deleteClick = function() { if($attr.onDelete) { // this item has an on-delete attribute - $scope.onDelete($scope.item); + $scope.onDelete({ item: $scope.item }); } else if($parentAttrs.onDelete) { // run the parent list's onDelete method // if it doesn't exist nothing will happen - $parentScope.onDelete($scope.item); + $parentScope.onDelete({ item: $scope.item }); } }; @@ -1003,7 +904,6 @@ angular.module('ionic.ui.list', ['ngAnimate']) onRefresh: '&', onRefreshOpening: '&', refreshComplete: '=', - onSelect: '&', onDelete: '&', onReorder: '&', optionButtons: '&', diff --git a/examples/starters/list/index.html b/examples/starters/list/index.html index 28e5dcaa22..6a8183483e 100644 --- a/examples/starters/list/index.html +++ b/examples/starters/list/index.html @@ -55,7 +55,7 @@ - + {{ movie.title }} diff --git a/js/ext/angular/src/directive/ionicList.js b/js/ext/angular/src/directive/ionicList.js index 31ebccf6ad..df21693426 100644 --- a/js/ext/angular/src/directive/ionicList.js +++ b/js/ext/angular/src/directive/ionicList.js @@ -16,18 +16,17 @@ angular.module('ionic.ui.list', ['ngAnimate']) canDelete: '@', canReorder: '@', canSwipe: '@', - onSelect: '&', onDelete: '&', optionButtons: '&', deleteIcon: '@', reorderIcon: '@' }, - template: '
\ + template: '
\
\ \
\ -
\ + \
\ \
\ @@ -42,104 +41,6 @@ angular.module('ionic.ui.list', ['ngAnimate']) var $parentScope = list.scope; var $parentAttrs = list.attrs; - // Set this item's class, first from the item directive attr, and then the list attr if item not set - $scope.itemClass = $scope.itemType || $parentScope.itemType; - - // Decide if this item can do stuff, and follow a certain priority - // depending on where the value comes from - if(($attr.canDelete ? $scope.canDelete : $parentScope.canDelete) !== "false") { - if($attr.onDelete || $parentAttrs.onDelete) { - - // only assign this method when we need to - // and use its existence to decide if the delete should show or not - $scope.deleteClick = function() { - if($attr.onDelete) { - // this item has an on-delete attribute - $scope.onDelete($scope.item); - } else if($parentAttrs.onDelete) { - // run the parent list's onDelete method - // if it doesn't exist nothing will happen - $parentScope.onDelete($scope.item); - } - }; - - // Set which icons to use for deleting - $scope.deleteIconClass = $scope.deleteIcon || $parentScope.deleteIcon || 'ion-minus-circled'; - } - } - - if($attr.onSelect || $parentAttrs.onSelect) { - // only assign this method when we need to - $scope.selectClick = function() { - if($attr.onSelect) { - // this item has an on-delete attribute - $scope.onSelect($scope.item); - } else if($parentAttrs.onSelect) { - // run the parent list's onDelete method - // if it doesn't exist nothing will happen - $parentScope.onSelect($scope.item); - } - }; - } - - // set the reorder Icon Class only if the item or list set can-reorder="true" - if(($attr.canReorder ? $scope.canReorder : $parentScope.canReorder) === "true") { - $scope.reorderIconClass = $scope.reorderIcon || $parentScope.reorderIcon || 'ion-navicon'; - } - - // Set the option buttons which can be revealed by swiping to the left - // if canSwipe was set to false don't even bother - if(($attr.canSwipe ? $scope.canSwipe : $parentScope.canSwipe) !== "false") { - $scope.itemOptionButtons = $scope.optionButtons(); - if(typeof $scope.itemOptionButtons === "undefined") { - $scope.itemOptionButtons = $parentScope.optionButtons(); - } - } - - } - }; -}]) - -.directive('linkItem', [function() { - return { - restrict: 'E', - require: '?^list', - replace: true, - transclude: true, - - scope: { - item: '=', - itemType: '@', - canDelete: '@', - canReorder: '@', - canSwipe: '@', - onSelect: '&', - onDelete: '&', - optionButtons: '&', - deleteIcon: '@', - reorderIcon: '@', - href: '@' - }, - - template: '\ -
\ - \ -
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
', - - link: function($scope, $element, $attr, list) { - if(!list) return; - - var $parentScope = list.scope; - var $parentAttrs = list.attrs; - $attr.$observe('href', function(value) { if(value) $scope.href = value.trim(); }); @@ -157,11 +58,11 @@ angular.module('ionic.ui.list', ['ngAnimate']) $scope.deleteClick = function() { if($attr.onDelete) { // this item has an on-delete attribute - $scope.onDelete($scope.item); + $scope.onDelete({ item: $scope.item }); } else if($parentAttrs.onDelete) { // run the parent list's onDelete method // if it doesn't exist nothing will happen - $parentScope.onDelete($scope.item); + $parentScope.onDelete({ item: $scope.item }); } }; @@ -205,7 +106,6 @@ angular.module('ionic.ui.list', ['ngAnimate']) onRefresh: '&', onRefreshOpening: '&', refreshComplete: '=', - onSelect: '&', onDelete: '&', onReorder: '&', optionButtons: '&', diff --git a/js/ext/angular/test/list.html b/js/ext/angular/test/list.html index 6385155a1c..6902e0b960 100644 --- a/js/ext/angular/test/list.html +++ b/js/ext/angular/test/list.html @@ -65,7 +65,7 @@ on-refresh-opening="refreshOpening(ratio)" on-refresh="refreshItems()" refresh-complete="refreshComplete" - on-delete="deleteListItem()" + on-delete="deleteListItem(item)" delete-icon="ion-minus-circled" reorder-icon="ion-navicon" animation="my-repeat-animation" @@ -98,7 +98,7 @@ -