From f9b17a6d6c6e69ab6f5a28747d21ba24d602cfce Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Fri, 19 Aug 2016 18:59:06 -0400 Subject: Support MDL toasts --- Makefile | 14 +++++++++----- mdl/classes-1.1.3 | 1 + mdl/lib.urp | 5 +++++ mdl/mdl.ur | 16 ++++++++++++++++ mdl/mdlFfi.js | 28 ++++++++++++++++++++++++++++ mdl/mdlFfi.urs | 15 +++++++++++++++ 6 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 mdl/mdlFfi.js create mode 100644 mdl/mdlFfi.urs diff --git a/Makefile b/Makefile index 7d6aa97..715f208 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,14 @@ MDL_GENERATED = mdl/mdlClasses.urp mdl/mdlClasses.ur .PHONY: all all: ugtd ugtd.db -ugtd initialize.sql: ugtd.urp $(MDL_GENERATED) mdl/lib.urp mdl/mdl.ur main.urs \ - main.ur +ugtd initialize.sql: \ + ugtd.urp \ + mdl/lib.urp \ + mdl/mdlFfi.urs mdl/mdlFfi.js \ + mdl/mdlClasses.urp \ + mdl/mdlClasses.ur \ + mdl/mdl.ur \ + main.urs main.ur urweb -ccompiler build_scripts/clang -output ugtd ugtd ugtd.db: initialize.sql prepopulate.sql @@ -26,9 +32,7 @@ ugtd.db: initialize.sql prepopulate.sql sqlite3 $@ transaction unit} = + id <- fresh; + return { + Placeholder = +
+
+ +
+ , + Show = MdlFfi.showSnackbar (show id) + } +end diff --git a/mdl/mdlFfi.js b/mdl/mdlFfi.js new file mode 100644 index 0000000..f961cab --- /dev/null +++ b/mdl/mdlFfi.js @@ -0,0 +1,28 @@ +// Copyright 2015 Google Inc. +// Copyright 2016 Benjamin Barenblat +// +// Licensed under the Apache License, Version 2.0 (the “License”); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an “AS IS” BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. + +"use strict"; + +var UrWeb = { + MdlFfi: { + + showSnackbar: + function(id, text) { + document.querySelector('#' + id) + .MaterialSnackbar.showSnackbar({message: text}); + }, + + } +}; // UrWeb.MdlFfi diff --git a/mdl/mdlFfi.urs b/mdl/mdlFfi.urs new file mode 100644 index 0000000..74dd636 --- /dev/null +++ b/mdl/mdlFfi.urs @@ -0,0 +1,15 @@ +(* Copyright 2015 Google Inc. +Copyright 2016 Benjamin Barenblat + +Licensed under the Apache License, Version 2.0 (the “License”); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. *) + +val showSnackbar : string (* id *) -> string (* text *) -> transaction unit -- cgit v1.2.3