Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82e6c6e

Browse files
authored
Merge pull request #105 from Borzik/jquery-ui-upgrade
jQuery UI upgrade to 1.12
2 parents de88822 + 441a9eb commit 82e6c6e

File tree

279 files changed

+14520
-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.

279 files changed

+14520
-11722
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
rvm:
2-
- 1.9.3
2+
- 2.2.2

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 is 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/` subdirectory 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: 48 additions & 27 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,44 @@ 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)
26-
return "jquery.js" if dep_entry == 'jquery'
27-
28-
"#{dep_entry.sub 'ui.', ''}.js"
19+
def source_file_for_dependency_entry(caller, dep_entry)
20+
p = Pathname.new caller
21+
parent_path = p.parent
22+
parent_path.join(dep_entry + '.js').to_s
2923
end
3024

3125
# return a Hash of dependency info, whose keys are jquery-ui
3226
# source files and values are Arrays containing the source files
3327
# they depend on
3428
def map_dependencies
3529
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))
30+
Dir.glob("jquery-ui/ui/**/*.js").each do |path|
31+
basename = File.basename path
32+
file = File.read path
33+
34+
matchdata = file.match(/define\(\s*\[\s*([\"\.\/\,\w\s-\:]+)\]/m)
35+
36+
next if matchdata.nil?
37+
38+
deps = matchdata[1]
3939

40-
deps = build_info['dependencies'].keys
40+
# remove lines with comments
41+
deps = deps.gsub(/\/\/.+\s/, "")
42+
43+
# remove all non-path symbols
44+
deps = deps.gsub(/[\r\n\t\"\[\]\s]/, "")
45+
46+
deps_paths = deps.split(',')
47+
48+
deps_paths.map!(&method(:remove_js_extension))
4149

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

46-
deps.map! {|d| source_file_for_dependency_entry d }
54+
deps_paths.map! {|d| source_file_for_dependency_entry path, d }
4755

48-
dependencies[source_file_name] = deps
56+
dependencies[basename] = deps_paths
4957
end
5058
dependencies
5159
end
@@ -70,7 +78,7 @@ def get_js_dependencies(basename)
7078
end
7179
# Make sure we do not package assets with broken dependencies
7280
dependencies.each do |dep|
73-
unless File.exist?("jquery-ui/ui/#{dep}")
81+
unless File.exist?("#{dep}")
7482
fail "#{basename}: missing #{dep}"
7583
end
7684
end
@@ -107,13 +115,18 @@ task :javascripts => :submodule do
107115
target_dir = "app/assets/javascripts"
108116
target_ui_dir = "#{target_dir}/jquery-ui"
109117
mkdir_p target_ui_dir
118+
mkdir_p target_ui_dir + '/effects'
119+
mkdir_p target_ui_dir + '/widgets'
120+
mkdir_p target_ui_dir + '/i18n'
110121

111-
Dir.glob("jquery-ui/ui/*.js").each do |path|
122+
Dir.glob("jquery-ui/ui/**/*.js").each do |path|
112123
basename = File.basename(path)
124+
clean_path = path.gsub('/ui', '')
113125
dep_modules = get_js_dependencies(basename).map(&method(:remove_js_extension))
114-
File.open("#{target_ui_dir}/#{basename}", "w") do |out|
126+
File.open("#{target_dir}/#{clean_path}", "w") do |out|
115127
dep_modules.each do |mod|
116-
out.write("//= require jquery-ui/#{mod}\n")
128+
mod.gsub!('/ui', '')
129+
out.write("//= require #{mod}\n")
117130
end
118131
out.write("\n") unless dep_modules.empty?
119132
source_code = File.read(path)
@@ -127,7 +140,7 @@ task :javascripts => :submodule do
127140
# https://github.com/joliss/jquery-ui-rails/issues/9
128141
Dir.glob("jquery-ui/ui/i18n/*.js").each do |path|
129142
basename = File.basename(path)
130-
File.open("#{target_ui_dir}/#{basename}", "w") do |out|
143+
File.open("#{target_ui_dir}/i18n/#{basename}", "w") do |out|
131144
source_code = File.read(path)
132145
source_code.gsub!('@VERSION', version)
133146
protect_copyright_notice(source_code)
@@ -136,15 +149,23 @@ task :javascripts => :submodule do
136149
end
137150

138151
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")
152+
Dir.glob("jquery-ui/ui/effects/*.js").sort.each do |path|
153+
clean_path = remove_js_extension(path).gsub('/ui', '')
154+
out.write("//= require #{clean_path}\n")
142155
end
143156
end
144157
File.open("#{target_dir}/jquery-ui.js", "w") do |out|
145158
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")
159+
clean_path = remove_js_extension(path).gsub('/ui', '')
160+
out.write("//= require #{clean_path}\n")
161+
end
162+
Dir.glob("jquery-ui/ui/effects/*.js").sort.each do |path|
163+
clean_path = remove_js_extension(path).gsub('/ui', '')
164+
out.write("//= require #{clean_path}\n")
165+
end
166+
Dir.glob("jquery-ui/ui/widgets/*.js").sort.each do |path|
167+
clean_path = remove_js_extension(path).gsub('/ui', '')
168+
out.write("//= require #{clean_path}\n")
148169
end
149170
end
150171
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
-178 Bytes
Binary file not shown.
-120 Bytes
Binary file not shown.
-105 Bytes
Binary file not shown.
-111 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)