line_send_button 0.1.0
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.
- data/README.md +62 -0
- data/Rakefile +1 -0
- data/lib/line_send_button.rb +4 -0
- data/lib/line_send_button/engine.rb +11 -0
- data/lib/line_send_button/version.rb +3 -0
- data/lib/line_send_button/view_helpers.rb +27 -0
- data/vendor/assets/images/linebutton_20x20.png +0 -0
- data/vendor/assets/images/linebutton_30x30.png +0 -0
- data/vendor/assets/images/linebutton_36x60.png +0 -0
- data/vendor/assets/images/linebutton_40x40.png +0 -0
- data/vendor/assets/images/linebutton_86x20.png +0 -0
- metadata +72 -0
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# LineSendButton
|
2
|
+
|
3
|
+
http://about.naver.jp/press/press_detail?docId=1976
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'line_send_button'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install line_send_button
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
|
22
|
+
### naver_line_send_link(message, url = nil, options = {}, html_options = {}, image_options = {})
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
<%= naver_line_send_link('foo') %>
|
26
|
+
# => <a href="http://line.naver.jp/R/msg/text/?foo"><img alt="LINEで送る" height="60" src="/assets/linebutton_36x60.png" width="36" /></a>
|
27
|
+
```
|
28
|
+
|
29
|
+
call
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
link_to(naver_line_send_url(message, url), options, html_options) do
|
33
|
+
naver_line_send_image_tag(image_options)
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
### naver_line_send_url(message, url = nil)
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
<%= naver_line_send_url('bar') %>
|
41
|
+
# => http://line.naver.jp/R/msg/text/?bar
|
42
|
+
```
|
43
|
+
|
44
|
+
### naver_line_send_image_tag(options = {})
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
<%= naver_line_send_image_tag %>
|
48
|
+
# => <img alt="LINEで送る" height="60" src="/assets/linebutton_36x60.png" width="36" />
|
49
|
+
<%= naver_line_send_image_tag(:size => '20x20') %>
|
50
|
+
# => <img alt="LINEで送る" height="20" src="/assets/linebutton_20x20.png" width="20" />
|
51
|
+
```
|
52
|
+
|
53
|
+
* size option ... `20x20`, `30x30`, `36x60`(default), '40x40', '86x20'
|
54
|
+
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
1. Fork it
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
61
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
62
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require File.expand_path('view_helpers', File.dirname(__FILE__))
|
3
|
+
module LineSendButton
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
initializer "line_send_button.helper", after: 'disable_dependency_loading' do
|
6
|
+
ActiveSupport.on_load(:action_view) do
|
7
|
+
include ::LineSendButton::ViewHelpers
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'cgi'
|
3
|
+
|
4
|
+
module LineSendButton
|
5
|
+
module ViewHelpers
|
6
|
+
def naver_line_send_link(title, url = nil, options = {}, html_options = {}, image_options = {})
|
7
|
+
link_to(naver_line_send_url(title, url), options, html_options) do
|
8
|
+
naver_line_send_image_tag(image_options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def naver_line_send_url(message, url = nil)
|
13
|
+
'http://line.naver.jp/R/msg/text/?' + CGI.escape(message.tap{|m| m + "\r\n" + url if url})
|
14
|
+
end
|
15
|
+
|
16
|
+
def naver_line_send_image_tag(options = {})
|
17
|
+
options = {:size => '36x60', :alt => 'LINEで送る'}.merge options
|
18
|
+
case options[:size]
|
19
|
+
when "20x20", "30x30", "36x60", "40x40", "86x20"
|
20
|
+
file = options[:size]
|
21
|
+
else
|
22
|
+
file = "36x60"
|
23
|
+
end
|
24
|
+
image_tag "linebutton_#{file}.png", options
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: line_send_button
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- kengos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
description: LINE Send button helper
|
31
|
+
email:
|
32
|
+
- kengo@kengos.jp
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- lib/line_send_button/engine.rb
|
38
|
+
- lib/line_send_button/version.rb
|
39
|
+
- lib/line_send_button/view_helpers.rb
|
40
|
+
- lib/line_send_button.rb
|
41
|
+
- vendor/assets/images/linebutton_20x20.png
|
42
|
+
- vendor/assets/images/linebutton_30x30.png
|
43
|
+
- vendor/assets/images/linebutton_36x60.png
|
44
|
+
- vendor/assets/images/linebutton_40x40.png
|
45
|
+
- vendor/assets/images/linebutton_86x20.png
|
46
|
+
- Rakefile
|
47
|
+
- README.md
|
48
|
+
homepage: https://github.com/kengos/line_send_button
|
49
|
+
licenses: []
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.8.23
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Never LINE Send button helper
|
72
|
+
test_files: []
|