Skip to content

Commit d504a40

Browse files
committed
upgrade jquery-ui to 1.12.1
1 parent de88822 commit d504a40

File tree

277 files changed

+14524
-11722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+14524
-11722
lines changed

History.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# master
22

3+
# 6.0.0
4+
5+
* Update to jQuery UI 1.12.1
6+
37
# 5.0.5
48

59
* Update to jQuery UI 1.11.4

README.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ Also add the jQuery UI CSS to your application.css:
4141
*/
4242
```
4343

44-
Warning: If you are using a version below 5.0, you will have to use a different naming
45-
for the files to require, see https://github.com/joliss/jquery-ui-rails/blob/v4.2.1/README.md
46-
for more information.
44+
### Warning:
45+
Due to directory structure changes between jQuery-UI 1.10, 1.11, and 1.12,
46+
if you use version lower than 6.0, you will have to use a different naming
47+
for the files to require, please check following links for more information:
48+
[For 5.0 users](https://github.com/joliss/jquery-ui-rails/blob/v5.0.5/README.md)
49+
[For 4.2 users](https://github.com/joliss/jquery-ui-rails/blob/v4.2.1/README.md)
4750

4851
All images required by jQuery UI are automatically served through the asset
4952
pipeline, so you are good to go! For example, this code will add a
@@ -66,10 +69,11 @@ For example, if you only need the datepicker module, add this to your
6669
application.js:
6770

6871
```javascript
69-
//= require jquery-ui/datepicker
72+
//= require jquery-ui/widgets/datepicker
7073
```
7174

72-
In your application.css, require the corresponding CSS module:
75+
In your application.css, require the corresponding CSS module (notice
76+
no `widgets/` path here:
7377

7478
```css
7579
/*
@@ -84,7 +88,6 @@ In your application.css, require the corresponding CSS module:
8488
```javascript
8589
//= require jquery-ui/core
8690
//= require jquery-ui/widget
87-
//= require jquery-ui/mouse
8891
//= require jquery-ui/position
8992
```
9093

@@ -94,31 +97,32 @@ other JavaScript modules as needed.
9497
### Interactions
9598

9699
```javascript
97-
//= require jquery-ui/draggable
98-
//= require jquery-ui/droppable
99-
//= require jquery-ui/resizable
100-
//= require jquery-ui/selectable
101-
//= require jquery-ui/sortable
100+
//= require jquery-ui/widgets/mouse
101+
//= require jquery-ui/widgets/draggable
102+
//= require jquery-ui/widgets/droppable
103+
//= require jquery-ui/widgets/resizable
104+
//= require jquery-ui/widgets/selectable
105+
//= require jquery-ui/widgets/sortable
102106
```
103107

104-
For all but `jquery-ui/droppable`, remember to `require` their matching CSS
108+
For all but `jquery-ui/mouse` and `jquery-ui/droppable`, remember to `require` their matching CSS
105109
files in your application.css as well.
106110

107111
### Widgets
108112

109113
```javascript
110-
//= require jquery-ui/accordion
111-
//= require jquery-ui/autocomplete
112-
//= require jquery-ui/button
113-
//= require jquery-ui/datepicker
114-
//= require jquery-ui/dialog
115-
//= require jquery-ui/menu
116-
//= require jquery-ui/progressbar
117-
//= require jquery-ui/selectmenu
118-
//= require jquery-ui/slider
119-
//= require jquery-ui/spinner
120-
//= require jquery-ui/tabs
121-
//= require jquery-ui/tooltip
114+
//= require jquery-ui/widgets/accordion
115+
//= require jquery-ui/widgets/autocomplete
116+
//= require jquery-ui/widgets/button
117+
//= require jquery-ui/widgets/datepicker
118+
//= require jquery-ui/widgets/dialog
119+
//= require jquery-ui/widgets/menu
120+
//= require jquery-ui/widgets/progressbar
121+
//= require jquery-ui/widgets/selectmenu
122+
//= require jquery-ui/widgets/slider
123+
//= require jquery-ui/widgets/spinner
124+
//= require jquery-ui/widgets/tabs
125+
//= require jquery-ui/widgets/tooltip
122126
```
123127

124128
For all of these, remember to `require` their matching CSS files in your
@@ -132,8 +136,8 @@ Datepicker has optional i18n modules for non-US locales, named
132136
for example:
133137

134138
```javascript
135-
//= require jquery-ui/datepicker
136-
//= require jquery-ui/datepicker-pt-BR
139+
//= require jquery-ui/widgets/datepicker
140+
//= require jquery-ui/i18n/datepicker-pt-BR
137141
```
138142

139143
Note that you still need to include the main datepicker module. It is not
@@ -144,6 +148,11 @@ reasons](https://github.com/joliss/jquery-ui-rails/issues/9#issuecomment-6524987
144148

145149
```javascript
146150
//= require jquery-ui/effect.all
151+
```
152+
153+
OR
154+
155+
```javascript
147156
//= require jquery-ui/effect
148157
//= require jquery-ui/effect-blind
149158
//= require jquery-ui/effect-bounce

Rakefile

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ Encoding.default_external = "UTF-8" if defined?(Encoding)
22
require 'json'
33
require 'bundler/gem_tasks'
44

5-
# returns the source filename for a given JSON build file
6-
# (e.g., "ui.core.jquery.json" returns "core.js")
7-
def source_file_for_build_file(build_file)
8-
"#{build_file.sub('ui.', '').sub('.jquery.json', '')}.js"
9-
end
10-
115
# returns the source filename for a named file in the 'dependencies'
126
# array of a JSON build file
137
# (e.g., if the JSON build file contains
@@ -22,30 +16,48 @@ end
2216
#
2317
# The only exception is "jquery", which doesn't follow the
2418
# same naming conventions so it's a special case.
25-
def source_file_for_dependency_entry(dep_entry)
19+
def source_file_for_dependency_entry(caller, dep_entry)
2620
return "jquery.js" if dep_entry == 'jquery'
2721

28-
"#{dep_entry.sub 'ui.', ''}.js"
22+
p = Pathname.new caller
23+
parent_path = p.parent
24+
parent_path.join(dep_entry).to_s
2925
end
3026

3127
# return a Hash of dependency info, whose keys are jquery-ui
3228
# source files and values are Arrays containing the source files
3329
# they depend on
3430
def map_dependencies
3531
dependencies = {}
36-
Dir.glob("jquery-ui/*.jquery.json").each do |build_file|
37-
build_info = JSON.parse(File.read build_file)
38-
source_file_name = source_file_for_build_file(File.basename(build_file))
32+
Dir.glob("jquery-ui/ui/**/*.js").each do |path|
33+
basename = File.basename path
34+
file = File.read path
35+
36+
matchdata = file.match(/define\(.*\[[\S\s]+\]\, factory \);/m)
37+
38+
matchdata ||= file.match(/define\(.*\[[\S\s]+\](\, factory )?.*\);/m)
39+
40+
next if matchdata.nil?
41+
42+
deps_str = matchdata[0]
3943

