Skip to content

Commit

Permalink
Merge pull request #62 from synec/config-template-urls
Browse files Browse the repository at this point in the history
configurable template urls
  • Loading branch information
pedroabreu committed May 11, 2016
2 parents d9c8f03 + a73838b commit 324dafb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ Default values in example.
app.config(function(ionGalleryConfigProvider) {
ionGalleryConfigProvider.setGalleryConfig({
action_label: 'Close',
template_gallery: 'gallery.html',
template_slider: 'slider.html',
toggle: false,
row_size: 3,
fixed_row_size: true
Expand All @@ -71,6 +73,8 @@ app.config(function(ionGalleryConfigProvider) {
```
Default values
action_label - 'Close' (String)
template_gallery - 'gallery.html' (String)
template_slider - 'slider.html' (String)
toggle - false (Boolean)
row_size - 3 (Int)
fixed_row_size - true (boolean). If true, thumbnails in gallery will always be sized as if there are "row_size" number of images in a row (even if there aren't). If set to false, the row_size will be dynamic until it reaches the set row_size (Ex: if only 1 image it will be rendered in the entire row, if 2 images, both will be rendered in the entire row)
Expand Down
10 changes: 6 additions & 4 deletions dist/ion-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
controller: controller,
link: link,
replace: true,
templateUrl: 'gallery.html'
templateUrl: ionGalleryConfig.template_gallery
};

function controller($scope) {
Expand Down Expand Up @@ -66,6 +66,8 @@
function ionGalleryConfig(){
this.config = {
action_label: 'Done',
template_gallery: 'gallery.html',
template_slider: 'slider.html',
toggle: true,
row_size: 3,
fixed_row_size: true,
Expand Down Expand Up @@ -278,9 +280,9 @@
.module('ion-gallery')
.directive('ionSlider',ionSlider);

ionSlider.$inject = ['$ionicModal','$timeout','$ionicScrollDelegate','ionSliderHelper'];
ionSlider.$inject = ['$ionicModal','$timeout','$ionicScrollDelegate','ionSliderHelper','ionGalleryConfig'];

function ionSlider($ionicModal,$timeout,$ionicScrollDelegate,ionSliderHelper){
function ionSlider($ionicModal,$timeout,$ionicScrollDelegate,ionSliderHelper,ionGalleryConfig){

controller.$inject = ["$scope"];
return {
Expand Down Expand Up @@ -430,7 +432,7 @@
function link(scope, element, attrs) {
var _modal;

$ionicModal.fromTemplateUrl('slider.html', {
$ionicModal.fromTemplateUrl(ionGalleryConfig.template_slider, {
scope: scope,
animation: 'fade-in'
}).then(function(modal){
Expand Down
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.

2 changes: 1 addition & 1 deletion src/js/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
controller: controller,
link: link,
replace: true,
templateUrl: 'gallery.html'
templateUrl: ionGalleryConfig.template_gallery
};

function controller($scope) {
Expand Down
2 changes: 2 additions & 0 deletions src/js/galleryConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
function ionGalleryConfig(){
this.config = {
action_label: 'Done',
template_gallery: 'gallery.html',
template_slider: 'slider.html',
toggle: true,
row_size: 3,
fixed_row_size: true,
Expand Down
6 changes: 3 additions & 3 deletions src/js/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
.module('ion-gallery')
.directive('ionSlider',ionSlider);

ionSlider.$inject = ['$ionicModal','$timeout','$ionicScrollDelegate','ionSliderHelper'];
ionSlider.$inject = ['$ionicModal','$timeout','$ionicScrollDelegate','ionSliderHelper','ionGalleryConfig'];

function ionSlider($ionicModal,$timeout,$ionicScrollDelegate,ionSliderHelper){
function ionSlider($ionicModal,$timeout,$ionicScrollDelegate,ionSliderHelper,ionGalleryConfig){

return {
restrict: 'A',
Expand Down Expand Up @@ -156,7 +156,7 @@
function link(scope, element, attrs) {
var _modal;

$ionicModal.fromTemplateUrl('slider.html', {
$ionicModal.fromTemplateUrl(ionGalleryConfig.template_slider, {
scope: scope,
animation: 'fade-in'
}).then(function(modal){
Expand Down

0 comments on commit 324dafb

Please sign in to comment.