rails_bs_popcon 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a02b0587ce8e3a13266610077615516117c0168
4
+ data.tar.gz: 329b79a0f25cf9683fa231576274e2360fca4407
5
+ SHA512:
6
+ metadata.gz: f76e56752b6f020871628c9789506e3a821cc606df7d864bdea3f32b9ce91d265aca2da1a43e25a1fed157df4c7665f88f642bc49391e2c8045b8deb42db7843
7
+ data.tar.gz: b46639f7235fef4e04cecbeff7d81698919028586a6bbfcd21fb2748c85d3fc01879af5007e03ff67888a1e910e5f73630c8d65dfaaf2f410c2b83f809118b89
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Kadu Diógenes
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'RailsBsPopcon'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ load 'rails/tasks/statistics.rake'
20
+
21
+
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
@@ -0,0 +1,58 @@
1
+ @RailsBsPopcon = {}
2
+ RailsBsPopcon.DEFAULTS = $.extend {}, $.fn.popover.Constructor.DEFAULTS,
3
+ placement: 'top'
4
+ title: 'Are you sure?'
5
+ html: true
6
+ btnOkClass: 'btn btn-danger'
7
+ btnOkIcon: 'glyphicon glyphicon-ok'
8
+ btnOkLabel: 'Yes'
9
+ btnCancelClass: 'btn btn-default'
10
+ btnCancelIcon: 'glyphicon glyphicon-remove'
11
+ btnCancelLabel: 'No'
12
+ template:
13
+ '<div class="popover">
14
+ <div class="arrow"></div>
15
+ <h3 class="popover-title"></h3>
16
+ <div class="popover-content text-center">
17
+ </div>
18
+ </div>'
19
+ content: '
20
+ <div class="btn-group">
21
+ <a class="btn" data-apply="confirmation"></a>
22
+ <a class="btn" data-dismiss="confirmation"></a>
23
+ </div>'
24
+
25
+ actionConfirmed = (element) ->
26
+ $(element).removeAttr('data-confirm')
27
+ $(element).removeData('confirm')
28
+ $(element).trigger('click.rails')
29
+
30
+ if (typeof $().popover == 'function') # test if bootstrap is loaded
31
+ $.rails.allowAction = (element) ->
32
+ message = element.data('confirm')
33
+ answer = false
34
+ return true unless message
35
+
36
+ if $.rails.fire(element, 'confirm')
37
+ if $(element).data('bs.popover') == undefined
38
+ options = $.extend {}, RailsBsPopcon.DEFAULTS
39
+ $content = $('<div>', html: options.content)
40
+ $content.prepend $('<p>', html: message) unless typeof(message) == 'boolean'
41
+ $content.find '[data-apply=confirmation]'
42
+ .addClass options.btnOkClass
43
+ .html options.btnOkLabel
44
+ .prepend $('<i>', class: options.btnOkIcon), ' '
45
+ .on 'click', ->
46
+ actionConfirmed(element)
47
+ $(element).popover('destroy')
48
+ $content.find '[data-dismiss=confirmation]'
49
+ .addClass options.btnCancelClass
50
+ .html options.btnCancelLabel
51
+ .prepend $('<i>', class: options.btnCancelIcon), ' '
52
+ .on 'click', ->
53
+ $(element).popover('destroy')
54
+ options.content = $content.children()
55
+ $(element).popover(options).popover('show')
56
+ $(element).data('bs.popover').inState.click = true # https://github.com/twbs/bootstrap/issues/16732
57
+
58
+ false
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,4 @@
1
+ module RailsBsPopcon
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module RailsBsPopcon
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "rails_bs_popcon/engine"
2
+
3
+ module RailsBsPopcon
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :rails_bs_popcon do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_bs_popcon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kadu Diógenes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ description: Uses bootstrap popover to show confirmation buttons for links with data-confirm.
28
+ email:
29
+ - kadu.diogenes@fnix.com.br
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - Rakefile
36
+ - app/assets/javascripts/rails_bs_popcon/popcon.coffee
37
+ - config/routes.rb
38
+ - lib/rails_bs_popcon.rb
39
+ - lib/rails_bs_popcon/engine.rb
40
+ - lib/rails_bs_popcon/version.rb
41
+ - lib/tasks/rails_bs_popcon_tasks.rake
42
+ homepage: https://github.com/fnix/rails_bs_popcon
43
+ licenses:
44
+ - MIT
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.4.8
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Bootstrap popover for confirmation.
66
+ test_files: []