Skip to content

Commit

Permalink
added onSlideClicked handler to carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
pruhsert committed Jul 21, 2017
1 parent 6d6728a commit 5886d96
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 12 deletions.
10 changes: 5 additions & 5 deletions bootstrapExtraComponentsDemo/.buildpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry excluding=".stp/|medias/" kind="src" path=""/>
<buildpathentry exported="true" kind="prj" path="/svyMicroSamples"/>
</buildpath>
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry excluding=".stp/|medias/" kind="src" path=""/>
<buildpathentry exported="true" kind="prj" path="/svyMicroSamples"/>
</buildpath>
1 change: 1 addition & 0 deletions bootstrapExtraComponentsDemo/forms/demoCarouselManual.frm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ y:47
},
noPause:false,
noTransition:false,
onSlideClicked:"34B28027-34B3-4085-9669-BEF987400206",
size:{
height:400,
width:533
Expand Down
12 changes: 12 additions & 0 deletions bootstrapExtraComponentsDemo/forms/demoCarouselManual.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,15 @@ function onDataChange_noPause(oldValue, newValue, event) {
function onAction_btnRemoveSlide(event) {
elements.carousel.removeSlide(0);
}

/**
* @param {JSEvent} event
* @param {bootstrapextracomponents-carousel.slide} slide
*
* @private
*
* @properties={typeid:24,uuid:"34B28027-34B3-4085-9669-BEF987400206"}
*/
function onSlideClicked(event, slide) {
application.output('Click on slide ' + slide.imageUrl);
}
6 changes: 3 additions & 3 deletions bootstrapExtraComponentsDemo/forms/main.frm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ items:[
anchors:3,
formIndex:1,
horizontalAlignment:4,
location:"247,40",
location:"207,40",
name:"lblSolutionName",
size:"363,80",
size:"413,80",
styleClass:"banner",
text:"Example Solution",
transparent:true,
Expand Down Expand Up @@ -99,7 +99,7 @@ uuid:"F21AE5D6-F785-4453-94DC-A23F40777F33"
},
{
anchors:11,
imageMediaID:"784D56FB-FF89-4A5D-AED4-FB1730A774F7",
imageMediaID:"881A887F-2DE9-4632-B53E-89314E3ACECC",
location:"20,0",
size:"600,120",
styleClass:"banner-orange",
Expand Down
7 changes: 7 additions & 0 deletions bootstrapExtraComponentsDemo/medias.obj
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@ mimeType:"image/png",
name:"servoy_logo.png",
typeid:37,
uuid:"BAF87A22-88C2-42EE-BD88-D10BAACA7D62"
},
{
encapsulation:0,
mimeType:"image/png",
name:"servoy_logo_next_gen.png",
typeid:37,
uuid:"881A887F-2DE9-4632-B53E-89314E3ACECC"
}
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bootstrapextracomponents/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-SymbolicName: bootstrapextracomponents
Bundle-Name: Bootstrap Extra Components
Bundle-Version: 1.1.4
Bundle-Version: 1.1.5
Package-Type: Web-Component

Name: badge/badge.spec
Expand Down
2 changes: 2 additions & 0 deletions bootstrapextracomponents/carousel/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
class="bts-extra-carousel-img"
ng-style="model.imageCssInternal"
ng-if="model.lazyLoading" src="bootstrapextracomponents/carousel/resources/loading.gif"
ng-click="onClick($event,slide)"
btse-carousel-smart-src="{{slide.image != null && slide.image.url != null ? slide.image.url : 'bootstrapextracomponents/carousel/resources/missing.png'}}"
btse-carousel-smart-src-watch="slide.active"
>
<img
class="bts-extra-carousel-img"
ng-style="model.imageCssInternal"
ng-click="onClick($event,slide)"
ng-if="!model.lazyLoading" src="bootstrapextracomponents/carousel/resources/loading.gif" ng-src="{{slide.image != null && slide.image.url != null ? slide.image.url : 'bootstrapextracomponents/carousel/resources/missing.png'}}"
>
<div ng-if="slide.caption" class="carousel-caption">
Expand Down
20 changes: 19 additions & 1 deletion bootstrapextracomponents/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,32 @@ angular.module('bootstrapextracomponentsCarousel', ['servoy']).directive('bootst
}
}, true);
},
controller: function($scope, $element, $attrs) {
controller: function($scope, $element, $attrs, $utils) {
if ($scope.svyServoyapi.isInDesigner() && !($scope.model.slides || $scope.model.slides.length == 0)) {
$scope.model.slides = [
{ image: 'http://lorempixel.com/400/200/' },
{ image: 'http://lorempixel.com/400/200/food' },
{ image: 'http://lorempixel.com/400/200/sports' },
{ image: 'http://lorempixel.com/400/200/people' }];
}

function getSlide(slide) {
var result = {imageUrl: null, caption: null};
if (slide.image && slide.image.url) {
result.imageUrl = slide.image.url;
}
if (slide.caption) {
result.caption = slide.caption;
}
return result;
}

$scope.onClick = function(event, slide) {
if ($scope.handlers.onSlideClicked) {
var jsEvent = $utils.createJSEvent(event, 'action');
$scope.handlers.onSlideClicked(jsEvent, getSlide(slide));
}
}
},
templateUrl: 'bootstrapextracomponents/carousel/carousel.html'
};
Expand Down
9 changes: 9 additions & 0 deletions bootstrapextracomponents/carousel/carousel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@
]
}
},
"handlers":
{
"onSlideClicked": {
"parameters": [
{ "name": "event", "type": "JSEvent" },
{ "name": "slide", "type": "slide" }
]
}
},
"types":
{
"slide": {
Expand Down
5 changes: 3 additions & 2 deletions webpackage.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
{"version":"1.1.0","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.0/bootstrapextracomponents.zip", "servoy-version":"8.1.1"},
{"version":"1.1.1","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.1/bootstrapextracomponents.zip", "servoy-version":"8.1.1"},
{"version":"1.1.2","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.2/bootstrapextracomponents.zip", "servoy-version":"8.1.1"},
{"version":"1.1.3","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.3/bootstrapextracomponents.zip", "servoy-version":"8.1.4"},
{"version":"1.1.4","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.4/bootstrapextracomponents.zip", "servoy-version":"8.1.4"}
{"version":"1.1.3","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.3/bootstrapextracomponents.zip", "servoy-version":"8.1.4"},
{"version":"1.1.4","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.4/bootstrapextracomponents.zip", "servoy-version":"8.1.4"},
{"version":"1.1.5","url":"https://github.com/Servoy/bootstrapextracomponents/releases/download/v1.1.5/bootstrapextracomponents.zip", "servoy-version":"8.1.4-8.2.0"}
]
}

0 comments on commit 5886d96

Please sign in to comment.