Merge branch 'master' of github.com:discourse/discourse
This commit is contained in:
commit
b87a78f7b2
|
@ -13,6 +13,7 @@ Discourse.ShareController = Discourse.Controller.extend({
|
|||
// Close the share controller
|
||||
close: function() {
|
||||
this.set('link', '');
|
||||
this.set('postNumber', '');
|
||||
return false;
|
||||
},
|
||||
|
||||
|
|
|
@ -167,7 +167,8 @@ Discourse.PostMenuView = Discourse.View.extend({
|
|||
renderShare: function(post, buffer) {
|
||||
buffer.push("<button title=\"" +
|
||||
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
|
||||
|
|
|
@ -13,8 +13,8 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
|
||||
title: function() {
|
||||
if (this.get('controller.type') === 'topic') return I18n.t('share.topic');
|
||||
return I18n.t('share.post');
|
||||
}.property('controller.type'),
|
||||
return I18n.t('share.post', {postNumber: this.get('controller.postNumber')});
|
||||
}.property('controller.type', 'controller.postNumber'),
|
||||
|
||||
hasLink: function() {
|
||||
if (this.present('controller.link')) return 'visible';
|
||||
|
@ -48,6 +48,7 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
e.preventDefault();
|
||||
var $currentTarget = $(e.currentTarget);
|
||||
var url = $currentTarget.data('share-url');
|
||||
var postNumber = $currentTarget.data('post-number');
|
||||
// Relative urls
|
||||
|
||||
if (url.indexOf("/") === 0) {
|
||||
|
@ -64,6 +65,7 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
top: "" + (e.pageY - 100) + "px"
|
||||
});
|
||||
shareView.set('controller.link', url);
|
||||
shareView.set('controller.postNumber', postNumber);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ en:
|
|||
other: "%{count} days ago"
|
||||
share:
|
||||
topic: 'share a link to this topic'
|
||||
post: 'share a link to this post'
|
||||
post: 'share a link to post #%{postNumber}'
|
||||
close: 'close'
|
||||
twitter: 'share this link on Twitter'
|
||||
facebook: 'share this link on Facebook'
|
||||
|
|
|
@ -170,13 +170,11 @@ describe Jobs::Importer do
|
|||
end
|
||||
|
||||
# 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)
|
||||
# community user needs to be accounted for
|
||||
User.count.should == 2
|
||||
Jobs::Importer.any_instance.stubs(:ordered_models_for_import).returns([User])
|
||||
Jobs::Importer.new.execute(@importer_args)
|
||||
User.count.should == 1
|
||||
User.count.should == 0 # empty table (data loading is stubbed for this test)
|
||||
end
|
||||
|
||||
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
|
||||
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
|
||||
# fails here
|
||||
Jobs::Importer.new.execute( @importer_args )
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue