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
|
||||
show: function() {
|
||||
app.publisher.open();
|
||||
this._addPopover(this.firstMessage, {
|
||||
trigger: "manual",
|
||||
id: "first_message_explain",
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ app.views.Publisher = Backbone.View.extend({
|
|||
|
||||
this.initSubviews();
|
||||
this.checkSubmitAvailability();
|
||||
this.triggerGettingStarted();
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
@ -184,7 +185,10 @@ app.views.Publisher = Backbone.View.extend({
|
|||
|
||||
// show the "getting started" popups around the publisher
|
||||
triggerGettingStarted: function() {
|
||||
this.viewGettingStarted.show();
|
||||
if (gon.preloads.getting_started) {
|
||||
this.open();
|
||||
this.viewGettingStarted.show();
|
||||
}
|
||||
},
|
||||
|
||||
createStatusMessage : function(evt) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ class StreamsController < ApplicationController
|
|||
end
|
||||
|
||||
def multi
|
||||
stream_responder(Stream::Multi)
|
||||
gon.preloads[:getting_started] = current_user.getting_started
|
||||
stream_responder(Stream::Multi)
|
||||
end
|
||||
|
||||
def commented
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module InterimStreamHackinessHelper
|
|||
if params[:prefill].present?
|
||||
params[:prefill]
|
||||
elsif defined?(@stream)
|
||||
@stream.publisher.prefill
|
||||
@stream.publisher.prefill
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
|
@ -50,8 +50,4 @@ module InterimStreamHackinessHelper
|
|||
def publisher_public
|
||||
publisher_method(:public)
|
||||
end
|
||||
|
||||
def publisher_explain
|
||||
publisher_method(:explain)
|
||||
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")}
|
||||
.content_creation
|
||||
= form_for(StatusMessage.new) do |status|
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
class Publisher
|
||||
attr_accessor :user, :open, :prefill, :public, :explain
|
||||
attr_accessor :user, :open, :prefill, :public
|
||||
|
||||
def initialize(user, opts={})
|
||||
self.user = user
|
||||
self.open = opts[:open]
|
||||
self.prefill = opts[:prefill]
|
||||
self.public = opts[:public]
|
||||
self.explain = opts[:explain]
|
||||
end
|
||||
|
||||
def text
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ class Stream::Multi < Stream::Base
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def publisher_opts
|
||||
if welcome?
|
||||
{open: true, prefill: publisher_prefill, public: true, explain: true}
|
||||
{open: true, prefill: publisher_prefill, public: true}
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ describe Publisher do
|
|||
end
|
||||
end
|
||||
|
||||
["open", "public", "explain"].each do |property|
|
||||
%w(open public).each do |property|
|
||||
describe "##{property}" do
|
||||
it 'defaults to closed' do
|
||||
expect(@publisher.send("#{property}".to_sym)).to be_falsey
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe Stream::Multi do
|
|||
prefill_text = "sup?"
|
||||
allow(@stream).to receive(:welcome?).and_return(true)
|
||||
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
|
||||
|
||||
it 'provides no opts if welcome? is not set' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue