From e6c2b28c9824cae592c59c4838d12ae98fb27f9e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 21 Sep 2017 01:34:58 +0200 Subject: form for custom push notifications --- lib/okpush/public/push.js | 21 ++++++++++++++++++ lib/okpush/templates/index.liquid | 15 ++++--------- lib/okpush/templates/new.liquid | 45 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 lib/okpush/templates/new.liquid (limited to 'lib') diff --git a/lib/okpush/public/push.js b/lib/okpush/public/push.js index e75fc7f4..06588327 100644 --- a/lib/okpush/public/push.js +++ b/lib/okpush/public/push.js @@ -27,6 +27,27 @@ $(function(){ } }) }) + + $('#custom').submit(function(e){ + e.preventDefault() + var message = $("#message").val().trim() + var dest = $("#dest").val() + var msg = "This will send this push notification to everyone. Click OK to confirm.\n\n" + message + if (! confirm(msg)) return + + $.ajax({ + type: "POST", + url: "/_services/push/custom", + data: { + message: message, + dest: dest, + }, + success: function(){ + alert("Push notification sent.") + } + }) + + }) }) function capitalize (string) { diff --git a/lib/okpush/templates/index.liquid b/lib/okpush/templates/index.liquid index 124fb4ee..ec639646 100644 --- a/lib/okpush/templates/index.liquid +++ b/lib/okpush/templates/index.liquid @@ -11,9 +11,6 @@ th { th:nth-child(2) { min-width: 300px; } -th:nth-child(3) { - min-width: 170px; -} table,tr,th,td { margin: 0; padding: 0; @@ -33,12 +30,15 @@ tr:nth-child(2n+1) {

Push Notifications

+ +

+ Send custom push notification +

- @@ -52,13 +52,6 @@ tr:nth-child(2n+1) { - diff --git a/lib/okpush/templates/new.liquid b/lib/okpush/templates/new.liquid new file mode 100644 index 00000000..0393535c --- /dev/null +++ b/lib/okpush/templates/new.liquid @@ -0,0 +1,45 @@ +{% include 'partials/head' %} + +{% include 'partials/flash' %} + + + + + +
+ +

Custom Push Notification

+ +
+ +
+ + +
+ +
+ + + (will open after push is tapped) +
+ +
+ +
+ + + +
+ +{% include 'partials/tail' %} + + \ No newline at end of file -- cgit v1.2.3-70-g09d2
Key MessageLast Push Tokens
{{spec.alert}} - {% unless spec.last_push %} - Never - {% else %} - {{ spec.last_push | date: "%a %d-%b-%Y %H:%M" }} - {% endunless %} - {{spec.count}}