forked from OpenNeo/impress
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) {
|
View.PrankColorMessage = function(wardrobe) {
|
||||||
var el = $('#prank-color-message');
|
var el = $('#prank-color-message');
|
||||||
var nameEls = el.find('.prank-color-message-name');
|
var nameEls = el.find('.prank-color-message-name');
|
||||||
|
var artistEls = el.find('.prank-color-message-artist');
|
||||||
var colorsById = null;
|
var colorsById = null;
|
||||||
var petType = null;
|
var petType = null;
|
||||||
|
var petState = null;
|
||||||
|
|
||||||
function updateMessage() {
|
function updateMessage() {
|
||||||
if (colorsById !== null && petType !== null) {
|
if (colorsById !== null && petType !== null && petState !== null) {
|
||||||
var color = colorsById[petType.color_id];
|
var color = colorsById[petType.color_id];
|
||||||
if (color.prank) {
|
if (color.prank) {
|
||||||
nameEls.text(color.unfunny_name);
|
nameEls.text(color.unfunny_name);
|
||||||
|
artistEls.text(petState.artistName);
|
||||||
|
if (petState.artistUrl === null) {
|
||||||
|
artistEls.removeAttr('href');
|
||||||
|
} else {
|
||||||
|
artistEls.attr('href', petState.artistUrl);
|
||||||
|
}
|
||||||
el.show();
|
el.show();
|
||||||
} else {
|
} else {
|
||||||
el.hide();
|
el.hide();
|
||||||
|
@ -1319,6 +1327,11 @@ View.PrankColorMessage = function(wardrobe) {
|
||||||
petType = newPetType;
|
petType = newPetType;
|
||||||
updateMessage();
|
updateMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
wardrobe.outfits.bind('updatePetState', function(newPetState) {
|
||||||
|
petState = newPetState;
|
||||||
|
updateMessage();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var userbar_sessions_link = $('#userbar a:last');
|
var userbar_sessions_link = $('#userbar a:last');
|
||||||
|
|
|
@ -731,6 +731,8 @@ function Wardrobe() {
|
||||||
this.gender_mood_description = '';
|
this.gender_mood_description = '';
|
||||||
this.assetIds = [];
|
this.assetIds = [];
|
||||||
this.assets = [];
|
this.assets = [];
|
||||||
|
this.artistName = "";
|
||||||
|
this.artistUrl = null;
|
||||||
|
|
||||||
this.loadAssets = function (success) {
|
this.loadAssets = function (success) {
|
||||||
var params;
|
var params;
|
||||||
|
@ -752,6 +754,8 @@ function Wardrobe() {
|
||||||
this.update = function (data) {
|
this.update = function (data) {
|
||||||
this.gender_mood_description = data.gender_mood_description;
|
this.gender_mood_description = data.gender_mood_description;
|
||||||
this.assetIds = data.swf_asset_ids;
|
this.assetIds = data.swf_asset_ids;
|
||||||
|
this.artistName = data.artist_name;
|
||||||
|
this.artistUrl = data.artist_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
PetState.cache[id] = this;
|
PetState.cache[id] = this;
|
||||||
|
|
|
@ -31,7 +31,7 @@ body
|
||||||
size: 90%
|
size: 90%
|
||||||
line-height: 1.5
|
line-height: 1.5
|
||||||
|
|
||||||
a
|
a[href]
|
||||||
color: $link-color
|
color: $link-color
|
||||||
|
|
||||||
p
|
p
|
||||||
|
|
|
@ -126,10 +126,16 @@ module OutfitsHelper
|
||||||
end
|
end
|
||||||
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'
|
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",
|
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')
|
content_tag('p', content, id: 'prank-color-message', :class => 'warning')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,7 +43,9 @@ class PetState < ActiveRecord::Base
|
||||||
{
|
{
|
||||||
id: id,
|
id: id,
|
||||||
gender_mood_description: gender_mood_description,
|
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
|
end
|
||||||
|
|
||||||
|
@ -157,6 +159,18 @@ class PetState < ActiveRecord::Base
|
||||||
count
|
count
|
||||||
end
|
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)
|
def self.from_pet_type_and_biology_info(pet_type, info)
|
||||||
swf_asset_ids = []
|
swf_asset_ids = []
|
||||||
info.each do |zone_id, asset_info|
|
info.each do |zone_id, asset_info|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#save-success= t '.sidebar.notifications.outfits.save.success'
|
#save-success= t '.sidebar.notifications.outfits.save.success'
|
||||||
#save-error
|
#save-error
|
||||||
#preview-closet.sidebar-view
|
#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
|
%ul
|
||||||
#preview-outfits.sidebar-view
|
#preview-outfits.sidebar-view
|
||||||
%ul#preview-outfits-list
|
%ul#preview-outfits-list
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
= outfit_creation_summary(@outfit)
|
= outfit_creation_summary(@outfit)
|
||||||
|
|
||||||
- if @outfit.color.prank?
|
- 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-wrapper
|
||||||
#preview-swf
|
#preview-swf
|
||||||
|
|
|
@ -226,9 +226,9 @@ en:
|
||||||
your hard-earned Neopoints on a %{color} Paint Brush and fall for
|
your hard-earned Neopoints on a %{color} Paint Brush and fall for
|
||||||
%{color} pet trade scams, because %{color} is <em>totally</em> a real
|
%{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?
|
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
|
unfunny_html: This pet is painted %{color}, a fake color drawn by
|
||||||
site for April Fools 2014. Anyone who claims to have a <em>real</em>
|
%{artist} for April Fools 2014. Anyone who claims to have a
|
||||||
%{color} pet is a big fat liar.
|
<em>real</em> %{color} pet is a big fat liar.
|
||||||
|
|
||||||
contributions:
|
contributions:
|
||||||
contributed_description:
|
contributed_description:
|
||||||
|
@ -763,6 +763,7 @@ en:
|
||||||
glitched: Glitched
|
glitched: Glitched
|
||||||
unconverted: Unconverted
|
unconverted: Unconverted
|
||||||
unlabeled: Unlabeled
|
unlabeled: Unlabeled
|
||||||
|
default_artist_name: the OpenNeo team
|
||||||
|
|
||||||
pet_types:
|
pet_types:
|
||||||
human_name: "%{color_human_name} %{species_human_name}"
|
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.
|
# 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|
|
create_table "auth_servers", :force => true do |t|
|
||||||
t.string "short_name", :limit => 10, :null => false
|
t.string "short_name", :limit => 10, :null => false
|
||||||
|
@ -243,6 +243,7 @@ ActiveRecord::Schema.define(:version => 20140125202515) do
|
||||||
t.boolean "unconverted"
|
t.boolean "unconverted"
|
||||||
t.boolean "labeled", :default => false, :null => false
|
t.boolean "labeled", :default => false, :null => false
|
||||||
t.boolean "glitched", :default => false, :null => false
|
t.boolean "glitched", :default => false, :null => false
|
||||||
|
t.string "artist_neopets_username"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id"
|
add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id"
|
||||||
|
|
Loading…
Reference in a new issue