Permalink
Browse files

Update script.aculo.us to 1.5_rc2, and Prototype to 1.4.0_pre7

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2386 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent dd21e9a commit 516dc2c0f16cf187f981b5e8648a7f7f1b31d190 @madrobby madrobby committed Sep 28, 2005
@@ -51,7 +51,12 @@ def javascript_path(source)
# <script type="text/javascript" src="/javascripts/dragdrop.js"></script>
def javascript_include_tag(*sources)
options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
- sources = ['prototype', 'effects', 'controls', 'dragdrop'] if sources.first == :defaults
+ if sources.first == :defaults
+ sources = ['prototype', 'scriptaculous']
+ if defined?(RAILS_ROOT) and File.exists?("#{RAILS_ROOT}/public/javascripts/application.js")
+ sources << 'application'
+ end
+ end
sources.collect { |source|
source = javascript_path(source)
content_tag("script", "", { "type" => "text/javascript", "src" => source }.merge(options))
@@ -74,9 +74,8 @@ def in_place_editor_field(object, method, tag_options = {}, in_place_editor_opti
# input field.
#
# Required +options+ are:
- # <tt>:url</tt>:: Specifies the DOM ID of the element whose
- # innerHTML should be updated with the autocomplete
- # entries returned by XMLHttpRequest.
+ # <tt>:url</tt>:: URL to call for autocompletion results
+ # in url_for format.
#
# Addtional +options+ are:
# <tt>:update</tt>:: Specifies the DOM ID of the element whose
@@ -130,10 +129,41 @@ def auto_complete_result(entries, field, phrase = nil)
# See the RDoc on ActionController::AutoComplete to learn more about this.
def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {})
(completion_options[:skip_style] ? "" : auto_complete_stylesheet) +
- text_field(object, method, { :autocomplete => "off" }.merge!(tag_options)) +
+ text_field(object, method, tag_options) +
content_tag("div", "", :id => "#{object}_#{method}_auto_complete", :class => "auto_complete") +
auto_complete_field("#{object}_#{method}", { :url => { :action => "auto_complete_for_#{object}_#{method}" } }.update(completion_options))
end
+
+ private
+ def auto_complete_stylesheet
+ content_tag("style", <<-EOT
+ div.auto_complete {
+ width: 350px;
+ background: #fff;
+ }
+ div.auto_complete ul {
+ border:1px solid #888;
+ margin:0;
+ padding:0;
+ width:100%;
+ list-style-type:none;
+ }
+ div.auto_complete ul li {
+ margin:0;
+ padding:3px;
+ }
+ div.auto_complete ul li.selected {
+ background-color: #ffb;
+ }
+ div.auto_complete ul strong.highlight {
+ color: #800;
+ margin:0;
+ padding:0;
+ }
+ EOT
+ )
+ end
+
end
end
end
@@ -498,34 +498,6 @@ def build_callbacks(options)
callbacks
end
- def auto_complete_stylesheet
- content_tag("style", <<-EOT
- div.auto_complete {
- width: 350px;
- background: #fff;
- }
- div.auto_complete ul {
- border:1px solid #888;
- margin:0;
- padding:0;
- width:100%;
- list-style-type:none;
- }
- div.auto_complete ul li {
- margin:0;
- padding:3px;
- }
- div.auto_complete ul li.selected {
- background-color: #ffb;
- }
- div.auto_complete ul strong.highlight {
- color: #800;
- margin:0;
- padding:0;
- }
- EOT
- )
- end
end
JavascriptHelper = JavaScriptHelper unless const_defined? :JavascriptHelper
Oops, something went wrong.

0 comments on commit 516dc2c

Please sign in to comment.