easy_modal_window 0.0.2 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0f1edecbf457f9ac4ab4003d9f14cf68ff03180
4
- data.tar.gz: 4669f37fba2c805592af32f9caeaaf2e2305b876
3
+ metadata.gz: 349676271caa27036813e23be466cddfd58a7bb5
4
+ data.tar.gz: 6e585413cbaf808d83859b03dc993cb45afa5a44
5
5
  SHA512:
6
- metadata.gz: b88551d6a2fed1f6b6dae6e7645b69a0fc6832c0af9a0d0f9f1c1c54ce88277147e29c9087d0f724aa60283481d023f2c690dc273e63f3eb0ba2403010b6cca3
7
- data.tar.gz: 0bfb336f4c4d37054101dd486d24df8312f1f9cdbf8b7f749eccca02a2307ef5bdcf337c81421b7b1c9cd7c868428e570457e58219b58a286beb9fb58d44e11c
6
+ metadata.gz: 5e6f96a38b9f8f87db298dccf583103f1c521cc671dedbcd4911b7b12280298263a15e0f4bd3ee58df07a8ec24905e86077c56f3cc8108fa69f2e3f1fbda86e4
7
+ data.tar.gz: 13d7e37e2f48d67f21bd78cfa862d51e842130428785250ac38643043ee2ef006f59dbe57ae3163120dc10e3f83bf8785e86d7687dbae78cad1a14b133fd5256
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # EasyModalWindow
2
2
 
3
- This is wrapper for jQuery-UI Dialog. Additionaly it contain several templates for render errors from ActiveRecord and ErrorMessagesContainer.
3
+ This is wrapper for jQuery-UI Dialog. Additionally it contain several templates for render errors from ActiveRecord and
4
+ [ErrorMessagesContainer](https://github.com/Loriowar/error_messages_container).
5
+
6
+ ## Dependency
7
+
8
+ Gem require [jQuery-UI](https://jqueryui.com/) version 1.8 or greater.
4
9
 
5
10
  ## Installation
6
11
 
@@ -26,6 +31,7 @@ Helper `render_base_dialog`. It take parameters like a `dialog`, but in more eas
26
31
 
27
32
  render_base_dialog(
28
33
  render_template: 'example_template',
34
+ locals: {id: 42},
29
35
  resizable: false,
30
36
  height: 'auto',
31
37
  width: 'auto',
@@ -36,15 +42,17 @@ Helper `render_base_dialog`. It take parameters like a `dialog`, but in more eas
36
42
  buttons: {
37
43
  load_button: {
38
44
  name: l(:load_button),
39
- action: "$('#modal-window-ajax-form').submit();"
45
+ action: "$('#modal-window-ajax-form').submit();",
46
+ class: 'my-first-css-class'
40
47
  },
41
48
  close_button: {
42
49
  name: l(:close_button),
43
- action: "$(this).dialog('close');"
50
+ action: "$(this).dialog('close');",
51
+ class: 'my-second-css-class'
44
52
  }
45
53
  }
46
54
 
47
- Here we can skip any parameters except `render_template`.
55
+ Here we can skip any parameters except `render_template` or `render_partial`.
48
56
 
49
57
  **NOTE:** by default modal window puts in `#ajax-modal` element; you can specify other selector in `window_selector` option.
50
58
 
@@ -26,8 +26,12 @@ $modalWindow.dialog({
26
26
  buttons: {
27
27
  <% modal_options.buttons.each do |button_options| %>
28
28
  <% if button_options[:condition] %>
29
- "<%= button_options[:name] %>": function() {
30
- <%= button_options[:action].html_safe %>
29
+ "<%= button_options[:internal_name] %>": {
30
+ text: "<%= button_options[:name] %>",
31
+ class: "<%= button_options[:class] %>",
32
+ click: function() {
33
+ <%= button_options[:action].html_safe %>
34
+ }
31
35
  },
32
36
  <% end %>
33
37
  <% end %>
@@ -23,7 +23,8 @@ module EasyModalWindow
23
23
  @modal_options[:width] = 'auto'
24
24
  # hash with button descriptions: {first_button: {name: 'Name',
25
25
  # condition: -> {...},
26
- # action: 'location.reload();'},
26
+ # action: 'location.reload();',
27
+ # class: 'my-css-class'},
27
28
  # second_button: ...}
28
29
  @modal_options[:buttons] = {}
29
30
  # dialog callbacks
@@ -65,13 +66,16 @@ module EasyModalWindow
65
66
  end
66
67
 
67
68
  def buttons
68
- @modal_options[:buttons].inject([]) do |h, v|
69
- option = {}
70
- option[:name] = v.last[:name] || 'unknown'
71
- option[:condition] = value_of(v.last[:condition]).nil? || value_of(v.last[:condition])
72
- option[:action] = v.last[:action] || ''
73
- h << option
74
- h
69
+ @modal_options[:buttons].inject([]) do |h, (k, v)|
70
+ h.push(
71
+ {
72
+ internal_name: k,
73
+ name: v[:name] || 'unknown',
74
+ condition: value_of(v[:condition]).nil? || value_of(v[:condition]),
75
+ action: v[:action] || '',
76
+ class: v[:class] || ''
77
+ }
78
+ )
75
79
  end
76
80
  end
77
81
 
@@ -1,3 +1,3 @@
1
1
  module EasyModalWindow
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_modal_window
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Zabrovskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler