prank color artist credit
This commit is contained in:
parent
6e80c228c1
commit
f9fa3eb596
10 changed files with 60 additions and 15 deletions
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -31,7 +31,7 @@ body
|
|||
size: 90%
|
||||
line-height: 1.5
|
||||
|
||||
a
|
||||
a[href]
|
||||
color: $link-color
|
||||
|
||||
p
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#save-success= t '.sidebar.notifications.outfits.save.success'
|
||||
#save-error
|
||||
#preview-closet.sidebar-view
|
||||
= prank_color_message('<span class="prank-color-message-name"></span>'.html_safe)
|
||||
= prank_color_message('<span class="prank-color-message-name"></span>'.html_safe, '$artist-name', '$artist-url')
|
||||
%ul
|
||||
#preview-outfits.sidebar-view
|
||||
%ul#preview-outfits-list
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -226,9 +226,9 @@ en:
|
|||
your hard-earned Neopoints on a %{color} Paint Brush and fall for
|
||||
%{color} pet trade scams, because %{color} is <em>totally</em> 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 <em>real</em>
|
||||
%{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
|
||||
<em>real</em> %{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}"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddArtistNeopetsUsernameToPetState < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :pet_states, :artist_neopets_username, :string, null: true
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
@ -243,6 +243,7 @@ ActiveRecord::Schema.define(:version => 20140125202515) do
|
|||
t.boolean "unconverted"
|
||||
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"
|
||||
|
|
Loading…
Reference in a new issue