toolsmith 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.0.14
4
+
5
+ * Adds more flexibility to the PageHeader#button method to allow definition of button properties based on arguments.
6
+ For Example:
7
+
8
+ ```ruby
9
+ header.button "Title", "/path", "icon"
10
+ ```
11
+
12
+ This change is backwards compatible with the hash structure option.
13
+
3
14
  ## v0.0.13
4
15
 
5
16
  * Add definition_list_for helper for creating lists with only attribute names.
@@ -1,3 +1,3 @@
1
1
  module Toolsmith
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -11,14 +11,16 @@ module Toolsmith
11
11
  @subtitle = args.first
12
12
  end
13
13
 
14
- def button(options)
15
- [:title, :icon, :path].each { |param| missing_parameter(param, options) }
16
- buttons << options
14
+ def button(*args)
15
+ button_options = args.size >= 3 ? button_options(*args) : args.shift
16
+ buttons << button_options
17
+
18
+ button_options
17
19
  end
18
20
 
19
21
  def button_markup(options)
20
22
  anchor_options = options.fetch(:anchor, {})
21
- context.link_to options[:path], anchor_options.merge(class: "btn"), title: options[:title] do
23
+ context.link_to options[:path], anchor_options.merge(class: "btn", title: options[:title]) do
22
24
  content_tag :i, "", class: "icon-#{options[:icon]}"
23
25
  end
24
26
  end
@@ -51,6 +53,10 @@ module Toolsmith
51
53
  end.html_join
52
54
  end
53
55
  end
56
+
57
+ def button_options(title, path, icon, options={})
58
+ options.merge(title: title, path: path, icon: icon)
59
+ end
54
60
  end
55
61
  end
56
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolsmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: