/
public.rb
153 lines (132 loc) · 10 KB
/
public.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
ActionController::Routing::Routes.draw do |map|
# SPECIAL PAGES
map.root :controller => 'special', :action => 'home', :conditions => { :method => :get }
map.connect 'robots.txt', :controller => 'special', :action => 'robots_dot_txt', :format => :txt, :conditions => { :method => :get }
# map.widget_instructions 'widget_instructions', :controller => 'special', :action => 'widget_instructions', :conditions => { :method => :get }
# ENTRY SEARCH
map.entries_search 'articles/search.:format', :controller => 'entries/search', :action => 'show', :conditions => { :method => :get }
map.entries_search_help 'articles/search/help', :controller => 'entries/search', :action => 'help', :conditions => { :method => :get }
map.entries_search_activity_sparkline 'articles/search/activity/sparkline/:period',
:controller => 'entries/search',
:action => 'activity_sparkline',
:conditions => { :method => :get}
# ENTRY PAGE VIEW
map.entries_page_views 'articles/views', :controller => 'entries/page_views', :action => 'create', :conditions => { :method => :post }
# ENTRIES
map.entries 'articles.:format', :controller => 'entries', :action => 'index', :conditions => { :method => :get }
map.highlighted_entries 'articles/featured.:format', :controller => 'entries', :action => 'highlighted', :conditions => { :method => :get }
map.entries_search_facet 'articles/search/facet', :controller => 'entries', :action => 'search_facet', :conditions => { :method => :get }
map.entries_widget 'articles/widget', :controller => 'entries', :action => 'widget', :conditions => { :method => :get }
map.entry 'articles/:year/:month/:day/:document_number/:slug.:format', :controller => 'entries', :conditions => { :method => :get },
:action => 'show',
:year => /\d{4}/,
:month => /\d{1,2}/,
:day => /\d{1,2}/
map.entry_citation 'citations/:year/:month/:day/:document_number/:slug', :controller => 'entries',
:action => 'citations',
:conditions => { :method => :get },
:year => /\d{4}/,
:month => /\d{1,2}/,
:day => /\d{1,2}/
map.entries_current_issue 'articles/current', :controller => 'entries',
:action => 'current_issue',
:conditions => { :method => :get }
map.entries_by_date 'articles/:year/:month/:day', :controller => 'entries',
:action => 'by_date',
:conditions => { :method => :get },
:year => /\d{4}/,
:month => /\d{1,2}/,
:day => /\d{1,2}/
map.entries_date_search 'articles/date_search', :controller => 'entries',
:action => 'date_search',
:conditions => { :method => :get }
map.current_headlines 'articles/current-headlines', :controller => 'entries',
:action => 'current_headlines',
:conditions => { :method => :get }
map.short_entry 'a/:document_number', :controller => 'entries',
:action => 'tiny_url',
:conditions => { :method => :get }
# Backwards compatability, at least for now...
map.connect 'e/:document_number', :controller => 'entries',
:action => 'tiny_url',
:conditions => { :method => :get }
map.short_entry_with_anchor 'a/:document_number/:anchor',
:controller => 'entries',
:action => 'tiny_url',
:conditions => { :method => :get }
map.connect 'citation/:volume/:page', :controller => 'citations',
:action => 'show',
:conditions => { :method => :get },
:volume => /\d+/,
:page => /\d+/
map.citation 'citation/:fr_citation', :controller => 'citations',
:action => 'show',
:conditions => { :method => :get },
:fr_citation => /\d+-FR-\d+/
map.citation_search 'citation/search', :controller => 'citations',
:action => 'search',
:conditions => { :method => :get }
# ENTRY EMAILS
map.new_entry_email 'articles/email-a-friend/:document_number', :controller => "entries/emails",
:action => "new",
:conditions => {:method => :get}
map.entry_email 'articles/email-a-friend/:document_number', :controller => "entries/emails",
:action => "create",
:conditions => {:method => :post}
map.delivered_entry_email 'articles/email-a-friend/:document_number/delivered', :controller => "entries/emails",
:action => "delivered",
:conditions => {:method => :get}
# EVENT SEARCH
map.events_search 'events/search.:format', :controller => 'events/search', :action => 'show', :conditions => { :method => :get }
# EVENT
map.event 'events/:id.:format', :controller => 'events', :action => 'show', :conditions => { :method => :get }
# TOPICS
map.resources :topics, :as => "topics", :only => [:index, :show]
map.significant_entries_topic 'topics/:id/significant.:format', :controller => "topics", :action => "significant_entries", :conditions => { :method => :get }
# AGENCIES
map.resources :agencies, :only => [:index, :show], :collection => {:search => :get}
map.significant_entries_agency 'agencies/:id/significant.:format', :controller => "agencies", :action => "significant_entries", :conditions => { :method => :get }
# REGULATIONS
map.regulatory_plans_search 'regulations/search',
:controller => 'regulatory_plans/search',
:action => 'show',
:conditions => { :method => :get }
map.regulatory_plan 'regulations/:regulation_id_number/:slug.:format',
:controller => 'regulatory_plans',
:action => 'show',
:conditions => { :method => :get }
map.connect 'regulations/:regulation_id_number.js',
:controller => 'regulatory_plans',
:action => 'json_summary',
:format => 'js',
:conditions => { :method => :get }
map.short_regulatory_plan 'r/:regulation_id_number', :controller => 'regulatory_plans',
:action => 'tiny_url',
:conditions => { :method => :get }
# EXTERNAL CITATIONS
# /external-citation/10-CFR-123.456
map.with_options(:controller => 'external_citations', :conditions => {:method => :get}) do |external_citation|
external_citation.with_options(:requirements => {:citation => /\d+-CFR-\d+(?:\.\d+)?/}) do |external_cfr_citation|
external_cfr_citation.cfr_citation 'external-citation/:year/:citation', :action => :cfr_citation
external_cfr_citation.select_cfr_citation 'select-citation/:year/:month/:day/:citation', :action => :select_cfr_citation
end
end
# SUBSCRIPTIONS
map.resources :subscriptions, :only => [:new, :create, :edit, :update, :destroy], :member => {:unsubscribe => :get, :confirm => :get}, :collection => {:confirmation_sent => :get, :confirmed => :get, :unsubscribed => :get}
# SECTIONS
Section.all.each do |section|
map.with_options :slug => section.slug, :controller => "sections", :conditions => { :method => :get } do |section_map|
section_map.connect "#{section.slug}.:format", :action => "show"
section_map.connect "#{section.slug}/about", :action => "about"
section_map.connect "#{section.slug}/featured.:format", :action => "highlighted_entries"
section_map.connect "#{section.slug}/significant.:format", :action => "significant_entries"
end
end
# CANNED SEARCHES
map.canned_search ":slug.:format", :controller => "canned_searches", :action => :show
# SECTIONS
map.about_section ":slug/about", :controller => "sections", :action => "about", :conditions => { :method => :get }
map.highlighted_entries_section ":slug/featured.:format", :controller => "sections", :action => "highlighted_entries", :conditions => { :method => :get }
map.significant_entries_section ":slug/significant.:format", :controller => "sections", :action => "significant_entries", :conditions => { :method => :get }
map.section ':slug.:format', :controller => "sections", :action => "show", :conditions => { :method => :get }
end