Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ionic to version 1.3.2 & added long-swipe directive #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
6 changes: 3 additions & 3 deletions can-swipe/can-swipe-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/* Directives */

var module = angular.module('canSwipeDirective', []);
angular.module('canSwipeDirective', ['ionic'])

/*****************************************************************************/
/************************** DIRECTIVE **********************************/
Expand All @@ -25,12 +25,12 @@ var module = angular.module('canSwipeDirective', []);
* ### Known issues:
*
*/
module.directive('canSwipe', function() {
.directive('canSwipe', function() {
return {
restrict: 'A',
require: '^ionItem',
link: function(scope, element, attr, itemCtrl) {

if(attr.canSwipe !== null && attr.canSwipe.length > 0 &&
typeof(!!attr.canSwipe) === "boolean") {
scope.$watch('!!(' + attr.canSwipe + ')', function(value) {
Expand Down
87 changes: 87 additions & 0 deletions click-swipe/click-swipe-directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
'use strict';

/* Directives */

angular.module('clickSwipeDirective', ['ionic'])

/*****************************************************************************/
/************************** DIRECTIVE **********************************/
/*****************************************************************************/
/***
* click-swipe is an attribute directive which can enables open close on click
*
* @usage
*
* ```html
* <ion-item click-swipe>
* <ion-option-button class="button-assertive" ng-click="edit(item)">
* Edit
* </ion-option-button>
* </ion-item>
* ```
*
* ### Known issues:
*
*/
.directive('clickSwipe', function($ionicGesture) {
return {
restrict: 'A',
require: '^ionItem',
link: function(scope, element, attr, itemCtrl) {
var left = itemCtrl.itemSwipeLeft ? itemCtrl.itemSwipeLeft : null;
var right = itemCtrl.itemSwipeRight ? itemCtrl.itemSwipeRight: null;

function closeAll(){
//Close all items of the parent
if (element.parent()[0])
angular.forEach((element.parent()[0]).querySelectorAll('.item-content'),function(el){
angular.forEach(angular.element(el).parent()[0].querySelectorAll('.item-options'),function(btn){
var button = angular.element(btn);
if (!button.hasClass('invisible')){
el.style[ionic.CSS.TRANSFORM] = '';
setTimeout(function() {
button.addClass('invisible');
}, 250);
}
});
});
}

$ionicGesture.on('tap', function(e){
// Grab the content
var content = element[0].querySelector('.item-content');
if (!left && !right) return;
// Grab the buttons and their width
var isLeft;
if (left && !right) isLeft=true;
else if (!left && right) isLeft=false;
else isLeft = ionic.tap.pointerCoord(e.gesture).x>=content.clientWidth/2;
//Check if we allready are opened
if ((left && !left.hasClass('invisible')) || (right && !right.hasClass('invisible'))) {
closeAll();
return;
}
var buttons = isLeft ? left[0] : right[0]; //ToDo better left right selectiong

var buttonsWidth = buttons.offsetWidth;
ionic.requestAnimationFrame(function() {
content.style[ionic.CSS.TRANSITION] = 'all ease-out .25s';

if (!buttons.classList.contains('invisible')) {
content.style[ionic.CSS.TRANSFORM] = '';
setTimeout(function() {
buttons.classList.add('invisible');
}, 250);
} else {
closeAll();
buttons.classList.remove('invisible');
content.style[ionic.CSS.TRANSFORM] = 'translate3d(' +
(isLeft ? '-' : '' ) + buttonsWidth + 'px, 0, 0)';
}
});

}, element);

} // link
}; // return
}) // can-swipe directive
2 changes: 1 addition & 1 deletion ionic/css/ionic.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2015 Drifty Co.
* http://drifty.com/
*
* Ionic, v1.3.1
* Ionic, v1.3.2
* A powerful HTML5 mobile app framework.
* http://ionicframework.com/
*
Expand Down
2 changes: 1 addition & 1 deletion ionic/css/ionic.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified ionic/js/angular-ui/angular-ui-router.js
100644 → 100755
Empty file.
Empty file modified ionic/js/angular-ui/angular-ui-router.min.js
100644 → 100755
Empty file.
61 changes: 35 additions & 26 deletions ionic/js/ionic-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2015 Drifty Co.
* http://drifty.com/
*
* Ionic, v1.3.1
* Ionic, v1.3.2
* A powerful HTML5 mobile app framework.
* http://ionicframework.com/
*
Expand Down Expand Up @@ -2204,7 +2204,8 @@ var LOADING_TPL =
* .controller('LoadingCtrl', function($scope, $ionicLoading) {
* $scope.show = function() {
* $ionicLoading.show({
* template: 'Loading...'
* template: 'Loading...',
* duration: 3000
* }).then(function(){
* console.log("The loading indicator is now displayed");
* });
Expand Down Expand Up @@ -2659,7 +2660,9 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
}

return $timeout(function() {
$ionicBody.removeClass(self.viewType + '-open');
if (!modalStack.length) {
$ionicBody.removeClass(self.viewType + '-open');
}
self.el.classList.add('hide');
}, self.hideDelay || 320);
},
Expand Down Expand Up @@ -3014,8 +3017,8 @@ IonicModule
* @description
* Add Cordova event listeners, such as `pause`, `resume`, `volumedownbutton`, `batterylow`,
* `offline`, etc. More information about available event types can be found in
* [Cordova's event documentation](https://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#Events).
* @param {string} type Cordova [event type](https://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#Events).
* [Cordova's event documentation](https://cordova.apache.org/docs/en/latest/cordova/events/events.html).
* @param {string} type Cordova [event type](https://cordova.apache.org/docs/en/latest/cordova/events/events.html).
* @param {function} callback Called when the Cordova event is fired.
* @returns {function} Returns a deregistration function to remove the event listener.
*/
Expand Down Expand Up @@ -3126,7 +3129,7 @@ IonicModule
* $scope.$on('$destroy', function() {
* $scope.popover.remove();
* });
* // Execute action on hide popover
* // Execute action on hidden popover
* $scope.$on('popover.hidden', function() {
* // Execute action
* });
Expand Down Expand Up @@ -7769,20 +7772,15 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io

self.content.setTranslateX(amount);

if (amount >= 0) {
leftShowing = true;
rightShowing = false;
leftShowing = amount > 0;
rightShowing = amount < 0;

if (amount > 0) {
// Push the z-index of the right menu down
self.right && self.right.pushDown && self.right.pushDown();
// Bring the z-index of the left menu up
self.left && self.left.bringUp && self.left.bringUp();
}
if (amount > 0) {
// Push the z-index of the right menu down
self.right && self.right.pushDown && self.right.pushDown();
// Bring the z-index of the left menu up
self.left && self.left.bringUp && self.left.bringUp();
} else {
rightShowing = true;
leftShowing = false;

// Bring the z-index of the right menu up
self.right && self.right.bringUp && self.right.bringUp();
// Push the z-index of the left menu down
Expand Down Expand Up @@ -11068,9 +11066,9 @@ IonicModule.directive('ionOptionButton', [function() {
return function($scope, $element, $attr, itemCtrl) {
if (!itemCtrl.optionsContainer) {
itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);
itemCtrl.$element.append(itemCtrl.optionsContainer);
itemCtrl.$element.prepend(itemCtrl.optionsContainer);
}
itemCtrl.optionsContainer.append($element);
itemCtrl.optionsContainer.prepend($element);

itemCtrl.$element.addClass('item-right-editable');

Expand Down Expand Up @@ -11780,7 +11778,6 @@ IonicModule
* @param {boolean=} no-tap-scroll By default, the navbar will scroll the content
* to the top when tapped. Set no-tap-scroll to true to disable this behavior.
*
* </table><br/>
*/
IonicModule
.directive('ionNavBar', function() {
Expand Down Expand Up @@ -12499,7 +12496,9 @@ IonicModule

$scope.$on('scroll.refreshComplete', function() {
$scope.$evalAsync(function() {
scrollCtrl.scrollView.finishPullToRefresh();
if(scrollCtrl.scrollView){
scrollCtrl.scrollView.finishPullToRefresh();
}
});
});
}
Expand Down Expand Up @@ -12541,6 +12540,7 @@ IonicModule
* @param {boolean=} paging Whether to scroll with paging.
* @param {expression=} on-refresh Called on pull-to-refresh, triggered by an {@link ionic.directive:ionRefresher}.
* @param {expression=} on-scroll Called whenever the user scrolls.
* @param {expression=} on-scroll-complete Called whenever the scrolling paging is completed.
* @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.
* @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.
* @param {boolean=} zooming Whether to support pinch-to-zoom
Expand Down Expand Up @@ -12576,6 +12576,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
direction: '@',
paging: '@',
$onScroll: '&onScroll',
$onScrollComplete: '&onScrollComplete',
scroll: '@',
scrollbarX: '@',
scrollbarY: '@',
Expand Down Expand Up @@ -12617,18 +12618,26 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
maxZoom: $scope.$eval($scope.maxZoom) || 3,
minZoom: $scope.$eval($scope.minZoom) || 0.5,
preventDefault: true,
nativeScrolling: nativeScrolling
nativeScrolling: nativeScrolling,
scrollingComplete: onScrollComplete
};

if (isPaging) {
scrollViewOptions.speedMultiplier = 0.8;
scrollViewOptions.bouncing = false;
}

$controller('$ionicScroll', {
var scrollCtrl = $controller('$ionicScroll', {
$scope: $scope,
scrollViewOptions: scrollViewOptions
});

function onScrollComplete() {
$scope.$onScrollComplete && $scope.$onScrollComplete({
scrollTop: scrollCtrl.scrollView.__scrollTop,
scrollLeft: scrollCtrl.scrollView.__scrollLeft
});
}
}
}
};
Expand Down Expand Up @@ -13332,8 +13341,8 @@ function($animate, $timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $i
*
* $scope.$on("$ionicSlides.slideChangeEnd", function(event, data){
* // note: the indexes are 0-based
* $scope.activeIndex = data.activeIndex;
* $scope.previousIndex = data.previousIndex;
* $scope.activeIndex = data.slider.activeIndex;
* $scope.previousIndex = data.slider.previousIndex;
* });
*
* ```
Expand Down
8 changes: 4 additions & 4 deletions ionic/js/ionic-angular.min.js

Large diffs are not rendered by default.

Loading