diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index e6c5ac33697dd98a15df8d588e4b60e3922ac062..c8c952f24331744a7d81876941e8de051180048e 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -42,6 +42,12 @@ app.views.Publisher = Backbone.View.extend(_.extend( this.el_hiddenInput.val( this.el_input.val() ); } + // hide close button, in case publisher is standalone + // (e.g. bookmarklet, mentions popup) + if( this.options.standalone ) { + this.$('#hide_publisher').hide(); + } + // this has to be here, otherwise for some reason the callback for the // textchange event won't be called in Backbone... this.el_input.bind('textchange', $.noop); diff --git a/spec/javascripts/app/views/publisher_view_spec.js b/spec/javascripts/app/views/publisher_view_spec.js index b1c55e64a70138788ebb4c9413ae4440acb00d46..0e301847c3c75ce5623d46e994353258e7b9ed4c 100644 --- a/spec/javascripts/app/views/publisher_view_spec.js +++ b/spec/javascripts/app/views/publisher_view_spec.js @@ -4,6 +4,22 @@ */ describe("app.views.Publisher", function() { + describe("standalone", function() { + beforeEach(function() { + // should be jasmine helper + loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}}); + + spec.loadFixture("aspects_index"); + this.view = new app.views.Publisher({ + standalone: true + }); + }); + + it("hides the close button in standalone mode", function() { + expect(this.view.$('#hide_publisher').is(':visible')).toBeFalsy(); + }); + }); + context("plain publisher", function() { beforeEach(function() { // should be jasmine helper diff --git a/spec/javascripts/bookmarklet-spec.js b/spec/javascripts/bookmarklet-spec.js index 57ac4925a811c7674777b7f4c83ac0917fd3b55b..fee57d0e7480426b66d8a6886305020f3e1d35b6 100644 --- a/spec/javascripts/bookmarklet-spec.js +++ b/spec/javascripts/bookmarklet-spec.js @@ -16,6 +16,7 @@ describe("bookmarklet", function() { it('verifies we are using the bookmarklet', function(){ expect(app.publisher.options.standalone).toBeTruthy(); + expect(app.publisher.$('#hide_publisher').is(':visible')).toBeFalsy(); }); });