genkiwow-nitro-generator 0.0.2
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.
- data/LICENSE +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +56 -0
- data/VERSION.yml +4 -0
- data/generators/nitro_layout/USAGE +3 -0
- data/generators/nitro_layout/nitro_layout_generator.rb +66 -0
- data/generators/nitro_layout/templates/admin/admin_controller.rb +4 -0
- data/generators/nitro_layout/templates/admin/view_layout_administration.html.erb +59 -0
- data/generators/nitro_layout/templates/admin/view_layout_sign.html.erb +17 -0
- data/generators/nitro_layout/templates/admin/view_sidebar.html.erb +13 -0
- data/generators/nitro_layout/templates/admin/view_signin.html.erb +39 -0
- data/generators/nitro_layout/templates/admin/view_signup.html.erb +56 -0
- data/generators/nitro_layout/templates/app_helper.rb +42 -0
- data/generators/nitro_layout/templates/javascripts/application.js +42 -0
- data/generators/nitro_layout/templates/javascripts/jquery-1.3.min.js +19 -0
- data/generators/nitro_layout/templates/layout.html.erb +47 -0
- data/generators/nitro_layout/templates/stylesheets/base.css +336 -0
- data/generators/nitro_layout/templates/stylesheets/themes/bec-green/style.css +290 -0
- data/generators/nitro_layout/templates/stylesheets/themes/bec/style.css +301 -0
- data/generators/nitro_layout/templates/stylesheets/themes/blue/style.css +280 -0
- data/generators/nitro_layout/templates/stylesheets/themes/default/style.css +267 -0
- data/generators/nitro_layout/templates/stylesheets/themes/djime-cerulean/style.css +298 -0
- data/generators/nitro_layout/templates/stylesheets/themes/kathleene/style.css +272 -0
- data/generators/nitro_layout/templates/stylesheets/themes/orange/style.css +263 -0
- data/generators/nitro_layout/templates/stylesheets/themes/reidb-greenish/style.css +301 -0
- data/generators/nitro_layout/templates/view_sidebar.html.erb +13 -0
- data/generators/nitro_scaffold/USAGE +3 -0
- data/generators/nitro_scaffold/nitro_scaffold_generator.rb +186 -0
- data/generators/nitro_scaffold/templates/admin/controller.rb +101 -0
- data/generators/nitro_scaffold/templates/admin/view_destroy.js.erb +2 -0
- data/generators/nitro_scaffold/templates/admin/view_edit.html.erb +19 -0
- data/generators/nitro_scaffold/templates/admin/view_form.html.erb +19 -0
- data/generators/nitro_scaffold/templates/admin/view_index.html.erb +56 -0
- data/generators/nitro_scaffold/templates/admin/view_new.html.erb +20 -0
- data/generators/nitro_scaffold/templates/admin/view_show.html.erb +31 -0
- data/generators/nitro_scaffold/templates/admin/view_sidebar.html.erb +13 -0
- data/generators/nitro_scaffold/templates/controller.rb +85 -0
- data/generators/nitro_scaffold/templates/functional_test.rb +45 -0
- data/generators/nitro_scaffold/templates/helper.rb +2 -0
- data/generators/nitro_scaffold/templates/helper_test.rb +4 -0
- data/generators/nitro_scaffold/templates/layout.html.erb +47 -0
- data/generators/nitro_scaffold/templates/view_edit.html.erb +19 -0
- data/generators/nitro_scaffold/templates/view_form.html.erb +19 -0
- data/generators/nitro_scaffold/templates/view_index.html.erb +56 -0
- data/generators/nitro_scaffold/templates/view_new.html.erb +20 -0
- data/generators/nitro_scaffold/templates/view_show.html.erb +32 -0
- data/generators/nitro_scaffold/templates/view_sidebar.html.erb +13 -0
- data/lib/nitro_generator.rb +3 -0
- data/test/nitro_generator_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +104 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Genki
|
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,15 @@
|
|
1
|
+
= Nitro Generator
|
2
|
+
|
3
|
+
A collection of useful Rails admin area code generator scripts.
|
4
|
+
|
5
|
+
== Install
|
6
|
+
|
7
|
+
gem install genkiwow-nitro-generator
|
8
|
+
|
9
|
+
You may need to uninstall the older version if it's installed.
|
10
|
+
|
11
|
+
gem uninstall genkiwow-nitro-generator
|
12
|
+
|
13
|
+
== Copyright
|
14
|
+
|
15
|
+
Copyright (c) 2009 Genki. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "nitro-generator"
|
8
|
+
gem.summary = %Q{Nitro generator}
|
9
|
+
gem.email = "genkiwow@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/genkiwow/nitro-generator"
|
11
|
+
gem.authors = ["Genki"]
|
12
|
+
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
if File.exist?('VERSION.yml')
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
|
+
else
|
48
|
+
version = ""
|
49
|
+
end
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "nitro-generator #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|
data/VERSION.yml
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
class NitroLayoutGenerator < Rails::Generator::NamedBase
|
2
|
+
default_options :app_name => 'Web App', :layout_type => :administration, :theme => :default,
|
3
|
+
:no_layout => false
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
def initialize(runtime_args, runtime_options = {})
|
8
|
+
super
|
9
|
+
@name = @args.first || 'application'
|
10
|
+
end
|
11
|
+
|
12
|
+
def manifest
|
13
|
+
|
14
|
+
record do |m|
|
15
|
+
if !options[:without_public]
|
16
|
+
|
17
|
+
m.directory("app/views/admin/shared")
|
18
|
+
m.directory("app/views/shared")
|
19
|
+
m.directory("public/javascripts/admin")
|
20
|
+
m.directory("public/stylesheets/themes/#{options[:theme]}/")
|
21
|
+
m.directory("public/stylesheets/themes/default/")
|
22
|
+
m.directory('app/controllers/admin')
|
23
|
+
#adding layout
|
24
|
+
|
25
|
+
m.template("admin/view_layout_#{options[:layout_type]}.html.erb", File.join("app/views/layouts", "admin.html.erb")) unless options[:no_layout]
|
26
|
+
m.template("stylesheets/base.css", File.join("public/stylesheets", "base.css"))
|
27
|
+
m.template("stylesheets/themes/#{options[:theme]}/style.css", File.join("public/stylesheets/themes/#{options[:theme]}", "style.css"))
|
28
|
+
m.template("stylesheets/themes/default/style.css", File.join("public/stylesheets/themes/default", "style.css"))
|
29
|
+
m.template("javascripts/jquery-1.3.min.js", File.join("public/javascripts", "jquery-1.3.min.js"))
|
30
|
+
m.template("javascripts/application.js", File.join("public/javascripts/admin", "application.js"))
|
31
|
+
m.template("admin/view_sidebar.html.erb", File.join("app/views/admin/shared", "_sidebar.html.erb"))
|
32
|
+
m.template("view_sidebar.html.erb", File.join("app/views/shared", "_sidebar.html.erb"))
|
33
|
+
m.template("app_helper.rb", File.join("app/helpers", "application_helper.rb"))
|
34
|
+
# Layout and stylesheet.
|
35
|
+
|
36
|
+
m.template('layout.html.erb', File.join('app/views/layouts', "application.html.erb"))
|
37
|
+
|
38
|
+
m.template(
|
39
|
+
'admin/admin_controller.rb', File.join('app/controllers/admin', "admin_controller.rb")
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
|
50
|
+
# Override with your own usage banner.
|
51
|
+
def banner
|
52
|
+
"Usage: #{$0} nitro_layout"
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_options!(opt)
|
56
|
+
opt.separator ''
|
57
|
+
opt.separator 'Options:'
|
58
|
+
|
59
|
+
opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
|
60
|
+
opt.on("--type=layout_type", String, "Specify the layout type") { |v| options[:layout_type] = v }
|
61
|
+
opt.on("--theme=theme", String, "Specify the theme") { |v| options[:theme] = v }
|
62
|
+
opt.on("--no-layout", "Don't create layout") { |v| options[:no_layout] = true }
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title> <%%= @page_title || '<%= options[:app_name] %>' %></title>
|
6
|
+
<%%= stylesheet_link_tag 'base', "themes/<%= options[:theme] %>/style", :media => "screen" %>
|
7
|
+
<%%= javascript_include_tag 'jquery-1.3.min','admin/application' %>
|
8
|
+
<%%= yield(:js) %>
|
9
|
+
<%%= yield(:css) %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div id="container">
|
13
|
+
<div id="header">
|
14
|
+
<h1><a href="/"><%= options[:app_name] %></a></h1>
|
15
|
+
<div id="user-navigation">
|
16
|
+
<ul>
|
17
|
+
<%% if is_admin? %>
|
18
|
+
<li><a href="#">Profile</a></li>
|
19
|
+
<li><a href="#">Settings</a></li>
|
20
|
+
|
21
|
+
<%% else %>
|
22
|
+
<li><%%= link_to 'Login', login_path %></li>
|
23
|
+
<li><%%= link_to 'Signup', signup_path %></li>
|
24
|
+
<%% end -%>
|
25
|
+
</ul>
|
26
|
+
<div class="clear"></div>
|
27
|
+
</div>
|
28
|
+
<div id="main-navigation">
|
29
|
+
<ul>
|
30
|
+
<%% if is_admin? %>
|
31
|
+
<li class="first"><a href="#block-text">Dash Board</a></li>
|
32
|
+
<li class="active"><a href="#block-text">Active</a></li>
|
33
|
+
<li><%%= link_to 'Logout', logout_path %></li>
|
34
|
+
<%% else %>
|
35
|
+
<li><%%= link_to 'Login', login_path %></li>
|
36
|
+
<li><%%= link_to 'Signup', signup_path %></li>
|
37
|
+
<%% end -%>
|
38
|
+
</ul>
|
39
|
+
<div class="clear"></div>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<div id="wrapper">
|
43
|
+
<div id="main">
|
44
|
+
<%%= flash_messages %>
|
45
|
+
<%%= yield %>
|
46
|
+
<div id="footer">
|
47
|
+
<div class="block">
|
48
|
+
<p>Copyright © 2009 Your Site.</p>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<div id="sidebar">
|
53
|
+
<%%= (yield :sidebar) || render(:partial => 'admin/shared/sidebar') -%>
|
54
|
+
</div>
|
55
|
+
<div class="clear"></div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</body>
|
59
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title><%%= @page_title || '<%= options[:app_name] %>' %></title>
|
6
|
+
<%%= stylesheet_link_tag 'base', "themes/<%= options[:theme] %>/style" %>
|
7
|
+
<%%= yield(:js) %>
|
8
|
+
<%%= yield(:css) %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="container">
|
12
|
+
<div id="box">
|
13
|
+
<%%= yield %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="block">
|
2
|
+
<h3>Simple Block</h3>
|
3
|
+
<div class="content">
|
4
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
<div class="block">
|
8
|
+
<h3>Links</h3>
|
9
|
+
<ul class="navigation">
|
10
|
+
<li><a href="#">Link 1</a></li>
|
11
|
+
<li><a href="#">Link 2</a></li>
|
12
|
+
</ul>
|
13
|
+
</div>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<h1><%= options[:app_name] %></h1>
|
2
|
+
<div class="block" id="block-login">
|
3
|
+
<h2>Login Box</h2>
|
4
|
+
<div class="content login">
|
5
|
+
<div class="flash">
|
6
|
+
<%% flash.each do |type, message| -%>
|
7
|
+
<div class="message <%%= type %>">
|
8
|
+
<p><%%= message %></p>
|
9
|
+
</div>
|
10
|
+
<%% end -%>
|
11
|
+
</div>
|
12
|
+
<%% form_tag({:action => :create}, :class => 'form login') do -%>
|
13
|
+
<div class="group">
|
14
|
+
<div class="left">
|
15
|
+
<label class="label right">Login</label>
|
16
|
+
</div>
|
17
|
+
<div class="right">
|
18
|
+
<%%= text_field_tag :login, @login, :class => 'text_field' %>
|
19
|
+
</div>
|
20
|
+
<div class="clear"></div>
|
21
|
+
</div>
|
22
|
+
<div class="group">
|
23
|
+
<div class="left">
|
24
|
+
<label class="label right">Password</label>
|
25
|
+
</div>
|
26
|
+
<div class="right">
|
27
|
+
<%%= password_field_tag :password, nil, :class => 'text_field' %>
|
28
|
+
</div>
|
29
|
+
<div class="clear"></div>
|
30
|
+
</div>
|
31
|
+
<div class="group navform">
|
32
|
+
<div class="right">
|
33
|
+
<input type="submit" class="button" value="Sign in" />
|
34
|
+
</div>
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
<%% end -%>
|
38
|
+
</div>
|
39
|
+
</div>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<h1><%= options[:app_name] %></h1>
|
2
|
+
<div class="block" id="block-signup">
|
3
|
+
<h2>Sign up</h2>
|
4
|
+
<div class="content">
|
5
|
+
<div class="flash">
|
6
|
+
<%% flash.each do |type, message| -%>
|
7
|
+
<div class="message <%%= type %>">
|
8
|
+
<p><%%= message %></p>
|
9
|
+
</div>
|
10
|
+
<%% end -%>
|
11
|
+
</div>
|
12
|
+
<%% form_for @<%= singular_name %>, :html => { :class => 'form' } do |f| -%>
|
13
|
+
<div class="group">
|
14
|
+
<div class="left">
|
15
|
+
<label class="label">Login</label>
|
16
|
+
</div>
|
17
|
+
<div class="right">
|
18
|
+
<%%= f.text_field :login, :class => 'text_field' %>
|
19
|
+
</div>
|
20
|
+
<div class="clear"></div>
|
21
|
+
</div>
|
22
|
+
<div class="group">
|
23
|
+
<div class="left">
|
24
|
+
<label class="label">Email</label>
|
25
|
+
</div>
|
26
|
+
<div class="right">
|
27
|
+
<%%= f.text_field :email, :class => 'text_field' %>
|
28
|
+
</div>
|
29
|
+
<div class="clear"></div>
|
30
|
+
</div>
|
31
|
+
<div class="group">
|
32
|
+
<div class="left">
|
33
|
+
<label class="label">Password</label>
|
34
|
+
</div>
|
35
|
+
<div class="right">
|
36
|
+
<%%= f.password_field :password, :class => 'text_field' %>
|
37
|
+
</div>
|
38
|
+
<div class="clear"></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="group">
|
42
|
+
<div class="left">
|
43
|
+
<label class="label">Password</label>
|
44
|
+
</div>
|
45
|
+
<div class="right">
|
46
|
+
<%%= f.password_field :password_confirmation, :class => 'text_field' %>
|
47
|
+
</div>
|
48
|
+
<div class="clear"></div>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="group navform">
|
52
|
+
<input type="submit" class="button" value="Sign up" />
|
53
|
+
</div>
|
54
|
+
<%% end -%>
|
55
|
+
</div>
|
56
|
+
</div>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module ApplicationHelper
|
2
|
+
|
3
|
+
# Sets the page title and outputs title if container is passed in.
|
4
|
+
# eg. <%%= title('Hello World', :h2) %> will return the following:
|
5
|
+
# <h2>Hello World</h2> as well as setting the page title.
|
6
|
+
def title(str, container = nil)
|
7
|
+
@page_title = str
|
8
|
+
content_tag(container, str) if container
|
9
|
+
end
|
10
|
+
|
11
|
+
# Outputs the corresponding flash message if any are set
|
12
|
+
def flash_messages
|
13
|
+
messages = []
|
14
|
+
%w(notice warning error).each do |msg|
|
15
|
+
messages << content_tag(:div, html_escape(flash[msg.to_sym]), :id => "flash-#{msg}", :class => msg) unless flash[msg.to_sym].blank?
|
16
|
+
end
|
17
|
+
content_tag(:div, messages, :class => "flash")
|
18
|
+
end
|
19
|
+
|
20
|
+
def stylesheet(*args)
|
21
|
+
content_for(:css) { stylesheet_link_tag(*args) }
|
22
|
+
end
|
23
|
+
|
24
|
+
def javascript(*args)
|
25
|
+
content_for(:js) { javascript_include_tag(*args) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def admin_area(&block)
|
29
|
+
if is_admin?
|
30
|
+
concat content_tag(:div, capture(&block), :class => 'admin')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def info(&block)
|
35
|
+
concat content_tag(:div, capture(&block), :id => 'info')
|
36
|
+
end
|
37
|
+
|
38
|
+
def is_admin?
|
39
|
+
logged_in? && current_user.has_role?('admin')
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
jQuery.ajaxSetup({
|
2
|
+
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")},
|
3
|
+
});
|
4
|
+
|
5
|
+
$(document).ajaxSend(function(event, request, settings) {
|
6
|
+
if (typeof(AUTH_TOKEN) == "undefined") return;
|
7
|
+
settings.data = settings.data || "";
|
8
|
+
settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
|
9
|
+
});
|
10
|
+
|
11
|
+
|
12
|
+
$(document).ready(function() {
|
13
|
+
|
14
|
+
$('.table :checkbox.toggle').each(function(i, toggle) {
|
15
|
+
$(toggle).change(function(e) {
|
16
|
+
$(toggle).parents('table:first').find(':checkbox:not(.toggle)').each(function(j, checkbox) {
|
17
|
+
checkbox.checked = !checkbox.checked;
|
18
|
+
})
|
19
|
+
});
|
20
|
+
});
|
21
|
+
|
22
|
+
$(".form input.delete").live("click", function () {
|
23
|
+
|
24
|
+
if (confirm('Are you sure?'))
|
25
|
+
{
|
26
|
+
var cbs = $("input:checkbox[name='ids[]']:checked");
|
27
|
+
if (cbs.length > 0 )
|
28
|
+
{
|
29
|
+
$.post($("form.form").attr("action"), $("form.form").serialize(), null, "script");
|
30
|
+
}
|
31
|
+
else
|
32
|
+
{
|
33
|
+
alert("At least choose one item!");
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return false;
|
37
|
+
});
|
38
|
+
|
39
|
+
});
|
40
|
+
|
41
|
+
|
42
|
+
|