puffer 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +55 -53
- data/VERSION +1 -1
- data/app/assets/javascripts/puffer/application.js +6 -3
- data/app/assets/javascripts/puffer/paginator.js +223 -0
- data/app/assets/javascripts/puffer/puffer.js +12 -0
- data/app/assets/javascripts/puffer/rails.js +1 -0
- data/app/assets/javascripts/puffer/{right-autocompleter.js → right-autocompleter-src.js} +45 -41
- data/app/assets/javascripts/puffer/{right-calendar.js → right-calendar-src.js} +53 -50
- data/app/assets/javascripts/puffer/right-dialog-src.js +768 -0
- data/app/assets/javascripts/puffer/right-slider-src.js +507 -0
- data/app/assets/javascripts/puffer/{right.js → right-src.js} +1000 -230
- data/app/assets/stylesheets/puffer/application.css +2 -0
- data/app/assets/stylesheets/puffer/paginator.css +33 -0
- data/app/assets/stylesheets/puffer/right.css +4 -0
- data/app/components/base/form.html.erb +15 -0
- data/app/components/base_component.rb +15 -0
- data/app/components/boolean/form.html.erb +3 -0
- data/app/components/boolean/index.html.erb +3 -0
- data/app/components/boolean_component.rb +13 -0
- data/app/components/date_time/form.html.erb +5 -0
- data/app/components/date_time_component.rb +12 -0
- data/app/components/file/form.html.erb +5 -0
- data/app/components/file_component.rb +3 -0
- data/app/components/hidden/form.html.erb +1 -0
- data/app/components/hidden_component.rb +3 -0
- data/app/components/password/form.html.erb +5 -0
- data/app/components/password_component.rb +7 -0
- data/app/components/references_many/form.html.erb +1 -0
- data/app/components/references_many_component.rb +7 -0
- data/app/components/references_one/choose.html.erb +9 -0
- data/app/components/references_one/form.html.erb +28 -0
- data/app/components/references_one_component.rb +12 -0
- data/app/components/select/form.html.erb +5 -0
- data/app/components/select_component.rb +15 -0
- data/app/components/string/form.html.erb +5 -0
- data/app/components/string_component.rb +3 -0
- data/app/components/text/form.html.erb +5 -0
- data/app/components/text_component.rb +3 -0
- data/app/controllers/puffer/base.rb +4 -0
- data/app/views/puffer/base/_form.html.erb +0 -1
- data/app/views/puffer/base/_table.html.erb +25 -0
- data/app/views/puffer/base/index.html.erb +14 -28
- data/app/views/puffer/tree_base/_record.html.erb +1 -1
- data/lib/generators/puffer/component/USAGE +12 -0
- data/lib/generators/puffer/component/component_generator.rb +19 -0
- data/lib/generators/puffer/component/templates/component.rb +15 -0
- data/lib/generators/puffer/component/templates/component_spec.rb +19 -0
- data/lib/puffer/component.rb +141 -0
- data/lib/puffer/controller/dsl.rb +25 -12
- data/lib/puffer/engine.rb +5 -0
- data/lib/puffer/extensions/controller.rb +11 -9
- data/lib/puffer/extensions/form.rb +2 -1
- data/lib/puffer/extensions/mapper.rb +2 -0
- data/lib/puffer/field.rb +30 -19
- data/lib/puffer/field_set.rb +17 -2
- data/lib/puffer.rb +25 -8
- data/puffer.gemspec +59 -28
- data/spec/app/components/base_component_spec.rb +19 -0
- data/spec/app/components/boolean_component_spec.rb +36 -0
- data/spec/app/components/date_time_component_spec.rb +26 -0
- data/spec/app/components/file_component_spec.rb +25 -0
- data/spec/app/components/hidden_component_spec.rb +24 -0
- data/spec/app/components/password_component_spec.rb +37 -0
- data/spec/app/components/references_many_component_spec.rb +19 -0
- data/spec/app/components/references_one_component_spec.rb +19 -0
- data/spec/app/components/select_component_spec.rb +30 -0
- data/spec/app/components/string_component_spec.rb +25 -0
- data/spec/app/components/text_component_spec.rb +25 -0
- data/spec/dummy/app/controllers/admin/categories_controller.rb +3 -3
- data/spec/dummy/app/controllers/admin/posts_controller.rb +3 -0
- data/spec/dummy/app/controllers/{puffer → admin}/sessions_controller.rb +1 -1
- data/spec/dummy/app/controllers/admin/users_controller.rb +2 -2
- data/spec/dummy/app/models/post.rb +4 -0
- data/spec/dummy/db/migrate/20100930132656_create_posts.rb +2 -0
- data/spec/dummy/db/migrate/20100930132726_create_categories.rb +1 -0
- data/spec/dummy/db/schema.rb +3 -0
- data/spec/dummy/db/seeds.rb +6 -1
- data/spec/fabricators/categories_fabricator.rb +1 -0
- data/spec/fabricators/posts_fabricator.rb +1 -0
- data/spec/lib/component_spec.rb +7 -0
- data/spec/lib/fields_spec.rb +0 -4
- metadata +85 -56
- data/app/views/puffer/base/associated/_many.html.erb +0 -56
- data/app/views/puffer/base/associated/many.rjs +0 -1
- data/app/views/puffer/base/associated/one.js.erb +0 -13
- data/app/views/puffer/base/association/_many.html.erb +0 -7
- data/lib/puffer/controller/generated.rb +0 -65
- data/lib/puffer/customs.rb +0 -64
- data/lib/puffer/inputs/association.rb +0 -38
- data/lib/puffer/inputs/base.rb +0 -51
- data/lib/puffer/inputs/boolean.rb +0 -19
- data/lib/puffer/inputs/collection_association.rb +0 -11
- data/lib/puffer/inputs/date_time.rb +0 -16
- data/lib/puffer/inputs/file.rb +0 -11
- data/lib/puffer/inputs/hidden.rb +0 -15
- data/lib/puffer/inputs/password.rb +0 -11
- data/lib/puffer/inputs/select.rb +0 -19
- data/lib/puffer/inputs/text.rb +0 -11
data/.rspec
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,74 +1,75 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (3.1.0
|
5
|
-
actionpack (= 3.1.0
|
4
|
+
actionmailer (3.1.0)
|
5
|
+
actionpack (= 3.1.0)
|
6
6
|
mail (~> 2.3.0)
|
7
|
-
actionpack (3.1.0
|
8
|
-
activemodel (= 3.1.0
|
9
|
-
activesupport (= 3.1.0
|
7
|
+
actionpack (3.1.0)
|
8
|
+
activemodel (= 3.1.0)
|
9
|
+
activesupport (= 3.1.0)
|
10
10
|
builder (~> 3.0.0)
|
11
11
|
erubis (~> 2.7.0)
|
12
12
|
i18n (~> 0.6)
|
13
|
-
rack (~> 1.3.
|
14
|
-
rack-cache (~> 1.0.
|
15
|
-
rack-mount (~> 0.8.
|
16
|
-
rack-test (~> 0.6.
|
17
|
-
sprockets (~> 2.0.0
|
18
|
-
activemodel (3.1.0
|
19
|
-
activesupport (= 3.1.0
|
20
|
-
bcrypt-ruby (~>
|
13
|
+
rack (~> 1.3.2)
|
14
|
+
rack-cache (~> 1.0.3)
|
15
|
+
rack-mount (~> 0.8.2)
|
16
|
+
rack-test (~> 0.6.1)
|
17
|
+
sprockets (~> 2.0.0)
|
18
|
+
activemodel (3.1.0)
|
19
|
+
activesupport (= 3.1.0)
|
20
|
+
bcrypt-ruby (~> 3.0.0)
|
21
21
|
builder (~> 3.0.0)
|
22
22
|
i18n (~> 0.6)
|
23
|
-
activerecord (3.1.0
|
24
|
-
activemodel (= 3.1.0
|
25
|
-
activesupport (= 3.1.0
|
26
|
-
arel (~> 2.1
|
23
|
+
activerecord (3.1.0)
|
24
|
+
activemodel (= 3.1.0)
|
25
|
+
activesupport (= 3.1.0)
|
26
|
+
arel (~> 2.2.1)
|
27
27
|
tzinfo (~> 0.3.29)
|
28
|
-
activeresource (3.1.0
|
29
|
-
activemodel (= 3.1.0
|
30
|
-
activesupport (= 3.1.0
|
31
|
-
activesupport (3.1.0
|
28
|
+
activeresource (3.1.0)
|
29
|
+
activemodel (= 3.1.0)
|
30
|
+
activesupport (= 3.1.0)
|
31
|
+
activesupport (3.1.0)
|
32
32
|
multi_json (~> 1.0)
|
33
33
|
apotomo (1.1.2)
|
34
34
|
cells (>= 3.5.6)
|
35
35
|
hooks (~> 0.1.3)
|
36
36
|
onfire (~> 0.2.0)
|
37
|
-
arel (2.1
|
38
|
-
bcrypt-ruby (
|
37
|
+
arel (2.2.1)
|
38
|
+
bcrypt-ruby (3.0.0)
|
39
39
|
builder (3.0.0)
|
40
|
-
capybara (1.
|
40
|
+
capybara (1.1.1)
|
41
41
|
mime-types (>= 1.16)
|
42
42
|
nokogiri (>= 1.3.3)
|
43
43
|
rack (>= 1.0.0)
|
44
44
|
rack-test (>= 0.5.4)
|
45
|
-
selenium-webdriver (~>
|
45
|
+
selenium-webdriver (~> 2.0)
|
46
46
|
xpath (~> 0.1.4)
|
47
|
-
cells (3.6.
|
47
|
+
cells (3.6.5)
|
48
48
|
actionpack (~> 3.0)
|
49
49
|
railties (~> 3.0)
|
50
|
-
childprocess (0.2.
|
50
|
+
childprocess (0.2.2)
|
51
51
|
ffi (~> 1.0.6)
|
52
52
|
database_cleaner (0.6.7)
|
53
|
-
diff-lcs (1.1.
|
53
|
+
diff-lcs (1.1.3)
|
54
54
|
erubis (2.7.0)
|
55
|
-
fabrication (1.0
|
55
|
+
fabrication (1.1.0)
|
56
56
|
ffi (1.0.9)
|
57
|
-
forgery (0.3
|
57
|
+
forgery (0.4.3)
|
58
58
|
nokogiri (~> 1.4)
|
59
59
|
git (1.2.5)
|
60
|
-
guard (0.
|
60
|
+
guard (0.6.3)
|
61
61
|
thor (~> 0.14.6)
|
62
|
-
guard-rspec (0.4.
|
62
|
+
guard-rspec (0.4.4)
|
63
63
|
guard (>= 0.4.0)
|
64
|
-
hike (1.2.
|
64
|
+
hike (1.2.1)
|
65
65
|
hooks (0.1.4)
|
66
66
|
i18n (0.6.0)
|
67
67
|
jeweler (1.6.4)
|
68
68
|
bundler (~> 1.0)
|
69
69
|
git (>= 1.2.5)
|
70
70
|
rake
|
71
|
-
json_pure (1.5.
|
71
|
+
json_pure (1.5.4)
|
72
|
+
spruz (~> 0.2.8)
|
72
73
|
kaminari (0.12.4)
|
73
74
|
rails (>= 3.0.0)
|
74
75
|
libnotify (0.5.7)
|
@@ -78,38 +79,38 @@ GEM
|
|
78
79
|
treetop (~> 1.4.8)
|
79
80
|
mime-types (1.16)
|
80
81
|
multi_json (1.0.3)
|
81
|
-
nested_set (1.6.
|
82
|
+
nested_set (1.6.8)
|
82
83
|
activerecord (>= 3.0.0)
|
83
84
|
railties (>= 3.0.0)
|
84
85
|
nokogiri (1.5.0)
|
85
86
|
onfire (0.2.0)
|
86
87
|
polyglot (0.3.2)
|
87
88
|
rack (1.3.2)
|
88
|
-
rack-cache (1.0.
|
89
|
+
rack-cache (1.0.3)
|
89
90
|
rack (>= 0.4)
|
90
|
-
rack-mount (0.8.
|
91
|
+
rack-mount (0.8.3)
|
91
92
|
rack (>= 1.0.0)
|
92
93
|
rack-ssl (1.3.2)
|
93
94
|
rack
|
94
95
|
rack-test (0.6.1)
|
95
96
|
rack (>= 1.0)
|
96
|
-
rails (3.1.0
|
97
|
-
actionmailer (= 3.1.0
|
98
|
-
actionpack (= 3.1.0
|
99
|
-
activerecord (= 3.1.0
|
100
|
-
activeresource (= 3.1.0
|
101
|
-
activesupport (= 3.1.0
|
97
|
+
rails (3.1.0)
|
98
|
+
actionmailer (= 3.1.0)
|
99
|
+
actionpack (= 3.1.0)
|
100
|
+
activerecord (= 3.1.0)
|
101
|
+
activeresource (= 3.1.0)
|
102
|
+
activesupport (= 3.1.0)
|
102
103
|
bundler (~> 1.0)
|
103
|
-
railties (= 3.1.0
|
104
|
-
railties (3.1.0
|
105
|
-
actionpack (= 3.1.0
|
106
|
-
activesupport (= 3.1.0
|
104
|
+
railties (= 3.1.0)
|
105
|
+
railties (3.1.0)
|
106
|
+
actionpack (= 3.1.0)
|
107
|
+
activesupport (= 3.1.0)
|
107
108
|
rack-ssl (~> 1.3.2)
|
108
109
|
rake (>= 0.8.7)
|
109
110
|
rdoc (~> 3.4)
|
110
111
|
thor (~> 0.14.6)
|
111
112
|
rake (0.9.2)
|
112
|
-
rdoc (3.9)
|
113
|
+
rdoc (3.9.4)
|
113
114
|
rspec (2.6.0)
|
114
115
|
rspec-core (~> 2.6.0)
|
115
116
|
rspec-expectations (~> 2.6.0)
|
@@ -124,18 +125,19 @@ GEM
|
|
124
125
|
railties (~> 3.0)
|
125
126
|
rspec (~> 2.6.0)
|
126
127
|
rubyzip (0.9.4)
|
127
|
-
selenium-webdriver (
|
128
|
-
childprocess (>= 0.1
|
128
|
+
selenium-webdriver (2.5.0)
|
129
|
+
childprocess (>= 0.2.1)
|
129
130
|
ffi (>= 1.0.7)
|
130
131
|
json_pure
|
131
132
|
rubyzip
|
132
|
-
sprockets (2.0.0
|
133
|
+
sprockets (2.0.0)
|
133
134
|
hike (~> 1.2)
|
134
135
|
rack (~> 1.0)
|
135
136
|
tilt (~> 1.1, != 1.3.0)
|
137
|
+
spruz (0.2.13)
|
136
138
|
sqlite3 (1.3.4)
|
137
139
|
thor (0.14.6)
|
138
|
-
tilt (1.3.
|
140
|
+
tilt (1.3.3)
|
139
141
|
treetop (1.4.10)
|
140
142
|
polyglot
|
141
143
|
polyglot (>= 0.3.1)
|
@@ -158,6 +160,6 @@ DEPENDENCIES
|
|
158
160
|
kaminari
|
159
161
|
libnotify
|
160
162
|
nested_set
|
161
|
-
rails (
|
163
|
+
rails (~> 3.1.0)
|
162
164
|
rspec-rails
|
163
165
|
sqlite3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.24
|
@@ -1,5 +1,8 @@
|
|
1
|
-
//= require puffer/right
|
2
|
-
//= require puffer/right-
|
3
|
-
//= require puffer/right-
|
1
|
+
//= require puffer/right-src
|
2
|
+
//= require puffer/right-dialog-src
|
3
|
+
//= require puffer/right-slider-src
|
4
|
+
//= require puffer/right-calendar-src
|
5
|
+
//= require puffer/right-autocompleter-src
|
6
|
+
//= require puffer/paginator
|
4
7
|
//= require puffer/rails
|
5
8
|
//= require puffer/puffer
|
@@ -0,0 +1,223 @@
|
|
1
|
+
var Paginator = RightJS.Paginator = (function(document, Math, RightJS) {
|
2
|
+
|
3
|
+
/**
|
4
|
+
* This module defines the basic widgets constructor
|
5
|
+
* it creates an abstract proxy with the common functionality
|
6
|
+
* which then we reuse and override in the actual widgets
|
7
|
+
*
|
8
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
9
|
+
*/
|
10
|
+
|
11
|
+
/**
|
12
|
+
* The widget units constructor
|
13
|
+
*
|
14
|
+
* @param String tag-name or Object methods
|
15
|
+
* @param Object methods
|
16
|
+
* @return Widget wrapper
|
17
|
+
*/
|
18
|
+
function Widget(tag_name, methods) {
|
19
|
+
if (!methods) {
|
20
|
+
methods = tag_name;
|
21
|
+
tag_name = 'DIV';
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* An Abstract Widget Unit
|
26
|
+
*
|
27
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
28
|
+
*/
|
29
|
+
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
30
|
+
/**
|
31
|
+
* The common constructor
|
32
|
+
*
|
33
|
+
* @param Object options
|
34
|
+
* @param String optional tag name
|
35
|
+
* @return void
|
36
|
+
*/
|
37
|
+
initialize: function(key, options) {
|
38
|
+
this.key = key;
|
39
|
+
var args = [{'class': 'rui-' + key}];
|
40
|
+
|
41
|
+
// those two have different constructors
|
42
|
+
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
43
|
+
args.unshift(tag_name);
|
44
|
+
}
|
45
|
+
this.$super.apply(this, args);
|
46
|
+
|
47
|
+
if (RightJS.isString(options)) {
|
48
|
+
options = RightJS.$(options);
|
49
|
+
}
|
50
|
+
|
51
|
+
// if the options is another element then
|
52
|
+
// try to dynamically rewrap it with our widget
|
53
|
+
if (options instanceof RightJS.Element) {
|
54
|
+
this._ = options._;
|
55
|
+
if ('$listeners' in options) {
|
56
|
+
options.$listeners = options.$listeners;
|
57
|
+
}
|
58
|
+
options = {};
|
59
|
+
}
|
60
|
+
this.setOptions(options, this);
|
61
|
+
|
62
|
+
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
63
|
+
},
|
64
|
+
|
65
|
+
// protected
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Catches the options
|
69
|
+
*
|
70
|
+
* @param Object user-options
|
71
|
+
* @param Element element with contextual options
|
72
|
+
* @return void
|
73
|
+
*/
|
74
|
+
setOptions: function(options, element) {
|
75
|
+
if (element) {
|
76
|
+
options = RightJS.Object.merge(options, new Function("return "+(
|
77
|
+
element.get('data-'+ this.key) || '{}'
|
78
|
+
))());
|
79
|
+
}
|
80
|
+
|
81
|
+
if (options) {
|
82
|
+
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
83
|
+
}
|
84
|
+
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
});
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Creating the actual widget class
|
91
|
+
*
|
92
|
+
*/
|
93
|
+
var Klass = new RightJS.Class(AbstractWidget, methods);
|
94
|
+
|
95
|
+
// creating the widget related shortcuts
|
96
|
+
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
|
97
|
+
|
98
|
+
return Klass;
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
/**
|
103
|
+
* The filenames to include
|
104
|
+
*
|
105
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
106
|
+
*/
|
107
|
+
var R = RightJS,
|
108
|
+
$ = RightJS.$,
|
109
|
+
$$ = RightJS.$$,
|
110
|
+
$w = RightJS.$w,
|
111
|
+
$E = RightJS.$E,
|
112
|
+
$A = RightJS.$A,
|
113
|
+
isHash = RightJS.isHash,
|
114
|
+
Element = RightJS.Element;
|
115
|
+
|
116
|
+
|
117
|
+
var Paginator = new Widget({
|
118
|
+
extend: {
|
119
|
+
version: '2.2.3',
|
120
|
+
|
121
|
+
Options: {
|
122
|
+
total: 1,
|
123
|
+
current: 1,
|
124
|
+
link: ''
|
125
|
+
}
|
126
|
+
},
|
127
|
+
|
128
|
+
initialize: function() {
|
129
|
+
var args = $A(arguments).compact(), options = args.pop(), element = args.pop();
|
130
|
+
|
131
|
+
if (!isHash(options) || options instanceof Element) {
|
132
|
+
element = $(element || options);
|
133
|
+
options = {};
|
134
|
+
}
|
135
|
+
|
136
|
+
this.$super('paginator', element).setOptions(options);
|
137
|
+
|
138
|
+
this.sliderValue = (this.options.current - 1) * 100 / (this.options.total - 1)
|
139
|
+
this.append(
|
140
|
+
this.wrapper = new Element('div', {'class': 'rui-paginator-pages-wrapper'}).append(this.pages = new Paginator.Pages(this)),
|
141
|
+
this.slider = new Slider({round: 1})
|
142
|
+
);
|
143
|
+
this.slider.onChange(this.pages.redraw.bind(this.pages));
|
144
|
+
this.slider.setValue(this.sliderValue);
|
145
|
+
this.pages.redraw();
|
146
|
+
},
|
147
|
+
|
148
|
+
insertTo: function(element, position) {
|
149
|
+
this.$super(element, position);
|
150
|
+
this.slider.setValue(this.sliderValue);
|
151
|
+
this.pages.redraw();
|
152
|
+
return this;
|
153
|
+
}
|
154
|
+
});
|
155
|
+
|
156
|
+
Paginator.Pages = new Class(Element, {
|
157
|
+
initialize: function(paginator) {
|
158
|
+
this.paginator = paginator;
|
159
|
+
this.options = paginator.options;
|
160
|
+
|
161
|
+
this.$super('ul', {'class': 'rui-paginator-pages'});
|
162
|
+
},
|
163
|
+
|
164
|
+
redraw: function(event) {
|
165
|
+
var value = this.paginator.slider.getValue();
|
166
|
+
var current_page = (value * (this.options.total - 1) / 100).round() + 1;
|
167
|
+
|
168
|
+
this.clean();
|
169
|
+
var page = new Paginator.Page(this.paginator, current_page);
|
170
|
+
this.append(page);
|
171
|
+
|
172
|
+
var width = this.paginator.wrapper.dimensions().width;
|
173
|
+
var page_width = page.dimensions().width;
|
174
|
+
var pages_width = width - page_width/2;
|
175
|
+
var track_point = value * pages_width / 100;
|
176
|
+
|
177
|
+
var i = current_page - 1;
|
178
|
+
while (i > 0 && this.dimensions().width < track_point) {
|
179
|
+
this.insert(new Paginator.Page(this.paginator, i), 'top');
|
180
|
+
i--;
|
181
|
+
}
|
182
|
+
|
183
|
+
var i = current_page + 1;
|
184
|
+
while (i <= this.options.total && this.dimensions().width < pages_width) {
|
185
|
+
this.append(new Paginator.Page(this.paginator, i));
|
186
|
+
i++;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
});
|
190
|
+
|
191
|
+
Paginator.Page = new Class(Element, {
|
192
|
+
initialize: function(paginator, page) {
|
193
|
+
this.paginator = paginator;
|
194
|
+
this.options = paginator.options;
|
195
|
+
|
196
|
+
this.$super('li');
|
197
|
+
|
198
|
+
if (this.options.current == page) {
|
199
|
+
this.setClass('current');
|
200
|
+
this.insert(new Element('span').update(page));
|
201
|
+
} else {
|
202
|
+
var link = {'href': '#'}
|
203
|
+
RightJS.Object.each(this.options.link, function(key, value) {
|
204
|
+
link[key] = value.replace('%{page}', page).replace('%25%7Bpage%7D', page);
|
205
|
+
});
|
206
|
+
|
207
|
+
this.insert(new Element('a', link).update(page));
|
208
|
+
}
|
209
|
+
}
|
210
|
+
});
|
211
|
+
|
212
|
+
$(document).on({
|
213
|
+
ready: function() {
|
214
|
+
$$('.rui-paginator').each(function(element) {
|
215
|
+
if (!(element instanceof Paginator)) {
|
216
|
+
element = new Paginator(element);
|
217
|
+
}
|
218
|
+
});
|
219
|
+
}
|
220
|
+
});
|
221
|
+
|
222
|
+
return Paginator;
|
223
|
+
})(document, Math, RightJS);
|
@@ -8,3 +8,15 @@ var association_done = function(event) {
|
|
8
8
|
this.prev('input[type=text]').value('').enable();
|
9
9
|
this.next('input[type=hidden]').value('');
|
10
10
|
});
|
11
|
+
|
12
|
+
'a[data-dialog-uri]'.on('click', function(event) {
|
13
|
+
if (event.which != 1) return;
|
14
|
+
event.stop();
|
15
|
+
|
16
|
+
var dialog = event.find('.rui-dialog');
|
17
|
+
if (!dialog || !(dialog instanceof Dialog)) {
|
18
|
+
dialog = new Dialog({expandable: true});
|
19
|
+
}
|
20
|
+
|
21
|
+
dialog.load(this.get('data-dialog-uri'));
|
22
|
+
});
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/**
|
2
|
-
* RightJS-UI
|
2
|
+
* RightJS-UI Autocompleter v2.2.1
|
3
3
|
* http://rightjs.org/ui/autocompleter
|
4
4
|
*
|
5
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
5
|
+
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
6
6
|
*/
|
7
7
|
var Autocompleter = RightJS.Autocompleter = (function(document, RightJS) {
|
8
8
|
/**
|
@@ -13,26 +13,6 @@ var Autocompleter = RightJS.Autocompleter = (function(document, RightJS) {
|
|
13
13
|
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
14
14
|
*/
|
15
15
|
|
16
|
-
/**
|
17
|
-
* Autocompleter initializer
|
18
|
-
*
|
19
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
20
|
-
*/
|
21
|
-
var R = RightJS,
|
22
|
-
$ = RightJS.$,
|
23
|
-
$w = RightJS.$w,
|
24
|
-
$E = RightJS.$E,
|
25
|
-
Xhr = RightJS.Xhr,
|
26
|
-
RegExp = RightJS.RegExp,
|
27
|
-
isArray = RightJS.isArray;
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
16
|
/**
|
37
17
|
* The widget units constructor
|
38
18
|
*
|
@@ -97,12 +77,16 @@ function Widget(tag_name, methods) {
|
|
97
77
|
* @return void
|
98
78
|
*/
|
99
79
|
setOptions: function(options, element) {
|
100
|
-
|
101
|
-
|
102
|
-
RightJS.Object.merge(options, eval("("+(
|
80
|
+
if (element) {
|
81
|
+
options = RightJS.Object.merge(options, new Function("return "+(
|
103
82
|
element.get('data-'+ this.key) || '{}'
|
104
|
-
)
|
105
|
-
|
83
|
+
))());
|
84
|
+
}
|
85
|
+
|
86
|
+
if (options) {
|
87
|
+
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
88
|
+
}
|
89
|
+
|
106
90
|
return this;
|
107
91
|
}
|
108
92
|
});
|
@@ -114,7 +98,7 @@ function Widget(tag_name, methods) {
|
|
114
98
|
var Klass = new RightJS.Class(AbstractWidget, methods);
|
115
99
|
|
116
100
|
// creating the widget related shortcuts
|
117
|
-
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
|
101
|
+
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
|
118
102
|
|
119
103
|
return Klass;
|
120
104
|
}
|
@@ -309,6 +293,26 @@ function Toggler_re_position(element, where, resize) {
|
|
309
293
|
target.setStyle('visibility:visible').hide(null);
|
310
294
|
}
|
311
295
|
|
296
|
+
/**
|
297
|
+
* Autocompleter initializer
|
298
|
+
*
|
299
|
+
* Copyright (C) 2010 Nikolay Nemshilov
|
300
|
+
*/
|
301
|
+
var R = RightJS,
|
302
|
+
$ = RightJS.$,
|
303
|
+
$w = RightJS.$w,
|
304
|
+
$E = RightJS.$E,
|
305
|
+
Xhr = RightJS.Xhr,
|
306
|
+
RegExp = RightJS.RegExp,
|
307
|
+
isArray = RightJS.isArray;
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
312
316
|
/**
|
313
317
|
* The RightJS UI Autocompleter unit base class
|
314
318
|
*
|
@@ -318,7 +322,7 @@ var Autocompleter = new Widget('UL', {
|
|
318
322
|
include: Toggler,
|
319
323
|
|
320
324
|
extend: {
|
321
|
-
version: '2.2.
|
325
|
+
version: '2.2.1',
|
322
326
|
|
323
327
|
EVENTS: $w('show hide update load select done'),
|
324
328
|
|
@@ -397,7 +401,7 @@ var Autocompleter = new Widget('UL', {
|
|
397
401
|
|
398
402
|
if (current) {
|
399
403
|
current.radioClass('current');
|
400
|
-
this.input.setValue(
|
404
|
+
this.input.setValue(current._.textContent || current._.innerText);
|
401
405
|
this.fire('done');
|
402
406
|
}
|
403
407
|
|
@@ -602,20 +606,20 @@ $(document).on({
|
|
602
606
|
}
|
603
607
|
}
|
604
608
|
});
|
605
|
-
(function() {
|
606
|
-
var style = document.createElement('style'),
|
607
|
-
rules = document.createTextNode(" *.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}");
|
608
609
|
|
609
|
-
style.type = 'text/css';
|
610
610
|
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
611
|
+
var embed_style = document.createElement('style'),
|
612
|
+
embed_rules = document.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}");
|
613
|
+
|
614
|
+
embed_style.type = 'text/css';
|
615
|
+
document.getElementsByTagName('head')[0].appendChild(embed_style);
|
616
|
+
|
617
|
+
if(embed_style.styleSheet) {
|
618
|
+
embed_style.styleSheet.cssText = embed_rules.nodeValue;
|
619
|
+
} else {
|
620
|
+
embed_style.appendChild(embed_rules);
|
621
|
+
}
|
616
622
|
|
617
|
-
document.getElementsByTagName('head')[0].appendChild(style);
|
618
|
-
})();
|
619
623
|
|
620
624
|
return Autocompleter;
|
621
625
|
})(document, RightJS);
|