Move tag prefill to Backbone, add tests
This commit is contained in:
parent
b01026f9b8
commit
f6fbbbb5f6
9 changed files with 61 additions and 8 deletions
|
|
@ -106,6 +106,7 @@ app.Router = Backbone.Router.extend({
|
||||||
{tagText: decodeURIComponent(name).toLowerCase()}
|
{tagText: decodeURIComponent(name).toLowerCase()}
|
||||||
);
|
);
|
||||||
$("#author_info").prepend(followedTagsAction.render().el)
|
$("#author_info").prepend(followedTagsAction.render().el)
|
||||||
|
app.tags = new app.views.Tags({tagName: name});
|
||||||
}
|
}
|
||||||
this._hideInactiveStreamLists();
|
this._hideInactiveStreamLists();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
setText: function(txt) {
|
setText: function(txt) {
|
||||||
this.el_input.val(txt);
|
this.el_input.val(txt);
|
||||||
this.el_hiddenInput.val(txt);
|
this.el_hiddenInput.val(txt);
|
||||||
|
this.prefillText = txt;
|
||||||
|
|
||||||
this.el_input.trigger('input');
|
this.el_input.trigger('input');
|
||||||
this.handleTextchange();
|
this.handleTextchange();
|
||||||
|
|
@ -482,7 +483,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_beforeUnload: function(e) {
|
_beforeUnload: function(e) {
|
||||||
if(this._submittable()){
|
if(this._submittable() && this.el_input.val() != this.prefillText){
|
||||||
var confirmationMessage = Diaspora.I18n.t("confirm_unload");
|
var confirmationMessage = Diaspora.I18n.t("confirm_unload");
|
||||||
(e || window.event).returnValue = confirmationMessage; //Gecko + IE
|
(e || window.event).returnValue = confirmationMessage; //Gecko + IE
|
||||||
return confirmationMessage; //Webkit, Safari, Chrome, etc.
|
return confirmationMessage; //Webkit, Safari, Chrome, etc.
|
||||||
|
|
|
||||||
10
app/assets/javascripts/app/views/tags_view.js
Normal file
10
app/assets/javascripts/app/views/tags_view.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||||
|
|
||||||
|
app.views.Tags = Backbone.View.extend({
|
||||||
|
|
||||||
|
initialize: function(opts) {
|
||||||
|
app.publisher.setText("#"+ this.tagName + " ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// @license-end
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
%br
|
%br
|
||||||
|
|
||||||
%h4
|
%h4
|
||||||
= t('invitaitons.new.language')
|
= t('invitations.new.language')
|
||||||
= select_tag('email_inviter[locale]', options_from_collection_for_select(available_language_options, "second", "first", :selected => current_user.language))
|
= select_tag('email_inviter[locale]', options_from_collection_for_select(available_language_options, "second", "first", :selected => current_user.language))
|
||||||
|
|
||||||
%br
|
%br
|
||||||
|
|
|
||||||
|
|
@ -1240,7 +1240,6 @@ en:
|
||||||
tags:
|
tags:
|
||||||
title: "Posts tagged: %{tags}"
|
title: "Posts tagged: %{tags}"
|
||||||
contacts_title: "People who dig this tag"
|
contacts_title: "People who dig this tag"
|
||||||
tag_prefill_text: "%{tag_name} "
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
title: "Public Activity"
|
title: "Public Activity"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ Feature: invitation acceptance
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
And I confirm the alert
|
And I confirm the alert
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
|
And I close the publisher
|
||||||
|
|
||||||
Scenario: accept invitation from user
|
Scenario: accept invitation from user
|
||||||
Given I have been invited by bob
|
Given I have been invited by bob
|
||||||
|
|
@ -27,6 +28,7 @@ Feature: invitation acceptance
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
And I confirm the alert
|
And I confirm the alert
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
|
And I close the publisher
|
||||||
And I log out
|
And I log out
|
||||||
And I sign in as "bob@bob.bob"
|
And I sign in as "bob@bob.bob"
|
||||||
And I follow "By email"
|
And I follow "By email"
|
||||||
|
|
|
||||||
24
features/desktop/posts_from_tag_page.feature
Normal file
24
features/desktop/posts_from_tag_page.feature
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
@javascript
|
||||||
|
Feature: Posting from the tag page
|
||||||
|
In order to share my opinion on cats
|
||||||
|
I want to post from the tag page
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given I am on the home page
|
||||||
|
And a user with username "alice"
|
||||||
|
When I sign in as "alice@alice.alice"
|
||||||
|
And I am on the tag page for "cats"
|
||||||
|
|
||||||
|
Scenario: posting some text
|
||||||
|
Given I expand the publisher
|
||||||
|
And I have turned off jQuery effects
|
||||||
|
And I append "I like cats." to the publisher
|
||||||
|
And I press "Share"
|
||||||
|
|
||||||
|
Then "#cats I like cats." should be post 1
|
||||||
|
|
||||||
|
When I am on the home page
|
||||||
|
Then "#cats I like cats." should be post 1
|
||||||
|
|
||||||
|
When I am on the tag page for "cats"
|
||||||
|
Then "#cats I like cats." should be post 1
|
||||||
|
|
@ -14,6 +14,7 @@ Feature: new user registration
|
||||||
And I follow "awesome_button"
|
And I follow "awesome_button"
|
||||||
And I confirm the alert
|
And I confirm the alert
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
|
And I close the publisher
|
||||||
And I should not see "awesome_button"
|
And I should not see "awesome_button"
|
||||||
|
|
||||||
Scenario: new user tries to XSS itself
|
Scenario: new user tries to XSS itself
|
||||||
|
|
@ -36,6 +37,24 @@ Feature: new user registration
|
||||||
When I follow "awesome_button"
|
When I follow "awesome_button"
|
||||||
And I confirm the alert
|
And I confirm the alert
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
|
And I close the publisher
|
||||||
|
|
||||||
|
Scenario: new user without any tags posts first status message
|
||||||
|
When I follow "awesome_button"
|
||||||
|
And I confirm the alert
|
||||||
|
Then I should be on the stream page
|
||||||
|
When I submit the publisher
|
||||||
|
Then "Hey everyone, I'm #NewHere." should be post 1
|
||||||
|
|
||||||
|
Scenario: new user with some tags posts first status message
|
||||||
|
When I fill in the following:
|
||||||
|
| profile_first_name | some name |
|
||||||
|
And I fill in "tags" with "#rockstar"
|
||||||
|
And I press the first ".as-result-item" within "#as-results-tags"
|
||||||
|
And I follow "awesome_button"
|
||||||
|
Then I should be on the stream page
|
||||||
|
When I submit the publisher
|
||||||
|
Then "Hey everyone, I'm #NewHere. I'm interested in #rockstar." should be post 1
|
||||||
|
|
||||||
Scenario: closing a popover clears getting started
|
Scenario: closing a popover clears getting started
|
||||||
When I follow "awesome_button"
|
When I follow "awesome_button"
|
||||||
|
|
@ -44,6 +63,7 @@ Feature: new user registration
|
||||||
And I have turned off jQuery effects
|
And I have turned off jQuery effects
|
||||||
And I wait for the popovers to appear
|
And I wait for the popovers to appear
|
||||||
And I click close on all the popovers
|
And I click close on all the popovers
|
||||||
|
And I close the publisher
|
||||||
Then I should not see "Welcome to diaspora*"
|
Then I should not see "Welcome to diaspora*"
|
||||||
|
|
||||||
Scenario: user fills in bogus data - client side validation
|
Scenario: user fills in bogus data - client side validation
|
||||||
|
|
|
||||||
|
|
@ -38,13 +38,9 @@ class Stream::Tag < Stream::Base
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def tag_prefill_text
|
|
||||||
I18n.translate('streams.tags.tag_prefill_text', :tag_name => display_tag_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
def publisher_opts
|
def publisher_opts
|
||||||
{:prefill => "#{tag_prefill_text}", :open => true}
|
{:open => true}
|
||||||
end
|
end
|
||||||
|
|
||||||
def construct_post_query
|
def construct_post_query
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue