Trigger getting started with backbone
This commit is contained in:
parent
14304f3620
commit
b8c76a3317
9 changed files with 13 additions and 19 deletions
|
|
@ -18,7 +18,6 @@ app.views.PublisherGettingStarted = Backbone.View.extend({
|
||||||
|
|
||||||
// initiate all the popover message boxes
|
// initiate all the popover message boxes
|
||||||
show: function() {
|
show: function() {
|
||||||
app.publisher.open();
|
|
||||||
this._addPopover(this.firstMessage, {
|
this._addPopover(this.firstMessage, {
|
||||||
trigger: "manual",
|
trigger: "manual",
|
||||||
id: "first_message_explain",
|
id: "first_message_explain",
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
|
|
||||||
this.initSubviews();
|
this.initSubviews();
|
||||||
this.checkSubmitAvailability();
|
this.checkSubmitAvailability();
|
||||||
|
this.triggerGettingStarted();
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -184,7 +185,10 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
|
|
||||||
// show the "getting started" popups around the publisher
|
// show the "getting started" popups around the publisher
|
||||||
triggerGettingStarted: function() {
|
triggerGettingStarted: function() {
|
||||||
|
if (gon.preloads.getting_started) {
|
||||||
|
this.open();
|
||||||
this.viewGettingStarted.show();
|
this.viewGettingStarted.show();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
createStatusMessage : function(evt) {
|
createStatusMessage : function(evt) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ class StreamsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def multi
|
def multi
|
||||||
|
gon.preloads[:getting_started] = current_user.getting_started
|
||||||
stream_responder(Stream::Multi)
|
stream_responder(Stream::Multi)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,4 @@ module InterimStreamHackinessHelper
|
||||||
def publisher_public
|
def publisher_public
|
||||||
publisher_method(:public)
|
publisher_method(:public)
|
||||||
end
|
end
|
||||||
|
|
||||||
def publisher_explain
|
|
||||||
publisher_method(:explain)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,3 @@
|
||||||
-if publisher_explain
|
|
||||||
:javascript
|
|
||||||
$(document).ready(function() {
|
|
||||||
if( app.publisher ) app.publisher.triggerGettingStarted();
|
|
||||||
});
|
|
||||||
|
|
||||||
.row.publisher#publisher{class: ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")}
|
.row.publisher#publisher{class: ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")}
|
||||||
.content_creation
|
.content_creation
|
||||||
= form_for(StatusMessage.new) do |status|
|
= form_for(StatusMessage.new) do |status|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
class Publisher
|
class Publisher
|
||||||
attr_accessor :user, :open, :prefill, :public, :explain
|
attr_accessor :user, :open, :prefill, :public
|
||||||
|
|
||||||
def initialize(user, opts={})
|
def initialize(user, opts={})
|
||||||
self.user = user
|
self.user = user
|
||||||
self.open = opts[:open]
|
self.open = opts[:open]
|
||||||
self.prefill = opts[:prefill]
|
self.prefill = opts[:prefill]
|
||||||
self.public = opts[:public]
|
self.public = opts[:public]
|
||||||
self.explain = opts[:explain]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def text
|
def text
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,10 @@ class Stream::Multi < Stream::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def publisher_opts
|
def publisher_opts
|
||||||
if welcome?
|
if welcome?
|
||||||
{open: true, prefill: publisher_prefill, public: true, explain: true}
|
{open: true, prefill: publisher_prefill, public: true}
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ describe Publisher do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
["open", "public", "explain"].each do |property|
|
%w(open public).each do |property|
|
||||||
describe "##{property}" do
|
describe "##{property}" do
|
||||||
it 'defaults to closed' do
|
it 'defaults to closed' do
|
||||||
expect(@publisher.send("#{property}".to_sym)).to be_falsey
|
expect(@publisher.send("#{property}".to_sym)).to be_falsey
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ describe Stream::Multi do
|
||||||
prefill_text = "sup?"
|
prefill_text = "sup?"
|
||||||
allow(@stream).to receive(:welcome?).and_return(true)
|
allow(@stream).to receive(:welcome?).and_return(true)
|
||||||
allow(@stream).to receive(:publisher_prefill).and_return(prefill_text)
|
allow(@stream).to receive(:publisher_prefill).and_return(prefill_text)
|
||||||
expect(@stream.send(:publisher_opts)).to eq(open: true, prefill: prefill_text, public: true, explain: true)
|
expect(@stream.send(:publisher_opts)).to eq(open: true, prefill: prefill_text, public: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'provides no opts if welcome? is not set' do
|
it 'provides no opts if welcome? is not set' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue