kamiliff 0.10.3 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 974d744e69fcb18d050baac3b08528a150518597b0a4e2d2a45452434e93f94b
4
- data.tar.gz: ae6c6711d1fb9af227182a31fd7da014f365a257c3edcdb6d5a2b2a27db81e6e
3
+ metadata.gz: 2a69ff997971cc02efb5123cc81123219c309c8722d8054ec66de2ba2977a430
4
+ data.tar.gz: daa822aeddc0c7d4b946a1bd4c8c624aa301ee4dff48031a8ff6db52f7ed9f46
5
5
  SHA512:
6
- metadata.gz: e1ef6894ac88c9dfa6f5f1930550201c32a9c293277f7daf3c66f775daac985839f118a50a47bc11994997d84b3d9e2d8be54943c122bb24fdec498bae27e7f1
7
- data.tar.gz: 9cb91107335f3ae5195997b4a2b8d0cc265a03482523296ffc198b2120c839f40fdfd5a0090e2e01631bfb481e795b006c4aa4dc6044b67ef666923ac3924f70
6
+ metadata.gz: ba9fd6471a65a18b0f91c13dde5b62a036550d431184a6b668a37c82ea994a3106b8025026bd54959c23126af4ec03938f28f8ea6f76302575a5b638b7d1855f
7
+ data.tar.gz: 92117e5ac8cd9d06081bef407416234e6292c2dbb3a8910d0beca729460ab2dd2c49df0bf2040d29d884b102a6e07da95236c070fb1ff29d5fffc25660f82662
data/README.md CHANGED
@@ -7,86 +7,9 @@ Kamiliff make LIFF easy to use.
7
7
  - liff_submit event: a hook when LIFF form submit, with form data in js object format.
8
8
  - liff_send_text_message: quick send message and close LIFF.
9
9
 
10
- ## Installation
10
+ ## Installation & Usage
11
11
 
12
- ```ruby
13
- gem 'kamiliff'
14
- ```
15
-
16
- Login to line developers, and create 3 LIFF for 3 different size.
17
-
18
- - for compact
19
- - name: Compact
20
- - size: Compact
21
- - Endpoint URL: https://yourwebsite/liff
22
-
23
- - for tall
24
- - name: Tall
25
- - size: Tall
26
- - Endpoint URL: https://yourwebsite/liff
27
-
28
- - for full
29
- - name: Full
30
- - size: Full
31
- - Endpoint URL: https://yourwebsite/liff
32
-
33
- And then copy the result to enviroment parameters:
34
-
35
- ```
36
- LIFF_COMPACT=line://app/for_compact_liff_id
37
- LIFF_TALL=line://app/for_tall_liff_id
38
- LIFF_FULL=line://app/for_full_liff_id
39
- ```
40
-
41
- ## Usage
42
-
43
- ### Generate LIFF Link
44
-
45
- You can change any path to liff by `liff_path` method.
46
-
47
- For example:
48
-
49
- ```
50
- liff_path(path: '/todos/new')
51
- ```
52
-
53
- You can choice the liff size by `liff_size` parameter. the default value of liff_size is compact.
54
-
55
- ```
56
- liff_path(path: '/todos/new', liff_size: :compact)
57
- liff_path(path: '/todos/new', liff_size: :tall)
58
- liff_path(path: '/todos/new', liff_size: :full)
59
- ```
60
-
61
- liff_path method add format :liff automatically.
62
-
63
- ### Implement LIFF View
64
-
65
- Kamiliff using view format `.liff`, so you can reuse exists controller and model, you can create a LIFF form by only adding a new view file.
66
-
67
- Suppose you have a resource `todos`, you want to create a liff form for `todos/new`, so you create a file `app/views/todos/new.liff.erb`, the content is as follows:
68
-
69
- ```
70
- <% content_for :title, "new todo" %>
71
-
72
- <%= render "todos/form.html", todo: @todo %>
73
- ```
74
-
75
- You can test the form at [localhost:3000/todos/new.liff](localhost:3000/todos/new.liff)
76
-
77
- ### Receive LIFF Submit Event And Send Message
78
-
79
- You need to add those js to handle the `liff_submit` event when user submit a form in LIFF.
80
-
81
- ``` js
82
- window.addEventListener("liff_submit", function(event){
83
- var json = JSON.stringify(event.detail.data);
84
- var url = event.detail.url;
85
- var method = event.detail.method;
86
- var request_text = method + " " + url + "\n" + json;
87
- liff_send_text_message(request_text);
88
- });
89
- ```
12
+ See my kamiliff demo: [https://github.com/etrex/kamiliff_demo](https://github.com/etrex/kamiliff_demo)
90
13
 
91
14
  ## Author
92
15
  Create by [etrex](https://etrex.tw)
@@ -1,6 +1,5 @@
1
1
 
2
2
  class LiffController < ApplicationController
3
- # layout :liff
4
3
  layout false, only: :route
5
4
 
6
5
 
@@ -0,0 +1,7 @@
1
+ <script>
2
+ document.title = "<%= yield :title %>";
3
+ </script>
4
+
5
+ <div class="container-fluid">
6
+ <%= yield %>
7
+ </div>
@@ -1,3 +1,3 @@
1
1
  module Kamiliff
2
- VERSION = '0.10.3'
2
+ VERSION = '0.10.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamiliff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - etrex kuo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -37,6 +37,7 @@ files:
37
37
  - app/assets/javascripts/kamiliff.js
38
38
  - app/controllers/liff_controller.rb
39
39
  - app/helpers/liff_helper.rb
40
+ - app/views/layouts/application.liff.erb
40
41
  - app/views/layouts/liff.html.erb
41
42
  - app/views/liff/entry.html.erb
42
43
  - app/views/liff/route.html.erb