puffer_pages 0.0.17 → 0.0.18

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puffer_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,23 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-01 00:00:00.000000000 +04:00
13
- default_executable:
12
+ date: 2011-09-09 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
- requirement: &20295440 !ruby/object:Gem::Requirement
16
+ requirement: &21147960 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
- - - ! '>='
19
+ - - ~>
21
20
  - !ruby/object:Gem::Version
22
- version: 3.1.0.rc5
21
+ version: 3.1.0
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *20295440
24
+ version_requirements: *21147960
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: puffer
28
- requirement: &20294700 !ruby/object:Gem::Requirement
27
+ requirement: &21146840 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *20294700
35
+ version_requirements: *21146840
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: liquid
39
- requirement: &20294040 !ruby/object:Gem::Requirement
38
+ requirement: &21145940 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,10 +43,10 @@ dependencies:
44
43
  version: '0'
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *20294040
46
+ version_requirements: *21145940
48
47
  - !ruby/object:Gem::Dependency
49
48
  name: nested_set
50
- requirement: &20293180 !ruby/object:Gem::Requirement
49
+ requirement: &21144900 !ruby/object:Gem::Requirement
51
50
  none: false
52
51
  requirements:
53
52
  - - ! '>='
@@ -55,10 +54,10 @@ dependencies:
55
54
  version: '0'
56
55
  type: :runtime
57
56
  prerelease: false
58
- version_requirements: *20293180
57
+ version_requirements: *21144900
59
58
  - !ruby/object:Gem::Dependency
60
59
  name: sqlite3-ruby
61
- requirement: &20292440 !ruby/object:Gem::Requirement
60
+ requirement: &21144000 !ruby/object:Gem::Requirement
62
61
  none: false
63
62
  requirements:
64
63
  - - ! '>='
@@ -66,10 +65,10 @@ dependencies:
66
65
  version: '0'
67
66
  type: :development
68
67
  prerelease: false
69
- version_requirements: *20292440
68
+ version_requirements: *21144000
70
69
  - !ruby/object:Gem::Dependency
71
70
  name: pg
72
- requirement: &20291740 !ruby/object:Gem::Requirement
71
+ requirement: &21142840 !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
74
  - - ! '>='
@@ -77,10 +76,10 @@ dependencies:
77
76
  version: '0'
78
77
  type: :development
79
78
  prerelease: false
80
- version_requirements: *20291740
79
+ version_requirements: *21142840
81
80
  - !ruby/object:Gem::Dependency
82
81
  name: mysql
83
- requirement: &20290900 !ruby/object:Gem::Requirement
82
+ requirement: &19229200 !ruby/object:Gem::Requirement
84
83
  none: false
85
84
  requirements:
86
85
  - - ! '>='
@@ -88,10 +87,10 @@ dependencies:
88
87
  version: '0'
89
88
  type: :development
90
89
  prerelease: false
91
- version_requirements: *20290900
90
+ version_requirements: *19229200
92
91
  - !ruby/object:Gem::Dependency
93
92
  name: rspec-rails
94
- requirement: &20290320 !ruby/object:Gem::Requirement
93
+ requirement: &19221700 !ruby/object:Gem::Requirement
95
94
  none: false
96
95
  requirements:
97
96
  - - ! '>='
@@ -99,10 +98,10 @@ dependencies:
99
98
  version: '0'
100
99
  type: :development
101
100
  prerelease: false
102
- version_requirements: *20290320
101
+ version_requirements: *19221700
103
102
  - !ruby/object:Gem::Dependency
104
103
  name: capybara
105
- requirement: &20289720 !ruby/object:Gem::Requirement
104
+ requirement: &19218260 !ruby/object:Gem::Requirement
106
105
  none: false
107
106
  requirements:
108
107
  - - ! '>='
@@ -110,10 +109,10 @@ dependencies:
110
109
  version: 0.4.0
111
110
  type: :development
112
111
  prerelease: false
113
- version_requirements: *20289720
112
+ version_requirements: *19218260
114
113
  - !ruby/object:Gem::Dependency
115
114
  name: database_cleaner
116
- requirement: &20288880 !ruby/object:Gem::Requirement
115
+ requirement: &19197020 !ruby/object:Gem::Requirement
117
116
  none: false
118
117
  requirements:
119
118
  - - ! '>='
@@ -121,10 +120,10 @@ dependencies:
121
120
  version: '0'
122
121
  type: :development
123
122
  prerelease: false
124
- version_requirements: *20288880
123
+ version_requirements: *19197020
125
124
  - !ruby/object:Gem::Dependency
