semantic-rails-ui 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea81b789e98b17ed6195b3fa3bcdf5535be09bf0
4
- data.tar.gz: 4be7ba8d7ab81b2fed9396137bae0a2e783d2798
3
+ metadata.gz: ed3b17e1d0df406452bb994361d2a986dbbde4af
4
+ data.tar.gz: 4d139c2fbcc4789659a4526417553e64ba9fb2cc
5
5
  SHA512:
6
- metadata.gz: 8ccaf636f92830216ec593e90efff382a4304fe7e051b0b1f029e0101e4ac711ea1f183c056acd63fea0060934b6dcfa630764f3ba45b9d12a76068609799634
7
- data.tar.gz: 926bbf1010e4dba819d77b3b2e66f072738656ec0bb5b3de37aef13697fea19e44d3d3333779d8333f0927718d24074eee645757cb1546c5d3e708996634c2f3
6
+ metadata.gz: c7030b4851033cb5a7945eeda3fd70908f305121e960acc6b57cd4825823031ccc18926c383674a141113702e1fafd113e8f6eed5f8be63b34b29497f89a2fd7
7
+ data.tar.gz: ef23e23bc181bade850a74226bf8857f71dcd91cc2c661ac92c836134c6425daaaaf76386af1516ce6c2662c8ab69cf257553599375d28881d79dd2af08aa2c8
@@ -1,23 +1,34 @@
1
- jQuery ->
2
- $.rails.confirm = (message) ->
3
- confirm_dialog = """
4
- <div id="ui-confirm-dialog" class="ui small modal">
5
- <div class="header">Confirmation dialog</div>
6
- <div class="content">#{message}</div>
7
- <div class="actions">
8
- <div class="ui red basic cancel inverted button">
9
- <i class="remove icon"></i>No
10
- </div>
11
- <div class="ui green ok inverted button">
12
- <i class="checkmark icon"></i>Yes
13
- </div>
1
+ $(document).bind 'confirm', (event) ->
2
+ element = $(event.target)
3
+ message = element.data("confirm")
4
+ title = element.data("confirm-title")
5
+ confirm_dialog = """
6
+ <div class="ui-confirm-dialog ui small modal">
7
+ <div class="header">#{title}</div>
8
+ <div class="content">#{message}</div>
9
+ <div class="actions">
10
+ <div class="ui red basic cancel button">
11
+ <i class="remove icon"></i>No
12
+ </div>
13
+ <div class="ui green ok button">
14
+ <i class="checkmark icon"></i>Yes
14
15
  </div>
15
16
  </div>
16
- """
17
- $('body').append(confirm_dialog)
18
- $('#ui-confirm-dialog').modal(
19
- closable: false
20
- onApprove: -> return true
21
- onDeny: -> return false
22
- ).modal('show')
23
-
17
+ </div>
18
+ """
19
+ # remove old confirm dialog from the body
20
+ $('.ui-confirm-dialog').parent().remove()
21
+ # attach new confirm dialog to the body
22
+ $('body').append(confirm_dialog)
23
+ $('.ui-confirm-dialog').modal(
24
+ closable: false
25
+ duration: 100
26
+ transition: 'fade'
27
+ onApprove: ->
28
+ # remove data-confirm
29
+ element.data 'confirm', null
30
+ # re-click link
31
+ element.trigger 'click.rails'
32
+ ).modal('show')
33
+ # Prevent rails from popping up a browser box, we've already done the work
34
+ return false
@@ -1,2 +1 @@
1
- jQuery ->
2
- $('.message .close').on 'click', -> $(this).closest('.message').transition('fade')
1
+ $('.message .close').bind 'click', -> $(this).closest('.message').transition('fade')
@@ -30,14 +30,14 @@ module SemanticRailsUi
30
30
  content_tag(:i, '', class: "#{icon_name} icon")
31
31
  end
32
32
 
33
- def ui_delete_link(text, url, message)
33
+ def ui_delete_link(title, text, url, message)
34
34
  if text == nil
35
35
  text = ''
36
36
  css_class = "ui red tiny compact link button"
37
37
  else
38
38
  css_class = "ui red tiny compact basic button"
39
39
  end
40
- link_to url, class: css_class, method: :delete, data: { confirm: message } do
40
+ link_to url, class: css_class, method: :delete, data: { confirm: message, 'confirm-title' => title } do
41
41
  ui_icon("remove link") + text
42
42
  end
43
43
  end
@@ -1,3 +1,3 @@
1
1
  module SemanticRailsUi
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic-rails-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Jancev