lib/actv/asset.rb in actv-1.2.0 vs lib/actv/asset.rb in actv-1.3.0
- old
+ new
@@ -130,11 +130,11 @@
alias assetPrices prices
def topics
@asset_topics ||= Array(@attrs[:assetTopics]).map do |topic|
ACTV::AssetTopic.new(topic)
- end
+ end.sort
end
alias asset_topics topics
alias assetTopics topics
def seo_urls
@@ -189,14 +189,11 @@
is_article = true
end
end
else
# no categories so check the sourceSystem
- # this guid is equal to the Active.com Articles
- if self.sourceSystem.fetch(:legacyGuid, "").upcase == "CA4EA0B1-7377-470D-B20D-BF6BEA23F040"
- is_article = true
- end
+ is_article = articles_source?
end
is_article
end
@@ -240,18 +237,13 @@
self.sourceSystem[:legacyGuid].upcase == "FB27C928-54DB-4ECD-B42F-482FC3C8681F" rescue false
end
def kids?
return false if Rails.env == 'production'
- (activenet? || awcamps? || awcamps30?) && kidsinterest?
+ kids_friendly_source_system? && kids_interest?
end
- def kidsinterest?
- interests = meta_interests.to_a.map(&:downcase)
- ['kids', 'family'].any? { |tag| interests.include? tag }
- end
-
def registration_status
@registration_status ||= nil
end
alias reg_status registration_status
@@ -294,10 +286,14 @@
def first_topic_path
urlize first_topic
end
+ def first_topic_name
+ topics.first.topic.name
+ end
+
def sub_topic
get_first_topic_taxonomy[1]
end
def sub_topic_path
@@ -370,11 +366,11 @@
current_image
end
def get_first_topic_taxonomy
- @first_topic_taxonomy ||= assetTopics.sort_by(&:sequence).first
+ @first_topic_taxonomy ||= assetTopics.first
if @first_topic_taxonomy
@first_topic_taxonomy.topic.topicTaxonomy.split '/'
else
[]
end
@@ -384,9 +380,24 @@
if str
str.downcase.gsub ' ', '-'
else
""
end
+ end
+
+private
+ def kids_interest?
+ interests = meta_interests.to_a.map(&:downcase)
+ ['kids', 'family'].any? { |tag| interests.include? tag }
+ end
+
+ def kids_friendly_source_system?
+ activenet? || awcamps? || awcamps30? || articles_source?
+ end
+
+ def articles_source?
+ # this guid is equal to the Active.com Articles
+ self.sourceSystem.fetch(:legacyGuid, "").upcase == "CA4EA0B1-7377-470D-B20D-BF6BEA23F040"
end
end
end