Skip to content

Commit

Permalink
rename callback to action
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroabreu committed Apr 1, 2016
1 parent da91935 commit 4a0b5a7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ Markup overrides provider definitions

<ion-gallery ion-gallery-items="items" ion-gallery-toggle="false"></ion-gallery>

- ion-item-callback: Overrides the default action with a custom callback when an item is tapped. Default: opens the slider modal
- ion-item-action: Overrides the default action when a gallery item is tapped. Default: opens the slider modal

<ion-gallery ion-gallery-items="items" ion-item-callback="callback(item)"></ion-gallery>
<ion-gallery ion-gallery-items="items" ion-item-action="itemAction(item)"></ion-gallery>

- ion-zoom-events: Enable/Disable all zoom events in slider (pinchToZoom, tap and double tap). Default: true

Expand Down
7 changes: 3 additions & 4 deletions dist/ion-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
scope: {
ionGalleryItems: '=ionGalleryItems',
ionGalleryRowSize: '=?ionGalleryRow',
ionItemCallback: '&?ionItemCallback',
ionItemAction: '&?ionItemAction',
ionZoomEvents: '=?ionZoomEvents'
},
controller: controller,
Expand Down Expand Up @@ -48,8 +48,7 @@
}

function link(scope, element, attrs) {

scope.customCallback = angular.isFunction(scope.ionItemCallback) && attrs.hasOwnProperty('ionItemCallback');
scope.customItemAction = angular.isFunction(scope.ionItemAction) && attrs.hasOwnProperty('ionItemAction');
scope.ionSliderToggle = attrs.ionGalleryToggle === 'false' ? false : ionGalleryConfig.toggle;
}
}
Expand Down Expand Up @@ -479,5 +478,5 @@
}
})();

angular.module("templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("gallery.html","<div class=\"gallery-view\">\n <div class=\"row\" ng-repeat=\"item in items track by $index\" ion-row-height>\n <div ng-repeat=\"photo in item track by $index\"\n class=\"col col-{{responsiveGrid}} image-container\">\n\n <img ion-image-scale\n ng-src=\"{{photo.thumb || photo.src}}\"\n ng-click=\"customCallback ? ionItemCallback({item:photo}) : openSlider(photo.position)\">\n\n </div>\n </div>\n <div ion-slider></div>\n</div>\n");
angular.module("templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("gallery.html","<div class=\"gallery-view\">\n <div class=\"row\" ng-repeat=\"item in items track by $index\" ion-row-height>\n <div ng-repeat=\"photo in item track by $index\"\n class=\"col col-{{responsiveGrid}} image-container\">\n\n <img ion-image-scale\n ng-src=\"{{photo.thumb}}\"\n ng-click=\"customItemAction ? ionItemAction({item: photo}) : openSlider(photo.position)\">\n\n </div>\n </div>\n <div ion-slider></div>\n</div>\n");
$templateCache.put("slider.html","<ion-modal-view class=\"imageView\">\n <ion-header-bar class=\"headerView\" ng-show=\"!hideAll\">\n <button class=\"button button-outline button-light close-btn\" ng-click=\"closeModal()\">{{::actionLabel}}</button>\n </ion-header-bar>\n\n <ion-content class=\"has-no-header\" scroll=\"false\">\n <ion-slide-box does-continue=\"true\" active-slide=\"selectedSlide\" show-pager=\"false\" class=\"listContainer\" on-slide-changed=\"slideChanged($index)\">\n <ion-slide ng-repeat=\"single in slides track by $index\">\n <ion-scroll direction=\"xy\"\n locking=\"false\"\n zooming=\"{{ionZoomEvents}}\"\n min-zoom=\"1\"\n scrollbar-x=\"false\"\n scrollbar-y=\"false\"\n ion-slide-action\n delegate-handle=\"slide-{{$index}}\"\n overflow-scroll=\"false\"\n >\n <div class=\"item item-image gallery-slide-view\">\n <img ng-src=\"{{single.src}}\">\n </div>\n <div ng-if=\"single.sub && single.sub.length > 0\" class=\"image-subtitle\" ng-show=\"!hideAll\">\n <span ng-bind-html=\'single.sub\'></span>\n </div>\n </ion-scroll>\n </ion-slide>\n </ion-slide-box>\n </ion-content>\n</ion-modal-view>\n");}]);
2 changes: 1 addition & 1 deletion dist/ion-gallery.min.js

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

5 changes: 2 additions & 3 deletions src/js/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
scope: {
ionGalleryItems: '=ionGalleryItems',
ionGalleryRowSize: '=?ionGalleryRow',
ionItemCallback: '&?ionItemCallback',
ionItemAction: '&?ionItemAction',
ionZoomEvents: '=?ionZoomEvents'
},
controller: controller,
Expand Down Expand Up @@ -47,8 +47,7 @@
}

function link(scope, element, attrs) {

scope.customCallback = angular.isFunction(scope.ionItemCallback) && attrs.hasOwnProperty('ionItemCallback');
scope.customItemAction = angular.isFunction(scope.ionItemAction) && attrs.hasOwnProperty('ionItemAction');
scope.ionSliderToggle = attrs.ionGalleryToggle === 'false' ? false : ionGalleryConfig.toggle;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/templates/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
class="col col-{{responsiveGrid}} image-container">

<img ion-image-scale
ng-src="{{photo.thumb || photo.src}}"
ng-click="customCallback ? ionItemCallback({item:photo}) : openSlider(photo.position)">
ng-src="{{photo.thumb}}"
ng-click="customItemAction ? ionItemAction({item: photo}) : openSlider(photo.position)">

</div>
</div>
Expand Down

0 comments on commit 4a0b5a7

Please sign in to comment.