diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-22 13:29:26 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-22 13:29:26 +0000 |
commit | 6a2ca5e0342751b6d38a1a05ad25b5c0002d6e46 (patch) | |
tree | af09ea2d29ce61690b656be91fbf82a3009ea1ed /app/helpers | |
parent | 387836f8aa736eba4dfe0da879ad71bbc19dd224 (diff) | |
download | redmine-6a2ca5e0342751b6d38a1a05ad25b5c0002d6e46.tar.gz redmine-6a2ca5e0342751b6d38a1a05ad25b5c0002d6e46.zip |
JQuery in, Prototype/Scriptaculous out (#11445).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10068 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 22 | ||||
-rw-r--r-- | app/helpers/journals_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/repositories_helper.rb | 7 |
3 files changed, 8 insertions, 25 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c6f9efa9f..b8d87214b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -43,13 +43,6 @@ module ApplicationHelper link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) end - # Display a link to remote if user is authorized - def link_to_remote_if_authorized(name, options = {}, html_options = nil) - ActiveSupport::Deprecation.warn "ApplicationHelper#link_to_remote_if_authorized is deprecated and will be removed in Redmine 2.2." - url = options[:url] || {} - link_to_remote(name, options, html_options) if authorize_for(url[:controller] || params[:controller], url[:action]) - end - # Displays a link to user's account page if active def link_to_user(user, options={}) if user.is_a?(User) @@ -161,8 +154,8 @@ module ApplicationHelper end def toggle_link(name, id, options={}) - onclick = "Element.toggle('#{id}'); " - onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") + onclick = "$('##{id}').toggle(); " + onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") onclick << "return false;" link_to(name, "#", :onclick => onclick) end @@ -175,11 +168,6 @@ module ApplicationHelper })) end - def prompt_to_remote(name, text, param, url, html_options = {}) - html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" - link_to name, {}, html_options - end - def format_activity_title(text) h(truncate_single_line(text, :length => 100)) end @@ -1042,7 +1030,7 @@ module ApplicationHelper end @context_menu_included = true end - javascript_tag "new ContextMenu('#{ url_for(url) }')" + javascript_tag "contextMenuInit('#{ url_for(url) }')" end def calendar_for(field_id) @@ -1173,9 +1161,9 @@ module ApplicationHelper # Returns the javascript tags that are included in the html layout head def javascript_heads - tags = javascript_include_tag('prototype', 'effects', 'dragdrop', 'controls', 'rails', 'application') + tags = javascript_include_tag('jquery-1.7.2-ui-1.8.21-ujs-2.0.2', 'application') unless User.current.pref.warn_on_leaving_unsaved == '0' - tags << "\n".html_safe + javascript_tag("Event.observe(window, 'load', function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });") + tags << "\n".html_safe + javascript_tag("$(window).load(function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });") end tags end diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index a075061c1..b4441c193 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -29,7 +29,7 @@ module JournalsHelper :method => 'post', :title => l(:button_quote)) if options[:reply_links] links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes", - { :controller => 'journals', :action => 'edit', :id => journal }, + { :controller => 'journals', :action => 'edit', :id => journal, :format => 'js' }, :title => l(:button_edit)) if editable end content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? @@ -40,7 +40,7 @@ module JournalsHelper end def link_to_in_place_notes_editor(text, field_id, url, options={}) - onclick = "new Ajax.Request('#{url_for(url)}', {asynchronous:true, evalScripts:true, method:'get'}); return false;" + onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;" link_to text, '#', options.merge(:onclick => onclick) end end diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 66c63fa90..d9fdfd3fe 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -141,12 +141,7 @@ module RepositoriesHelper select_tag('repository_scm', options_for_select(scm_options, repository.class.name.demodulize), :disabled => (repository && !repository.new_record?), - :onchange => remote_function( - :url => new_project_repository_path(@project), - :method => :get, - :update => 'content', - :with => "Form.serialize(this.form)") - ) + :data => {:remote => true, :method => 'get'}) end def with_leading_slash(path) |