Merge branch 'master' of github.com:discourse/discourse

This commit is contained in:
Robin Ward 2013-09-06 18:01:33 -04:00
commit b87a78f7b2
5 changed files with 10 additions and 9 deletions

View File

@ -13,6 +13,7 @@ Discourse.ShareController = Discourse.Controller.extend({
// Close the share controller // Close the share controller
close: function() { close: function() {
this.set('link', ''); this.set('link', '');
this.set('postNumber', '');
return false; return false;
}, },

View File

@ -167,7 +167,8 @@ Discourse.PostMenuView = Discourse.View.extend({
renderShare: function(post, buffer) { renderShare: function(post, buffer) {
buffer.push("<button title=\"" + buffer.push("<button title=\"" +
I18n.t("post.controls.share") + I18n.t("post.controls.share") +
"\" data-share-url=\"" + post.get('shareUrl') + "\" class='share'><i class=\"icon-link\"></i></button>"); "\" data-share-url=\"" + post.get('shareUrl') + "\" data-post-number=\"" + post.get('post_number') +
"\" class='share'><i class=\"icon-link\"></i></button>");
}, },
// Reply button // Reply button

View File

@ -13,8 +13,8 @@ Discourse.ShareView = Discourse.View.extend({
title: function() { title: function() {
if (this.get('controller.type') === 'topic') return I18n.t('share.topic'); if (this.get('controller.type') === 'topic') return I18n.t('share.topic');
return I18n.t('share.post'); return I18n.t('share.post', {postNumber: this.get('controller.postNumber')});
}.property('controller.type'), }.property('controller.type', 'controller.postNumber'),
hasLink: function() { hasLink: function() {
if (this.present('controller.link')) return 'visible'; if (this.present('controller.link')) return 'visible';
@ -48,6 +48,7 @@ Discourse.ShareView = Discourse.View.extend({
e.preventDefault(); e.preventDefault();
var $currentTarget = $(e.currentTarget); var $currentTarget = $(e.currentTarget);
var url = $currentTarget.data('share-url'); var url = $currentTarget.data('share-url');
var postNumber = $currentTarget.data('post-number');
// Relative urls // Relative urls
if (url.indexOf("/") === 0) { if (url.indexOf("/") === 0) {
@ -64,6 +65,7 @@ Discourse.ShareView = Discourse.View.extend({
top: "" + (e.pageY - 100) + "px" top: "" + (e.pageY - 100) + "px"
}); });
shareView.set('controller.link', url); shareView.set('controller.link', url);
shareView.set('controller.postNumber', postNumber);
return false; return false;
}); });

View File

@ -71,7 +71,7 @@ en:
other: "%{count} days ago" other: "%{count} days ago"
share: share:
topic: 'share a link to this topic' topic: 'share a link to this topic'
post: 'share a link to this post' post: 'share a link to post #%{postNumber}'
close: 'close' close: 'close'
twitter: 'share this link on Twitter' twitter: 'share this link on Twitter'
facebook: 'share this link on Facebook' facebook: 'share this link on Facebook'

View File

@ -170,13 +170,11 @@ describe Jobs::Importer do
end end
# Neil, please have a look here # Neil, please have a look here
pending "should have a users table that's empty" do it "should have a users table that's empty" do
@user1 = Fabricate(:user) @user1 = Fabricate(:user)
# community user needs to be accounted for
User.count.should == 2
Jobs::Importer.any_instance.stubs(:ordered_models_for_import).returns([User]) Jobs::Importer.any_instance.stubs(:ordered_models_for_import).returns([User])
Jobs::Importer.new.execute(@importer_args) Jobs::Importer.new.execute(@importer_args)
User.count.should == 1 User.count.should == 0 # empty table (data loading is stubbed for this test)
end end
it "should indicate that an import is running" do it "should indicate that an import is running" do
@ -192,7 +190,6 @@ describe Jobs::Importer do
Discourse.expects(:enable_maintenance_mode).in_sequence(seq).at_least_once Discourse.expects(:enable_maintenance_mode).in_sequence(seq).at_least_once
Jobs::Importer.any_instance.expects(:backup_tables).in_sequence(seq).at_least_once Jobs::Importer.any_instance.expects(:backup_tables).in_sequence(seq).at_least_once
Jobs::Importer.any_instance.expects(:load_data).in_sequence(seq).at_least_once Jobs::Importer.any_instance.expects(:load_data).in_sequence(seq).at_least_once
# fails here
Jobs::Importer.new.execute( @importer_args ) Jobs::Importer.new.execute( @importer_args )
end end