symbolink 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Symbolink changelog
2
2
 
3
+ ## v.0.0.4
4
+ - Allow define confirmation text for the action
5
+
3
6
  ## v0.0.3
4
7
  - Use Symbolink.configure rather then Symbolink.add_symbols
8
+ - Allow define actions (icon + title)
5
9
 
6
10
  ## v0.0.2
7
11
  - New default symbolink refresh: ⟲
data/README.md CHANGED
@@ -50,5 +50,12 @@ Action is a combination of icon + title. Actions may be defined as following:
50
50
 
51
51
  So symbolink_to(:create, model) will returns the link with icon defined as :add and title 'Create something'.
52
52
 
53
+ It is possible to setup confirmation for the action:
54
+
55
+ Symbolink.configure do |config|
56
+ config.action :unsubscribe, icon: :delete, confirm: 'Are you sure?'
57
+ end
58
+
59
+ So symbolink_to(:unsubscribe, unsubscribe_path) will return the link with data-confirm set to confirmation text.
53
60
 
54
61
 
@@ -25,6 +25,9 @@ module Symbolink
25
25
  #
26
26
  # - title: string to be used as link title
27
27
  # humanized action sysmbol will be used as a title if not provided
28
+ #
29
+ # - confirm: string to be used as action confirmation text
30
+ # data-confirm attribute will be added into the generated link if defined.
28
31
  def action(sym, ops = {})
29
32
  ops[:icon] ||= sym
30
33
  ops[:title] ||= sym.to_s.humanize
@@ -14,11 +14,18 @@ module Symbolink
14
14
  if action
15
15
  icon = action[:icon]
16
16
  title = action[:title]
17
+ confirm = action[:confirm]
17
18
  else
18
19
  icon = sym
19
20
  title = sym.to_s.humanize
21
+ confirm = nil
20
22
  end
21
23
  html_options[:title] ||= title
24
+ if confirm
25
+
26
+ html_options[:'data-confirm'] = html_options[:confirm] if html_options[:confirm]
27
+ html_options[:'data-confirm'] ||= confirm
28
+ end
22
29
  link_to(symbolicon(icon), options, html_options)
23
30
  end
24
31
 
@@ -1,3 +1,3 @@
1
1
  module Symbolink
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -235,3 +235,10 @@ Connecting to database specified by database.yml
235
235
  Connecting to database specified by database.yml
236
236
  Connecting to database specified by database.yml
237
237
  Connecting to database specified by database.yml
238
+ Connecting to database specified by database.yml
239
+ Connecting to database specified by database.yml
240
+ Connecting to database specified by database.yml
241
+ Connecting to database specified by database.yml
242
+ Connecting to database specified by database.yml
243
+ Connecting to database specified by database.yml
244
+ Connecting to database specified by database.yml
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symbolink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-06 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &25153488 !ruby/object:Gem::Requirement
16
+ requirement: &21461616 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.11
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *25153488
24
+ version_requirements: *21461616
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &25152960 !ruby/object:Gem::Requirement
27
+ requirement: &21461004 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *25152960
35
+ version_requirements: *21461004
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &25152420 !ruby/object:Gem::Requirement
38
+ requirement: &21460296 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 2.12.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *25152420
46
+ version_requirements: *21460296
47
47
  description: Allow to register unicode symbols and displays them as symbolic icons
48
48
  in rails application. Provides some helpers to generate the links by symbols.
49
49
  email: