Skip to content

Commit

Permalink
add [data-ion-list-toggle] both
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Davis committed Aug 29, 2015
1 parent 4cd628a commit 6ac1578
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
41 changes: 30 additions & 11 deletions components/ionBody/ionBody.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Platform = {
isIOS: function () {
return (!!navigator.userAgent.match(/iPad/i) || !!navigator.userAgent.match(/iPhone/i) || !!navigator.userAgent.match(/iPod/i))
|| Session.get('platformOverride') === 'iOS';
|| Session.get('platformOverride') === 'iOS';
},

isAndroid: function () {
return navigator.userAgent.indexOf('Android') > 0
|| Session.get('platformOverride') === 'Android';
|| Session.get('platformOverride') === 'Android';
}
};

Expand Down Expand Up @@ -98,8 +98,24 @@ Template.ionBody.events({
} else {
direction = 'left';
}
template.$('.list').toggleClass('list-' + direction + '-editing');
if (template.$('.item-' + direction + '-edit').hasClass('visible')){

direction = direction.trim(); //just in case..

switch(direction){
case "left":
toggleListIcons("left");
break;
case "right":
toggleListIcons("right");
break;
case "both":
toggleListIcons("left");
toggleListIcons("right");
}

function toggleListIcons(direction){
template.$('.list').toggleClass('list-' + direction + '-editing');
if (template.$('.item-' + direction + '-edit').hasClass('visible')){
template.$('.item-' + direction + '-edit').removeClass('active').delay(125).queue(function(next){
$(this).removeClass('visible');
next();
Expand All @@ -110,13 +126,16 @@ Template.ionBody.events({
next();
});
}
},

'mousedown .button, touchstart .button': function (event, template) {
$(event.target).addClass('active');
},

'mouseup .button, touchend .button': function (event, template) {
$(event.target).removeClass('active');
}

},

'mousedown .button, touchstart .button': function (event, template) {
$(event.target).addClass('active');
},

'mouseup .button, touchend .button': function (event, template) {
$(event.target).removeClass('active');
}
});
1 change: 0 additions & 1 deletion components/ionListButton/ionListButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Template.ionListButton.helpers({

var action = this.action || 'delete';
var side = this.side || 'left';

classes.push('item-' + action);
classes.push('item-' + side + '-edit');

Expand Down

0 comments on commit 6ac1578

Please sign in to comment.