From 90c4d7b7d79258cc04a8d9ad376ad2e9152f81f9 Mon Sep 17 00:00:00 2001 From: hdf1986 Date: Tue, 30 Apr 2019 09:56:24 -0300 Subject: [PATCH 1/7] [WIP] Added basic template selector --- package-lock.json | 542 +++++++++--------- resources/sass/site2.scss | 37 ++ src/planwise/client/projects2/api.cljs | 3 +- .../client/projects2/components/listings.cljs | 20 +- src/planwise/client/projects2/handlers.cljs | 12 +- src/planwise/client/projects2/views.cljs | 1 + src/planwise/client/routes.cljs | 4 +- src/planwise/component/projects2.clj | 7 +- src/planwise/endpoint/projects2.clj | 4 +- 9 files changed, 348 insertions(+), 282 deletions(-) diff --git a/package-lock.json b/package-lock.json index d872a5588..21571043b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,25 +7,25 @@ "resolved": "https://registry.npmjs.org/@cljs-oss/module-deps/-/module-deps-1.1.1.tgz", "integrity": "sha1-YmZ/KCFk8/EParnxJLpBb9EkOfo=", "requires": { - "JSONStream": "^1.0.3", - "babel-traverse": "^6.23.1", - "babylon": "^6.15.0", - "browser-resolve": "^1.7.0", - "cached-path-relative": "^1.0.0", - "concat-stream": "~1.5.0", - "defined": "^1.0.0", - "detective": "^4.0.0", - "duplexer2": "^0.1.2", + "JSONStream": "1.3.2", + "babel-traverse": "6.26.0", + "babylon": "6.18.0", + "browser-resolve": "1.11.2", + "cached-path-relative": "1.0.2", + "concat-stream": "1.5.2", + "defined": "1.0.0", + "detective": "4.7.1", + "duplexer2": "0.1.4", "enhanced-resolve": "3.4.1", - "inherits": "^2.0.1", + "inherits": "2.0.3", "konan": "1.1.0", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.3", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" + "parents": "1.0.1", + "readable-stream": "2.3.5", + "resolve": "1.6.0", + "stream-combiner2": "1.1.1", + "subarg": "1.0.0", + "through2": "2.0.3", + "xtend": "4.0.1" } }, "@material/animation": { @@ -48,10 +48,10 @@ "resolved": "https://registry.npmjs.org/@material/button/-/button-0.32.0.tgz", "integrity": "sha512-3PBA+o8T5lFJbCo2GZD8sm5U4VXiHDN6nHkrKlysuvcbo6QQK1C3ZMP4BIj2nmSpodvNRXOk8opG3feDcubg3g==", "requires": { - "@material/elevation": "^0.28.0", - "@material/ripple": "^0.32.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/elevation": "0.28.0", + "@material/ripple": "0.32.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/card": { @@ -59,10 +59,10 @@ "resolved": "https://registry.npmjs.org/@material/card/-/card-0.32.0.tgz", "integrity": "sha512-Y/o8Mekvlt3su0K80gcLpmcdFUa+D57nKDI3nVcM1Xi2r5/ra3qjAmFda5mauxZK/8PzyB/FJzF1fy/RH5s+9g==", "requires": { - "@material/elevation": "^0.28.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0" + "@material/elevation": "0.28.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0" } }, "@material/checkbox": { @@ -70,12 +70,12 @@ "resolved": "https://registry.npmjs.org/@material/checkbox/-/checkbox-0.32.0.tgz", "integrity": "sha512-Rc6sidCCsc+wyktwd6KhNqAt14H6zSEarwLnvqCaYLv/Ml+lqg2SjQ3mg9rRKt1JREaN7G9BGKQKAnB//OMY4g==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/selection-control": "^0.32.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/selection-control": "0.32.0", + "@material/theme": "0.30.0" } }, "@material/chips": { @@ -83,8 +83,8 @@ "resolved": "https://registry.npmjs.org/@material/chips/-/chips-0.32.0.tgz", "integrity": "sha512-bw4LSzF+Ejyi4Z7iZHZE5J2k437b2iLVM9bGjkXYZ4bkFR+gqjjfB9787FEQGoowHwKOWmuVwYrsO+Vsomf6jg==", "requires": { - "@material/base": "^0.29.0", - "@material/ripple": "^0.32.0" + "@material/base": "0.29.0", + "@material/ripple": "0.32.0" } }, "@material/dialog": { @@ -92,14 +92,14 @@ "resolved": "https://registry.npmjs.org/@material/dialog/-/dialog-0.32.0.tgz", "integrity": "sha512-tmOdwpFAT5aI4nI43ldzgZ5ONPEZzhE8Nf95DnP8najwKni/aY3D61yo3KwrE2Q0fuuXL1e6AEojX83IHEEciw==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/elevation": "^0.28.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.1.1", - "focus-trap": "^2.3.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/elevation": "0.28.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.1.1", + "focus-trap": "2.4.3" }, "dependencies": { "@material/typography": { @@ -114,12 +114,12 @@ "resolved": "https://registry.npmjs.org/@material/drawer/-/drawer-0.30.0.tgz", "integrity": "sha512-NZyp6jVd6cDucBPUl391cTuIkR5Vy5OdrdNQxvH+pTjvb7R2yQJKVv2a7PxuR1uKjGM1vRudFOdXpviwbplr9A==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/elevation": "^0.28.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/elevation": "0.28.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/elevation": { @@ -127,8 +127,8 @@ "resolved": "https://registry.npmjs.org/@material/elevation/-/elevation-0.28.0.tgz", "integrity": "sha512-U2utCuMDDhrJ8Cyisz16GAejN9h9xyS4jvVkt2uIOUyPZRjnaJyoAbpyf0mOzFxIdBuRpNGJYm2PoAwHsSA+xw==", "requires": { - "@material/animation": "^0.25.0", - "@material/theme": "^0.4.0" + "@material/animation": "0.25.0", + "@material/theme": "0.4.0" }, "dependencies": { "@material/theme": { @@ -143,10 +143,10 @@ "resolved": "https://registry.npmjs.org/@material/fab/-/fab-0.32.0.tgz", "integrity": "sha512-VWzka0qpDxDuqPai9alrFUQadpyEwSGuwt+vgqV0gL5vs0VxLlEa1XP8McZSvdCdHGPNEZtohUif2ZaDEiMSzQ==", "requires": { - "@material/animation": "^0.25.0", - "@material/elevation": "^0.28.0", - "@material/ripple": "^0.32.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/elevation": "0.28.0", + "@material/ripple": "0.32.0", + "@material/theme": "0.30.0" } }, "@material/floating-label": { @@ -154,9 +154,9 @@ "resolved": "https://registry.npmjs.org/@material/floating-label/-/floating-label-0.32.0.tgz", "integrity": "sha512-YrcRSK04EnvmVJw2bH0if9zOaag6zUbk41vW2FQZJkkaKd3kQt02d0RqlAJ9qSKciGNb0J0h/EDMcdGpNDAp6Q==", "requires": { - "@material/base": "^0.29.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0" + "@material/base": "0.29.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0" } }, "@material/form-field": { @@ -164,11 +164,11 @@ "resolved": "https://registry.npmjs.org/@material/form-field/-/form-field-0.32.0.tgz", "integrity": "sha512-DrUSzqS73H+ksyI0HM66q7IRVSuIIN5dvapayaCXscoSVq5jU1jObqDNtu7PmBxEqvXj68SHrRWm7M06m06a5w==", "requires": { - "@material/base": "^0.29.0", - "@material/rtl": "^0.30.0", - "@material/selection-control": "^0.32.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/base": "0.29.0", + "@material/rtl": "0.30.0", + "@material/selection-control": "0.32.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/grid-list": { @@ -176,10 +176,10 @@ "resolved": "https://registry.npmjs.org/@material/grid-list/-/grid-list-0.30.0.tgz", "integrity": "sha512-RjL5npvXRWqYE1ro83JjzF2JTimIqVrshCcjSCkiFcDY0AKyEBfihvtHA2JhngLgCgKBBcSHDzNL8sqGMT8AJg==", "requires": { - "@material/base": "^0.29.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/base": "0.29.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/icon-toggle": { @@ -187,10 +187,10 @@ "resolved": "https://registry.npmjs.org/@material/icon-toggle/-/icon-toggle-0.32.0.tgz", "integrity": "sha512-49jrIvP64yVkhVuwek4PmPumMllB3CkqGHgGaSlNJHGdZ3VaSD4DqxnKD0avxhPxEUWg/NXy1dEE+3YFrI/Caw==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/ripple": "^0.32.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/ripple": "0.32.0", + "@material/theme": "0.30.0" } }, "@material/layout-grid": { @@ -203,9 +203,9 @@ "resolved": "https://registry.npmjs.org/@material/line-ripple/-/line-ripple-0.32.0.tgz", "integrity": "sha512-vd/jlnK/paWZnsr9rvKkeo4qjIDTd59TljSUzqgXN4wiOwiCqXWtNgsy+veKG4fNLVqwad7ECKizUn2iQ/+IMQ==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/theme": "0.30.0" } }, "@material/linear-progress": { @@ -213,9 +213,9 @@ "resolved": "https://registry.npmjs.org/@material/linear-progress/-/linear-progress-0.30.0.tgz", "integrity": "sha512-xKeC22ni5B2xEoYwY8bBJABS3Xkxa1qjKb+bWu0zf90F7e3bQ0rp2pvzHSp0GGJHTAChu1COMXOyZ1QzaBYtGg==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/theme": "0.30.0" } }, "@material/list": { @@ -223,10 +223,10 @@ "resolved": "https://registry.npmjs.org/@material/list/-/list-0.32.0.tgz", "integrity": "sha512-03eZsHYRSS7b+fUsx5gBkRhUubfPYYg5Nr7PwLdEPLR5VuQ6RzgcNYcBnLtIa5rdvrd6NugNNSL9c2k27Qjt6g==", "requires": { - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/menu": { @@ -234,11 +234,11 @@ "resolved": "https://registry.npmjs.org/@material/menu/-/menu-0.31.0.tgz", "integrity": "sha512-9318W8Ws1lnJzsXC9+3hVaYJkGxJOXNHR4PaIpvI9T4ZmyRu5+E6Cp0hf42RTQ1bHTDLOSG/tPuKvsN9VW/6hQ==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/elevation": "^0.28.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/elevation": "0.28.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/radio": { @@ -246,11 +246,11 @@ "resolved": "https://registry.npmjs.org/@material/radio/-/radio-0.32.0.tgz", "integrity": "sha512-a+uUiCem0ULjcdH3mwOz/dabLGiiCshqr/Gu5xN1kB6bDLmXybM50DMgw3TowRXyyS4YOX6tm6j+af4dsiNJNQ==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/ripple": "^0.32.0", - "@material/selection-control": "^0.32.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/ripple": "0.32.0", + "@material/selection-control": "0.32.0", + "@material/theme": "0.30.0" } }, "@material/ripple": { @@ -258,8 +258,8 @@ "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-0.32.0.tgz", "integrity": "sha512-pfG16d1/46f4QnrUHG66aV22kbY7sh7n2HR/cFALX6D0l0Kae3+xjuUnr1yy32Y1tzLAc84U9jGEzTDykVff9A==", "requires": { - "@material/base": "^0.29.0", - "@material/theme": "^0.30.0" + "@material/base": "0.29.0", + "@material/theme": "0.30.0" } }, "@material/rtl": { @@ -272,14 +272,14 @@ "resolved": "https://registry.npmjs.org/@material/select/-/select-0.32.0.tgz", "integrity": "sha512-KLlP4i1QDzsDJoIW4qA1JB17zSrgHSG2PpxKeqhUjqb9W5Q71LJ6QjhPynFA897sq1Wd9WTSHl41BAu2qUZlFA==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/list": "^0.32.0", - "@material/menu": "^0.31.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/list": "0.32.0", + "@material/menu": "0.31.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/selection-control": { @@ -287,7 +287,7 @@ "resolved": "https://registry.npmjs.org/@material/selection-control/-/selection-control-0.32.0.tgz", "integrity": "sha512-zlq6x5n0pN3eKJQBYkWdh4UQScF7Ui7g7XIeeuKnNFo99oxJoKtuGk3WX5/OBc0wU4qe38rfQW6XGeFG4Adk3Q==", "requires": { - "@material/ripple": "^0.32.0" + "@material/ripple": "0.32.0" } }, "@material/slider": { @@ -295,10 +295,10 @@ "resolved": "https://registry.npmjs.org/@material/slider/-/slider-0.32.0.tgz", "integrity": "sha512-FmV9tjzhj9KfTpxXL2YNgV3STQTWXmROp7SJqrz8v2JpDXiVyI/pq/DhcFLEMvs096cIZWgH+iyZPQGFTPH12A==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0" } }, "@material/snackbar": { @@ -306,11 +306,11 @@ "resolved": "https://registry.npmjs.org/@material/snackbar/-/snackbar-0.30.0.tgz", "integrity": "sha512-zQamWIxco7wZGYHXZ5G6TGTUKeZgS/EZ+YgRhA5hm6ZwfZrQYhn8coWRPOfsgHHlDN511sA8svU41h6HArlSFA==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/switch": { @@ -318,9 +318,9 @@ "resolved": "https://registry.npmjs.org/@material/switch/-/switch-0.32.0.tgz", "integrity": "sha512-nn5HN8AdSb4aSOJEEG9wGvPg+wPhg2rMD3j8WTX1HZ7c0HklgM07SuNKI+Yz5VFgfA28m3qFJAdHIv7OdzSuaQ==", "requires": { - "@material/animation": "^0.25.0", - "@material/elevation": "^0.28.0", - "@material/theme": "^0.30.0" + "@material/animation": "0.25.0", + "@material/elevation": "0.28.0", + "@material/theme": "0.30.0" } }, "@material/tabs": { @@ -328,12 +328,12 @@ "resolved": "https://registry.npmjs.org/@material/tabs/-/tabs-0.32.0.tgz", "integrity": "sha512-RWzxlQoR6MPqxCP2kVNrxg4+D2A5eT7WO0cqkoxsbDz8wAPeNlU/vdr17bnTlhAiiwcDCKulxHRNX7Gztwwg0A==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/textfield": { @@ -341,14 +341,14 @@ "resolved": "https://registry.npmjs.org/@material/textfield/-/textfield-0.32.0.tgz", "integrity": "sha512-5gLDjBE14LqRT3NcToYZu/vVL/FzPY/kPT+oqzyZaRfvx3iyTBXSPsE0LOfGIgPv+Z65Z4g1PoccLWW/cZWHbw==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/floating-label": "^0.32.0", - "@material/line-ripple": "^0.32.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/floating-label": "0.32.0", + "@material/line-ripple": "0.32.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/theme": { @@ -361,12 +361,12 @@ "resolved": "https://registry.npmjs.org/@material/toolbar/-/toolbar-0.32.0.tgz", "integrity": "sha512-eDouRzRFqOpOigm1nOr8QrfEGJW87gdzhqlM8YbrIzUchm3JouAQgV62wvDs+mMpy2jXj1rMBZOTbtff78myqA==", "requires": { - "@material/base": "^0.29.0", - "@material/elevation": "^0.28.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/base": "0.29.0", + "@material/elevation": "0.28.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/top-app-bar": { @@ -374,13 +374,13 @@ "resolved": "https://registry.npmjs.org/@material/top-app-bar/-/top-app-bar-0.32.0.tgz", "integrity": "sha512-zdL70MN10Hd1831o0xdGGAASemY4ht2Wz2juANaK3fCf9uvv2UFouS8eJa4BX16rHenIzwrffuA1EKn96RauaQ==", "requires": { - "@material/animation": "^0.25.0", - "@material/base": "^0.29.0", - "@material/elevation": "^0.28.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/theme": "^0.30.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/base": "0.29.0", + "@material/elevation": "0.28.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/theme": "0.30.0", + "@material/typography": "0.28.0" } }, "@material/typography": { @@ -393,8 +393,8 @@ "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo=", "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" + "jsonparse": "1.3.1", + "through": "2.3.8" } }, "acorn": { @@ -422,9 +422,9 @@ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" } }, "babel-messages": { @@ -432,7 +432,7 @@ "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", "requires": { - "babel-runtime": "^6.22.0" + "babel-runtime": "6.26.0" } }, "babel-runtime": { @@ -440,8 +440,8 @@ "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" + "core-js": "2.5.4", + "regenerator-runtime": "0.11.1" } }, "babel-traverse": { @@ -449,15 +449,15 @@ "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.9", + "globals": "9.18.0", + "invariant": "2.2.4", + "lodash": "4.17.11" } }, "babel-types": { @@ -465,10 +465,10 @@ "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.11", + "to-fast-properties": "1.0.3" } }, "babylon": { @@ -501,11 +501,11 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "classnames": { @@ -518,9 +518,9 @@ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", "requires": { - "inherits": "~2.0.1", - "readable-stream": "~2.0.0", - "typedarray": "~0.0.5" + "inherits": "2.0.3", + "readable-stream": "2.0.6", + "typedarray": "0.0.6" }, "dependencies": { "readable-stream": { @@ -528,12 +528,12 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" } } } @@ -553,9 +553,9 @@ "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.3.tgz", "integrity": "sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==", "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1" } }, "debug": { @@ -576,8 +576,8 @@ "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", "requires": { - "acorn": "^5.2.1", - "defined": "^1.0.0" + "acorn": "5.5.3", + "defined": "1.0.0" } }, "duplexer2": { @@ -585,7 +585,7 @@ "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", "requires": { - "readable-stream": "^2.0.2" + "readable-stream": "2.3.5" } }, "encoding": { @@ -593,7 +593,7 @@ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", "requires": { - "iconv-lite": "~0.4.13" + "iconv-lite": "0.4.19" } }, "enhanced-resolve": { @@ -601,10 +601,10 @@ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "object-assign": "^4.0.1", - "tapable": "^0.2.7" + "graceful-fs": "4.1.11", + "memory-fs": "0.4.1", + "object-assign": "4.1.1", + "tapable": "0.2.8" } }, "errno": { @@ -612,7 +612,7 @@ "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", "requires": { - "prr": "~1.0.1" + "prr": "1.0.1" } }, "escape-string-regexp": { @@ -630,13 +630,13 @@ "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "requires": { - "core-js": "^1.0.0", - "isomorphic-fetch": "^2.1.1", - "loose-envify": "^1.0.0", - "object-assign": "^4.1.0", - "promise": "^7.1.1", - "setimmediate": "^1.0.5", - "ua-parser-js": "^0.7.9" + "core-js": "1.2.7", + "isomorphic-fetch": "2.2.1", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "promise": "7.3.1", + "setimmediate": "1.0.5", + "ua-parser-js": "0.7.17" }, "dependencies": { "core-js": { @@ -651,7 +651,7 @@ "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-2.4.3.tgz", "integrity": "sha512-sT5Ip9nyAIxWq8Apt1Fdv6yTci5GotaOtO5Ro1/+F3PizttNBcCYz8j/Qze54PPFK73KUbOqh++HUCiyNPqvhA==", "requires": { - "tabbable": "^1.0.3" + "tabbable": "1.1.2" } }, "globals": { @@ -669,7 +669,7 @@ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "iconv-lite": { @@ -687,7 +687,7 @@ "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", "requires": { - "loose-envify": "^1.0.0" + "loose-envify": "1.3.1" } }, "is-stream": { @@ -705,8 +705,8 @@ "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", "requires": { - "node-fetch": "^1.0.1", - "whatwg-fetch": ">=0.10.0" + "node-fetch": "1.7.3", + "whatwg-fetch": "2.0.4" } }, "js-tokens": { @@ -724,8 +724,8 @@ "resolved": "https://registry.npmjs.org/konan/-/konan-1.1.0.tgz", "integrity": "sha1-M3dDxLl7S9Hvi2KiSzFeuLxLIJQ=", "requires": { - "babel-traverse": "^6.23.1", - "babylon": "^6.15.0" + "babel-traverse": "6.26.0", + "babylon": "6.18.0" } }, "lodash": { @@ -738,7 +738,7 @@ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", "requires": { - "js-tokens": "^3.0.0" + "js-tokens": "3.0.2" } }, "material-components-web": { @@ -746,40 +746,40 @@ "resolved": "https://registry.npmjs.org/material-components-web/-/material-components-web-0.32.0.tgz", "integrity": "sha512-f2etJyWzZu/5U1qYnybzHXuUhyEAG19a/OFjSLi6rYJtjY1BtPS+Az9IHvnKDB7ahLET00vEtMKZbNsSa8Eksw==", "requires": { - "@material/animation": "^0.25.0", - "@material/auto-init": "^0.32.0", - "@material/base": "^0.29.0", - "@material/button": "^0.32.0", - "@material/card": "^0.32.0", - "@material/checkbox": "^0.32.0", - "@material/chips": "^0.32.0", - "@material/dialog": "^0.32.0", - "@material/drawer": "^0.30.0", - "@material/elevation": "^0.28.0", - "@material/fab": "^0.32.0", - "@material/floating-label": "^0.32.0", - "@material/form-field": "^0.32.0", - "@material/grid-list": "^0.30.0", - "@material/icon-toggle": "^0.32.0", - "@material/layout-grid": "^0.24.0", - "@material/line-ripple": "^0.32.0", - "@material/linear-progress": "^0.30.0", - "@material/list": "^0.32.0", - "@material/menu": "^0.31.0", - "@material/radio": "^0.32.0", - "@material/ripple": "^0.32.0", - "@material/rtl": "^0.30.0", - "@material/select": "^0.32.0", - "@material/selection-control": "^0.32.0", - "@material/slider": "^0.32.0", - "@material/snackbar": "^0.30.0", - "@material/switch": "^0.32.0", - "@material/tabs": "^0.32.0", - "@material/textfield": "^0.32.0", - "@material/theme": "^0.30.0", - "@material/toolbar": "^0.32.0", - "@material/top-app-bar": "^0.32.0", - "@material/typography": "^0.28.0" + "@material/animation": "0.25.0", + "@material/auto-init": "0.32.0", + "@material/base": "0.29.0", + "@material/button": "0.32.0", + "@material/card": "0.32.0", + "@material/checkbox": "0.32.0", + "@material/chips": "0.32.0", + "@material/dialog": "0.32.0", + "@material/drawer": "0.30.0", + "@material/elevation": "0.28.0", + "@material/fab": "0.32.0", + "@material/floating-label": "0.32.0", + "@material/form-field": "0.32.0", + "@material/grid-list": "0.30.0", + "@material/icon-toggle": "0.32.0", + "@material/layout-grid": "0.24.0", + "@material/line-ripple": "0.32.0", + "@material/linear-progress": "0.30.0", + "@material/list": "0.32.0", + "@material/menu": "0.31.0", + "@material/radio": "0.32.0", + "@material/ripple": "0.32.0", + "@material/rtl": "0.30.0", + "@material/select": "0.32.0", + "@material/selection-control": "0.32.0", + "@material/slider": "0.32.0", + "@material/snackbar": "0.30.0", + "@material/switch": "0.32.0", + "@material/tabs": "0.32.0", + "@material/textfield": "0.32.0", + "@material/theme": "0.30.0", + "@material/toolbar": "0.32.0", + "@material/top-app-bar": "0.32.0", + "@material/typography": "0.28.0" } }, "memory-fs": { @@ -787,8 +787,8 @@ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" + "errno": "0.1.7", + "readable-stream": "2.3.5" } }, "minimist": { @@ -806,8 +806,8 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" + "encoding": "0.1.12", + "is-stream": "1.1.0" } }, "object-assign": { @@ -820,7 +820,7 @@ "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", "requires": { - "path-platform": "~0.11.15" + "path-platform": "0.11.15" } }, "path-parse": { @@ -843,7 +843,7 @@ "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "requires": { - "asap": "~2.0.3" + "asap": "2.0.6" } }, "prop-types": { @@ -851,9 +851,9 @@ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.1.tgz", "integrity": "sha512-4ec7bY1Y66LymSUOH/zARVYObB23AT2h8cf6e/O6ZALB/N0sqZFEx7rq6EYPX2MkOdKORuooI/H5k9TlR4q7kQ==", "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1" } }, "prr": { @@ -866,10 +866,10 @@ "resolved": "https://registry.npmjs.org/react/-/react-15.5.4.tgz", "integrity": "sha1-+oPrAVBqsjfNwcjDsc6o3gEr8Ec=", "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "^15.5.7" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "prop-types": "15.6.1" } }, "react-dom": { @@ -877,10 +877,10 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.5.4.tgz", "integrity": "sha1-ugwoeG/VLtfk8hNf4CiNRirvk9o=", "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.0", - "prop-types": "~15.5.7" + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "prop-types": "15.5.10" }, "dependencies": { "prop-types": { @@ -888,8 +888,8 @@ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz", "integrity": "sha1-J5ffwxJhguOpXj37suiT3ddFYVQ=", "requires": { - "fbjs": "^0.8.9", - "loose-envify": "^1.3.1" + "fbjs": "0.8.16", + "loose-envify": "1.3.1" } } } @@ -907,7 +907,7 @@ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.5.8.tgz", "integrity": "sha1-a3suFBCDvjjIWVqlH8VXdccZk5Q=", "requires": { - "fbjs": "^0.8.9" + "fbjs": "0.8.16" } } } @@ -917,13 +917,13 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" }, "dependencies": { "process-nextick-args": { @@ -936,7 +936,7 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.1" } } } @@ -951,7 +951,7 @@ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz", "integrity": "sha512-mw7JQNu5ExIkcw4LPih0owX/TZXjD/ZUF/ZQ/pDnkw3ZKhDcZZw5klmBlj6gVMwjQ3Pz5Jgu7F3d0jcDVuEWdw==", "requires": { - "path-parse": "^1.0.5" + "path-parse": "1.0.5" } }, "rmwc": { @@ -959,7 +959,7 @@ "resolved": "https://registry.npmjs.org/rmwc/-/rmwc-1.4.1.tgz", "integrity": "sha512-Y8mZoc5tUgnQm/fTCz0lJIgJq2HzR+yTJxkhq6bunw56bJE1D09MNklfltQit5ss8olb0Dv7xwIARv4C+wGvqw==", "requires": { - "classnames": "^2.2.5", + "classnames": "2.2.5", "material-components-web": "0.32.0" } }, @@ -978,8 +978,8 @@ "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" + "duplexer2": "0.1.4", + "readable-stream": "2.3.5" } }, "string_decoder": { @@ -992,7 +992,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "subarg": { @@ -1000,7 +1000,7 @@ "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", "requires": { - "minimist": "^1.1.0" + "minimist": "1.2.0" } }, "supports-color": { @@ -1028,8 +1028,8 @@ "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" + "readable-stream": "2.3.5", + "xtend": "4.0.1" } }, "to-fast-properties": { diff --git a/resources/sass/site2.scss b/resources/sass/site2.scss index b1904115f..af4771a41 100644 --- a/resources/sass/site2.scss +++ b/resources/sass/site2.scss @@ -756,6 +756,43 @@ form.vertical, .fields-vertical { padding: 10px; } +.template-container { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + border-radius: 4px; + background-color: #FFFFFF; + box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 0 1px 3px 0 rgba(0,0,0,0.1); + flex-direction: column; + + h2 { + text-transform: uppercase; + } + + i { + font-size: 48px; + color: #FF5722; + display: block; + padding: 15px; + border: 1px solid rgba(0,0,0,0.1); + border-radius: 48px; + height: 48px; + width: 48px + } + + .action { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + } + + .row { + display: flex; + } +} + .loader { position: absolute; left: 50%; diff --git a/src/planwise/client/projects2/api.cljs b/src/planwise/client/projects2/api.cljs index 1e2c96866..f9b5f2323 100644 --- a/src/planwise/client/projects2/api.cljs +++ b/src/planwise/client/projects2/api.cljs @@ -4,9 +4,10 @@ ;; API methods (defn- create-project! - [] + [template] {:method :post :section :index + :params {:project {:name template}} :uri "/api/projects2"}) (defn- list-projects diff --git a/src/planwise/client/projects2/components/listings.cljs b/src/planwise/client/projects2/components/listings.cljs index d94546652..e14b64dd6 100644 --- a/src/planwise/client/projects2/components/listings.cljs +++ b/src/planwise/client/projects2/components/listings.cljs @@ -44,6 +44,24 @@ :on-click (utils/prevent-default #(dispatch [:projects2/new-project]))} "Create one"]]]) +(defn project-section-new + [] + [ui/fixed-width (common2/nav-params) + [:div.template-container + [:h2.row "Start from a template"] + [:div.row + [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} + [m/Icon {} "directions_walk"] + [:div "Plan facilities based on ground access"]] + [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} + [m/Icon {} "call_split"] + [:div "Plan diagonostic devices & sample referrals"]]] + [:h2.row "Start from scratch"] + [:div.row + [:a.action {} + [m/Icon {} "folder_open"] + [:div "Follow a wizard through all available settings"]]]]]) + (defn- listing-component [] (let [projects (subscribe [:projects2/list])] (if (empty? @projects) @@ -51,6 +69,6 @@ [projects-list @projects]))) (defn project-section-index [] - (let [create-project-button (ui/main-action {:icon "add" :on-click #(dispatch [:projects2/new-project])})] + (let [create-project-button (ui/main-action {:icon "add" :on-click #(dispatch [:projects2/template-project])})] [ui/fixed-width (merge {:action create-project-button} (common2/nav-params)) [listing-component]])) diff --git a/src/planwise/client/projects2/handlers.cljs b/src/planwise/client/projects2/handlers.cljs index a2212ac1c..b44cee0bf 100644 --- a/src/planwise/client/projects2/handlers.cljs +++ b/src/planwise/client/projects2/handlers.cljs @@ -15,10 +15,18 @@ (rf/reg-event-fx :projects2/new-project in-projects2 - (fn [_ [_]] - {:api (assoc (api/create-project!) + (fn [_ [_ template-identifier]] + {:api (assoc (api/create-project! template-identifier) :on-success [:projects2/project-created])})) +(rf/reg-event-fx +:projects2/template-project + in-projects2 + (fn [_ [_]] + {:navigate (routes/projects2-new {})})) + ; {:api (assoc (api/create-project!) + ; :on-success [:projects2/project-created])})) + (rf/reg-event-fx :projects2/project-created in-projects2 diff --git a/src/planwise/client/projects2/views.cljs b/src/planwise/client/projects2/views.cljs index 1712e0297..bf8baab96 100644 --- a/src/planwise/client/projects2/views.cljs +++ b/src/planwise/client/projects2/views.cljs @@ -37,6 +37,7 @@ (let [section (:section @page-params)] (case section :index [listings/project-section-index] + :new [listings/project-section-new] :show [project-section-show :scenarios] :project-scenarios [project-section-show :scenarios] :project-settings [project-section-show :settings] diff --git a/src/planwise/client/routes.cljs b/src/planwise/client/routes.cljs index 44d439f36..ebb3705e6 100644 --- a/src/planwise/client/routes.cljs +++ b/src/planwise/client/routes.cljs @@ -14,6 +14,8 @@ (dispatch [:navigate {:page :sources}])) (defroute projects2 "/projects2" [] (dispatch [:navigate {:page :projects2, :section :index}])) +(defroute projects2-new "/projects2/new" [] + (dispatch [:navigate {:page :projects2, :section :new}])) (defroute projects2-show "/projects2/:id" [id] (dispatch [:navigate {:page :projects2, :id (js/parseInt id), :section :show}])) (defroute design "/_design" [] @@ -27,4 +29,4 @@ (dispatch [:navigate {:page :projects2, :id (js/parseInt id), :section :project-scenarios}])) (defroute projects2-settings "/projects2/:id/settings" [id] (dispatch [:navigate {:page :projects2, :id (js/parseInt id), :section :project-settings}])) -(defroute download-sources-sample "/sources-sample.csv" []) \ No newline at end of file +(defroute download-sources-sample "/sources-sample.csv" []) diff --git a/src/planwise/component/projects2.clj b/src/planwise/component/projects2.clj index cb3ccdc6d..d20aa971f 100644 --- a/src/planwise/component/projects2.clj +++ b/src/planwise/component/projects2.clj @@ -28,10 +28,9 @@ ;; Service definition (defn create-project - [store owner-id] - (db-create-project! (get-db store) {:owner-id owner-id - :name "" - :state "draft"})) + [store params] + (db-create-project! (get-db store) (merge params { + :state "draft"}))) (defn update-project [store {:keys [config provider-set-id] :as project}] diff --git a/src/planwise/endpoint/projects2.clj b/src/planwise/endpoint/projects2.clj index 68375f672..4d0d7fdaa 100644 --- a/src/planwise/endpoint/projects2.clj +++ b/src/planwise/endpoint/projects2.clj @@ -26,9 +26,9 @@ [{service :projects2 service-scenarios :scenarios}] (routes - (POST "/" request + (POST "/" [name project :as request] (let [user-id (util/request-user-id request) - project-id (:id (projects2/create-project service user-id)) + project-id (:id (projects2/create-project service (merge project {:owner-id user-id}))) project (projects2/get-project service project-id)] (response project))) From c89a733390e37c7039220769fcc7f2fecb6a3981 Mon Sep 17 00:00:00 2001 From: hdf1986 Date: Wed, 29 May 2019 11:22:50 -0300 Subject: [PATCH 2/7] Fixes for linter --- .../client/projects2/components/listings.cljs | 28 +++++++++---------- src/planwise/client/projects2/handlers.cljs | 8 +++--- src/planwise/component/projects2.clj | 3 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/planwise/client/projects2/components/listings.cljs b/src/planwise/client/projects2/components/listings.cljs index e14b64dd6..92bfde44a 100644 --- a/src/planwise/client/projects2/components/listings.cljs +++ b/src/planwise/client/projects2/components/listings.cljs @@ -47,20 +47,20 @@ (defn project-section-new [] [ui/fixed-width (common2/nav-params) - [:div.template-container - [:h2.row "Start from a template"] - [:div.row - [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} - [m/Icon {} "directions_walk"] - [:div "Plan facilities based on ground access"]] - [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} - [m/Icon {} "call_split"] - [:div "Plan diagonostic devices & sample referrals"]]] - [:h2.row "Start from scratch"] - [:div.row - [:a.action {} - [m/Icon {} "folder_open"] - [:div "Follow a wizard through all available settings"]]]]]) + [:div.template-container + [:h2.row "Start from a template"] + [:div.row + [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} + [m/Icon {} "directions_walk"] + [:div "Plan facilities based on ground access"]] + [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} + [m/Icon {} "call_split"] + [:div "Plan diagonostic devices & sample referrals"]]] + [:h2.row "Start from scratch"] + [:div.row + [:a.action {} + [m/Icon {} "folder_open"] + [:div "Follow a wizard through all available settings"]]]]]) (defn- listing-component [] (let [projects (subscribe [:projects2/list])] diff --git a/src/planwise/client/projects2/handlers.cljs b/src/planwise/client/projects2/handlers.cljs index f2ac256b4..d328a01e6 100644 --- a/src/planwise/client/projects2/handlers.cljs +++ b/src/planwise/client/projects2/handlers.cljs @@ -22,10 +22,10 @@ :on-success [:projects2/project-created])})) (rf/reg-event-fx -:projects2/template-project - in-projects2 - (fn [_ [_]] - {:navigate (routes/projects2-new {})})) + :projects2/template-project + in-projects2 + (fn [_ [_]] + {:navigate (routes/projects2-new {})})) ; {:api (assoc (api/create-project!) ; :on-success [:projects2/project-created])})) diff --git a/src/planwise/component/projects2.clj b/src/planwise/component/projects2.clj index d20aa971f..e4cf04b03 100644 --- a/src/planwise/component/projects2.clj +++ b/src/planwise/component/projects2.clj @@ -29,8 +29,7 @@ (defn create-project [store params] - (db-create-project! (get-db store) (merge params { - :state "draft"}))) + (db-create-project! (get-db store) (merge params {:state "draft"}))) (defn update-project [store {:keys [config provider-set-id] :as project}] From 36f551eafe16f313873a86742d17968c90208534 Mon Sep 17 00:00:00 2001 From: pmallol Date: Wed, 29 May 2019 17:28:39 -0300 Subject: [PATCH 3/7] Fix style in template selector --- resources/sass/site2.scss | 20 ++++++++++++- .../client/projects2/components/listings.cljs | 29 ++++++++++--------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/resources/sass/site2.scss b/resources/sass/site2.scss index 3b87c96ba..3f94f2eac 100644 --- a/resources/sass/site2.scss +++ b/resources/sass/site2.scss @@ -845,9 +845,13 @@ form.vertical, .fields-vertical { background-color: #FFFFFF; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 0 1px 3px 0 rgba(0,0,0,0.1); flex-direction: column; + padding: 60px; h2 { + color: #999999; + font-size: 1rem; text-transform: uppercase; + margin-bottom: 45px; } i { @@ -864,12 +868,26 @@ form.vertical, .fields-vertical { .action { display: flex; flex-direction: column; - justify-content: center; align-items: center; + width: 20%; + cursor: pointer; + + div { + text-align: center; + margin: 1rem 0; + } } .row { display: flex; + justify-content: space-around; + width: 100%; + } + + hr { + border: 1px solid rgba(0,0,0,0.1); + width: calc(100% + 118px); + margin: 60px 0; } } diff --git a/src/planwise/client/projects2/components/listings.cljs b/src/planwise/client/projects2/components/listings.cljs index 92bfde44a..fbccb2fb2 100644 --- a/src/planwise/client/projects2/components/listings.cljs +++ b/src/planwise/client/projects2/components/listings.cljs @@ -47,20 +47,21 @@ (defn project-section-new [] [ui/fixed-width (common2/nav-params) - [:div.template-container - [:h2.row "Start from a template"] - [:div.row - [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} - [m/Icon {} "directions_walk"] - [:div "Plan facilities based on ground access"]] - [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} - [m/Icon {} "call_split"] - [:div "Plan diagonostic devices & sample referrals"]]] - [:h2.row "Start from scratch"] - [:div.row - [:a.action {} - [m/Icon {} "folder_open"] - [:div "Follow a wizard through all available settings"]]]]]) + [:div.template-container + [:h2 "Start from a template"] + [:div.row + [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} + [m/Icon {} "directions_walk"] + [:div "Plan facilities based on ground access"]] + [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} + [m/Icon {} "call_split"] + [:div "Plan diagonostic devices & sample referrals"]]] + [:hr] + [:h2 "Start from scratch"] + [:div.row + [:a.action {} + [m/Icon {} "folder_open"] + [:div "Follow a wizard through all available settings"]]]]]) (defn- listing-component [] (let [projects (subscribe [:projects2/list])] From 73b4daa886416b47d89cbfbb4f90d4528f111a35 Mon Sep 17 00:00:00 2001 From: pmallol Date: Wed, 29 May 2019 17:32:34 -0300 Subject: [PATCH 4/7] Fix format --- .../client/projects2/components/listings.cljs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/planwise/client/projects2/components/listings.cljs b/src/planwise/client/projects2/components/listings.cljs index fbccb2fb2..66cef6f45 100644 --- a/src/planwise/client/projects2/components/listings.cljs +++ b/src/planwise/client/projects2/components/listings.cljs @@ -47,21 +47,21 @@ (defn project-section-new [] [ui/fixed-width (common2/nav-params) - [:div.template-container - [:h2 "Start from a template"] - [:div.row - [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} - [m/Icon {} "directions_walk"] - [:div "Plan facilities based on ground access"]] - [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} - [m/Icon {} "call_split"] - [:div "Plan diagonostic devices & sample referrals"]]] - [:hr] - [:h2 "Start from scratch"] - [:div.row - [:a.action {} - [m/Icon {} "folder_open"] - [:div "Follow a wizard through all available settings"]]]]]) + [:div.template-container + [:h2 "Start from a template"] + [:div.row + [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} + [m/Icon {} "directions_walk"] + [:div "Plan facilities based on ground access"]] + [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} + [m/Icon {} "call_split"] + [:div "Plan diagonostic devices & sample referrals"]]] + [:hr] + [:h2 "Start from scratch"] + [:div.row + [:a.action {} + [m/Icon {} "folder_open"] + [:div "Follow a wizard through all available settings"]]]]]) (defn- listing-component [] (let [projects (subscribe [:projects2/list])] From db91b97761686648943077bb0323165b86156d89 Mon Sep 17 00:00:00 2001 From: hdf1986 Date: Fri, 31 May 2019 12:12:41 -0300 Subject: [PATCH 5/7] Basic defaults support --- src/planwise/client/projects2/api.cljs | 4 +- .../client/projects2/components/create.cljs | 39 +++++++++++++++++++ .../client/projects2/components/listings.cljs | 19 --------- src/planwise/client/projects2/handlers.cljs | 4 +- src/planwise/client/projects2/views.cljs | 3 +- 5 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 src/planwise/client/projects2/components/create.cljs diff --git a/src/planwise/client/projects2/api.cljs b/src/planwise/client/projects2/api.cljs index f9b5f2323..f5d61b685 100644 --- a/src/planwise/client/projects2/api.cljs +++ b/src/planwise/client/projects2/api.cljs @@ -4,10 +4,10 @@ ;; API methods (defn- create-project! - [template] + [defaults] {:method :post :section :index - :params {:project {:name template}} + :params {:project defaults} :uri "/api/projects2"}) (defn- list-projects diff --git a/src/planwise/client/projects2/components/create.cljs b/src/planwise/client/projects2/components/create.cljs new file mode 100644 index 000000000..d3dc6e12e --- /dev/null +++ b/src/planwise/client/projects2/components/create.cljs @@ -0,0 +1,39 @@ +(ns planwise.client.projects2.components.create + (:require [re-frame.core :refer [subscribe dispatch] :as rf] + [planwise.client.asdf :as asdf] + [reagent.core :as r] + [re-com.core :as rc] + [planwise.client.components.common2 :as common2] + [planwise.client.routes :as routes] + [planwise.client.utils :as utils] + [planwise.client.ui.common :as ui] + [planwise.client.ui.rmwc :as m] + [planwise.client.mapping :refer [static-image fullmap-region-geo]] + [planwise.client.components.common :as common])) +(def project-templates + [{:description "Plan facilities based on ground access" + :icon "directions_walk" + :key "plan" + :defaults {:name "ground"}} + {:description "Plan diagonostic devices & sample referrals" + :icon "call_split" + :key "diagnosis" + :defaults {:name "sample"}}]) + +(defn project-section-template-selector + [] + [ui/fixed-width (common2/nav-params) + [:div.template-container + [:h2 "Start from a template"] + [:div.row + (map (fn [template] + [:a.action {:key (:key template) :onClick #(dispatch [:projects2/new-project (:defaults template)])} + [m/Icon {} (:icon template)] + [:div (:description template)]]) + project-templates)] + [:hr] + [:h2 "Start from scratch"] + [:div.row + [:a.action {} + [m/Icon {} "folder_open"] + [:div "Follow a wizard through all available settings"]]]]]) diff --git a/src/planwise/client/projects2/components/listings.cljs b/src/planwise/client/projects2/components/listings.cljs index 66cef6f45..fb1c2435c 100644 --- a/src/planwise/client/projects2/components/listings.cljs +++ b/src/planwise/client/projects2/components/listings.cljs @@ -44,25 +44,6 @@ :on-click (utils/prevent-default #(dispatch [:projects2/new-project]))} "Create one"]]]) -(defn project-section-new - [] - [ui/fixed-width (common2/nav-params) - [:div.template-container - [:h2 "Start from a template"] - [:div.row - [:a.action {:onClick #(dispatch [:projects2/new-project "plan"])} - [m/Icon {} "directions_walk"] - [:div "Plan facilities based on ground access"]] - [:a.action {:onClick #(dispatch [:projects2/new-project "diagnosis"])} - [m/Icon {} "call_split"] - [:div "Plan diagonostic devices & sample referrals"]]] - [:hr] - [:h2 "Start from scratch"] - [:div.row - [:a.action {} - [m/Icon {} "folder_open"] - [:div "Follow a wizard through all available settings"]]]]]) - (defn- listing-component [] (let [projects (subscribe [:projects2/list])] (if (empty? @projects) diff --git a/src/planwise/client/projects2/handlers.cljs b/src/planwise/client/projects2/handlers.cljs index d328a01e6..07b9a76dc 100644 --- a/src/planwise/client/projects2/handlers.cljs +++ b/src/planwise/client/projects2/handlers.cljs @@ -17,8 +17,8 @@ (rf/reg-event-fx :projects2/new-project in-projects2 - (fn [_ [_ template-identifier]] - {:api (assoc (api/create-project! template-identifier) + (fn [_ [_ defaults]] + {:api (assoc (api/create-project! defaults) :on-success [:projects2/project-created])})) (rf/reg-event-fx diff --git a/src/planwise/client/projects2/views.cljs b/src/planwise/client/projects2/views.cljs index b4642a04a..f83212a73 100644 --- a/src/planwise/client/projects2/views.cljs +++ b/src/planwise/client/projects2/views.cljs @@ -7,6 +7,7 @@ [planwise.client.projects2.components.dashboard :as dashboard] [planwise.client.projects2.components.listings :as listings] [planwise.client.projects2.components.settings :as settings] + [planwise.client.projects2.components.create :as create] [planwise.client.routes :as routes] [planwise.client.ui.common :as ui])) @@ -37,7 +38,7 @@ (let [section (:section @page-params)] (case section :index [listings/project-section-index] - :new [listings/project-section-new] + :new [create/project-section-template-selector] :show [project-section-show :scenarios] :project-scenarios [project-section-show :scenarios] :project-settings [project-section-show :settings] From c005921999ebc613b5c938be60f8b6b95ec320f4 Mon Sep 17 00:00:00 2001 From: hdf1986 Date: Wed, 5 Jun 2019 14:04:56 -0300 Subject: [PATCH 6/7] Added example defaults --- resources/planwise/sql/projects2.sql | 4 +-- src/planwise/client/projects2/api.cljs | 6 ++++ .../client/projects2/components/create.cljs | 32 ++++++++++-------- src/planwise/client/projects2/handlers.cljs | 12 +++++++ src/planwise/client/projects2/subs.cljs | 6 +++- src/planwise/component/projects2.clj | 4 ++- src/planwise/configuration/templates.clj | 33 +++++++++++++++++++ src/planwise/endpoint/projects2.clj | 8 +++-- 8 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 src/planwise/configuration/templates.clj diff --git a/resources/planwise/sql/projects2.sql b/resources/planwise/sql/projects2.sql index 69ddc6e0f..55fce7e1f 100644 --- a/resources/planwise/sql/projects2.sql +++ b/resources/planwise/sql/projects2.sql @@ -1,7 +1,7 @@ -- :name db-create-project! : db + (assoc :templates templates))})) (rf/reg-event-fx :projects2/project-created diff --git a/src/planwise/client/projects2/subs.cljs b/src/planwise/client/projects2/subs.cljs index 4f7a9e08f..08d3b2695 100644 --- a/src/planwise/client/projects2/subs.cljs +++ b/src/planwise/client/projects2/subs.cljs @@ -9,6 +9,11 @@ (fn [db _] (get-in db [:projects2 :current-project]))) +(rf/reg-sub + :projects2/templates + (fn [db _] + (get-in db [:projects2 :templates]))) + (rf/reg-sub :projects2/list (fn [db _] @@ -29,4 +34,3 @@ :projects2/upgrade-actions :<- [:projects2/current-project] (fn [current-project [_]] (get-in current-project [:config :actions :upgrade]))) - diff --git a/src/planwise/component/projects2.clj b/src/planwise/component/projects2.clj index e4cf04b03..67d72700a 100644 --- a/src/planwise/component/projects2.clj +++ b/src/planwise/component/projects2.clj @@ -29,7 +29,9 @@ (defn create-project [store params] - (db-create-project! (get-db store) (merge params {:state "draft"}))) + (db-create-project! (get-db store) (-> (merge params {:state "draft" :config {}}) + (assoc :config (pr-str (:config params))) + (assoc :providers (pr-str (:providers params)))))) (defn update-project [store {:keys [config provider-set-id] :as project}] diff --git a/src/planwise/configuration/templates.clj b/src/planwise/configuration/templates.clj new file mode 100644 index 000000000..a0fc6e702 --- /dev/null +++ b/src/planwise/configuration/templates.clj @@ -0,0 +1,33 @@ +(ns planwise.configuration.templates) + +(defn templates-list + [] + [{:description "Plan facilities based on ground access" + :icon "directions_walk" + :key "plan" + :defaults {:name "ground" + :config {:coverage {:filter-options {:driving-time 90}} + :demographics {:target 12 + :unit-name "humans"} + :actions {:budget 123123 + :build [{:id "build-0" + :capacity 123 + :investment 456} + {:id "build-1" + :capacity 333 + :investment 444}] + :upgrade [{:id "upgrade-0" + :capacity 123 + :investment 456} + {:id "upgrade-1" + :capacity 333 + :investment 444}]}} + + :source-set-id 2 + :region-id 1 + :provider-set-id 1}} + + {:description "Plan diagonostic devices & sample referrals" + :icon "call_split" + :key "diagnosis" + :defaults {:name "sample"}}]) diff --git a/src/planwise/endpoint/projects2.clj b/src/planwise/endpoint/projects2.clj index 4d0d7fdaa..b0dbf764e 100644 --- a/src/planwise/endpoint/projects2.clj +++ b/src/planwise/endpoint/projects2.clj @@ -10,6 +10,7 @@ [planwise.model.projects2 :as model] [planwise.boundary.providers-set :as providers-set] [planwise.boundary.projects2 :as projects2] + [planwise.configuration.templates :as templates-config] [planwise.boundary.scenarios :as scenarios])) (timbre/refer-timbre) @@ -29,8 +30,8 @@ (POST "/" [name project :as request] (let [user-id (util/request-user-id request) project-id (:id (projects2/create-project service (merge project {:owner-id user-id}))) - project (projects2/get-project service project-id)] - (response project))) + project-db (projects2/get-project service project-id)] + (response project-db))) (PUT "/:id" [id project :as request] (let [user-id (util/request-user-id request) @@ -44,6 +45,9 @@ (projects2/update-project service project) (response (api-project (projects2/get-project service id))))))) + (GET "/templates" [] + (response (templates-config/templates-list))) + (GET "/:id" [id :as request] (let [user-id (util/request-user-id request) project (filter-owned-by (projects2/get-project service (Integer. id)) user-id)] From d58fe86cc163da73f2e5c3719654842ce31fefde Mon Sep 17 00:00:00 2001 From: hdf1986 Date: Thu, 6 Jun 2019 11:57:22 -0300 Subject: [PATCH 7/7] Fixed bugs in other templates --- .../client/projects2/components/create.cljs | 12 +++++++----- src/planwise/configuration/templates.clj | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/planwise/client/projects2/components/create.cljs b/src/planwise/client/projects2/components/create.cljs index 11d3d6b5e..c18c8a2ce 100644 --- a/src/planwise/client/projects2/components/create.cljs +++ b/src/planwise/client/projects2/components/create.cljs @@ -23,21 +23,23 @@ (defn project-section-template-selector [] [ui/fixed-width (common2/nav-params) - (let [templates (subscribe [:projects2/templates])] + (let [templates (subscribe [:projects2/templates]) + scratch-template (first (filter #(not (contains? % :description)) @templates)) + sample-templates (filter #(contains? % :description) @templates)] (dispatch [:projects2/get-templates-list]) [:div.template-container - (if (some? @templates) + (if (some? sample-templates) [:h2 "Start from a template"]) - (if (some? @templates) + (if (some? sample-templates) [:div.row (map (fn [template] [:a.action {:key (:key template) :onClick #(dispatch [:projects2/new-project (:defaults template)])} [m/Icon {} (:icon template)] [:div (:description template)]]) - @templates)]) + sample-templates)]) [:hr] [:h2 "Start from scratch"] [:div.row - [:a.action {} + [:a.action {:onClick #(dispatch [:projects2/new-project (:defaults scratch-template)])} [m/Icon {} "folder_open"] [:div "Follow a wizard through all available settings"]]]])]) diff --git a/src/planwise/configuration/templates.clj b/src/planwise/configuration/templates.clj index a0fc6e702..de655806b 100644 --- a/src/planwise/configuration/templates.clj +++ b/src/planwise/configuration/templates.clj @@ -26,8 +26,23 @@ :source-set-id 2 :region-id 1 :provider-set-id 1}} - {:description "Plan diagonostic devices & sample referrals" :icon "call_split" :key "diagnosis" - :defaults {:name "sample"}}]) + :defaults {:name "sample" + :config {:coverage {} + :demographics {} + :actions {}} + + :source-set-id nil + :region-id nil + :provider-set-id nil}} + {:key "empty" + :defaults {:name "" + :config {:coverage {} + :demographics {} + :actions {}} + + :source-set-id nil + :region-id nil + :provider-set-id nil}}])