aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-01-31 20:35:18 +0100
committerJochen Topf <jochen@topf.org>2013-01-31 20:35:18 +0100
commitb940c8b01a379519dcfc2ac88c7beca86aa79854 (patch)
treeb40eff44ab39a316c1b70862d4ec2317df30a1ed /web/lib
parent59ca7dcc45cae63309795d3b30822fa06d4b7cb1 (diff)
downloadtaginfo-b940c8b01a379519dcfc2ac88c7beca86aa79854.tar
taginfo-b940c8b01a379519dcfc2ac88c7beca86aa79854.tar.gz
Hide unfinished reports.
Reports without sources are now "hidden", ie. they are not visible in the list of reports. But if you know the URL you can access them. This allows them to be tested before they are publicly released. Similarly APIs being tested can now use the API version 0, which will make them invisible in the API documentation.
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/api/test/langtag.rb (renamed from web/lib/api/v4/langtag.rb)4
-rw-r--r--web/lib/reports.rb17
2 files changed, 16 insertions, 5 deletions
diff --git a/web/lib/api/v4/langtag.rb b/web/lib/api/test/langtag.rb
index a9eadf9..6cc42e5 100644
--- a/web/lib/api/v4/langtag.rb
+++ b/web/lib/api/test/langtag.rb
@@ -1,7 +1,7 @@
# web/lib/api/v4/langtag.rb
class Taginfo < Sinatra::Base
- api(4, 'keys/name', {
+ api(0, 'keys/name', {
:description => 'Get list of keys from the database that contain the string "name".',
:parameters => { :query => 'Only show keys matching this query (substring match, optional).' },
:paging => :optional,
@@ -75,7 +75,7 @@ class Taginfo < Sinatra::Base
@@bcp47_filters[type.to_sym] = { :expr => type, :doc => "Show entries of type '#{type}' only." };
end
- api(4, 'langtags', {
+ api(0, 'langtags', {
:description => 'Get official subtags from the IETF BCP47 registry.',
:parameters => { :query => 'Only show entries matching this query (case insensitive substring match on subtags and description; optional).' },
:paging => :optional,
diff --git a/web/lib/reports.rb b/web/lib/reports.rb
index 4b1e3d6..398e7da 100644
--- a/web/lib/reports.rb
+++ b/web/lib/reports.rb
@@ -11,8 +11,14 @@ class Report
end
end
- def self.each_with_index
- @@reports.sort_by{ |report| report.title }.each_with_index do |report, idx|
+ def self.each_visible
+ @@reports.select{ |report| report.visible? }.sort_by{ |report| report.title }.each do |report|
+ yield report
+ end
+ end
+
+ def self.each_visible_with_index
+ @@reports.select{ |report| report.visible? }.sort_by{ |report| report.title }.each_with_index do |report, idx|
yield report, idx
end
end
@@ -21,6 +27,7 @@ class Report
@@reports << self
@title = title
@sources = Hash.new
+ @visible = sources.size > 0
sources.each do |id|
@sources[id] = 1
end
@@ -38,6 +45,10 @@ class Report
'/reports/' + name
end
+ def visible?
+ @visible
+ end
+
end
Report.new 'Database statistics', :db
@@ -48,5 +59,5 @@ Report.new 'Key lengths', :db
Report.new 'Language comparison table for keys in the wiki', :wiki
Report.new 'Languages', :wiki
Report.new 'Wiki pages about non-existing keys', :db, :wiki
-#Report.new 'Name tags', :db
+Report.new 'Name tags'