jrhicks-static-generators 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/LICENSE +1 -0
  2. data/Manifest +34 -0
  3. data/Rakefile +1 -1
  4. data/rails_generators/static_app/static_app_generator.rb +55 -0
  5. data/rails_generators/static_app/templates/header_bg.png +0 -0
  6. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  7. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  8. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  9. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  10. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  11. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  12. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  13. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  14. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_217bc0_256x240.png +0 -0
  15. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
  16. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_469bdd_256x240.png +0 -0
  17. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
  18. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
  19. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
  20. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
  21. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/css/redmond/jquery-ui-1.7.2.custom.css +406 -0
  22. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/index.html +367 -0
  23. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/js/jquery-1.3.2.min.js +19 -0
  24. data/rails_generators/static_app/templates/jquery-ui-1.7.2.custom/js/jquery-ui-1.7.2.custom.min.js +298 -0
  25. data/rails_generators/static_app/templates/jrails/jquery-ui.js +160 -0
  26. data/rails_generators/static_app/templates/jrails/jquery.js +32 -0
  27. data/rails_generators/static_app/templates/jrails/jrails.js +1 -0
  28. data/rails_generators/static_app/templates/plugins/jrails/CHANGELOG +35 -0
  29. data/rails_generators/static_app/templates/plugins/jrails/README +21 -0
  30. data/rails_generators/static_app/templates/plugins/jrails/init.rb +6 -0
  31. data/rails_generators/static_app/templates/plugins/jrails/install.rb +9 -0
  32. data/rails_generators/static_app/templates/plugins/jrails/javascripts/jquery-ui.js +160 -0
  33. data/rails_generators/static_app/templates/plugins/jrails/javascripts/jquery.js +32 -0
  34. data/rails_generators/static_app/templates/plugins/jrails/javascripts/jrails.js +1 -0
  35. data/rails_generators/static_app/templates/plugins/jrails/javascripts/sources/jrails.js +194 -0
  36. data/rails_generators/static_app/templates/plugins/jrails/lib/jrails.rb +406 -0
  37. data/rails_generators/static_app/templates/plugins/jrails/tasks/jrails.rake +19 -0
  38. data/rails_generators/static_app/templates/standard_banner.html.erb +10 -0
  39. data/rails_generators/static_app/templates/standard_header.html.erb +8 -2
  40. data/rails_generators/static_app/templates/static_style.css +5 -34
  41. data/static-generators.gemspec +2 -2
  42. metadata +35 -1
