diff --git a/app/assets/javascripts/outfits/edit.js b/app/assets/javascripts/outfits/edit.js
index 3a70094b..3fb39d58 100644
--- a/app/assets/javascripts/outfits/edit.js
+++ b/app/assets/javascripts/outfits/edit.js
@@ -1292,14 +1292,22 @@ View.Search = function (wardrobe) {
View.PrankColorMessage = function(wardrobe) {
var el = $('#prank-color-message');
var nameEls = el.find('.prank-color-message-name');
+ var artistEls = el.find('.prank-color-message-artist');
var colorsById = null;
var petType = null;
+ var petState = null;
function updateMessage() {
- if (colorsById !== null && petType !== null) {
+ if (colorsById !== null && petType !== null && petState !== null) {
var color = colorsById[petType.color_id];
if (color.prank) {
nameEls.text(color.unfunny_name);
+ artistEls.text(petState.artistName);
+ if (petState.artistUrl === null) {
+ artistEls.removeAttr('href');
+ } else {
+ artistEls.attr('href', petState.artistUrl);
+ }
el.show();
} else {
el.hide();
@@ -1319,6 +1327,11 @@ View.PrankColorMessage = function(wardrobe) {
petType = newPetType;
updateMessage();
});
+
+ wardrobe.outfits.bind('updatePetState', function(newPetState) {
+ petState = newPetState;
+ updateMessage();
+ });
}
var userbar_sessions_link = $('#userbar a:last');
diff --git a/app/assets/javascripts/wardrobe.js b/app/assets/javascripts/wardrobe.js
index b6a159d7..85c6955a 100644
--- a/app/assets/javascripts/wardrobe.js
+++ b/app/assets/javascripts/wardrobe.js
@@ -731,6 +731,8 @@ function Wardrobe() {
this.gender_mood_description = '';
this.assetIds = [];
this.assets = [];
+ this.artistName = "";
+ this.artistUrl = null;
this.loadAssets = function (success) {
var params;
@@ -752,6 +754,8 @@ function Wardrobe() {
this.update = function (data) {
this.gender_mood_description = data.gender_mood_description;
this.assetIds = data.swf_asset_ids;
+ this.artistName = data.artist_name;
+ this.artistUrl = data.artist_url;
}
PetState.cache[id] = this;
diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass
index 9c312a43..402b10f9 100644
--- a/app/assets/stylesheets/_layout.sass
+++ b/app/assets/stylesheets/_layout.sass
@@ -31,7 +31,7 @@ body
size: 90%
line-height: 1.5
-a
+a[href]
color: $link-color
p
diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb
index 0eeec250..538c042e 100644
--- a/app/helpers/outfits_helper.rb
+++ b/app/helpers/outfits_helper.rb
@@ -126,10 +126,16 @@ module OutfitsHelper
end
end
- def prank_color_message(color_unfunny_human_name)
+ def prank_color_message(unfunny_human_name, artist_name, artist_url)
content_key_base = Color.pranks_funny? ? 'funny' : 'unfunny'
+ if artist_url
+ artist = link_to(artist_name, artist_url,
+ :class => 'prank-color-message-artist')
+ else
+ artist = artist_name
+ end
content = t("colors.prank_message.#{content_key_base}_html",
- color: color_unfunny_human_name)
+ color: unfunny_human_name, artist: artist)
content_tag('p', content, id: 'prank-color-message', :class => 'warning')
end
end
diff --git a/app/models/pet_state.rb b/app/models/pet_state.rb
index a993ac4a..e6dab9f4 100644
--- a/app/models/pet_state.rb
+++ b/app/models/pet_state.rb
@@ -43,7 +43,9 @@ class PetState < ActiveRecord::Base
{
id: id,
gender_mood_description: gender_mood_description,
- swf_asset_ids: swf_asset_ids_array
+ swf_asset_ids: swf_asset_ids_array,
+ artist_name: artist_name,
+ artist_url: artist_url
}
end
@@ -157,6 +159,18 @@ class PetState < ActiveRecord::Base
count
end
+ def artist_name
+ artist_neopets_username || I18n.translate("pet_states.default_artist_name")
+ end
+
+ def artist_url
+ if artist_neopets_username
+ "http://www.neopets.com/userlookup.phtml?user=#{artist_neopets_username}"
+ else
+ nil
+ end
+ end
+
def self.from_pet_type_and_biology_info(pet_type, info)
swf_asset_ids = []
info.each do |zone_id, asset_info|
diff --git a/app/views/outfits/edit.html.haml b/app/views/outfits/edit.html.haml
index 976b2e76..312e5695 100644
--- a/app/views/outfits/edit.html.haml
+++ b/app/views/outfits/edit.html.haml
@@ -48,7 +48,7 @@
#save-success= t '.sidebar.notifications.outfits.save.success'
#save-error
#preview-closet.sidebar-view
- = prank_color_message(''.html_safe)
+ = prank_color_message(''.html_safe, '$artist-name', '$artist-url')
%ul
#preview-outfits.sidebar-view
%ul#preview-outfits-list
diff --git a/app/views/outfits/show.html.haml b/app/views/outfits/show.html.haml
index 9e73f26a..9c558bae 100644
--- a/app/views/outfits/show.html.haml
+++ b/app/views/outfits/show.html.haml
@@ -17,7 +17,8 @@
= outfit_creation_summary(@outfit)
- if @outfit.color.prank?
- = prank_color_message(@outfit.color.unfunny_human_name)
+ = prank_color_message(@outfit.color.unfunny_human_name,
+ @outfit.pet_state.artist_name, @outfit.pet_state.artist_url)
#preview-wrapper
#preview-swf
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8279bc01..9c5d1920 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -226,9 +226,9 @@ en:
your hard-earned Neopoints on a %{color} Paint Brush and fall for
%{color} pet trade scams, because %{color} is totally a real
thing. C'mon, would I lie to you? On today of all days?
- unfunny_html: This pet is painted %{color}, a fake color added to the
- site for April Fools 2014. Anyone who claims to have a real
- %{color} pet is a big fat liar.
+ unfunny_html: This pet is painted %{color}, a fake color drawn by
+ %{artist} for April Fools 2014. Anyone who claims to have a
+ real %{color} pet is a big fat liar.
contributions:
contributed_description:
@@ -763,6 +763,7 @@ en:
glitched: Glitched
unconverted: Unconverted
unlabeled: Unlabeled
+ default_artist_name: the OpenNeo team
pet_types:
human_name: "%{color_human_name} %{species_human_name}"
diff --git a/db/migrate/20140331034031_add_artist_neopets_username_to_pet_state.rb b/db/migrate/20140331034031_add_artist_neopets_username_to_pet_state.rb
new file mode 100644
index 00000000..26e3967f
--- /dev/null
+++ b/db/migrate/20140331034031_add_artist_neopets_username_to_pet_state.rb
@@ -0,0 +1,5 @@
+class AddArtistNeopetsUsernameToPetState < ActiveRecord::Migration
+ def change
+ add_column :pet_states, :artist_neopets_username, :string, null: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4e0f5c0a..72d07dc9 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140125202515) do
+ActiveRecord::Schema.define(:version => 20140331034031) do
create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false
@@ -236,13 +236,14 @@ ActiveRecord::Schema.define(:version => 20140125202515) do
end
create_table "pet_states", :force => true do |t|
- t.integer "pet_type_id", :limit => 3, :null => false
- t.text "swf_asset_ids", :null => false
+ t.integer "pet_type_id", :limit => 3, :null => false
+ t.text "swf_asset_ids", :null => false
t.boolean "female"
t.integer "mood_id"
t.boolean "unconverted"
- t.boolean "labeled", :default => false, :null => false
- t.boolean "glitched", :default => false, :null => false
+ t.boolean "labeled", :default => false, :null => false
+ t.boolean "glitched", :default => false, :null => false
+ t.string "artist_neopets_username"
end
add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id"