port 'getting started' to a backbone view, revert filename changes
This commit is contained in:
parent
9560a8ec61
commit
4090f134f2
4 changed files with 68 additions and 57 deletions
|
|
@ -3,63 +3,63 @@
|
||||||
* the COPYRIGHT file.
|
* the COPYRIGHT file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function(){
|
// Getting started view for the publisher.
|
||||||
// mixin-object, used in conjunction with the publisher to provide the
|
// Provides "getting started" popups around the elements of the publisher
|
||||||
// functionality for displaying 'getting-started' information
|
// for describing their use to new users.
|
||||||
app.views.PublisherGettingStarted = {
|
app.views.PublisherGettingStarted = Backbone.View.extend({
|
||||||
|
|
||||||
// initiate all the popover message boxes
|
// initiate all the popover message boxes
|
||||||
triggerGettingStarted: function() {
|
show: function() {
|
||||||
this._addPopover(this.el_input, {
|
this._addPopover(this.options.el_first_msg, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
offset: 30,
|
offset: 30,
|
||||||
id: 'first_message_explain',
|
id: 'first_message_explain',
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
html: true
|
html: true
|
||||||
}, 600);
|
}, 600);
|
||||||
this._addPopover(this.$('.dropdown'), {
|
this._addPopover(this.options.el_visibility, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
offset: 10,
|
offset: 10,
|
||||||
id: 'message_visibility_explain',
|
id: 'message_visibility_explain',
|
||||||
placement: 'bottom',
|
placement: 'bottom',
|
||||||
html: true
|
html: true
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this._addPopover($('#gs-shim'), {
|
this._addPopover(this.options.el_stream, {
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
offset: -5,
|
offset: -5,
|
||||||
id: 'stream_explain',
|
id: 'stream_explain',
|
||||||
placement: 'left',
|
placement: 'left',
|
||||||
html: true
|
html: true
|
||||||
}, 1400);
|
}, 1400);
|
||||||
|
|
||||||
// hide some popovers when a post is created
|
// hide some popovers when a post is created
|
||||||
this.$('.button.creation').click(function() {
|
this.$('.button.creation').click(function() {
|
||||||
this.$('.dropdown').popover('hide');
|
this.options.el_visibility.popover('hide');
|
||||||
this.el_input.popover('hide');
|
this.options.el_first_msg.popover('hide');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_addPopover: function(el, opts, timeout) {
|
_addPopover: function(el, opts, timeout) {
|
||||||
el.popover(opts);
|
el.popover(opts);
|
||||||
el.click(function() {
|
el.click(function() {
|
||||||
|
el.popover('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
// show the popover after the given timeout
|
||||||
|
setTimeout(function() {
|
||||||
|
el.popover('show');
|
||||||
|
|
||||||
|
// disable 'getting started' when the last popover is closed
|
||||||
|
var popup = el.data('popover').$tip[0];
|
||||||
|
var close = $(popup).find('.close');
|
||||||
|
|
||||||
|
close.click(function() {
|
||||||
|
if( $('.popover').length==1 ) {
|
||||||
|
$.get('/getting_started_completed');
|
||||||
|
}
|
||||||
el.popover('hide');
|
el.popover('hide');
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
}, timeout);
|
||||||
// show the popover after the given timeout
|
}
|
||||||
setTimeout(function() {
|
});
|
||||||
el.popover('show');
|
|
||||||
|
|
||||||
// disable 'getting started' when the last popover is closed
|
|
||||||
var popup = el.data('popover').$tip[0];
|
|
||||||
var close = $(popup).find('.close');
|
|
||||||
|
|
||||||
close.click(function() {
|
|
||||||
if( $('.popover').length==1 ) {
|
|
||||||
$.get('/getting_started_completed');
|
|
||||||
}
|
|
||||||
el.popover('hide');
|
|
||||||
});
|
|
||||||
}, timeout);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
* the COPYRIGHT file.
|
* the COPYRIGHT file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//= require ./publisher/publisher_services
|
//= require ./publisher/services
|
||||||
//= require ./publisher/publisher_aspect_selector
|
//= require ./publisher/aspect_selector
|
||||||
//= require ./publisher/getting_started
|
//= require ./publisher/getting_started
|
||||||
//= require jquery.textchange
|
//= require jquery.textchange
|
||||||
|
|
||||||
|
|
@ -82,6 +82,12 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
el: this.$('.public_toggle > .dropdown'),
|
el: this.$('.public_toggle > .dropdown'),
|
||||||
form: form
|
form: form
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.view_getting_started = new app.views.PublisherGettingStarted({
|
||||||
|
el_first_msg: this.el_input,
|
||||||
|
el_visibility: this.$('.public_toggle > .dropdown'),
|
||||||
|
el_stream: $('#gs-shim')
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// set the selected aspects in the dropdown by their ids
|
// set the selected aspects in the dropdown by their ids
|
||||||
|
|
@ -89,6 +95,11 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
this.view_aspect_selector.updateAspectsSelector(ids);
|
this.view_aspect_selector.updateAspectsSelector(ids);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// show the "getting started" popups around the publisher
|
||||||
|
triggerGettingStarted: function() {
|
||||||
|
this.view_getting_started.show();
|
||||||
|
},
|
||||||
|
|
||||||
createStatusMessage : function(evt) {
|
createStatusMessage : function(evt) {
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue