diff --git a/app/assets/javascripts/discourse/views/topic-list-poster.js.es6 b/app/assets/javascripts/discourse/views/topic-list-poster.js.es6
index caee5427d4..3999134531 100644
--- a/app/assets/javascripts/discourse/views/topic-list-poster.js.es6
+++ b/app/assets/javascripts/discourse/views/topic-list-poster.js.es6
@@ -2,13 +2,13 @@ import { renderAvatar } from 'discourse/helpers/user-avatar';
export default Ember.View.extend({
tagName: 'a',
- attributeBindings: ['href', 'data-user-expand'],
+ attributeBindings: ['href', 'data-user-card'],
classNameBindings: ['content.extras'],
user: Em.computed.alias('content.user'),
href: Em.computed.alias('user.path'),
- 'data-user-expand': Em.computed.alias('user.username'),
+ 'data-user-card': Em.computed.alias('user.username'),
render: function(buffer) {
var av = renderAvatar(this.get('content'), {usernamePath: 'user.username', imageSize: 'small'});
diff --git a/app/assets/javascripts/discourse/views/user-expansion.js.es6 b/app/assets/javascripts/discourse/views/user-card.js.es6
similarity index 82%
rename from app/assets/javascripts/discourse/views/user-expansion.js.es6
rename to app/assets/javascripts/discourse/views/user-card.js.es6
index 328b2e9b7a..66bb57f377 100644
--- a/app/assets/javascripts/discourse/views/user-expansion.js.es6
+++ b/app/assets/javascripts/discourse/views/user-card.js.es6
@@ -1,16 +1,16 @@
import CleansUp from 'discourse/mixins/cleans-up';
-var clickOutsideEventName = "mousedown.outside-user-expansion",
- clickDataExpand = "click.discourse-user-expand",
+var clickOutsideEventName = "mousedown.outside-user-card",
+ clickDataExpand = "click.discourse-user-card",
clickMention = "click.discourse-user-mention";
export default Discourse.View.extend(CleansUp, {
- elementId: 'user-expansion',
+ elementId: 'user-card',
classNameBindings: ['controller.visible::hidden', 'controller.showBadges'],
allowBackgrounds: Discourse.computed.setting('allow_profile_backgrounds'),
addBackground: function() {
- var url = this.get('controller.user.expansion_background');
+ var url = this.get('controller.user.card_background');
if (!this.get('allowBackgrounds')) { return; }
var $this = this.$();
@@ -21,7 +21,7 @@ export default Discourse.View.extend(CleansUp, {
} else {
$this.css('background-image', "url(" + url + ")");
}
- }.observes('controller.user.expansion_background'),
+ }.observes('controller.user.card_background'),
_setup: function() {
var self = this;
@@ -30,7 +30,7 @@ export default Discourse.View.extend(CleansUp, {
$('html').off(clickOutsideEventName).on(clickOutsideEventName, function(e) {
if (self.get('controller.visible')) {
var $target = $(e.target);
- if ($target.closest('.trigger-expansion').length > 0) { return; }
+ if ($target.closest('.trigger-user-card').length > 0) { return; }
if (self.$().has(e.target).length !== 0) { return; }
self.get('controller').close();
@@ -39,10 +39,10 @@ export default Discourse.View.extend(CleansUp, {
return true;
});
- $('#main-outlet').on(clickDataExpand, '[data-user-expand]', function(e) {
+ $('#main-outlet').on(clickDataExpand, '[data-user-card]', function(e) {
var $target = $(e.currentTarget);
self._posterExpand($target);
- self.get('controller').show($target.data('user-expand'));
+ self.get('controller').show($target.data('user-card'));
return false;
});
diff --git a/app/assets/stylesheets/desktop.scss b/app/assets/stylesheets/desktop.scss
index 513ac47a5b..abeab14927 100644
--- a/app/assets/stylesheets/desktop.scss
+++ b/app/assets/stylesheets/desktop.scss
@@ -9,7 +9,7 @@
@import "desktop/header";
@import "desktop/login";
@import "desktop/modal";
-@import "desktop/poster_expansion";
+@import "desktop/user-card";
@import "desktop/topic-list";
@import "desktop/topic-post";
@import "desktop/topic";
diff --git a/app/assets/stylesheets/desktop/poster_expansion.scss b/app/assets/stylesheets/desktop/user-card.scss
similarity index 99%
rename from app/assets/stylesheets/desktop/poster_expansion.scss
rename to app/assets/stylesheets/desktop/user-card.scss
index c16aff2c5a..0242401e84 100644
--- a/app/assets/stylesheets/desktop/poster_expansion.scss
+++ b/app/assets/stylesheets/desktop/user-card.scss
@@ -1,6 +1,6 @@
// styles that apply to the "share" popup when sharing a link to a post or topic
-#user-expansion {
+#user-card {
position: absolute;
width: 460px;
left: 20px;
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b68ae9ae5b..2666deb89e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -461,8 +461,8 @@ class UsersController < ApplicationController
upload_avatar_for(user, upload)
when "profile_background"
upload_profile_background_for(user.user_profile, upload)
- when "expansion_background"
- upload_expansion_background_for(user.user_profile, upload)
+ when "card_background"
+ upload_card_background_for(user.user_profile, upload)
end
else
render status: 422, text: upload.errors.full_messages
@@ -492,8 +492,8 @@ class UsersController < ApplicationController
image_type = params.require(:image_type)
if image_type == 'profile_background'
user.user_profile.clear_profile_background
- elsif image_type == 'expansion_background'
- user.user_profile.clear_expansion_background
+ elsif image_type == 'card_background'
+ user.user_profile.clear_card_background
else
raise Discourse::InvalidParameters.new(:image_type)
end
@@ -554,8 +554,8 @@ class UsersController < ApplicationController
render json: { url: upload.url, width: upload.width, height: upload.height }
end
- def upload_expansion_background_for(user_profile, upload)
- user_profile.upload_expansion_background(upload)
+ def upload_card_background_for(user_profile, upload)
+ user_profile.upload_card_background(upload)
render json: { url: upload.url, width: upload.width, height: upload.height }
end
diff --git a/app/jobs/scheduled/clean_up_uploads.rb b/app/jobs/scheduled/clean_up_uploads.rb
index 2588843b03..3bbe10856a 100644
--- a/app/jobs/scheduled/clean_up_uploads.rb
+++ b/app/jobs/scheduled/clean_up_uploads.rb
@@ -8,7 +8,7 @@ module Jobs
ignore_urls = []
ignore_urls << UserProfile.uniq.where("profile_background IS NOT NULL AND profile_background != ''").pluck(:profile_background)
- ignore_urls << UserProfile.uniq.where("expansion_background IS NOT NULL AND expansion_background != ''").pluck(:expansion_background)
+ ignore_urls << UserProfile.uniq.where("card_background IS NOT NULL AND card_background != ''").pluck(:card_background)
ignore_urls << Category.uniq.where("logo_url IS NOT NULL AND logo_url != ''").pluck(:logo_url)
ignore_urls << Category.uniq.where("background_url IS NOT NULL AND background_url != ''").pluck(:background_url)
ignore_urls.flatten!
diff --git a/app/models/user_profile.rb b/app/models/user_profile.rb
index 56e9299dad..931789ccb9 100644
--- a/app/models/user_profile.rb
+++ b/app/models/user_profile.rb
@@ -29,13 +29,13 @@ class UserProfile < ActiveRecord::Base
cook
end
- def upload_expansion_background(upload)
- self.expansion_background = upload.url
+ def upload_card_background(upload)
+ self.card_background = upload.url
self.save!
end
- def clear_expansion_background
- self.expansion_background = ""
+ def clear_card_background
+ self.card_background = ""
self.save!
end
@@ -106,7 +106,7 @@ end
# bio_cooked :text
# dismissed_banner_key :integer
# profile_background :string(255)
-# expansion_background :string(255)
+# card_background :string(255)
# bio_cooked_version :integer
#
# Indexes
diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb
index b15c514ad5..a1be066229 100644
--- a/app/serializers/user_serializer.rb
+++ b/app/serializers/user_serializer.rb
@@ -27,7 +27,7 @@ class UserSerializer < BasicUserSerializer
:created_at,
:website,
:profile_background,
- :expansion_background,
+ :card_background,
:location,
:can_edit,
:can_edit_username,
@@ -118,12 +118,12 @@ class UserSerializer < BasicUserSerializer
profile_background.present?
end
- def expansion_background
- object.user_profile.expansion_background
+ def card_background
+ object.user_profile.card_background
end
- def include_expansion_background?
- expansion_background.present?
+ def include_card_background?
+ card_background.present?
end
def location
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 04676d2ca5..2c59d50edd 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -373,9 +373,9 @@ en:
title: "Profile Background"
instructions: "Profile backgrounds will be centered and have a default width of 850px."
- change_expansion_background:
- title: "User Expansion Background"
- instructions: "Expansion images will be centered and have a default width of 590px."
+ change_card_background:
+ title: "User Card Background"
+ instructions: "Background images will be centered and have a default width of 590px."
email:
title: "Email"
diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml
index 81e6e616f0..23b9e10f01 100644
--- a/config/locales/client.pt_BR.yml
+++ b/config/locales/client.pt_BR.yml
@@ -330,7 +330,7 @@ pt_BR:
change_profile_background:
title: "Fundo do perfil"
instructions: "Fundos do perfil será centralizado e tera uma largura padrão de 850px."
- change_expansion_background:
+ change_card_background:
title: "Fundo de Expansão do Usuário"
instructions: "Imagens de Expansão será centralizado e tera uma largura padrão de 590px."
email:
diff --git a/db/migrate/20141020154935_rename_expansion_to_card.rb b/db/migrate/20141020154935_rename_expansion_to_card.rb
new file mode 100644
index 0000000000..9dbde2f821
--- /dev/null
+++ b/db/migrate/20141020154935_rename_expansion_to_card.rb
@@ -0,0 +1,5 @@
+class RenameExpansionToCard < ActiveRecord::Migration
+ def change
+ rename_column :user_profiles, :expansion_background, :card_background
+ end
+end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 0b3d63c452..2cdb735420 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -1156,13 +1156,13 @@ describe UsersController do
json['height'].should == 200
end
- it 'is successful for expansion backgrounds' do
+ it 'is successful for card backgrounds' do
upload = Fabricate(:upload)
Upload.expects(:create_for).returns(upload)
- xhr :post, :upload_user_image, username: user.username, file: user_image, image_type: "expansion_background"
+ xhr :post, :upload_user_image, username: user.username, file: user_image, image_type: "card_background"
user.reload
- user.user_profile.expansion_background.should == "/uploads/default/1/1234567890123456.png"
+ user.user_profile.card_background.should == "/uploads/default/1/1234567890123456.png"
# returns the url, width and height of the uploaded image
json = JSON.parse(response.body)
@@ -1220,12 +1220,12 @@ describe UsersController do
json['height'].should == 200
end
- it 'is successful for expansion backgrounds' do
+ it 'is successful for card backgrounds' do
upload = Fabricate(:upload)
Upload.expects(:create_for).returns(upload)
- xhr :post, :upload_user_image, username: user.username, file: user_image_url, image_type: "expansion_background"
+ xhr :post, :upload_user_image, username: user.username, file: user_image_url, image_type: "card_background"
user.reload
- user.user_profile.expansion_background.should == "/uploads/default/1/1234567890123456.png"
+ user.user_profile.card_background.should == "/uploads/default/1/1234567890123456.png"
# returns the url, width and height of the uploaded image
json = JSON.parse(response.body)
diff --git a/spec/phantom_js/smoke_test.js b/spec/phantom_js/smoke_test.js
index d41f697e11..9e6d83aa39 100644
--- a/spec/phantom_js/smoke_test.js
+++ b/spec/phantom_js/smoke_test.js
@@ -126,7 +126,7 @@ page.runTests = function(){
});
test("has details",function(){
- return $('#user-expansion .names').length === 1;
+ return $('#user-card .names').length === 1;
});
run();
diff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rb
index e2ca7460c3..c26bc8217a 100644
--- a/spec/serializers/user_serializer_spec.rb
+++ b/spec/serializers/user_serializer_spec.rb
@@ -32,13 +32,13 @@ describe UserSerializer do
end
end
- context "with filled out expansion background" do
+ context "with filled out card background" do
before do
- user.user_profile.expansion_background = 'http://expansion.com'
+ user.user_profile.card_background = 'http://card.com'
end
it "has a profile background" do
- expect(json[:expansion_background]).to eq 'http://expansion.com'
+ expect(json[:card_background]).to eq 'http://card.com'
end
end
diff --git a/test/javascripts/integration/user-card-test.js.es6 b/test/javascripts/integration/user-card-test.js.es6
new file mode 100644
index 0000000000..a49ed9fcfb
--- /dev/null
+++ b/test/javascripts/integration/user-card-test.js.es6
@@ -0,0 +1,13 @@
+integration("User Card");
+
+test("card", function() {
+ visit('/');
+
+ ok(find('#user-card:visible').length === 0, 'user card is invisible by default');
+ click('a[data-user-card=eviltrout]:first');
+
+ andThen(function() {
+ ok(find('#user-card:visible').length === 1, 'card should appear');
+ });
+
+});
diff --git a/test/javascripts/integration/user-expansion-test.js.es6 b/test/javascripts/integration/user-expansion-test.js.es6
deleted file mode 100644
index 4e7be135bc..0000000000
--- a/test/javascripts/integration/user-expansion-test.js.es6
+++ /dev/null
@@ -1,13 +0,0 @@
-integration("User Expansion");
-
-test("expansion", function() {
- visit('/');
-
- ok(find('#user-expansion:visible').length === 0, 'user expansion is invisible by default');
- click('a[data-user-expand=eviltrout]:first');
-
- andThen(function() {
- ok(find('#user-expansion:visible').length === 1, 'expansion should appear');
- });
-
-});