harukizaemon-cascading_javascripts 2.0.0
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/CHANGELOG.rdoc +25 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +45 -0
- data/about.yml +5 -0
- data/cascading_javascripts.gemspec +23 -0
- data/lib/cascading_javascripts.rb +1 -0
- data/lib/red_hill_consulting/cascading_javascripts/action_view/helpers/asset_tag_helper.rb +20 -0
- data/rails/init.rb +1 -0
- metadata +71 -0
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
== 2.0.0 released 2009-01-05
|
2
|
+
|
3
|
+
* Brought up-to-date with Rails 2.2.
|
4
|
+
|
5
|
+
== 2007-11-28
|
6
|
+
|
7
|
+
* Workaround to ensure plugin is only ever loaded once.
|
8
|
+
|
9
|
+
== 2007-03-15
|
10
|
+
|
11
|
+
* Use ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR when searching for javascripts.
|
12
|
+
* Load application after controller_name/action_name.
|
13
|
+
|
14
|
+
== 2006-12-02
|
15
|
+
|
16
|
+
* Use Rails 1.2 alias_method_chain.
|
17
|
+
* Separate modules into individual files.
|
18
|
+
|
19
|
+
== 2006-07-17
|
20
|
+
|
21
|
+
* Placed code into module named after the class to which the mixin will be applied.
|
22
|
+
|
23
|
+
== 2006-05-23
|
24
|
+
|
25
|
+
* Added tests!
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2006 RedHill Consulting, Pty. Ltd.
|
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,45 @@
|
|
1
|
+
= Cascading Javascripts
|
2
|
+
|
3
|
+
Cascading Javascripts is a plugin that enhances the behaviour of the built-in javascript_include_tag macro to include
|
4
|
+
controller and action specific javascript files.
|
5
|
+
|
6
|
+
If :cascades is passed as a parameter, the javascript_include_tag macro will load the following javascript files (if
|
7
|
+
present) in order:
|
8
|
+
|
9
|
+
1. controller_name/action_name.js (e.g. home.js, customers.js, etc.); and
|
10
|
+
2. controller_name/action_name.js (eg. home/index.js, customers/new.js, etc.).
|
11
|
+
|
12
|
+
This allows you to define application-wide and page-specific javascript files without needing to manually include each
|
13
|
+
one.
|
14
|
+
|
15
|
+
To use, simply call javascript_include_tag from application.html.erb including :cascades as a (or the only) parameter:
|
16
|
+
|
17
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
20
|
+
<head>
|
21
|
+
...
|
22
|
+
<%= javascript_include_tag :cascades %>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
...
|
26
|
+
</body>
|
27
|
+
</html>
|
28
|
+
|
29
|
+
== Installation
|
30
|
+
|
31
|
+
You have two choices for installation. The first uses a gem (recommended):
|
32
|
+
|
33
|
+
$ sudo gem install harukizaemon-cascading_javascripts
|
34
|
+
|
35
|
+
Or you can use the Rails plugin
|
36
|
+
|
37
|
+
$ ruby script/install git://github.com/harukizaemon/cascading_javascripts.git
|
38
|
+
|
39
|
+
=== See Also
|
40
|
+
|
41
|
+
* <b>Cascading Stylesheets:</b> http://github.com/harukizaemon/cascading_stylesheets
|
42
|
+
|
43
|
+
=== License
|
44
|
+
|
45
|
+
This plugin is copyright 2006 by RedHill Consulting, Pty. Ltd. and is released under the MIT license.
|
data/about.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "cascading_javascripts"
|
3
|
+
s.version = "2.0.0"
|
4
|
+
s.date = "2009-01-05"
|
5
|
+
s.summary = "Include controller and action specific javascript files in your Ruby on Rails templates."
|
6
|
+
s.email = "simon.harris@redhillconsulting.com.au"
|
7
|
+
s.homepage = "http://github.com/harukizaemon/cascading_javascripts"
|
8
|
+
s.description = "Cascading Javascripts is a Ruby on Rails plugin that enhances the behaviour of the built-in javascript_include_tag macro to include controller and action specific javascript files."
|
9
|
+
s.has_rdoc = true
|
10
|
+
s.authors = ["Simon Harris"]
|
11
|
+
s.files = ["CHANGELOG.rdoc",
|
12
|
+
"MIT-LICENSE",
|
13
|
+
"README.rdoc",
|
14
|
+
"about.yml",
|
15
|
+
"cascading_javascripts.gemspec",
|
16
|
+
"lib",
|
17
|
+
"lib/cascading_javascripts.rb",
|
18
|
+
"lib/red_hill_consulting/cascading_javascripts/action_view/helpers/asset_tag_helper.rb",
|
19
|
+
"rails/init.rb"]
|
20
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
21
|
+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
|
22
|
+
s.add_dependency("actionpack", ["> 2.2.2"])
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ActionView::Helpers::AssetTagHelper::JavaScriptSources.send(:include, RedHillConsulting::CascadingJavascripts::ActionView::Helpers::AssetTagHelper::JavaScriptSources)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RedHillConsulting::CascadingJavascripts::ActionView::Helpers
|
2
|
+
module AssetTagHelper
|
3
|
+
module JavaScriptSources
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
alias_method_chain :expand_sources, :cascade
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def expand_sources_with_cascade
|
11
|
+
if @sources.delete(:cascades)
|
12
|
+
[@controller.controller_name, "#{@controller.controller_name}/#{@controller.action_name}"].each do |source|
|
13
|
+
@sources << source if File.exists?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, source + '.js'))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
expand_sources_without_cascade
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'cascading_javascripts' unless defined?(RedHillConsulting::CascadingJavascripts)
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: harukizaemon-cascading_javascripts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Harris
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-05 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: actionpack
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.2.2
|
23
|
+
version:
|
24
|
+
description: Cascading Javascripts is a Ruby on Rails plugin that enhances the behaviour of the built-in javascript_include_tag macro to include controller and action specific javascript files.
|
25
|
+
email: simon.harris@redhillconsulting.com.au
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- CHANGELOG.rdoc
|
32
|
+
- README.rdoc
|
33
|
+
files:
|
34
|
+
- CHANGELOG.rdoc
|
35
|
+
- MIT-LICENSE
|
36
|
+
- README.rdoc
|
37
|
+
- about.yml
|
38
|
+
- cascading_javascripts.gemspec
|
39
|
+
- lib
|
40
|
+
- lib/cascading_javascripts.rb
|
41
|
+
- lib/red_hill_consulting/cascading_javascripts/action_view/helpers/asset_tag_helper.rb
|
42
|
+
- rails/init.rb
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: http://github.com/harukizaemon/cascading_javascripts
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options:
|
47
|
+
- --main
|
48
|
+
- README.rdoc
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.2.0
|
67
|
+
signing_key:
|
68
|
+
specification_version: 2
|
69
|
+
summary: Include controller and action specific javascript files in your Ruby on Rails templates.
|
70
|
+
test_files: []
|
71
|
+
|