port 'getting started' to a backbone view, revert filename changes

This commit is contained in:
Florian Staudacher 2013-08-30 14:51:52 +02:00
parent 9560a8ec61
commit 4090f134f2
4 changed files with 68 additions and 57 deletions

View file

@ -3,28 +3,28 @@
* 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',
@ -34,8 +34,8 @@
// 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');
}); });
}, },
@ -58,8 +58,8 @@
$.get('/getting_started_completed'); $.get('/getting_started_completed');
} }
el.popover('hide'); el.popover('hide');
return false;
}); });
}, timeout); }, timeout);
} }
}; });
})();

View file

@ -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(); }