126
125
  name: guard
127
- requirement: &20275980 !ruby/object:Gem::Requirement
126
+ requirement: &19192240 !ruby/object:Gem::Requirement
128
127
  none: false
129
128
  requirements:
130
129
  - - ! '>='
@@ -132,10 +131,10 @@ dependencies:
132
131
  version: '0'
133
132
  type: :development
134
133
  prerelease: false
135
- version_requirements: *20275980
134
+ version_requirements: *19192240
136
135
  - !ruby/object:Gem::Dependency
137
136
  name: libnotify
138
- requirement: &20275340 !ruby/object:Gem::Requirement
137
+ requirement: &19189500 !ruby/object:Gem::Requirement
139
138
  none: false
140
139
  requirements:
141
140
  - - ! '>='
@@ -143,10 +142,10 @@ dependencies:
143
142
  version: '0'
144
143
  type: :development
145
144
  prerelease: false
146
- version_requirements: *20275340
145
+ version_requirements: *19189500
147
146
  - !ruby/object:Gem::Dependency
148
147
  name: guard-rspec
149
- requirement: &20274620 !ruby/object:Gem::Requirement
148
+ requirement: &19186120 !ruby/object:Gem::Requirement
150
149
  none: false
151
150
  requirements:
152
151
  - - ! '>='
@@ -154,10 +153,10 @@ dependencies:
154
153
  version: '0'
155
154
  type: :development
156
155
  prerelease: false
157
- version_requirements: *20274620
156
+ version_requirements: *19186120
158
157
  - !ruby/object:Gem::Dependency
159
158
  name: forgery
160
- requirement: &20273900 !ruby/object:Gem::Requirement
159
+ requirement: &19181780 !ruby/object:Gem::Requirement
161
160
  none: false
162
161
  requirements:
163
162
  - - ! '>='
@@ -165,10 +164,10 @@ dependencies:
165
164
  version: '0'
166
165
  type: :development
167
166
  prerelease: false
168
- version_requirements: *20273900
167
+ version_requirements: *19181780
169
168
  - !ruby/object:Gem::Dependency
170
169
  name: fabrication
171
- requirement: &20272960 !ruby/object:Gem::Requirement
170
+ requirement: &19176340 !ruby/object:Gem::Requirement
172
171
  none: false
173
172
  requirements:
174
173
  - - ! '>='
@@ -176,10 +175,10 @@ dependencies:
176
175
  version: '0'
177
176
  type: :development
178
177
  prerelease: false
179
- version_requirements: *20272960
178
+ version_requirements: *19176340
180
179
  - !ruby/object:Gem::Dependency
181
180
  name: jeweler
182
- requirement: &20272160 !ruby/object:Gem::Requirement
181
+ requirement: &19170480 !ruby/object:Gem::Requirement
183
182
  none: false
184
183
  requirements:
185
184
  - - ! '>='
@@ -187,7 +186,7 @@ dependencies:
187
186
  version: '0'
188
187
  type: :development
189
188
  prerelease: false
190
- version_requirements: *20272160
189
+ version_requirements: *19170480
191
190
  description: Puffer pages is integratable rails CMS with puffer admin interface
192
191
  email: kinwizard@gmail.com
193
192
  executables: []
@@ -208,11 +207,14 @@ files:
208
207
  - app/assets/javascripts/puffer_pages/codemirror-parser.js
209
208
  - app/assets/javascripts/puffer_pages/codemirror.js
210
209
  - app/assets/javascripts/puffer_pages/puffer_pages.js
211
- - app/assets/javascripts/puffer_pages/right-dialog.js
212
- - app/assets/javascripts/puffer_pages/right-tabs.js
210
+ - app/assets/javascripts/puffer_pages/right-tabs-src.js
213
211
  - app/assets/stylesheets/puffer_pages/application.css
214
212
  - app/assets/stylesheets/puffer_pages/codemirror.css
215
213
  - app/assets/stylesheets/puffer_pages/puffer_pages.css
214
+ - app/components/page_part_body/form.html.erb
215
+ - app/components/page_part_body_component.rb
216
+ - app/components/page_parts/form.html.erb
217
+ - app/components/page_parts_component.rb
216
218
  - app/controllers/admin/layouts_controller.rb
217
219
  - app/controllers/admin/pages_controller.rb
218
220
  - app/controllers/admin/snippets_controller.rb
@@ -230,8 +232,6 @@ files:
230
232
  - app/models/puffer_pages/snippet.rb
231
233
  - app/models/snippet.rb
