Merge pull request #390 from dkhamsing/details

Details
This commit is contained in:
dkhamsing 2016-07-28 08:33:56 -07:00 committed by GitHub
commit b284b43445
3 changed files with 51 additions and 4 deletions

View File

@ -41,6 +41,10 @@ def output_apps(apps)
stars = a['stars']
lang = a['lang']
date_added = a['date_added']
screenshots = a['screenshots']
license = a['license']
o << "- #{name}"
if desc.nil?
@ -49,6 +53,10 @@ def output_apps(apps)
o << ": #{desc} " if desc.size>0
end
unless itunes.nil?
o << "[` App Store`](#{itunes}) "
end
unless tags.nil?
o << '`Swift` ' if tags.include? 'swift'
end
@ -62,9 +70,42 @@ def output_apps(apps)
end
o << "\n"
o << " - #{link}\n"
o << " - #{homepage}\n" unless homepage.nil?
o << " - #{itunes}\n" unless itunes.nil?
show_details = !homepage.nil? || !screenshots.nil? || !license.nil? || !date_added.nil?
if (!show_details)
o << " - #{link}\n"
else
details = " <details><summary>#{link}</summary>\n"
details_list = []
unless date_added.nil?
date = DateTime.parse(date_added)
formatted_date = date.strftime "%B %e, %Y"
details_list.push "Added #{formatted_date}"
end
unless license.nil?
details_list.push "License: `#{license}`"
end
unless homepage.nil?
details_list.push homepage
end
details << ' '
details << details_list[0]
details_list[1..-1].each { |x| details << " - #{x}" }
unless screenshots.nil?
screenshots.each_with_index do |s, i|
details << " ![#{name} image #{i+1}](#{screenshots[i]})" unless screenshots.nil?
end
end
details << "\n </details>\n"
o << details
end
end
o
end

5
.github/schema.json vendored
View File

@ -147,6 +147,11 @@
"title": "Date Added",
"description": "Date when project was added.",
"type": "string"
},
"screenshots": {
"title": "Screenshots",
"description": "Links to screenshot images.",
"type": "array"
}
},
"required": ["title", "category", "source"],

View File

@ -235,7 +235,8 @@
"swift"
],
"date_added": "Fri Nov 6 06:19:26 2015 -0800",
"suggested_by": "@dkhamsing"
"suggested_by": "@dkhamsing",
"screenshots": [ "https://raw.githubusercontent.com/artsy/emergence/master/docs/screenshots/featured.png", "https://raw.githubusercontent.com/artsy/emergence/master/docs/screenshots/show.png"]
},
{
"title": "EX Player",