mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Fixed list item edit icon and options exposed issue for #76
Still needs work on the border issue @adamdbradley
This commit is contained in:
17
dist/js/ionic-angular.js
vendored
17
dist/js/ionic-angular.js
vendored
@ -487,7 +487,7 @@ angular.module('ionic.ui.content', [])
|
|||||||
|
|
||||||
angular.module('ionic.ui.list', ['ngAnimate'])
|
angular.module('ionic.ui.list', ['ngAnimate'])
|
||||||
|
|
||||||
.directive('listItem', function() {
|
.directive('listItem', ['$timeout', function($timeout) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
require: ['?^list', '?^virtualList'],
|
require: ['?^list', '?^virtualList'],
|
||||||
@ -508,7 +508,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
</div>\
|
</div>\
|
||||||
<div class="item-content slide-left" ng-transclude>\
|
<div class="item-content slide-left" ng-transclude>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="item-options" ng-if="canSwipe && !isEditing">\
|
<div class="item-options" ng-if="canSwipe && !isEditing && showOptions">\
|
||||||
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
||||||
</div>\
|
</div>\
|
||||||
</a>',
|
</a>',
|
||||||
@ -538,6 +538,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
$scope.isEditing = false;
|
$scope.isEditing = false;
|
||||||
$scope.deleteIcon = list.scope.deleteIcon;
|
$scope.deleteIcon = list.scope.deleteIcon;
|
||||||
$scope.reorderIcon = list.scope.reorderIcon;
|
$scope.reorderIcon = list.scope.reorderIcon;
|
||||||
|
$scope.showOptions = true;
|
||||||
|
|
||||||
$scope.buttonClicked = function(button) {
|
$scope.buttonClicked = function(button) {
|
||||||
button.onButtonClicked && button.onButtonClicked($scope.item, button);
|
button.onButtonClicked && button.onButtonClicked($scope.item, button);
|
||||||
@ -545,10 +546,20 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
|
|
||||||
list.scope.$watch('isEditing', function(v) {
|
list.scope.$watch('isEditing', function(v) {
|
||||||
$scope.isEditing = v;
|
$scope.isEditing = v;
|
||||||
|
|
||||||
|
// Add a delay before we allow the options layer to show, to avoid any odd
|
||||||
|
// animation issues
|
||||||
|
if(!v) {
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.showOptions = true;
|
||||||
|
}, 200);
|
||||||
|
} else {
|
||||||
|
$scope.showOptions = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
}])
|
||||||
|
|
||||||
.directive('list', function() {
|
.directive('list', function() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
17
js/ext/angular/src/directive/ionicList.js
vendored
17
js/ext/angular/src/directive/ionicList.js
vendored
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
angular.module('ionic.ui.list', ['ngAnimate'])
|
angular.module('ionic.ui.list', ['ngAnimate'])
|
||||||
|
|
||||||
.directive('listItem', function() {
|
.directive('listItem', ['$timeout', function($timeout) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
require: ['?^list', '?^virtualList'],
|
require: ['?^list', '?^virtualList'],
|
||||||
@ -24,7 +24,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
</div>\
|
</div>\
|
||||||
<div class="item-content slide-left" ng-transclude>\
|
<div class="item-content slide-left" ng-transclude>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="item-options" ng-if="canSwipe && !isEditing">\
|
<div class="item-options" ng-if="canSwipe && !isEditing && showOptions">\
|
||||||
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
<button ng-click="buttonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
||||||
</div>\
|
</div>\
|
||||||
</a>',
|
</a>',
|
||||||
@ -54,6 +54,7 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
$scope.isEditing = false;
|
$scope.isEditing = false;
|
||||||
$scope.deleteIcon = list.scope.deleteIcon;
|
$scope.deleteIcon = list.scope.deleteIcon;
|
||||||
$scope.reorderIcon = list.scope.reorderIcon;
|
$scope.reorderIcon = list.scope.reorderIcon;
|
||||||
|
$scope.showOptions = true;
|
||||||
|
|
||||||
$scope.buttonClicked = function(button) {
|
$scope.buttonClicked = function(button) {
|
||||||
button.onButtonClicked && button.onButtonClicked($scope.item, button);
|
button.onButtonClicked && button.onButtonClicked($scope.item, button);
|
||||||
@ -61,10 +62,20 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
|
|
||||||
list.scope.$watch('isEditing', function(v) {
|
list.scope.$watch('isEditing', function(v) {
|
||||||
$scope.isEditing = v;
|
$scope.isEditing = v;
|
||||||
|
|
||||||
|
// Add a delay before we allow the options layer to show, to avoid any odd
|
||||||
|
// animation issues
|
||||||
|
if(!v) {
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.showOptions = true;
|
||||||
|
}, 200);
|
||||||
|
} else {
|
||||||
|
$scope.showOptions = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
}])
|
||||||
|
|
||||||
.directive('list', function() {
|
.directive('list', function() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user