dorsale 1.1.2 → 1.1.3
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/app/helpers/dorsale/button_helper.rb +113 -0
- data/lib/dorsale/version.rb +1 -1
- metadata +5 -4
@@ -0,0 +1,113 @@
|
|
1
|
+
module Dorsale
|
2
|
+
module ButtonHelper
|
3
|
+
def dorsale_button(url, options = {})
|
4
|
+
action = options.delete(:action)
|
5
|
+
icon = options.delete(:icon)
|
6
|
+
|
7
|
+
text = options.delete(:text) || t("actions.#{action}")
|
8
|
+
text = "#{icon icon} #{text}"
|
9
|
+
|
10
|
+
options = {
|
11
|
+
:class => "btn btn-xs link_#{action}"
|
12
|
+
}.deep_merge(options)
|
13
|
+
|
14
|
+
if confirm = options.delete(:confirm)
|
15
|
+
confirm = t("actions.confirm") if confirm == true
|
16
|
+
|
17
|
+
options.deep_merge!(
|
18
|
+
:data => {
|
19
|
+
:confirm => confirm
|
20
|
+
}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
link_to(text, url, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_button(url, options = {})
|
28
|
+
options = {
|
29
|
+
:icon => :plus,
|
30
|
+
:action => :create,
|
31
|
+
:class =>"btn btn-xs btn-success link_create"
|
32
|
+
}.merge(options)
|
33
|
+
|
34
|
+
dorsale_button(url, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def read_button(url, options = {})
|
38
|
+
options = {
|
39
|
+
:icon => "info-circle",
|
40
|
+
:action => :read
|
41
|
+
}.merge(options)
|
42
|
+
|
43
|
+
dorsale_button(url, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def update_button(url, options = {})
|
47
|
+
options = {
|
48
|
+
:icon => :pencil,
|
49
|
+
:action => :update
|
50
|
+
}.merge(options)
|
51
|
+
|
52
|
+
dorsale_button(url, options)
|
53
|
+
end
|
54
|
+
|
55
|
+
def delete_button(url, options = {})
|
56
|
+
options = {
|
57
|
+
:icon => :trash,
|
58
|
+
:action => :delete,
|
59
|
+
:class => "btn btn-xs btn-danger link_delete",
|
60
|
+
:confirm => true,
|
61
|
+
:method => :delete,
|
62
|
+
}.merge(options)
|
63
|
+
|
64
|
+
dorsale_button(url, options)
|
65
|
+
end
|
66
|
+
|
67
|
+
def complete_button(url, options = {})
|
68
|
+
options = {
|
69
|
+
:icon => :check,
|
70
|
+
:action => :complete,
|
71
|
+
:class => "btn btn-xs btn-success link_complete",
|
72
|
+
:confirm => true,
|
73
|
+
:method => :patch,
|
74
|
+
}.merge(options)
|
75
|
+
|
76
|
+
dorsale_button(url, options)
|
77
|
+
end
|
78
|
+
|
79
|
+
def snooze_button(url, options = {})
|
80
|
+
options = {
|
81
|
+
:icon => :"clock-o",
|
82
|
+
:action => :snooze,
|
83
|
+
:confirm => true,
|
84
|
+
:method => :patch
|
85
|
+
}.merge(options)
|
86
|
+
|
87
|
+
dorsale_button(url, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def lock_button(url, options = {})
|
91
|
+
options = {
|
92
|
+
:icon => :lock,
|
93
|
+
:action => :lock,
|
94
|
+
:confirm => true,
|
95
|
+
:method => :patch
|
96
|
+
}.merge(options)
|
97
|
+
|
98
|
+
dorsale_button(url, options)
|
99
|
+
end
|
100
|
+
|
101
|
+
def unlock_button(url, options = {})
|
102
|
+
options = {
|
103
|
+
:icon => :unlock,
|
104
|
+
:action => :unlock,
|
105
|
+
:confirm => true,
|
106
|
+
:method => :patch
|
107
|
+
}.merge(options)
|
108
|
+
|
109
|
+
dorsale_button(url, options)
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
data/lib/dorsale/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorsale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -258,6 +258,7 @@ files:
|
|
258
258
|
- app/controllers/dorsale/small_data/filters_controller.rb
|
259
259
|
- app/helpers/dorsale/addresses_helper.rb
|
260
260
|
- app/helpers/dorsale/application_helper.rb
|
261
|
+
- app/helpers/dorsale/button_helper.rb
|
261
262
|
- app/helpers/dorsale/comments_helper.rb
|
262
263
|
- app/helpers/dorsale/context_helper.rb
|
263
264
|
- app/helpers/dorsale/form_helper.rb
|
@@ -353,7 +354,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
353
354
|
version: '0'
|
354
355
|
segments:
|
355
356
|
- 0
|
356
|
-
hash:
|
357
|
+
hash: 534421577428264776
|
357
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
358
359
|
none: false
|
359
360
|
requirements:
|
@@ -362,7 +363,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
363
|
version: '0'
|
363
364
|
segments:
|
364
365
|
- 0
|
365
|
-
hash:
|
366
|
+
hash: 534421577428264776
|
366
367
|
requirements: []
|
367
368
|
rubyforge_project:
|
368
369
|
rubygems_version: 1.8.23.2
|