40-
deps = build_info['dependencies'].keys
44+
deps = deps_str.match(/\[[\s\S]*\]/)[0]
45+
46+
deps = deps.gsub(/\/\/.+\s/, "")
47+
48+
deps = deps.gsub(/[\r\n\t\"\[\]\s]/, "")
49+
50+
deps_paths = deps.split(',')
4151

4252
# None of jquery.ui files should depend on jquery.js,
4353
# so we remove 'jquery' from the list of dependencies for all files
44-
deps.reject! {|d| d == "jquery" }
54+
deps_paths.reject! {|d| d == "jquery" }
4555

46-
deps.map! {|d| source_file_for_dependency_entry d }
56+
deps_paths.map! {|d| d + '.js' }
4757

48-
dependencies[source_file_name] = deps
58+
deps_paths.map! {|d| source_file_for_dependency_entry path, d }
59+
60+
dependencies[basename] = deps_paths
4961
end
5062
dependencies
5163
end
@@ -70,7 +82,7 @@ def get_js_dependencies(basename)
7082
end
7183
# Make sure we do not package assets with broken dependencies
7284
dependencies.each do |dep|
73-
unless File.exist?("jquery-ui/ui/#{dep}")
85+
unless File.exist?("#{dep}")
7486
fail "#{basename}: missing #{dep}"
7587
end
7688
end
@@ -107,13 +119,18 @@ task :javascripts => :submodule do
107119
target_dir = "app/assets/javascripts"
108120
target_ui_dir = "#{target_dir}/jquery-ui"
109121
mkdir_p target_ui_dir
122+
mkdir_p target_ui_dir + '/effects'
123+
mkdir_p target_ui_dir + '/widgets'
124+
mkdir_p target_ui_dir + '/i18n'
110125

111-
Dir.glob("jquery-ui/ui/*.js").each do |path|
126+
Dir.glob("jquery-ui/ui/**/*.js").each do |path|
112127
basename = File.basename(path)
128+
clean_path = path.gsub('/ui', '')
113129
dep_modules = get_js_dependencies(basename).map(&method(:remove_js_extension))
114-
File.open("#{target_ui_dir}/#{basename}", "w") do |out|
130+
File.open("#{target_dir}/#{clean_path}", "w") do |out|
115131
dep_modules.each do |mod|
116-
out.write("//= require jquery-ui/#{mod}\n")
132+
mod.gsub!('/ui', '')
133+
out.write("//= require #{mod}\n")
117134
end
118135
out.write("\n") unless dep_modules.empty?
119136
source_code = File.read(path)
@@ -127,7 +144,7 @@ task :javascripts => :submodule do
127144
# https://github.com/joliss/jquery-ui-rails/issues/9
128145
Dir.glob("jquery-ui/ui/i18n/*.js").each do |path|
129146
basename = File.basename(path)
130-
File.open("#{target_ui_dir}/#{basename}", "w") do |out|
147+
File.open("#{target_ui_dir}/i18n/#{basename}", "w") do |out|
131148
source_code = File.read(path)
132149
source_code.gsub!('@VERSION', version)
133150
protect_copyright_notice(source_code)
@@ -136,15 +153,23 @@ task :javascripts => :submodule do
136153
end
137154

138155
File.open("#{target_ui_dir}/effect.all.js", "w") do |out|
139-
Dir.glob("jquery-ui/ui/effect*.js").sort.each do |path|
140-
asset_name = remove_js_extension(File.basename(path))
141-
out.write("//= require jquery-ui/#{asset_name}\n")
156+
Dir.glob("jquery-ui/ui/effects/*.js").sort.each do |path|
157+
clean_path = path.gsub('/ui', '')
158+
out.write("//= require #{clean_path}\n")
142159
end
143160
end
144161
File.open("#{target_dir}/jquery-ui.js", "w") do |out|
145162
Dir.glob("jquery-ui/ui/*.js").sort.each do |path|
146-
asset_name = remove_js_extension(File.basename(path))
147-
out.write("//= require jquery-ui/#{asset_name}\n")
163+
clean_path = path.gsub('/ui', '')
164+
out.write("//= require #{clean_path}\n")
165+
end
166+
Dir.glob("jquery-ui/ui/effects/*.js").sort.each do |path|
167+
clean_path = path.gsub('/ui', '')
168+
out.write("//= require #{clean_path}\n")
169+
end
170+
Dir.glob("jquery-ui/ui/widgets/*.js").sort.each do |path|
171+
clean_path = path.gsub('/ui', '')
172+
out.write("//= require #{clean_path}\n")
148173
end
149174
end
150175
end

VERSIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
| Gem | jQuery UI |
44
|--------|-----------|
5+
| 6.0.0 | 1.12.1 |
56
| 5.0.5 | 1.11.4 |
67
| 5.0.4 | 1.11.3 |
78
| 5.0.3 | 1.11.2 |
-94 Bytes
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)