bootstrap-confirm-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +128 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +48 -0
- data/Rakefile +27 -0
- data/bootstrap-confirm-rails.gemspec +26 -0
- data/lib/bootstrap-confirm-rails.rb +27 -0
- data/lib/bootstrap-confirm-rails/action_view_extensions/form_helper.rb +26 -0
- data/lib/bootstrap-confirm-rails/engine.rb +5 -0
- data/lib/bootstrap-confirm-rails/version.rb +3 -0
- data/lib/generators/bootstrap-confirm-rails/install_generator.rb +17 -0
- data/lib/generators/bootstrap-confirm-rails/templates/README +1 -0
- data/lib/generators/bootstrap-confirm-rails/templates/config/initializers/bootstrap-confirm-rails.rb +13 -0
- data/lib/tasks/bootstrap-confirm-rails_tasks.rake +4 -0
- data/spec/spec_helper.rb +38 -0
- data/vendor/assets/javascripts/bootstrap-confirm-rails.coffee +61 -0
- data/vendor/assets/stylesheets/bootstrap-confirm-rails.scss +16 -0
- metadata +151 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in bootstrap-confirm-rails.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# jquery-rails is used by the dummy application
|
9
|
+
gem "jquery-rails"
|
10
|
+
|
11
|
+
# Declare any dependencies that are still in development here instead of in
|
12
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
+
# your gem to rubygems.org.
|
15
|
+
|
16
|
+
# To use debugger
|
17
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bootstrap-confirm-rails (0.0.1)
|
5
|
+
bootstrap-sass (~> 2.1.0.0)
|
6
|
+
coffee-rails (~> 3.2.2)
|
7
|
+
rails (~> 3.2.8)
|
8
|
+
sass-rails (~> 3.2.5)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: http://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actionmailer (3.2.8)
|
14
|
+
actionpack (= 3.2.8)
|
15
|
+
mail (~> 2.4.4)
|
16
|
+
actionpack (3.2.8)
|
17
|
+
activemodel (= 3.2.8)
|
18
|
+
activesupport (= 3.2.8)
|
19
|
+
builder (~> 3.0.0)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
journey (~> 1.0.4)
|
22
|
+
rack (~> 1.4.0)
|
23
|
+
rack-cache (~> 1.2)
|
24
|
+
rack-test (~> 0.6.1)
|
25
|
+
sprockets (~> 2.1.3)
|
26
|
+
activemodel (3.2.8)
|
27
|
+
activesupport (= 3.2.8)
|
28
|
+
builder (~> 3.0.0)
|
29
|
+
activerecord (3.2.8)
|
30
|
+
activemodel (= 3.2.8)
|
31
|
+
activesupport (= 3.2.8)
|
32
|
+
arel (~> 3.0.2)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.2.8)
|
35
|
+
activemodel (= 3.2.8)
|
36
|
+
activesupport (= 3.2.8)
|
37
|
+
activesupport (3.2.8)
|
38
|
+
i18n (~> 0.6)
|
39
|
+
multi_json (~> 1.0)
|
40
|
+
arel (3.0.2)
|
41
|
+
bootstrap-sass (2.1.0.0)
|
42
|
+
builder (3.0.3)
|
43
|
+
coffee-rails (3.2.2)
|
44
|
+
coffee-script (>= 2.2.0)
|
45
|
+
railties (~> 3.2.0)
|
46
|
+
coffee-script (2.2.0)
|
47
|
+
coffee-script-source
|
48
|
+
execjs
|
49
|
+
coffee-script-source (1.3.3)
|
50
|
+
diff-lcs (1.1.3)
|
51
|
+
erubis (2.7.0)
|
52
|
+
execjs (1.4.0)
|
53
|
+
multi_json (~> 1.0)
|
54
|
+
hike (1.2.1)
|
55
|
+
i18n (0.6.1)
|
56
|
+
journey (1.0.4)
|
57
|
+
jquery-rails (2.1.3)
|
58
|
+
railties (>= 3.1.0, < 5.0)
|
59
|
+
thor (~> 0.14)
|
60
|
+
json (1.7.5)
|
61
|
+
mail (2.4.4)
|
62
|
+
i18n (>= 0.4.0)
|
63
|
+
mime-types (~> 1.16)
|
64
|
+
treetop (~> 1.4.8)
|
65
|
+
mime-types (1.19)
|
66
|
+
multi_json (1.3.6)
|
67
|
+
polyglot (0.3.3)
|
68
|
+
rack (1.4.1)
|
69
|
+
rack-cache (1.2)
|
70
|
+
rack (>= 0.4)
|
71
|
+
rack-ssl (1.3.2)
|
72
|
+
rack
|
73
|
+
rack-test (0.6.2)
|
74
|
+
rack (>= 1.0)
|
75
|
+
rails (3.2.8)
|
76
|
+
actionmailer (= 3.2.8)
|
77
|
+
actionpack (= 3.2.8)
|
78
|
+
activerecord (= 3.2.8)
|
79
|
+
activeresource (= 3.2.8)
|
80
|
+
activesupport (= 3.2.8)
|
81
|
+
bundler (~> 1.0)
|
82
|
+
railties (= 3.2.8)
|
83
|
+
railties (3.2.8)
|
84
|
+
actionpack (= 3.2.8)
|
85
|
+
activesupport (= 3.2.8)
|
86
|
+
rack-ssl (~> 1.3.2)
|
87
|
+
rake (>= 0.8.7)
|
88
|
+
rdoc (~> 3.4)
|
89
|
+
thor (>= 0.14.6, < 2.0)
|
90
|
+
rake (0.9.2.2)
|
91
|
+
rdoc (3.12)
|
92
|
+
json (~> 1.4)
|
93
|
+
rspec (2.11.0)
|
94
|
+
rspec-core (~> 2.11.0)
|
95
|
+
rspec-expectations (~> 2.11.0)
|
96
|
+
rspec-mocks (~> 2.11.0)
|
97
|
+
rspec-core (2.11.1)
|
98
|
+
rspec-expectations (2.11.3)
|
99
|
+
diff-lcs (~> 1.1.3)
|
100
|
+
rspec-mocks (2.11.3)
|
101
|
+
rspec-rails (2.11.0)
|
102
|
+
actionpack (>= 3.0)
|
103
|
+
activesupport (>= 3.0)
|
104
|
+
railties (>= 3.0)
|
105
|
+
rspec (~> 2.11.0)
|
106
|
+
sass (3.2.1)
|
107
|
+
sass-rails (3.2.5)
|
108
|
+
railties (~> 3.2.0)
|
109
|
+
sass (>= 3.1.10)
|
110
|
+
tilt (~> 1.3)
|
111
|
+
sprockets (2.1.3)
|
112
|
+
hike (~> 1.2)
|
113
|
+
rack (~> 1.0)
|
114
|
+
tilt (~> 1.1, != 1.3.0)
|
115
|
+
thor (0.16.0)
|
116
|
+
tilt (1.3.3)
|
117
|
+
treetop (1.4.10)
|
118
|
+
polyglot
|
119
|
+
polyglot (>= 0.3.1)
|
120
|
+
tzinfo (0.3.33)
|
121
|
+
|
122
|
+
PLATFORMS
|
123
|
+
ruby
|
124
|
+
|
125
|
+
DEPENDENCIES
|
126
|
+
bootstrap-confirm-rails!
|
127
|
+
jquery-rails
|
128
|
+
rspec-rails
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 Spring MC <Heresy.Mc@gmail.com>
|
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/README.rdoc
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= Bootstrap Confirm Rails
|
2
|
+
|
3
|
+
This will overwrite rails' *$.rails.allowAction* function to use custom delete confirmation dialog with Bootstrap modal. And this also add new form helper *confirm_form_tag* for more adaptive use.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
1. add follow to your *Gemfile*
|
8
|
+
|
9
|
+
gem 'bootstrap-confirma-rails', :require => 'bootstrap-confirm-rails'
|
10
|
+
|
11
|
+
2. run *bundle* to install dependences
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or you can install it youself by:
|
16
|
+
|
17
|
+
$ gem install bootstrap-confirm-rails
|
18
|
+
|
19
|
+
== Usage
|
20
|
+
|
21
|
+
Setup dependence assets:
|
22
|
+
|
23
|
+
1. In your *application.js*
|
24
|
+
|
25
|
+
//= require bootstrap-confirm-rails
|
26
|
+
|
27
|
+
2. In your *application.scss*
|
28
|
+
|
29
|
+
@import "bootstrap-confirm-rails";
|
30
|
+
|
31
|
+
In your view file:
|
32
|
+
|
33
|
+
confirm_form_tag @model_name, 'data-confirm' => 'Are you sure?' do |f|
|
34
|
+
f.submit 'Delete'
|
35
|
+
end
|
36
|
+
|
37
|
+
With all options:
|
38
|
+
|
39
|
+
confirm_form_tag @model_name, 'data-confirm' => 'Are you sure?', 'data-confirm-body' => 'This will destroy data from database', 'data-confirm-ok' => 'Delete', 'data-confirm-cancel' => 'Cancel' do |f|
|
40
|
+
f.submit 'Delete'
|
41
|
+
end
|
42
|
+
|
43
|
+
*NOTE*: You can use *data-confirm-shortcut* option to reduce input. And this will use *BootstrapConfirmRails.shortcut_template* to produce result in *BootstrapConfirmRails.shortcut_template % confirm_shortcut_data* form.
|
44
|
+
|
45
|
+
|
46
|
+
== Copyright
|
47
|
+
|
48
|
+
Copyright (c) 2012 Spring MC. See LICENSE[https://raw.github.com/mcspring/bootstrap-confirm-rails/master/MIT-LICENSE] for details
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'BootstrapConfirmRails'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "bootstrap-confirm-rails/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "bootstrap-confirm-rails"
|
9
|
+
s.version = BootstrapConfirmRails::VERSION.dup
|
10
|
+
s.platform = Gem::Platform::RUBY
|
11
|
+
s.authors = ["Spring MC"]
|
12
|
+
s.email = ["Heresy.Mc@gmail.com"]
|
13
|
+
s.homepage = "https://github.com/mcspring/bootstrap-confirm-rails"
|
14
|
+
s.summary = "Custom rails delete confirmation dialog use Bootstrap modal."
|
15
|
+
s.description = "Applies a custom delete confirmation dialog for rails default data-confirm action."
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split($\)
|
18
|
+
s.require_paths = ["lib", "vendor"]
|
19
|
+
|
20
|
+
s.add_dependency "rails", "~> 3.2.8"
|
21
|
+
s.add_dependency "sass-rails", "~> 3.2.5"
|
22
|
+
s.add_dependency "coffee-rails", "~> 3.2.2"
|
23
|
+
s.add_dependency "bootstrap-sass", "~> 2.1.0.0"
|
24
|
+
|
25
|
+
s.add_development_dependency "rspec-rails"
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'action_view'
|
2
|
+
require 'bootstrap-confirm-rails/version'
|
3
|
+
require 'bootstrap-confirm-rails/engine'
|
4
|
+
require 'bootstrap-confirm-rails/action_view_extensions/form_helper'
|
5
|
+
|
6
|
+
module BootstrapConfirmRails
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
# Confirm message title shortcut template
|
10
|
+
mattr_accessor :shortcut_template
|
11
|
+
@@shortcut_template = 'Are you sure you want to %s?'
|
12
|
+
|
13
|
+
# Confirm dialog ok button title
|
14
|
+
mattr_accessor :confirm_ok
|
15
|
+
@@confirm_ok = "Yes, I'm positively certain."
|
16
|
+
|
17
|
+
# Confirm dialog cancel button title
|
18
|
+
mattr_accessor :confirm_cancel
|
19
|
+
@@confirm_cancel = 'Cancel'
|
20
|
+
|
21
|
+
|
22
|
+
# Default way to setup BootstrapConfirmRails. (Inspired from simple_form)
|
23
|
+
# Run *rails generate bootstrap-confirm-rails:install* to create a fresh initializer with all configuration values.
|
24
|
+
def self.setup
|
25
|
+
yield self
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BootstrapConfirmRails
|
2
|
+
module ActionViewExtensions
|
3
|
+
# This module creates confirm_form_tag.
|
4
|
+
#
|
5
|
+
# Example:
|
6
|
+
#
|
7
|
+
# confirm_form_tag @model_name, 'data-confirm' => 'Are you sure?' do |f|
|
8
|
+
# = f.submit 'Delete'
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
module FormHelper
|
12
|
+
def confirm_form_tag(*args, &block)
|
13
|
+
options = args.extract_options!
|
14
|
+
if options.has_key?('data-confirm-shortcut') && !options.has_key?('data-confirm')
|
15
|
+
options['data-confirm'] = BootstrapConfirmRails.shortcut_template % options.delete('data-confirm-shortcut')
|
16
|
+
end
|
17
|
+
|
18
|
+
options = {:method => :delete, 'data-confirm-ok' => BootstrapConfirmRails.confirm_ok, 'data-confirm-cancel' => BootstrapConfirmRails.confirm_cancel}.merge(options)
|
19
|
+
|
20
|
+
form_tag(*(args + [options]), &block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
ActionView::Base.send :include, BootstrapConfirmRails::ActionViewExtensions::FormHelper
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module BootstrapConfirmRails
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc 'Setup BootstrapConfirmRails default files.'
|
5
|
+
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def copy_config
|
9
|
+
template File.join('config', 'initializers', 'bootstrap-confirm-rails.rb')
|
10
|
+
end
|
11
|
+
|
12
|
+
def show_readme
|
13
|
+
readme 'README'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= TODO
|
data/lib/generators/bootstrap-confirm-rails/templates/config/initializers/bootstrap-confirm-rails.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Use this setup block to configure all options available in BootstrapConfirmRails
|
2
|
+
BootstrapConfirmRails.setup do |config|
|
3
|
+
|
4
|
+
# Confirm message title shortcut template
|
5
|
+
config.shortcut_template = 'Are you sure you want to %s?'
|
6
|
+
|
7
|
+
# Confirm dialog ok button title
|
8
|
+
config.confirm_ok = "Yes, I'm positively certain."
|
9
|
+
|
10
|
+
# Confirm dialog cancel button title
|
11
|
+
config.confirm_cancel = 'Cancel'
|
12
|
+
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# ## Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
|
28
|
+
# If true, the base class of anonymous controllers will be inferred
|
29
|
+
# automatically. This will be the default behavior in future versions of
|
30
|
+
# rspec-rails.
|
31
|
+
config.infer_base_class_for_anonymous_controllers = false
|
32
|
+
|
33
|
+
# Run specs in random order to surface order dependencies. If you find an
|
34
|
+
# order dependency and want to debug it, you can fix the order by providing
|
35
|
+
# the seed, which is printed after each run.
|
36
|
+
# --seed 1234
|
37
|
+
config.order = "random"
|
38
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
jQuery ->
|
2
|
+
|
3
|
+
$ = jQuery
|
4
|
+
|
5
|
+
# Override Rails handling of confirmation
|
6
|
+
# This will overwrite rails delete confirmation dialog to use bootstrap model
|
7
|
+
$.rails.allowAction = (element) ->
|
8
|
+
# The message title is something like "Are you sure?"
|
9
|
+
message_title = element.data('confirm')
|
10
|
+
# If there's no message_title, there's no data-confirm attribute, which means there's nothing to confirm
|
11
|
+
return true unless message_title
|
12
|
+
# This will allow user define there own options
|
13
|
+
message_body = element.data('confirm-body') || ''
|
14
|
+
button_ok = element.data('confirm-ok') || "Yes, I'm positively certain."
|
15
|
+
button_cancel = element.data('confirm-cancel') || 'Cancel'
|
16
|
+
|
17
|
+
# Clone the clicked element (probably a delete form or link/button) so we can use it in the dialog box.
|
18
|
+
$element = element.clone()
|
19
|
+
# We don't necessarily want the same styling as the original form/link/button.
|
20
|
+
.removeAttr('class')
|
21
|
+
# We don't want to pop up another confirmation (recursion)
|
22
|
+
.removeAttr('data-confirm')
|
23
|
+
# We should check whether this is a confirmation form or link/button?
|
24
|
+
if $element.is('form')
|
25
|
+
$button = $element.find('button')
|
26
|
+
if $button
|
27
|
+
$button.text(button_ok)
|
28
|
+
else
|
29
|
+
# We want a button styling for normal link/button
|
30
|
+
$element.addClass('btn btn-danger')
|
31
|
+
# We want it to sound confirmy
|
32
|
+
.html(button_ok)
|
33
|
+
|
34
|
+
# Create the modal box with the message
|
35
|
+
button_close = ''
|
36
|
+
if message_body
|
37
|
+
button_close = """<a class="close" data-dismiss="modal">×</a>"""
|
38
|
+
message_body = """<div class="modal-body"><p>#{message_body}</p></div>"""
|
39
|
+
|
40
|
+
$modal = $("""
|
41
|
+
<div id="rails_confirm_dialog" class="modal fade">
|
42
|
+
<div class="modal-header">
|
43
|
+
#{button_close}
|
44
|
+
<h3>#{message_title}</h3>
|
45
|
+
</div>
|
46
|
+
#{message_body}
|
47
|
+
<div class="modal-footer">
|
48
|
+
<a data-dismiss="modal" class="btn">#{button_cancel}</a>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
""")
|
52
|
+
$modal.addClass('modal-mini') unless message_body
|
53
|
+
# Add the new button to the modal box
|
54
|
+
$modal.find('.modal-footer').append($element)
|
55
|
+
# Pop it up
|
56
|
+
$modal.modal()
|
57
|
+
# Destroy it after hide
|
58
|
+
$modal.on 'hidden', (evt)->
|
59
|
+
$modal.remove()
|
60
|
+
# Prevent the original link from working
|
61
|
+
return false
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// Overwrite bootstrap modal header && footer styles for custom rails delete confirmation dialog
|
2
|
+
#rails_confirm_dialog{
|
3
|
+
form{
|
4
|
+
display:inline-block;
|
5
|
+
margin:0;
|
6
|
+
padding:0;
|
7
|
+
}
|
8
|
+
.modal-footer{
|
9
|
+
padding:8px 14px 10px;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
#rails_confirm_dialog.modal-mini{
|
13
|
+
.modal-header{
|
14
|
+
padding:16px 21px;
|
15
|
+
}
|
16
|
+
}
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bootstrap-confirm-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Spring MC
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.8
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.8
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: sass-rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.2.5
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.2.5
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: coffee-rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.2.2
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.2.2
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bootstrap-sass
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.1.0.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.1.0.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec-rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Applies a custom delete confirmation dialog for rails default data-confirm
|
95
|
+
action.
|
96
|
+
email:
|
97
|
+
- Heresy.Mc@gmail.com
|
98
|
+
executables: []
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- .gitignore
|
103
|
+
- Gemfile
|
104
|
+
- Gemfile.lock
|
105
|
+
- MIT-LICENSE
|
106
|
+
- README.rdoc
|
107
|
+
- Rakefile
|
108
|
+
- bootstrap-confirm-rails.gemspec
|
109
|
+
- lib/bootstrap-confirm-rails.rb
|
110
|
+
- lib/bootstrap-confirm-rails/action_view_extensions/form_helper.rb
|
111
|
+
- lib/bootstrap-confirm-rails/engine.rb
|
112
|
+
- lib/bootstrap-confirm-rails/version.rb
|
113
|
+
- lib/generators/bootstrap-confirm-rails/install_generator.rb
|
114
|
+
- lib/generators/bootstrap-confirm-rails/templates/README
|
115
|
+
- lib/generators/bootstrap-confirm-rails/templates/config/initializers/bootstrap-confirm-rails.rb
|
116
|
+
- lib/tasks/bootstrap-confirm-rails_tasks.rake
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- vendor/assets/javascripts/bootstrap-confirm-rails.coffee
|
119
|
+
- vendor/assets/stylesheets/bootstrap-confirm-rails.scss
|
120
|
+
homepage: https://github.com/mcspring/bootstrap-confirm-rails
|
121
|
+
licenses: []
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
- vendor
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
hash: 572764334227941150
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
hash: 572764334227941150
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 1.8.24
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: Custom rails delete confirmation dialog use Bootstrap modal.
|
151
|
+
test_files: []
|