@@ -0,0 +1,194 @@
1
+ /*
2
+ *
3
+ * jRails ajax extras
4
+ * version 0.1
5
+ * <aaron@ennerchi.com> | http://www.ennerchi.com
6
+ *
7
+ */
8
+
9
+ (function($) {
10
+ $().ajaxSend(function(a, xhr, s){ //Set request headers globally
11
+ xhr.setRequestHeader("Accept", "text/javascript, text/html, application/xml, text/xml, */*");
12
+ });
13
+ })(jQuery);
14
+
15
+
16
+ /*
17
+ *
18
+ * jRails form extras
19
+ * <aaron@ennerchi.com> | http://www.ennerchi.com
20
+ *
21
+ */
22
+
23
+
24
+ (function($) {
25
+ // reset a form
26
+ $.fn.reset = function() {
27
+ return this.each(function() {
28
+ // guard against an input with the name of 'reset'
29
+ // note that IE reports the reset function as an 'object'
30
+ if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
31
+ this.reset();
32
+ });
33
+ };
34
+ // enable a form element
35
+ $.fn.enable = function() {
36
+ return this.each(function() {
37
+ this.disabled = false;
38
+ });
39
+ };
40
+ // disable a form element
41
+ $.fn.disable = function() {
42
+ return this.each(function() {
43
+ this.disabled = true;
44
+ });
45
+ };
46
+
47
+ })(jQuery);
48
+
49
+ /*
50
+ *
51
+ * jRails form observer plugin
52
+ * version 0.2
53
+ * <aaron@ennerchi.com> | http://www.ennerchi.com
54
+ *
55
+ */
56
+
57
+ (function($) {
58
+ $.extend({ // Translate field to event
59
+ fieldEvent: function(el, obs) {
60
+ var field = el[0] || el, e = 'change';
61
+ if (field.type == 'radio' || field.type == 'checkbox') e = 'click';
62
+ else if (obs && field.type == 'text' || field.type == 'textarea') e = 'keyup';
63
+ return e;
64
+ }
65
+ });
66
+ $.fn.extend({ // Delayed observer for fields and forms
67
+ delayedObserver: function(delay, callback){
68
+ var el = $(this);
69
+ if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = [];
70
+ if (typeof window.delayedObserverCallback == 'undefined') {
71
+ window.delayedObserverCallback = function(stackPos) {
72
+ var observed = window.delayedObserverStack[stackPos];
73
+ if (observed.timer) clearTimeout(observed.timer);
74
+ observed.timer = setTimeout(function(){
75
+ observed.timer = null;
76
+ observed.callback(observed.obj, observed.obj.formVal());
77
+ }, observed.delay * 1000);
78
+ observed.oldVal = observed.obj.formVal();
79
+ };
80
+ }
81
+ window.delayedObserverStack.push({
82
+ obj: el, timer: null, delay: delay,
83
+ oldVal: el.formVal(), callback: callback
84
+ });
85
+ var stackPos = window.delayedObserverStack.length-1;
86
+ if (el[0].tagName == 'FORM') {
87
+ $(':input', el).each(function(){
88
+ var field = $(this);
89
+ field.bind($.fieldEvent(field, delay), function(){
90
+ var observed = window.delayedObserverStack[stackPos];
91
+ if (observed.obj.formVal() == observed.oldVal) return;
92
+ else window.delayedObserverCallback(stackPos);
93
+ });
94
+ });
95
+ } else {
96
+ el.bind($.fieldEvent(el, delay), function(){
97
+ var observed = window.delayedObserverStack[stackPos];
98
+ if (observed.obj.formVal() == observed.oldVal) return;
99
+ else window.delayedObserverCallback(stackPos);
100
+ });
101
+ };
102
+ },
103
+ formVal: function() { // Gets form values
104
+ var el = this[0];
105
+ if(el.tagName == 'FORM') return this.serialize();
106
+ if(el.type == 'checkbox' || el.type == 'radio') return this.filter('input:checked').val() || '';
107
+ else return this.val();
108
+ }
109
+ });
110
+ })(jQuery);
111
+
112
+ /*
113
+ *
114
+ * jRails visual effects stubs
115
+ * version 0.2
116
+ * <aaron@ennerchi.com> | http://www.ennerchi.com
117
+ *
118
+ */
119
+
120
+ (function($) {
121
+ $.fn.extend({
122
+ visualEffect : function(o) {
123
+ e = o.replace(/\_(.)/g, function(m, l){return l.toUpperCase()});
124
+ return eval('$(this).'+e+'()');
125
+ },
126
+ appear : function(speed, callback) {
127
+ return this.fadeIn(speed, callback);
128
+ },
129
+ blindDown : function(speed, callback) {
130
+ return this.show('blind', { direction: 'vertical' }, speed, callback);
131
+ },
132
+ blindUp : function(speed, callback) {
133
+ return this.hide('blind', { direction: 'vertical' }, speed, callback);
134
+ },
135
+ blindRight : function(speed, callback) {
136
+ return this.show('blind', { direction: 'horizontal' }, speed, callback);
137
+ },
138
+ blindLeft : function(speed, callback) {
139
+ this.hide('blind', { direction: 'horizontal' }, speed, callback);
140
+ return this;
141
+ },
142
+ dropOut : function(speed, callback) {
143
+ return this.hide('drop', {direction: 'down' }, speed, callback);
144
+ },
145
+ dropIn : function(speed, callback) {
146
+ return this.show('drop', { direction: 'up' }, speed, callback);
147
+ },
148
+ fade : function(speed, callback) {
149
+ return this.fadeOut(speed, callback);
150
+ },
151
+ fadeToggle : function(speed, callback) {
152
+ return this.animate({opacity: 'toggle'}, speed, callback);
153
+ },
154
+ fold : function(speed, callback) {
155
+ return this.hide('fold', {}, speed, callback);
156
+ },
157
+ foldOut : function(speed, callback) {
158
+ return this.show('fold', {}, speed, callback);
159
+ },
160
+ grow : function(speed, callback) {
161
+ return this.show('scale', {}, speed, callback);
162
+ },
163
+ highlight : function(speed, callback) {
164
+ return this.show('highlight', {}, speed, callback);
165
+ },
166
+ puff : function(speed, callback) {
167
+ return this.hide('puff', {}, speed, callback);
168
+ },
169
+ pulsate : function(speed, callback) {
170
+ return this.show('pulsate', {}, speed, callback);
171
+ },
172
+ shake : function(speed, callback) {
173
+ return this.show('shake', {}, speed, callback);
174
+ },
175
+ shrink : function(speed, callback) {
176
+ return this.hide('scale', {}, speed, callback);
177
+ },
178
+ squish : function(speed, callback) {
179
+ return this.hide('scale', { origin: ['top', 'left'] }, speed, callback);
180
+ },
181
+ slideUp : function(speed, callback) {
182
+ return this.hide('slide', { direction: 'up'}, speed, callback);
183
+ },
184
+ slideDown : function(speed, callback) {
185
+ return this.show('slide', { direction: 'up'}, speed, callback);
186
+ },
187
+ switchOff : function(speed, callback) {
188
+ return this.hide('clip', {}, speed, callback);
189
+ },
190
+ switchOn : function(speed, callback) {
191
+ return this.show('clip', {}, speed, callback);
192
+ }
193
+ });
194
+ })(jQuery);
@@ -0,0 +1,406 @@
1
+ module ActionView
2
+ module Helpers
3
+
4
+ module JavaScriptHelper
5
+
6
+ # This function can be used to render rjs inline
7
+ #
8
+ # <%= javascript_function do |page|
9
+ # page.replace_html :list, :partial => 'list', :object => @list
10
+ # end %>
11
+ #
12
+ def javascript_function(*args, &block)
13
+ html_options = args.extract_options!
14
+ function = args[0] || ''
15
+
16
+ html_options.symbolize_keys!
17
+ function = update_page(&block) if block_given?
18
+ javascript_tag(function)
19
+ end
20
+
21
+ def jquery_id(id)
22
+ id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
23
+ end
24
+
25
+ def jquery_ids(ids)
26
+ Array(ids).map{|id| jquery_id(id)}.join(',')
27
+ end
28
+
29
+ end
30
+
31
+ module PrototypeHelper
32
+
33
+ unless const_defined? :JQUERY_VAR
34
+ JQUERY_VAR = '$'
35
+ end
36
+
37
+ unless const_defined? :JQCALLBACKS
38
+ JQCALLBACKS = Set.new([ :beforeSend, :complete, :error, :success ] + (100..599).to_a)
39
+ AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url,
40
+ :asynchronous, :method, :insertion, :position,
41
+ :form, :with, :update, :script ]).merge(JQCALLBACKS)
42
+ end
43
+
44
+ def periodically_call_remote(options = {})
45
+ frequency = options[:frequency] || 10 # every ten seconds by default
46
+ code = "setInterval(function() {#{remote_function(options)}}, #{frequency} * 1000)"
47
+ javascript_tag(code)
48
+ end
49
+
50
+ def remote_function(options)
51
+ javascript_options = options_for_ajax(options)
52
+
53
+ update = ''
54
+ if options[:update] && options[:update].is_a?(Hash)
55
+ update = []
56
+ update << "success:'#{options[:update][:success]}'" if options[:update][:success]
57
+ update << "failure:'#{options[:update][:failure]}'" if options[:update][:failure]
58
+ update = '{' + update.join(',') + '}'
59
+ elsif options[:update]
60
+ update << "'#{options[:update]}'"
61
+ end
62
+
63
+ function = "#{JQUERY_VAR}.ajax(#{javascript_options})"
64
+
65
+ function = "#{options[:before]}; #{function}" if options[:before]
66
+ function = "#{function}; #{options[:after]}" if options[:after]
67
+ function = "if (#{options[:condition]}) { #{function}; }" if options[:condition]
68
+ function = "if (confirm('#{escape_javascript(options[:confirm])}')) { #{function}; }" if options[:confirm]
69
+ return function
70
+ end
71
+
72
+ class JavaScriptGenerator
73
+ module GeneratorMethods
74
+
75
+ def insert_html(position, id, *options_for_render)
76
+ insertion = position.to_s.downcase
77
+ insertion = 'append' if insertion == 'bottom'
78
+ insertion = 'prepend' if insertion == 'top'
79
+ call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").#{insertion}", render(*options_for_render)
80
+ end
81
+
82
+ def replace_html(id, *options_for_render)
83
+ insert_html(:html, id, *options_for_render)
84
+ end
85
+
86
+ def replace(id, *options_for_render)
87
+ call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").replaceWith", render(*options_for_render)
88
+ end
89
+
90
+ def remove(*ids)
91
+ call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").remove"
92
+ end
93
+
94
+ def show(*ids)
95
+ call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").show"
96
+ end
97
+
98
+ def hide(*ids)
99
+ call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").hide"
100
+ end
101
+
102
+ def toggle(*ids)
103
+ call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").toggle"
104
+ end
105
+
106
+ def jquery_id(id)
107
+ id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
108
+ end
109
+
110
+ def jquery_ids(ids)
111
+ Array(ids).map{|id| jquery_id(id)}.join(',')
112
+ end
113
+
114
+ end
115
+ end
116
+
117
+ protected
118
+ def options_for_ajax(options)
119
+ js_options = build_callbacks(options)
120
+
121
+ url_options = options[:url]
122
+ url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash)
123
+ js_options['url'] = "'#{url_for(url_options)}'"
124
+ js_options['async'] = false if options[:type] == :synchronous
125
+ js_options['type'] = options[:method] ? method_option_to_s(options[:method]) : ( options[:form] ? "'post'" : nil )
126
+ js_options['dataType'] = options[:datatype] ? "'#{options[:datatype]}'" : (options[:update] ? nil : "'script'")
127
+
128
+ if options[:form]
129
+ js_options['data'] = "#{JQUERY_VAR}.param(#{JQUERY_VAR}(this).serializeArray())"
130
+ elsif options[:submit]
131
+ js_options['data'] = "#{JQUERY_VAR}(\"##{options[:submit]} :input\").serialize()"
132
+ elsif options[:with]
133
+ js_options['data'] = options[:with].gsub("Form.serialize(this.form)","#{JQUERY_VAR}.param(#{JQUERY_VAR}(this.form).serializeArray())")
134
+ end
135
+
136
+ js_options['type'] ||= "'post'"
137
+ if options[:method]
138
+ if method_option_to_s(options[:method]) == "'put'" || method_option_to_s(options[:method]) == "'delete'"
139
+ js_options['type'] = "'post'"
140
+ if js_options['data']
141
+ js_options['data'] << " + '&"
142
+ else
143
+ js_options['data'] = "'"
144
+ end
145
+ js_options['data'] << "_method=#{options[:method]}'"
146
+ end
147
+ end
148
+
149
+ if respond_to?('protect_against_forgery?') && protect_against_forgery?
150
+ if js_options['data']
151
+ js_options['data'] << " + '&"
152
+ else
153
+ js_options['data'] = "'"
154
+ end
155
+ js_options['data'] << "#{request_forgery_protection_token}=' + encodeURIComponent('#{escape_javascript form_authenticity_token}')"
156
+ end
157
+ js_options['data'] = "''" if js_options['type'] == "'post'" && js_options['data'].nil?
158
+ options_for_javascript(js_options.reject {|key, value| value.nil?})
159
+ end
160
+
161
+ def build_update_for_success(html_id, insertion=nil)
162
+ insertion = build_insertion(insertion)
163
+ "#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request);"
164
+ end
165
+
166
+ def build_update_for_error(html_id, insertion=nil)
167
+ insertion = build_insertion(insertion)
168
+ "#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request.responseText);"
169
+ end
170
+
171
+ def build_insertion(insertion)
172
+ insertion = insertion ? insertion.to_s.downcase : 'html'
173
+ insertion = 'append' if insertion == 'bottom'
174
+ insertion = 'prepend' if insertion == 'top'
175
+ insertion
176
+ end
177
+
178
+ def build_observer(klass, name, options = {})
179
+ if options[:with] && (options[:with] !~ /[\{=(.]/)
180
+ options[:with] = "'#{options[:with]}=' + value"
181
+ else
182
+ options[:with] ||= 'value' unless options[:function]
183
+ end
184
+
185
+ callback = options[:function] || remote_function(options)
186
+ javascript = "#{JQUERY_VAR}('#{jquery_id(name)}').delayedObserver("
187
+ javascript << "#{options[:frequency] || 0}, "
188
+ javascript << "function(element, value) {"
189
+ javascript << "#{callback}}"
190
+ #javascript << ", '#{options[:on]}'" if options[:on]
191
+ javascript << ")"
192
+ javascript_tag(javascript)
193
+ end
194
+
195
+ def build_callbacks(options)
196
+ callbacks = {}
197
+ options[:beforeSend] = '';
198
+ [:uninitialized,:loading,:loaded].each do |key|
199
+ options[:beforeSend] << (options[key].last == ';' ? options.delete(key) : options.delete(key) << ';') if options[key]
200
+ end
201
+ options.delete(:beforeSend) if options[:beforeSend].blank?
202
+ options[:error] = options.delete(:failure) if options[:failure]
203
+ if options[:update]
204
+ if options[:update].is_a?(Hash)
205
+ options[:update][:error] = options[:update].delete(:failure) if options[:update][:failure]
206
+ if options[:update][:success]
207
+ options[:success] = build_update_for_success(options[:update][:success], options[:position]) << (options[:success] ? options[:success] : '')
208
+ end
209
+ if options[:update][:error]
210
+ options[:error] = build_update_for_error(options[:update][:error], options[:position]) << (options[:error] ? options[:error] : '')
211
+ end
212
+ else
213
+ options[:success] = build_update_for_success(options[:update], options[:position]) << (options[:success] ? options[:success] : '')
214
+ end
215
+ end
216
+ options.each do |callback, code|
217
+ if JQCALLBACKS.include?(callback)
218
+ callbacks[callback] = "function(request){#{code}}"
219
+ end
220
+ end
221
+ callbacks
222
+ end
223
+
224
+ end
225
+
226
+ class JavaScriptElementProxy < JavaScriptProxy #:nodoc:
227
+
228
+ unless const_defined? :JQUERY_VAR
229
+ JQUERY_VAR = ActionView::Helpers::PrototypeHelper::JQUERY_VAR
230
+ end
231
+
232
+ def initialize(generator, id)
233
+ id = id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
234
+ @id = id
235
+ super(generator, "#{JQUERY_VAR}(\"#{id}\")")
236
+ end
237
+
238
+ def replace_html(*options_for_render)
239
+ call 'html', @generator.send(:render, *options_for_render)
240
+ end
241
+
242
+ def replace(*options_for_render)
243
+ call 'replaceWith', @generator.send(:render, *options_for_render)
244
+ end
245
+
246
+ def value()
247
+ call 'val()'
248
+ end
249
+
250
+ def value=(value)
251
+ call 'val', value
252
+ end
253
+
254
+ end
255
+
256
+ class JavaScriptElementCollectionProxy < JavaScriptCollectionProxy #:nodoc:\
257
+
258
+ unless const_defined? :JQUERY_VAR
259
+ JQUERY_VAR = ActionView::Helpers::PrototypeHelper::JQUERY_VAR
260
+ end
261
+
262
+ def initialize(generator, pattern)
263
+ super(generator, "#{JQUERY_VAR}(#{pattern.to_json})")
264
+ end
265
+ end
266
+
267
+ module ScriptaculousHelper
268
+
269
+ unless const_defined? :JQUERY_VAR
270
+ JQUERY_VAR = ActionView::Helpers::PrototypeHelper::JQUERY_VAR
271
+ end
272
+
273
+ unless const_defined? :SCRIPTACULOUS_EFFECTS
274
+ SCRIPTACULOUS_EFFECTS = {
275
+ :appear => {:method => 'fadeIn'},
276
+ :blind_down => {:method => 'blind', :mode => 'show', :options => {:direction => 'vertical'}},
277
+ :blind_up => {:method => 'blind', :mode => 'hide', :options => {:direction => 'vertical'}},
278
+ :blind_right => {:method => 'blind', :mode => 'show', :options => {:direction => 'horizontal'}},
279
+ :blind_left => {:method => 'blind', :mode => 'hide', :options => {:direction => 'horizontal'}},
280
+ :bounce_in => {:method => 'bounce', :mode => 'show', :options => {:direction => 'up'}},
281
+ :bounce_out => {:method => 'bounce', :mode => 'hide', :options => {:direction => 'up'}},
282
+ :drop_in => {:method => 'drop', :mode => 'show', :options => {:direction => 'up'}},
283
+ :drop_out => {:method => 'drop', :mode => 'hide', :options => {:direction => 'down'}},
284
+ :fade => {:method => 'fadeOut'},
285
+ :fold_in => {:method => 'fold', :mode => 'hide'},
286
+ :fold_out => {:method => 'fold', :mode => 'show'},
287
+ :grow => {:method => 'scale', :mode => 'show'},
288
+ :shrink => {:method => 'scale', :mode => 'hide'},
289
+ :slide_down => {:method => 'slide', :mode => 'show', :options => {:direction => 'up'}},
290
+ :slide_up => {:method => 'slide', :mode => 'hide', :options => {:direction => 'up'}},
291
+ :slide_right => {:method => 'slide', :mode => 'show', :options => {:direction => 'left'}},
292
+ :slide_left => {:method => 'slide', :mode => 'hide', :options => {:direction => 'left'}},
293
+ :squish => {:method => 'scale', :mode => 'hide', :options => {:origin => "['top','left']"}},
294
+ :switch_on => {:method => 'clip', :mode => 'show', :options => {:direction => 'vertical'}},
295
+ :switch_off => {:method => 'clip', :mode => 'hide', :options => {:direction => 'vertical'}},
296
+ :toggle_appear => {:method => 'fadeToggle'},
297
+ :toggle_slide => {:method => 'slide', :mode => 'toggle', :options => {:direction => 'up'}},
298
+ :toggle_blind => {:method => 'blind', :mode => 'toggle', :options => {:direction => 'vertical'}},
299
+ }
300
+ end
301
+
302
+ def visual_effect(name, element_id = false, js_options = {})
303
+ element = element_id ? element_id : "this"
304
+
305
+ if SCRIPTACULOUS_EFFECTS.has_key? name.to_sym
306
+ effect = SCRIPTACULOUS_EFFECTS[name.to_sym]
307
+ name = effect[:method]
308
+ mode = effect[:mode]
309
+ js_options = js_options.merge(effect[:options]) if effect[:options]
310
+ end
311
+
312
+ [:color, :direction].each do |option|
313
+ js_options[option] = "'#{js_options[option]}'" if js_options[option]
314
+ end
315
+
316
+ if js_options.has_key? :duration
317
+ speed = js_options.delete :duration
318
+ speed = (speed * 1000).to_i unless speed.nil?
319
+ else
320
+ speed = js_options.delete :speed
321
+ end
322
+
323
+ if ['fadeIn','fadeOut','fadeToggle'].include?(name)
324
+ javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{name}("
325
+ javascript << "#{speed}" unless speed.nil?
326
+ javascript << ");"
327
+ else
328
+ javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{mode || 'effect'}('#{name}'"
329
+ javascript << ",#{options_for_javascript(js_options)}" unless speed.nil? && js_options.empty?
330
+ javascript << ",#{speed}" unless speed.nil?
331
+ javascript << ");"
332
+ end
333
+
334
+ end
335
+
336
+ def sortable_element_js(element_id, options = {}) #:nodoc:
337
+ #convert similar attributes
338
+ options[:handle] = ".#{options[:handle]}" if options[:handle]
339
+ if options[:tag] || options[:only]
340
+ options[:items] = "> "
341
+ options[:items] << options.delete(:tag) if options[:tag]
342
+ options[:items] << ".#{options.delete(:only)}" if options[:only]
343
+ end
344
+ options[:connectWith] = options.delete(:containment).map {|x| "##{x}"} if options[:containment]
345
+ options[:containment] = options.delete(:container) if options[:container]
346
+ options[:dropOnEmpty] = false unless options[:dropOnEmpty]
347
+ options[:helper] = "'clone'" if options[:ghosting] == true
348
+ options[:axis] = case options.delete(:constraint)
349
+ when "vertical"
350
+ "y"
351
+ when "horizontal"
352
+ "x"
353
+ when false
354
+ nil
355
+ when nil
356
+ "y"
357
+ end
358
+ options.delete(:axis) if options[:axis].nil?
359
+ options.delete(:overlap)
360
+ options.delete(:ghosting)
361
+
362
+ if options[:onUpdate] || options[:url]
363
+ options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}'})"
364
+ options[:onUpdate] ||= "function(){" + remote_function(options) + "}"
365
+ end
366
+
367
+ options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) }
368
+ options[:update] = options.delete(:onUpdate) if options[:onUpdate]
369
+
370
+ [:axis, :cancel, :containment, :cursor, :handle, :tolerance, :items, :placeholder].each do |option|
371
+ options[option] = "'#{options[option]}'" if options[option]
372
+ end
373
+
374
+ options[:connectWith] = array_or_string_for_javascript(options[:connectWith]) if options[:connectWith]
375
+
376
+ %(#{JQUERY_VAR}('#{jquery_id(element_id)}').sortable(#{options_for_javascript(options)});)
377
+ end
378
+
379
+ def draggable_element_js(element_id, options = {})
380
+ %(#{JQUERY_VAR}("#{jquery_id(element_id)}").draggable(#{options_for_javascript(options)});)
381
+ end
382
+
383
+ def drop_receiving_element_js(element_id, options = {})
384
+ #convert similar options
385
+ options[:hoverClass] = options.delete(:hoverclass) if options[:hoverclass]
386
+ options[:drop] = options.delete(:onDrop) if options[:onDrop]
387
+
388
+ if options[:drop] || options[:url]
389
+ options[:with] ||= "'id=' + encodeURIComponent(#{JQUERY_VAR}(ui.draggable).attr('id'))"
390
+ options[:drop] ||= "function(ev, ui){" + remote_function(options) + "}"
391
+ end
392
+
393
+ options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) }
394
+
395
+ options[:accept] = array_or_string_for_javascript(options[:accept]) if options[:accept]
396
+ [:activeClass, :hoverClass, :tolerance].each do |option|
397
+ options[option] = "'#{options[option]}'" if options[option]
398
+ end
399
+
400
+ %(#{JQUERY_VAR}('#{jquery_id(element_id)}').droppable(#{options_for_javascript(options)});)
401
+ end
402
+
403
+ end
404
+
405
+ end
406
+ end
@@ -0,0 +1,19 @@
1
+ namespace :jrails do
2
+ namespace :update do
3
+ desc "Copies the jQuery and jRails javascripts to public/javascripts"
4
+ task :javascripts do
5
+ puts "Copying files..."
6
+ project_dir = RAILS_ROOT + '/public/javascripts/'
7
+ scripts = Dir[File.join(File.dirname(__FILE__), '..') + '/javascripts/*.js']
8
+ FileUtils.cp(scripts, project_dir)
9
+ puts "files copied successfully."
10
+ end
11
+ end
12
+
13
+ namespace :install do
14
+ desc "Installs the jQuery and jRails javascripts to public/javascripts"
15
+ task :javascripts do
16
+ Rake::Task['jrails:update:javascripts'].invoke
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ <div id="header" class="">
2
+ <div class="container">
3
+ <div class="span-18">
4
+ <h1>Static App</h1>
5
+ </div>
6
+ <div class="userbox ui-corner-all span-5 last">
7
+ <%%=link_to "login"%>
8
+ </div>
9
+ </div>
10
+ </div>
@@ -25,12 +25,18 @@
25
25
  </style>
26
26
  <![endif]-->
27
27
 
28
- <%%= javascript_include_tag 'jquery' %>
28
+ <script src="/javascripts/jquery-1.3.2.min.js" type="text/javascript"></script>
29
+ <script src="/javascripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
30
+ <script src="/javascripts/jrails.js" type="text/javascript"></script>
29
31
  <%%= javascript_include_tag 'uni-form.jquery' %>
30
32
 
33
+
31
34
  <link rel="stylesheet" href="/stylesheets/screen.css" type="text/css" media="screen, projection">
32
35
  <link rel="stylesheet" href="/stylesheets/print.css" type="text/css" media="print">
36
+ <link rel="stylesheet" href="/stylesheets/redmond/jquery-ui-1.7.2.custom.css" type="text/css" media="screen">
33
37
 
34
38
  </head>
35
39
  <body <%%if @onload_javascript%>onLoad="on_load_function();"<%%end%>>
36
- <div class="container showgrid">
40
+
41
+ <%%=render :partial=>"shared/standard_banner"%>
42
+ <div class="container showgrid">
@@ -1,38 +1,9 @@
1
- body {
2
- font-family: "lucida grande", verdana, lucida, sans-serif;
3
- font-size: 8pt;
4
- }
5
-
6
-
7
-
8
- pre {
9
- background-color: #eee;
10
- padding: 10px;
11
- font-size: 11px;
12
- }
13
-
14
- .static_body {
15
- margin: 0;
16
- padding: 0;
17
- }
18
-
19
- .static_site_navigation {
20
- background-image: url(/images/navigation_section_bg.gif);
21
- background-repeat: repeat-y;
22
- background-position: right;
23
- width: 15%;
24
- }
25
-
26
- .static_site_navigation h1 {
27
- margin-top: 0;
28
- background-color: #336699;
29
- color: white;
30
- padding: .25em;
31
- }
1
+ #header{background:#fcfcfc url(/images/header_bg.png) 0 100% repeat-x;height:6.82em;min-width:75em;}
2
+ #header h1{padding: 0;float:left;margin:15px 0 0 0;}
3
+ #header{background:#fcfcfc url(/images/header_bg.png) 0 100% repeat-x;height:6.82em;min-width:75em;}
4
+ #header h1{padding: 0;float:left;margin:15px 0 0 0;}
5
+ #header .userbox{background-color: #fbfbfb; margin-top: 15px; padding: 1em; border: 1px solid #eeeeee;}
32
6
 
33
- a { color: #000; }
34
- a:visited { color: #666; }
35
- a:hover { color: #fff; background-color:#000; }
36
7
 
37
8
  .fieldWithErrors {
38
9
  padding: 2px;