diff --git a/app/assets/javascripts/app/views/publisher/getting_started_view.js b/app/assets/javascripts/app/views/publisher/getting_started_view.js index 5ba089efc..02a025e0a 100644 --- a/app/assets/javascripts/app/views/publisher/getting_started_view.js +++ b/app/assets/javascripts/app/views/publisher/getting_started_view.js @@ -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", diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index 1b9f2f56c..de9245027 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -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) { diff --git a/app/controllers/streams_controller.rb b/app/controllers/streams_controller.rb index f8e8b422f..18ec1837f 100644 --- a/app/controllers/streams_controller.rb +++ b/app/controllers/streams_controller.rb @@ -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 diff --git a/app/helpers/interim_stream_hackiness_helper.rb b/app/helpers/interim_stream_hackiness_helper.rb index 4219d29fe..c5d6992ab 100644 --- a/app/helpers/interim_stream_hackiness_helper.rb +++ b/app/helpers/interim_stream_hackiness_helper.rb @@ -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 diff --git a/app/views/publisher/_publisher.html.haml b/app/views/publisher/_publisher.html.haml index 4d85b0290..5e1ca38f1 100644 --- a/app/views/publisher/_publisher.html.haml +++ b/app/views/publisher/_publisher.html.haml @@ -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| diff --git a/lib/publisher.rb b/lib/publisher.rb index 71894b652..677afb89f 100644 --- a/lib/publisher.rb +++ b/lib/publisher.rb @@ -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 diff --git a/lib/stream/multi.rb b/lib/stream/multi.rb index 995804372..868a82228 100644 --- a/lib/stream/multi.rb +++ b/lib/stream/multi.rb @@ -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 diff --git a/spec/lib/publisher_spec.rb b/spec/lib/publisher_spec.rb index 0094f8f49..abbd5ab5b 100644 --- a/spec/lib/publisher_spec.rb +++ b/spec/lib/publisher_spec.rb @@ -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 diff --git a/spec/lib/stream/multi_spec.rb b/spec/lib/stream/multi_spec.rb index 5c1df2468..8f84caf54 100644 --- a/spec/lib/stream/multi_spec.rb +++ b/spec/lib/stream/multi_spec.rb @@ -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