232
234
  - app/views/layouts/puffer_pages.html.erb
233
- - app/views/puffer_pages/pages_base/_page_part_builder.html.erb
234
- - app/views/puffer_pages/pages_base/_page_parts.html.erb
235
235
  - app/views/puffer_pages/pages_base/_tree_page.html.erb
236
236
  - config/locales/en.yml
237
237
  - config/puffer_routes.rb
@@ -239,8 +239,6 @@ files:
239
239
  - db/migrate/20090504132337_create_page_parts.rb
240
240
  - db/migrate/20090506102004_create_layouts.rb
241
241
  - db/migrate/20090510121824_create_snippets.rb
242
- - lib/puffer/inputs/page_parts.rb
243
- - lib/puffer/inputs/page_parts_body.rb
244
242
  - lib/puffer_pages.rb
245
243
  - lib/puffer_pages/engine.rb
246
244
  - lib/puffer_pages/extensions/core.rb
@@ -300,7 +298,6 @@ files:
300
298
  - spec/models/page_spec.rb
301
299
  - spec/puffer_pages_spec.rb
302
300
  - spec/spec_helper.rb
303
- has_rdoc: true
304
301
  homepage: http://github.com/puffer/puffer_pages
305
302
  licenses: []
306
303
  post_install_message:
@@ -315,7 +312,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
315
312
  version: '0'
316
313
  segments:
317
314
  - 0
318
- hash: -302463699033257374
315
+ hash: 1478367954881148837
319
316
  required_rubygems_version: !ruby/object:Gem::Requirement
320
317
  none: false
321
318
  requirements:
@@ -324,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
321
  version: '0'
325
322
  requirements: []
326
323
  rubyforge_project:
327
- rubygems_version: 1.6.2
324
+ rubygems_version: 1.8.6
328
325
  signing_key:
329
326
  specification_version: 3
330
327
  summary: Content management system
