Skip to content

Commit

Permalink
modal after upload showing link to viewer URL
Browse files Browse the repository at this point in the history
  • Loading branch information
seanrose committed Apr 5, 2014
1 parent 471119c commit 7d1fba3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
22 changes: 18 additions & 4 deletions client/views/presentations/presentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
<button type="button" id="previous" class="btn presentation-btn btn-default btn-lg pull-right"><span class="glyphicon glyphicon-chevron-left"></span></button>
{{/if}}
</div>
{{#if sessionId}}
{{else}}
<h1>session is available!</h1>
{{/if}}
<div class="col-xs-10">
<div class="viewer crocodoc-presentation transition not-visible"></div>
</div>
Expand All @@ -18,4 +14,22 @@ <h1>session is available!</h1>
{{/if}}
</div>
</div>
{{#if isPresenter}}
<div class="modal fade" id="viewer-link-modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Share this link with people you want to present to!</h4>
</div>
<div class="modal-body">
<p><a href="{{pathFor 'viewer'}}" target="_blank">{{baseUrl}}{{pathFor 'viewer'}}</a></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-lg btn-block btn-primary" data-dismiss="modal">Take me to my presentation...</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{{/if}}
</template>
18 changes: 14 additions & 4 deletions client/views/presentations/presentation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Template.presentation.helpers({
isPresenter: function() {
return Session.get('isPresenter');
},

baseUrl: function() {
return window.location.protocol+"//"+window.location.host;
}
});

Expand All @@ -16,11 +20,17 @@ Template.presentation.rendered = function() {
viewer.load();

viewer.on('ready', function() {
// Delay because the viewer loads slightly before the template is ready
// there is probably a better way of doing this?
_.delay(function() {
if (Session.get('isPresenter')) {
// When the Box viewer is ready, show the modal with the viewer linik
var $viewerLinkModal = $('#viewer-link-modal');
$viewerLinkModal.modal('show');
// When the user closes the modal, fade in the presentation
$viewerLinkModal.on('hidden.bs.modal', function() {
$('.viewer').addClass('fade-in');
});
} else {
$('.viewer').addClass('fade-in');
}, 700);
}
});

// Update the DB whenever the page changes
Expand Down
2 changes: 1 addition & 1 deletion client/views/presentations/upload.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Template.upload.events({
'click #upload': function(e) {
e.preventDefault();
$('#upload').addClass('fade-out');
filepicker.setKey('A3UuvGmumRN273ixbsJnVz');
filepicker.pick(function(InkBlob) {
Meteor.call('createPresentation', InkBlob.url, function(error, presentationId) {
$('#upload').addClass('fade-out');
Router.go('presenter', {_id: presentationId});
});
});
Expand Down

0 comments on commit 7d1fba3

Please sign in to comment.