Skip to content

Commit

Permalink
step7
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayana committed Apr 20, 2015
1 parent 14dd74a commit 73cec82
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
43 changes: 40 additions & 3 deletions www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@ angular.module('jsconfuy.controllers', [])

})

.controller('SpeakersCtrl', function($scope, $http, Speakers) {
.controller('SpeakersCtrl', function($scope, $http, Speakers, $ionicLoading) {
$scope.speakers = [];

$ionicLoading.show({
template: 'Loading...'
});

Speakers.get()
.then(function(speakers){
$scope.speakers = speakers;
$ionicLoading.hide();
},function(err){
$ionicLoading.hide();
});

$scope.goToUrl = function(url){
//use inAppBrowser plugin
window.open(url, '_blank', 'location=yes');
}
})

.controller('VenueCtrl', function($scope) {
Expand All @@ -27,23 +38,49 @@ angular.module('jsconfuy.controllers', [])
})


.controller('AgendaCtrl', function($scope, Agenda) {
.controller('AgendaCtrl', function($scope, Agenda, $ionicLoading) {
$scope.events = [];

$ionicLoading.show({
template: 'Loading...'
});

Agenda.get()
.then(function(events){
$scope.events = events;
$ionicLoading.hide();
},function(err){
$ionicLoading.hide();
});
})

.controller('EventCtrl', function($scope, Agenda, $stateParams) {
.controller('EventCtrl', function($scope, Agenda, $stateParams, $ionicLoading) {
var eventId = $stateParams.eventId;

$ionicLoading.show({
template: 'Loading...'
});

Agenda.getEvent(eventId)
.then(function(event){
$scope.event = event;
$ionicLoading.hide();
},function(err){
$ionicLoading.hide();
});

$scope.shareEvent = function(event){
var speakersText = "";

_.each(event.speakers, function(speaker, index){
speakersText += speaker.name;
if((index+1) < event.speakers.length){
speakersText += " & ";
}
});

var messageToShare = event.title + " by " + speakersText + " at #JSConfUY";
window.plugins.socialsharing.share(messageToShare);
};

})
12 changes: 11 additions & 1 deletion www/templates/event.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
<ion-view class="event-view">
<ion-nav-buttons side="right">
<a class="button button-icon icon ion-share" ng-click="shareEvent(event)"></a>
</ion-nav-buttons>
<ion-nav-title>
<span>{{event.type}}</span>
</ion-nav-title>
<ion-content>
<img ng-src="{{event.speakers[0].image}}"/>
<ion-slide-box ng-show="event.speakers.length > 1" auto-play="true" does-continue="true">
<ion-slide ng-repeat="speaker in event.speakers">
<div style="width:100vw; overflow:hidden;">
<img ng-src="{{speaker.image}}"/>
</div>
</ion-slide>
</ion-slide-box>
<img ng-show="event.speakers.length == 1" ng-src="{{event.speakers[0].image}}"/>
<div>
<span ng-bind-html="event.title"></span>
<span ng-show="event.speakers">By
Expand Down
4 changes: 2 additions & 2 deletions www/templates/speakers.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ <h2>{{speaker.name}}</h2>
<p ng-bind-html="speaker.bio | rawHtml">
<div>
<div class="row">
<div class="col">
<a href="" class="button button-small button-outline button-block button-positive">@{{speaker.twitter}}</a>
<div ng-if="speaker.twitter" class="col">
<a href="" ng-click="goToUrl('http://twitter.com/{{speaker.twitter}}')" class="button button-small button-outline button-block button-positive">@{{speaker.twitter}}</a>
</div>
<div class="col">
<a ui-sref="app.event({eventId: speaker.event_id})" class="button button-small button-outline button-block button-positive">My talk</a>
Expand Down

0 comments on commit 73cec82

Please sign in to comment.