@@ -1,764 +0,0 @@
1
- /**
2
- * Standard dialog widget for RightJS
3
- * http://rightjs.org/ui/dialog
4
- *
5
- * Copyright (C) 2010 Nikolay Nemshilov
6
- */
7
- var Dialog = RightJS.Dialog = (function(RightJS) {
8
- /**
9
- * This module defines the basic widgets constructor
10
- * it creates an abstract proxy with the common functionality
11
- * which then we reuse and override in the actual widgets
12
- *
13
- * Copyright (C) 2010-2011 Nikolay Nemshilov
14
- */
15
-
16
- /**
17
- * Dialog widget initialization script
18
- *
19
- * Copyright (C) 2010 Nikolay Nemshilov
20
- */
21
- var R = RightJS,
22
- $ = RightJS.$,
23
- $w = RightJS.$w,
24
- $E = RightJS.$E,
25
- Class = RightJS.Class,
26
- Object = RightJS.Object,
27
- Element = RightJS.Element;
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
- /**
36
- * The widget units constructor
37
- *
38
- * @param String tag-name or Object methods
39
- * @param Object methods
40
- * @return Widget wrapper
41
- */
42
- function Widget(tag_name, methods) {
43
- if (!methods) {
44
- methods = tag_name;
45
- tag_name = 'DIV';
46
- }
47
-
48
- /**
49
- * An Abstract Widget Unit
50
- *
51
- * Copyright (C) 2010 Nikolay Nemshilov
52
- */
53
- var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
54
- /**
55
- * The common constructor
56
- *
57
- * @param Object options
58
- * @param String optional tag name
59
- * @return void
60
- */
61
- initialize: function(key, options) {
62
- this.key = key;
63
- var args = [{'class': 'rui-' + key}];
64
-
65
- // those two have different constructors
66
- if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
67
- args.unshift(tag_name);
68
- }
69
- this.$super.apply(this, args);
70
-
71
- if (RightJS.isString(options)) {
72
- options = RightJS.$(options);
73
- }
74
-
75
- // if the options is another element then
76
- // try to dynamically rewrap it with our widget
77
- if (options instanceof RightJS.Element) {
78
- this._ = options._;
79
- if ('$listeners' in options) {
80
- options.$listeners = options.$listeners;
81
- }
82
- options = {};
83
- }
84
- this.setOptions(options, this);
85
-
86
- return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
87
- },
88
-
89
- // protected
90
-
91
- /**
92
- * Catches the options
93
- *
94
- * @param Object user-options
95
- * @param Element element with contextual options
96
- * @return void
97
- */
98
- setOptions: function(options, element) {
99
- element = element || this;
100
- RightJS.Options.setOptions.call(this,
101
- RightJS.Object.merge(options, eval("("+(
102
- element.get('data-'+ this.key) || '{}'
103
- )+")"))
104
- );
105
- return this;
106
- }
107
- });
108
-
109
- /**
110
- * Creating the actual widget class
111
- *
112
- */
113
- var Klass = new RightJS.Class(AbstractWidget, methods);
114
-
115
- // creating the widget related shortcuts
116
- RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
117
-
118
- return Klass;
119
- }
120
-
121
-
122
- /**
123
- * A shared button unit.
124
- * NOTE: we use the DIV units instead of INPUTS
125
- * so those buttons didn't interfere with
126
- * the user's tab-index on his page
127
- *
128
- * Copyright (C) 2010-2011 Nikolay Nemshilov
129
- */
130
- var Button = new RightJS.Class(RightJS.Element, {
131
- /**
132
- * Constructor
133
- *
134
- * @param String caption
135
- * @param Object options
136
- * @return void
137
- */
138
- initialize: function(caption, options) {
139
- this.$super('div', options);
140
- this._.innerHTML = caption;
141
- this.addClass('rui-button');
142
- this.on('selectstart', 'stopEvent');
143
- },
144
-
145
- /**
146
- * Disasbles the button
147
- *
148
- * @return Button this
149
- */
150
- disable: function() {
151
- return this.addClass('rui-button-disabled');
152
- },
153
-
154
- /**
155
- * Enables the button
156
- *
157
- * @return Button this
158
- */
159
- enable: function() {
160
- return this.removeClass('rui-button-disabled');
161
- },
162
-
163
- /**
164
- * Checks if the button is disabled
165
- *
166
- * @return Button this
167
- */
168
- disabled: function() {
169
- return this.hasClass('rui-button-disabled');
170
- },
171
-
172
- /**
173
- * Checks if the button is enabled
174
- *
175
- * @return Button this
176
- */
177
- enabled: function() {
178
- return !this.disabled();
179
- },
180
-
181
- /**
182
- * Overloading the method, so it fired the events
183
- * only when the button is active
184
- *
185
- * @return Button this
186
- */
187
- fire: function() {
188
- if (this.enabled()) {
189
- this.$super.apply(this, arguments);
190
- }
191
- return this;
192
- }
193
- });
194
-
195
-
196
- /**
197
- * A shared module to create textual spinners
198
- *
199
- * Copyright (C) 2010-2011 Nikolay Nemshilov
200
- */
201
- var Spinner = new RightJS.Class(RightJS.Element, {
202
- /**
203
- * Constructor
204
- *
205
- * @param Number optional spinner size (4 by default)
206
- * @return void
207
- */
208
- initialize: function(size) {
209
- this.$super('div', {'class': 'rui-spinner'});
210
- this.dots = [];
211
-
212
- for (var i=0; i < (size || 4); i++) {
213
- this.dots.push(new RightJS.Element('div'));
214
- }
215
-
216
- this.dots[0].addClass('glowing');
217
- this.insert(this.dots);
218
- RightJS(this.shift).bind(this).periodical(300);
219
- },
220
-
221
- /**
222
- * Shifts the spinner elements
223
- *
224
- * @return void
225
- */
226
- shift: function() {
227
- if (this.visible()) {
228
- var dot = this.dots.pop();
229
- this.dots.unshift(dot);
230
- this.insert(dot, 'top');
231
- }
232
- }
233
- });
234
-
235
-
236
- /**
237
- * Basic dialog class
238
- *
239
- * Copyright (C) 2010-2011 Nikolay Nemshilov
240
- */
241
- var Dialog = new Widget({
242
- extend: {
243
- version: '2.2.0',
244
-
245
- EVENTS: $w('ok cancel help expand collapse resize load'),
246
-
247
- Options: {
248
- lockScreen: true, // if you need to lock the scrreen
249
- fxDuration: 'short', // dialog appearance duration
250
-
251
- draggable: true, // sets if the user should be able to drag the dialog around
252
- closeable: true, // allow the user to close the dialog
253
- expandable: false, // show the user to expand/collapse the dialog window width
254
-
255
- showHelp: false, // show the 'Help' button
256
- showIcon: null, // null or some text to be show in the dialog body icon
257
-
258
- title: null, // default title to preset
259
- html: null, // html content to set on instance
260
- url: null // url address that should be loaded on instance
261
- },
262
-
263
- i18n: {
264
- Ok: 'Ok',
265
- Close: 'Close',
266
- Cancel: 'Cancel',
267
- Help: 'Help',
268
- Expand: 'Expand',
269
- Collapse: 'Collapse',
270
-
271
- Alert: 'Warning!',
272
- Confirm: 'Confirm',
273
- Prompt: 'Enter'
274
- },
275
-
276
- current: false, // the current dialog reference
277
- dragged: false // currently dragged dialog reference
278
- },
279
-
280
- /**
281
- * Basic constructor
282
- *
283
- * @param Object options
284
- * @return void
285
- */
286
- initialize: function(options) {
287
- this
288
- .$super('dialog', options)
289
- .append(
290
- this.head = new Dialog.Head(this),
291
- this.body = new Dialog.Body(this),
292
- this.foot = new Dialog.Foot(this)
293
- )
294
- .onCancel(this.hide);
295
-
296
- this.locker = $E('div', {'class': 'rui-screen-locker'});
297
-
298
- if (this.options.title) {
299
- this.title(this.options.title);
300
- }
301
-
302
- if (this.options.html) {
303
- this.html(this.options.html);
304
- }
305
-
306
- if (this.options.url) {
307
- this.load(this.options.url);
308
- }
309
- },
310
-
311
- /**
312
- * Shows the dialog
313
- *
314
- * @return Dialog this
315
- */
316
- show: function() {
317
- if (this.options.lockScreen) {
318
- this.locker.insertTo(document.body);
319
- }
320
-
321
- this
322
- .setStyle('visibility:hidden')
323
- .insertTo(document.body)
324
- .resize()
325
- .setStyle('visibility:visible;opacity:0');
326
-
327
- if (this.options.fxDuration) {
328
- this.morph({opacity: 1}, {
329
- duration: this.options.fxDuration
330
- });
331
- } else {
332
- this.setStyle('opacity:1');
333
- }
334
-
335
- return (Dialog.current = this);
336
- },
337
-
338
- /**
339
- * Hides the dialog
340
- *
341
- * @return Dialog this
342
- */
343
- hide: function() {
344
- this.locker.remove();
345
- this.remove();
346
-
347
- Dialog.current = false;
348
-
349
- return this;
350
- },
351
-
352
- /**
353
- * Repositions the dialog to the middle of the screen
354
- *
355
- * @param normal arguments
356
- * @return Dialog this
357
- */
358
- resize: function() {
359
- if (arguments.length) {
360
- this.$super.apply(this, arguments);
361
- }
362
-
363
- var size = this.size(), win_size = $(window).size();
364
-
365
- if (this.expanded) {
366
- size.x = win_size.x - 20;
367
- size.y = win_size.y - 10;
368
- this.$super.call(this, size);
369
- }
370
-
371
- this.setStyle({
372
- top: (win_size.y - size.y)/2 + $(window).scrolls().y + 'px',
373
- left: (win_size.x - size.x - 16)/2 + 'px'
374
- });
375
-
376
- return this.fire('resize');
377
- },
378
-
379
- /**
380
- * Bidirectional method to work with titles
381
- *
382
- * @param String title to set
383
- * @return String title or Dialog this
384
- */
385
- title: function(text) {
386
- if (arguments.length) {
387
- this.head.title.html(text);
388
- return this;
389
- } else {
390
- return this.head.title.html();
391
- }
392
- },
393
-
394
- /**
395
- * Overloading the standard method, so that
396
- * all the content updates were going into the body element
397
- *
398
- * @param mixed content
399
- * @return Dialog this
400
- */
401
- update: function(content) {
402
- this.body.update(content);
403
- return this.resize();
404
- },
405
-
406
- /**
407
- * Redirecting the `html` method to work wiht the body html
408
- *
409
- * @param mixed content
410
- * @return Dialog this or html content of the body
411
- */
412
- html: function() {
413
- return arguments.length ?
414
- this.$super.apply(this, arguments) :
415
- this.body.html();
416
- },
417
-
418
- /**
419
- * Overloading the original method to bypass things into the body object
420
- *
421
- * @param String url
422
- * @param Object options
423
- * @return Dialog this
424
- */
425
- load: function(url, options) {
426
- this.show();
427
- this.body.load(url, options);
428
- return this;
429
- },
430
-
431
- /**
432
- * Expands a dialog screen-wide
433
- *
434
- * @return Dialog this
435
- */
436
- expand: function() {
437
- if (!this.expanded) {
438
- this._prevSize = this.size();
439
- this.resize({
440
- x: $(window).size().x - 20,
441
- y: $(window).size().y - 10
442
- });
443
-
444
- this.expanded = true;
445
- this.fire('expand');
446
- }
447
-
448
- return this;
449
- },
450
-
451
- /**
452
- * Collapses an expanded dialog to it's previous size
453
- *
454
- * @return Dialog this
455
- */
456
- collapse: function() {
457
- if (this.expanded) {
458
- this.expanded = false;
459
- this.resize(this._prevSize);
460
- this.fire('collapse');
461
- }
462
-
463
- return this;
464
- }
465
- });
466
-
467
- /**
468
- * Dialog header line element
469
- *
470
- * Copyright (C) 2010 Nikolay Nemshilov
471
- */
472
- Dialog.Head = new Class(Element, {
473
-
474
- initialize: function(dialog) {
475
- this.dialog = dialog;
476
- this.options = dialog.options;
477
-
478
- this.$super('div', {'class': 'rui-dialog-head'});
479
-
480
- this.append(
481
- this.icon = $E('div', {'class': 'icon'}),
482
- this.title = $E('div', {'class': 'title', 'html': '&nbsp;'}),
483
- this.tools = $E('div', {'class': 'tools'})
484
- );
485
-
486
- this.fsButton = $E('div', {
487
- 'class': 'expand', 'html': '&equiv;', 'title': Dialog.i18n.Expand
488
- }).onClick(function() {
489
- if (dialog.expanded) {
490
- dialog.collapse();
491
- this.html('&equiv;').set('title', Dialog.i18n.Expand);
492
- } else {
493
- dialog.expand();
494
- this.html('_').set('title', Dialog.i18n.Collapse);
495
- }
496
- });
497
-
498
- this.closeButton = $E('div', {
499
- 'class': 'close', 'html': '&times;', 'title': Dialog.i18n.Close
500
- }).onClick(function() { dialog.fire('cancel'); });
501
-
502
- if (this.options.expandable) {
503
- this.tools.insert(this.fsButton);
504
- }
505
-
506
- if (this.options.closeable) {
507
- this.tools.insert(this.closeButton);
508
- }
509
-
510
- this.on({
511
- selectstart: function(e) { e.stop(); },
512
- mousedown: this.dragStart
513
- });
514
-
515
- if (!this.options.draggable) {
516
- this.dialog.addClass('rui-dialog-nodrag');
517
- }
518
- },
519
-
520
- // protected
521
-
522
- dragStart: function(event) {
523
- if (this.options.draggable && !event.find('div.tools div')) {
524
- var dim = this.dialog.dimensions(),
525
- ev_pos = event.position();
526
-
527
- this.xDiff = dim.left - ev_pos.x;
528
- this.yDiff = dim.top - ev_pos.y;
529
- this.maxX = $(window).size().x - dim.width - 20;
530
- this.dlgStyle = this.dialog.get('style');
531
-
532
- Dialog.dragged = this.dialog;
533
-
534
- event.stop();
535
- }
536
- },
537
-
538
- dragMove: function(event) {
539
- var event_pos = event.position(),
540
- pos_x = event_pos.x + this.xDiff,
541
- pos_y = event_pos.y + this.yDiff;
542
-
543
- if (pos_x < 0) { pos_x = 0; }
544
- else if (pos_x > this.maxX) { pos_x = this.maxX; }
545
- if (pos_y < 0) { pos_y = 0; }
546
-
547
- this.dlgStyle.top = pos_y + 'px';
548
- this.dlgStyle.left = pos_x + 'px';
549
- },
550
-
551
- dragStop: function(event) {
552
- Dialog.dragged = false;
553
- }
554
- });
555
-
556
- /**
557
- * Dialog body element
558
- *
559
- * Copyright (C) 2010 Nikolay Nemshilov
560
- */
561
- Dialog.Body = new Class(Element, {
562
-
563
- initialize: function(dialog) {
564
- this.dialog = dialog;
565
- this.options = dialog.options;
566
-
567
- this.$super('div', {'class': 'rui-dialog-body'});
568
- this.locker = $E('div', {'class': 'rui-dialog-body-locker'})
569
- .insert(new Spinner());
570
- },
571
-
572
- load: function(url, options) {
573
- this.insert(this.locker, 'top');
574
-
575
- this.xhr = new Xhr(url, Object.merge({method:'get'}, options))
576
- .onComplete(R(function(r) {
577
- this.update(r.text);
578
- this.dialog.resize().fire('load');
579
- }).bind(this))
580
- .send();
581
-
582
- return this;
583
- },
584
-
585
- update: function(content) {
586
- this.$super(content);
587
-
588
- if (this.options.showIcon) {
589
- this.insert('<div class="rui-dialog-body-icon">'+ this.options.showIcon + '</div>', 'top');
590
- }
591
-
592
- return this;
593
- }
594
-
595
- });
596
-
597
- /**
598
- * Dialog footer line element
599
- *
600
- * Copyright (C) 2010 Nikolay Nemshilov
601
- */
602
- Dialog.Foot = new Class(Element, {
603
-
604
- initialize: function(dialog) {
605
- this.$super('div', {'class': 'rui-dialog-foot'});
606
-
607
- this.dialog = dialog;
608
-
609
- dialog.okButton = new Button(Dialog.i18n.Ok, {'class': 'ok'}).onClick(function() { dialog.fire('ok'); });
610
- dialog.helpButton = new Button(Dialog.i18n.Help, {'class': 'help'}).onClick(function() { dialog.fire('help'); });
611
- dialog.cancelButton = new Button(Dialog.i18n.Cancel, {'class': 'cancel'}).onClick(function() { dialog.fire('cancel'); });
612
-
613
- if (dialog.options.showHelp) {
614
- this.insert(dialog.helpButton);
615
- }
616
-
617
- if (dialog.options.closeable) {
618
- this.insert(dialog.cancelButton);
619
- }
620
-
621
- this.insert(dialog.okButton);
622
- }
623
-
624
- });
625
-
626
- /**
627
- * Alert specific dialog
628
- *
629
- * Copyright (C) 2010 Nikolay Nemshilov
630
- */
631
- Dialog.Alert = new Class(Dialog, {
632
-
633
- initialize: function(options) {
634
- options = Object.merge({
635
- showIcon: '!',
636
- title: Dialog.i18n.Alert
637
- }, options);
638
-
639
- this.$super(options);
640
- this.addClass('rui-dialog-alert');
641
- this.on('ok', 'hide');
642
- }
643
- });
644
-
645
- /**
646
- * Confirm specific dialog
647
- *
648
- * Copyright (C) 2010 Nikolay Nemshilov
649
- */
650
- Dialog.Confirm = new Class(Dialog, {
651
-
652
- initialize: function(options) {
653
- options = Object.merge({
654
- showIcon: '?',
655
- title: Dialog.i18n.Confirm
656
- }, options);
657
-
658
- this.$super(options);
659
- this.addClass('rui-dialog-confirm');
660
- this.on('ok', 'hide');
661
- }
662
-
663
- });
664
-
665
- /**
666
- * The prompt dialog class
667
- *
668
- * Copyright (C) 2010 Nikolay Nemshilov
669
- */
670
- Dialog.Prompt = new Class(Dialog, {
671
- /**
672
- * prompts constructor, you can use additional options with this one
673
- *
674
- * * `label` - the text for the input field label
675
- * * `input` - the input field options (standard for Input unit)
676
- *
677
- * @param Object options
678
- * @return void
679
- */
680
- initialize: function(options) {
681
- options = Object.merge({
682
- showIcon: '&#x27A5;',
683
- title: Dialog.i18n.Prompt,
684
- label: Dialog.i18n.Prompt
685
- }, options);
686
-
687
- this.$super(options);
688
- this.addClass('rui-dialog-prompt');
689
-
690
- this.html([
691
- $E('label', {html: this.options.label}),
692
- this.input = new RightJS.Input(this.options.input || {})
693
- ]);
694
-
695
- if (this.input.get('type') !== 'textarea') {
696
- this.input.onKeydown(R(function(event) {
697
- if (event.keyCode === 13) {
698
- this.fire('ok');
699
- }
700
- }).bind(this));
701
- }
702
- },
703
-
704
- show: function() {
705
- this.$super.apply(this, arguments);
706
- this.input.select();
707
- return this;
708
- }
709
-
710
- });
711
-
712
- /**
713
- * Document level hooks for the dialogs
714
- *
715
- * Copyright (C) 2010 Nikolay Nemshilov
716
- */
717
- $(document).on({
718
- keydown: function(event) {
719
- if (event.keyCode === 27 && Dialog.current) {
720
- if (Dialog.current.options.closeable) {
721
- Dialog.current.fire('cancel');
722
- }
723
- } else if (event.keyCode === 13 && Dialog.current) {
724
- if (!(Dialog.current instanceof Dialog.Prompt)) {
725
- event.stop();
726
- Dialog.current.fire('ok');
727
- }
728
- }
729
- },
730
-
731
- mousemove: function(event) {
732
- if (Dialog.dragged) {
733
- Dialog.dragged.head.dragMove(event);
734
- }
735
- },
736
-
737
- mouseup: function(event) {
738
- if (Dialog.dragged) {
739
- Dialog.dragged.head.dragStop(event);
740
- }
741
- }
742
- });
743
-
744
- $(window).onResize(function() {
745
- if (Dialog.current) {
746
- Dialog.current.resize();
747
- }
748
- });(function() {
749
- var style = document.createElement('style'),
750
- rules = document.createTextNode(" *.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}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-screen-locker{position:fixed;top:0;left:0;width:100%;height:100%;margin:0;padding:0;background:#000;opacity:.5;filter:alpha(opacity=50);z-index:99999;cursor:default}div.rui-dialog{position:absolute;z-index:99999;background:white;margin:0;padding:0;padding-top:2.5em;padding-bottom:2.8em;border-radius:.35em;-moz-border-radius:.35em;-webkit-border-radius:.35em;border:1px solid #ccc}div.rui-dialog-body{min-width:20em;min-height:4.5em;margin:0;padding:0 1em;height:100%;overflow:auto;position:relative}div.rui-dialog-body-locker{position:absolute;z-index:9999;left:0;top:0;width:100%;height:100%;text-align:center;opacity:.6;filter:alpha(opacity=60)}div.rui-dialog-body-locker div.rui-spinner{border:none;background:none;font-size:150%;margin-top:8%}div.rui-dialog-body-icon{float:left;background:#eee;font-size:360%;font-family:Arial;border:2px solid gray;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em;width:1em;line-height:1em;text-align:center;margin-right:.2em;margin-top:.05em;cursor:default;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-dialog-head{position:absolute;top:0;left:0;margin:0;padding:0;width:100%;line-height:2em;background:#ccc;border-radius:.35em;-moz-border-radius:.35em;-webkit-border-radius:.35em;border-bottom-left-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0;cursor:move;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-dialog-head div.icon{float:left;height:1.4em;width:1.4em;margin-left:1em;margin-top:.3em;margin-right:.3em;display:none}div.rui-dialog-head div.title{margin-left:1em;color:#444}div.rui-dialog-head div.tools{position:absolute;right:.3em;top:.3em}div.rui-dialog-head div.tools div{float:left;width:1.4em;line-height:1.4em;text-align:center;margin-left:.15em;cursor:pointer;background:#aaa;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;font-family:Verdana;opacity:.6;filter:alpha(opacity=60)}div.rui-dialog-head div.tools div:hover{opacity:1;filter:alpha(opacity=100);box-shadow:#444 0 0 .1em;-moz-box-shadow:#444 0 0 .1em;-webkit-box-shadow:#444 0 0 .1em}div.rui-dialog-head div.tools div.close:hover{background:#daa}div.rui-dialog-nodrag div.rui-dialog-head{cursor:default}div.rui-dialog-foot{position:absolute;bottom:0;left:0;width:100%;text-align:right}div.rui-dialog-foot div.rui-button{margin:.6em 1em;background:#eee;width:4em}div.rui-dialog-foot div.help{float:left}div.rui-dialog-foot div.cancel{margin-right:-.5em}div.rui-dialog-foot div.ok:hover{background-color:#ded}div.rui-dialog-foot div.cancel:hover{background-color:#ecc}div.rui-dialog-alert div.rui-dialog-foot{text-align:center}div.rui-dialog-alert div.rui-dialog-foot div.cancel{display:none}div.rui-dialog-alert div.rui-dialog-body-icon{color:brown;background:#FEE;border-color:brown}div.rui-dialog-confirm div.rui-dialog-body-icon{color:#44A;background:#EEF;border-color:#44a}div.rui-dialog-prompt div.rui-dialog-body-icon{color:#333}div.rui-dialog-prompt div.rui-dialog-body label{display:block;font-weight:bold;font-size:120%;color:#444;margin-bottom:.5em}div.rui-dialog-prompt div.rui-dialog-body input,div.rui-dialog-prompt div.rui-dialog-body textarea{border:1px solid #aaa;font-size:1em;display:block;width:16em;margin:0;padding:.2em;margin-left:4.7em;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;outline:none}div.rui-dialog-prompt div.rui-dialog-body textarea{width:24em;height:8em}");
751
-
752
- style.type = 'text/css';
753
-
754
- if(style.styleSheet) {
755
- style.styleSheet.cssText = rules.nodeValue;
756
- } else {
757
- style.appendChild(rules);
758
- }
759
-
760
- document.getElementsByTagName('head')[0].appendChild(style);
761
- })();
762
-
763
- return Dialog;
764
- })(RightJS);