Skip to content

Commit c18bf31

Browse files
committed
Move browserconfig.xml and manifest.json to actions
The application manifest files need to be generated with asset urls so it's simplest to just make them into Rails actions.
1 parent e2ba8c6 commit c18bf31

8 files changed

Lines changed: 80 additions & 57 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ gem 'dalli'
3434
gem 'connection_pool'
3535
gem 'lograge'
3636
gem 'logstash-logger'
37+
gem 'jbuilder'
3738

3839
group :development, :test do
3940
gem 'rspec-rails'

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ GEM
132132
phantomjs (>= 1.9)
133133
railties (>= 3.2.0)
134134
sprockets-rails
135+
jbuilder (2.3.1)
136+
activesupport (>= 3.0.0, < 5)
137+
multi_json (~> 1.2)
135138
jmespath (1.0.2)
136139
multi_json (~> 1.0)
137140
jquery-rails (4.0.4)
@@ -305,6 +308,7 @@ DEPENDENCIES
305308
faraday
306309
faraday_middleware
307310
jasmine-rails
311+
jbuilder
308312
jquery-rails
309313
json
310314
launchy

app/controllers/pages_controller.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,13 @@ def index
44

55
def help
66
end
7+
8+
def privacy
9+
end
10+
11+
def browserconfig
12+
end
13+
14+
def manifest
15+
end
716
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cache :browserconfig, expires_in: 5.minutes do
2+
xml.instruct! :xml, version: "1.0"
3+
xml.browserconfig do
4+
xml.msapplication do
5+
xml.tile do
6+
xml.square70x70logo src: path_to_image('os-social/windows/tiny.png')
7+
xml.square150x150logo src: path_to_image('os-social/windows/square.png')
8+
xml.wide310x150logo src: path_to_image('os-social/windows/wide.png')
9+
xml.square310x310logo src: path_to_image('os-social/windows/large.png')
10+
xml.TileColor "#008800"
11+
end
12+
end
13+
end
14+
end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
json.cache! :manifest, expires_in: 5.minutes do
2+
json.name "Petitions"
3+
json.display "standalone"
4+
json.orientation "portrait"
5+
json.start_url "/"
6+
7+
json.icons do
8+
json.child! do
9+
json.src path_to_image("os-social/android/launcher-icon-0-75x.png")
10+
json.sizes "36x36"
11+
json.type "image/png"
12+
json.density "0.75"
13+
end
14+
15+
json.child! do
16+
json.src path_to_image("os-social/android/launcher-icon-1x.png")
17+
json.sizes "48x48"
18+
json.type "image/png"
19+
json.density "1.0"
20+
end
21+
22+
json.child! do
23+
json.src path_to_image("os-social/android/launcher-icon-1-5x.png")
24+
json.sizes "72x72"
25+
json.type "image/png"
26+
json.density "1.5"
27+
end
28+
29+
json.child! do
30+
json.src path_to_image("os-social/android/launcher-icon-2x.png")
31+
json.sizes "96x96"
32+
json.type "image/png"
33+
json.density "2.0"
34+
end
35+
36+
json.child! do
37+
json.src path_to_image("os-social/android/launcher-icon-3x.png")
38+
json.sizes "144x144"
39+
json.type "image/png"
40+
json.density "3.0"
41+
end
42+
43+
json.child! do
44+
json.src path_to_image("os-social/android/launcher-icon-4x.png")
45+
json.sizes "192x192"
46+
json.type "image/png"
47+
json.density "4.0"
48+
end
49+
end
50+
end

config/routes.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
get '/' => 'pages#index', :as => :home
44
get 'help' => 'pages#help', :as => :help
55
get 'privacy' => 'pages#privacy', :as => :privacy
6-
6+
get 'browserconfig' => 'pages#browserconfig', format: 'xml'
7+
get 'manifest' => 'pages#manifest', format: 'json'
78

89
get 'feedback' => 'feedback#index', :as => 'feedback'
910
get 'feedback/thanks' => 'feedback#thanks', :as => 'thanks_feedback'

public/browserconfig.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

public/manifest.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)