whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: add a manifest in preparation for add to home screen / desktop support
Date Sun, 10 Jun 2018 01:39:18 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3574fd8  add a manifest in preparation for add to home screen / desktop support
3574fd8 is described below

commit 3574fd8c0bdb2c71a2bcc8b667ce8e98cabdec8d
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Sat Jun 9 21:38:49 2018 -0400

    add a manifest in preparation for add to home screen / desktop support
---
 www/board/agenda/routes.rb                | 26 ++++++++++++++++++++++++++
 www/board/agenda/views/bootstrap.html.erb |  1 +
 www/board/agenda/views/main.html.rb       |  1 +
 www/board/agenda/views/manifest.json.erb  | 15 +++++++++++++++
 4 files changed, 43 insertions(+)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 21d8c86..bd8b91b 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -18,6 +18,29 @@ get '/latest/' do
   )
 end
 
+# icon
+get '/whimsy.svg' do
+  send_file File.expand_path('../../../whimsy.svg', __FILE__),
+    type: 'image/svg+xml'
+end
+
+# Progress Web App Manfest
+get '/manifest.json' do
+  @svgmtime = File.mtime(File.expand_path('../../../whimsy.svg', __FILE__)).to_i
+
+  # capture all the variable content
+  hash = {
+    source: File.read("#{settings.views}/manifest.json.erb"),
+    svgmtime: @svgmtime
+  }
+
+  # detect if there were any modifications
+  etag Digest::MD5.hexdigest(JSON.dump(hash))
+
+  content_type 'application/json'
+  erb :"manifest.json"
+end
+
 # redirect shepherd to latest agenda
 get '/shepherd' do
   user=ASF::Person.find(env.user).public_name.split(' ').first
@@ -195,6 +218,7 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
   @page[:minutes] = YAML.load(File.read(minutes)) if File.exist? minutes
 
   @cssmtime = File.mtime('public/stylesheets/app.css').to_i
+  @manmtime = File.mtime("#{settings.views}/manifest.json.erb").to_i
   @appmtime = Wunderbar::Asset.convert("#{settings.views}/app.js.rb").mtime.to_i
   @server[:swmtime] = File.mtime("#{settings.views}/sw.js.rb").to_i
 
@@ -213,8 +237,10 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
 
     # capture all the variable content
     hash = {
+      source: File.read("#{settings.views}/bootstrap.html.erb"),
       cssmtime: @cssmtime, 
       appmtime: @appmtime, 
+      manmtime: @manmtime, 
       scripts: Wunderbar::Asset.scripts.
         map {|script| [script.path, script.mtime.to_i]}.sort,
       stylesheets: Wunderbar::Asset.stylesheets.
diff --git a/www/board/agenda/views/bootstrap.html.erb b/www/board/agenda/views/bootstrap.html.erb
index 5ed8031..f7e386e 100644
--- a/www/board/agenda/views/bootstrap.html.erb
+++ b/www/board/agenda/views/bootstrap.html.erb
@@ -8,6 +8,7 @@
     <link rel="stylesheet" href="<%= stylesheet.path %>?<%= stylesheet.mtime.to_i
%>"/>
 <% end %>
     <link rel="stylesheet" href="../stylesheets/app.css?<%= @cssmtime %>"/>
+    <link rel="manifest" href="../manifest.json?<%= @manmtime %>"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
   </head>
 
diff --git a/www/board/agenda/views/main.html.rb b/www/board/agenda/views/main.html.rb
index 600ccce..f2ac92d 100644
--- a/www/board/agenda/views/main.html.rb
+++ b/www/board/agenda/views/main.html.rb
@@ -6,6 +6,7 @@ _html do
   _base href: @base
   _title 'ASF Board Agenda'
   _link rel: 'stylesheet', href: "../stylesheets/app.css?#{@cssmtime}"
+  _link rel: 'manifest', href: "../manifest.json?#{@manmtime}"
   _meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'
 
   _div_.main!
diff --git a/www/board/agenda/views/manifest.json.erb b/www/board/agenda/views/manifest.json.erb
new file mode 100644
index 0000000..b3f4bd7
--- /dev/null
+++ b/www/board/agenda/views/manifest.json.erb
@@ -0,0 +1,15 @@
+{
+  "short_name": "Agenda",
+  "name": "ASF Board Agenda",
+  "icons": [
+    {
+      "src": "/whimsy.svg?<%= @svgmtime %>",
+      "type": "image/svg+xml",
+      "sizes": "120x84"
+    }
+  ],
+  "start_url": "/latest/",
+  "background_color": "#FFF",
+  "display": "standalone"
+}
+

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.

Mime
View raw message