diff options
Diffstat (limited to 'app')
86 files changed, 208 insertions, 305 deletions
diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb index cedbf716c..203dae4e7 100644 --- a/app/controllers/auto_completes_controller.rb +++ b/app/controllers/auto_completes_controller.rb @@ -20,7 +20,7 @@ class AutoCompletesController < ApplicationController def issues @issues = [] - q = params[:q].to_s + q = (params[:q] || params[:term]).to_s query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues if q.match(/^\d+$/) @issues << query.visible.find_by_id(q.to_i) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index d92494540..b2c2a9dc7 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -179,7 +179,8 @@ class MyController < ApplicationController group = params[:group] @user = User.current if group.is_a?(String) - group_items = (params["list-#{group}"] || []).collect(&:underscore) + group_items = (params["blocks"] || []).collect(&:underscore) + group_items.each {|s| s.sub!(/^block_/, '')} if group_items and group_items.is_a? Array layout = @user.pref[:my_page_layout] || {} # remove group blocks if they are presents in other groups diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e6a76fbc3..b59946082 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -42,7 +42,6 @@ class RepositoriesController < ApplicationController @repository = Repository.factory(scm) @repository.is_default = @project.repository.nil? @repository.project = @project - render :layout => !request.xhr? end def create 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) diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index f2f7f74ed..6c76ab2e8 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -36,7 +36,7 @@ </td> </tr> </table> -<%= javascript_tag "Form.Element.focus('username');" %> +<%= javascript_tag "$('#username').focus();" %> <% end %> </div> <%= call_hook :view_account_login_bottom %> diff --git a/app/views/auto_completes/issues.html.erb b/app/views/auto_completes/issues.html.erb index b130159eb..e292bbaeb 100644 --- a/app/views/auto_completes/issues.html.erb +++ b/app/views/auto_completes/issues.html.erb @@ -1,9 +1,7 @@ -<ul> -<% if @issues.any? -%> - <% @issues.each do |issue| -%> - <%= content_tag 'li', h("#{issue.tracker} ##{issue.id}: #{issue.subject}"), :id => issue.id %> - <% end -%> -<% else -%> - <%= content_tag("li", l(:label_none), :style => 'display:none') %> -<% end -%> -</ul> +<%= raw @issues.map {|issue| { + 'id' => issue.id, + 'label' => "#{issue.tracker} ##{issue.id}: #{truncate issue.subject.to_s, :length => 60}", + 'value' => issue.id + } + }.to_json +%> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 3d31014d7..e61d5b68a 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -4,7 +4,7 @@ <%= link_to_if_authorized l(:label_message_new), {:controller => 'messages', :action => 'new', :board_id => @board}, :class => 'icon icon-add', - :onclick => 'Element.show("add-message"); Form.Element.focus("message_subject"); return false;' %> + :onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' %> <%= watcher_tag(@board, User.current) %> </div> @@ -15,7 +15,7 @@ <%= render :partial => 'messages/form', :locals => {:f => f} %> <p><%= submit_tag l(:button_create) %> <%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %> | - <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-message")' %></p> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' %></p> <% end %> <div id="preview" class="wiki"></div> <% end %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index ab5590129..cc22b58fa 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -20,7 +20,7 @@ <%= label_tag('year', l(:label_year)) %> <%= select_year(@year, :prefix => "year", :discard_type => true) %> -<%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %> +<%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %> <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, :class => 'icon icon-reload' %> </p> <% end %> diff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erb index 4e5d23302..2cf90135f 100644 --- a/app/views/common/_tabs.html.erb +++ b/app/views/common/_tabs.html.erb @@ -16,8 +16,8 @@ </div> <script> - Event.observe(window, 'load', function() { displayTabsButtons(); }); - Event.observe(window, 'resize', function() { displayTabsButtons(); }); + $(document).ready(displayTabsButtons); + $(window).resize(displayTabsButtons); </script> <% tabs.each do |tab| -%> diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erb index afc15b53c..7ffbbaedc 100644 --- a/app/views/custom_fields/_form.html.erb +++ b/app/views/custom_fields/_form.html.erb @@ -3,63 +3,65 @@ <script type="text/javascript"> //<![CDATA[ function toggle_custom_field_format() { - format = $("custom_field_field_format"); - p_length = $("custom_field_min_length"); - p_regexp = $("custom_field_regexp"); - p_values = $("custom_field_possible_values"); - p_searchable = $("custom_field_searchable"); - p_default = $("custom_field_default_value"); - p_multiple = $("custom_field_multiple"); + var format = $("#custom_field_field_format").val(); + var p_length = $("#custom_field_min_length"); + var p_regexp = $("#custom_field_regexp"); + var p_values = $("#custom_field_possible_values"); + var p_searchable = $("#custom_field_searchable"); + var p_default = $("#custom_field_default_value"); + var p_multiple = $("#custom_field_multiple"); + // can't change type on JQuery objects + var p_default2 = document.getElementById("custom_field_default_value"); - p_default.setAttribute('type','text'); - Element.show(p_default.parentNode); + p_default2.type = 'text'; + p_default.parent().show(); - switch (format.value) { + switch (format) { case "list": - Element.hide(p_length.parentNode); - Element.hide(p_regexp.parentNode); - if (p_searchable) Element.show(p_searchable.parentNode); - Element.show(p_values.parentNode); - Element.show(p_multiple.parentNode); + p_length.parent().hide(); + p_regexp.parent().hide(); + p_searchable.parent().show(); + p_values.parent().show(); + p_multiple.parent().show(); break; case "bool": - p_default.setAttribute('type','checkbox'); - Element.hide(p_length.parentNode); - Element.hide(p_regexp.parentNode); - if (p_searchable) Element.hide(p_searchable.parentNode); - Element.hide(p_values.parentNode); - Element.hide(p_multiple.parentNode); + p_default2.type = 'checkbox'; + p_length.parent().hide(); + p_regexp.parent().hide(); + p_searchable.parent().hide(); + p_values.parent().hide(); + p_multiple.parent().hide(); break; case "date": - Element.hide(p_length.parentNode); - Element.hide(p_regexp.parentNode); - if (p_searchable) Element.hide(p_searchable.parentNode); - Element.hide(p_values.parentNode); - Element.hide(p_multiple.parentNode); + p_length.parent().hide(); + p_regexp.parent().hide(); + p_searchable.parent().hide(); + p_values.parent().hide(); + p_multiple.parent().hide(); break; case "float": case "int": - Element.show(p_length.parentNode); - Element.show(p_regexp.parentNode); - if (p_searchable) Element.hide(p_searchable.parentNode); - Element.hide(p_values.parentNode); - Element.hide(p_multiple.parentNode); + p_length.parent().show(); + p_regexp.parent().show(); + p_searchable.parent().hide(); + p_values.parent().hide(); + p_multiple.parent().hide(); break; case "user": case "version": - Element.hide(p_length.parentNode); - Element.hide(p_regexp.parentNode); - if (p_searchable) Element.hide(p_searchable.parentNode); - Element.hide(p_values.parentNode); - Element.hide(p_default.parentNode); - Element.show(p_multiple.parentNode); + p_length.parent().hide(); + p_regexp.parent().hide(); + p_searchable.parent().hide(); + p_values.parent().hide(); + p_multiple.parent().show(); + p_default.parent().hide(); break; default: - Element.show(p_length.parentNode); - Element.show(p_regexp.parentNode); - if (p_searchable) Element.show(p_searchable.parentNode); - Element.hide(p_values.parentNode); - Element.hide(p_multiple.parentNode); + p_length.parent().show(); + p_regexp.parent().show(); + p_searchable.parent().show(); + p_values.parent().hide(); + p_multiple.parent().hide(); break; } } diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index fd47c3842..28fc74684 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -1,6 +1,6 @@ <div class="contextual"> <%= link_to l(:label_document_new), new_project_document_path(@project), :class => 'icon icon-add', - :onclick => 'Element.show("add-document"); Form.Element.focus("document_title"); return false;' if User.current.allowed_to?(:manage_documents, @project) %> + :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:manage_documents, @project) %> </div> <div id="add-document" style="display:none;"> @@ -9,7 +9,7 @@ <%= render :partial => 'form', :locals => {:f => f} %> <p> <%= submit_tag l(:button_create) %> - <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-document")' %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-document").hide(); return false;' %> </p> <% end %> </div> diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 2a430040d..c18bb07cb 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -17,7 +17,7 @@ <%= link_to_attachments @document %> <% if authorize_for('documents', 'add_attachment') %> -<p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", +<p><%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;", :id => 'attach_files_link' %></p> <%= form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> <div class="box"> diff --git a/app/views/groups/_memberships.html.erb b/app/views/groups/_memberships.html.erb index 1b72f0d81..295f7fc3d 100644 --- a/app/views/groups/_memberships.html.erb +++ b/app/views/groups/_memberships.html.erb @@ -25,14 +25,14 @@ <p><%= submit_tag l(:button_change) %> <%= link_to_function( l(:button_cancel), - "$('member-#{membership.id}-roles').show(); $('member-#{membership.id}-roles-form').hide(); return false;" + "$('#member-#{membership.id}-roles').show(); $('#member-#{membership.id}-roles-form').hide(); return false;" ) %></p> <% end %> </td> <td class="buttons"> <%= link_to_function( l(:button_edit), - "$('member-#{membership.id}-roles').hide(); $('member-#{membership.id}-roles-form').show(); return false;", + "$('#member-#{membership.id}-roles').hide(); $('#member-#{membership.id}-roles-form').show(); return false;", :class => 'icon icon-edit' ) %> <%= delete_link({:controller => 'groups', :action => 'destroy_membership', :id => @group, :membership_id => membership}, diff --git a/app/views/groups/_users.html.erb b/app/views/groups/_users.html.erb index 58d328814..8bd76e90e 100644 --- a/app/views/groups/_users.html.erb +++ b/app/views/groups/_users.html.erb @@ -29,15 +29,7 @@ <fieldset><legend><%=l(:label_user_new)%></legend> <p><%= label_tag "user_search", l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> - <%= observe_field(:user_search, - :frequency => 0.5, - :update => :users, - :url => autocomplete_for_user_group_path(@group), - :method => :get, - :before => '$("user_search").addClassName("ajax-loading")', - :complete => '$("user_search").removeClassName("ajax-loading")', - :with => 'q') - %> + <%= javascript_tag "observeSearchfield('user_search', 'users', '#{ escape_javascript autocomplete_for_user_group_path(@group) }')" %> <div id="users"> <%= principals_check_box_tags 'user_ids[]', users %> diff --git a/app/views/groups/add_users.js.erb b/app/views/groups/add_users.js.erb index 35d432760..460527b6c 100644 --- a/app/views/groups/add_users.js.erb +++ b/app/views/groups/add_users.js.erb @@ -1,4 +1,4 @@ -Element.update('tab-content-users', '<%= escape_javascript(render :partial => 'groups/users') %>'); +$('#tab-content-users').html('<%= escape_javascript(render :partial => 'groups/users') %>'); <% @users.each do |user| %> - new Effect.Highlight('user-<%= user.id %>'); + $('#user-<%= user.id %>').effect("highlight"); <% end %> diff --git a/app/views/groups/destroy_membership.js.erb b/app/views/groups/destroy_membership.js.erb index 3e03eb817..30ab3b081 100644 --- a/app/views/groups/destroy_membership.js.erb +++ b/app/views/groups/destroy_membership.js.erb @@ -1 +1 @@ -Element.update('tab-content-memberships', '<%= escape_javascript(render :partial => 'groups/memberships') %>'); +$('#tab-content-memberships').html('<%= escape_javascript(render :partial => 'groups/memberships') %>'); diff --git a/app/views/groups/edit_membership.js.erb b/app/views/groups/edit_membership.js.erb index b693a7f90..6df0fbba9 100644 --- a/app/views/groups/edit_membership.js.erb +++ b/app/views/groups/edit_membership.js.erb @@ -1,6 +1,6 @@ <% if @membership.valid? %> - Element.update('tab-content-memberships', '<%= escape_javascript(render :partial => 'groups/memberships') %>'); - new Effect.Highlight('member-<%= @membership.id %>'); + $('#tab-content-memberships').html('<%= escape_javascript(render :partial => 'groups/memberships') %>'); + $('#member-<%= @membership.id %>').effect("highlight"); <% else %> alert('<%= escape_javascript(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', '))) %>'); <% end %> diff --git a/app/views/groups/remove_user.js.erb b/app/views/groups/remove_user.js.erb index b383830b2..88daa8f58 100644 --- a/app/views/groups/remove_user.js.erb +++ b/app/views/groups/remove_user.js.erb @@ -1 +1 @@ -Element.update('tab-content-users', '<%= escape_javascript(render :partial => 'groups/users') %>'); +$('#tab-content-users').html('<%= escape_javascript(render :partial => 'groups/users') %>'); diff --git a/app/views/issue_categories/create.js.erb b/app/views/issue_categories/create.js.erb index b9cc577aa..c4253b98e 100644 --- a/app/views/issue_categories/create.js.erb +++ b/app/views/issue_categories/create.js.erb @@ -1,3 +1,3 @@ hideModal(); <% select = content_tag('select', content_tag('option') + options_from_collection_for_select(@project.issue_categories, 'id', 'name', @category.id), :id => 'issue_category_id', :name => 'issue[category_id]') %> -Element.replace('issue_category_id', '<%= escape_javascript(select) %>'); +$('#issue_category_id').replaceWith('<%= escape_javascript(select) %>'); diff --git a/app/views/issue_categories/new.js.erb b/app/views/issue_categories/new.js.erb index 2a28e3863..0d623495e 100644 --- a/app/views/issue_categories/new.js.erb +++ b/app/views/issue_categories/new.js.erb @@ -1,3 +1,2 @@ -Element.update('ajax-modal', '<%= escape_javascript(render :partial => 'issue_categories/new_modal') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'issue_categories/new_modal') %>'); showModal('ajax-modal', '600px'); -Form.Element.focus('issue_category_name'); diff --git a/app/views/issue_relations/_form.html.erb b/app/views/issue_relations/_form.html.erb index d4feb540e..efd58b3ee 100644 --- a/app/views/issue_relations/_form.html.erb +++ b/app/views/issue_relations/_form.html.erb @@ -9,7 +9,6 @@ <%= toggle_link l(:button_cancel), 'new-relation-form'%> </p> -<div id="related_issue_candidates" class="autocomplete"></div> -<%= javascript_tag "observeRelatedIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %> +<%= javascript_tag "observeAutocompleteField('relation_issue_to_id', '#{escape_javascript auto_complete_issues_path(:id => @issue, :project_id => @project, :scope => 'all')}')" %> <%= javascript_tag "setPredecessorFieldsVisibility();" %> diff --git a/app/views/issue_relations/create.js.erb b/app/views/issue_relations/create.js.erb index a2446ab7f..03ba21975 100644 --- a/app/views/issue_relations/create.js.erb +++ b/app/views/issue_relations/create.js.erb @@ -1,5 +1,6 @@ -Element.update('relations', '<%= escape_javascript(render :partial => 'issues/relations') %>'); +$('#relations').html('<%= escape_javascript(render :partial => 'issues/relations') %>'); <% if @relation.errors.empty? %> - $('relation_delay').value = '' - $('relation_issue_to_id').value = '' + $('#relation_delay').val(''); + $('#relation_issue_to_id').val(''); + $('#relation_issue_to_id').focus(); <% end %> diff --git a/app/views/issue_relations/destroy.js.erb b/app/views/issue_relations/destroy.js.erb index f3a03d18f..f5f29d31d 100644 --- a/app/views/issue_relations/destroy.js.erb +++ b/app/views/issue_relations/destroy.js.erb @@ -1 +1 @@ -Element.remove('<%= "relation-#{@relation.id}" %>'); +$('#relation-<%= @relation.id %>').remove(); diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index ac2db0d65..a80fac9ce 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -3,9 +3,8 @@ <div class="splitcontent"> <div class="splitcontentleft"> <% if @issue.safe_attribute? 'status_id' %> -<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> -<%= observe_field :issue_status_id, :url => project_issue_form_path(@project, :id => @issue), - :with => "Form.serialize('issue-form')" %> +<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true}, + :onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p> <% else %> <p><label><%= l(:field_status) %></label> <%= h(@issue.status.name) %></p> @@ -44,8 +43,7 @@ <div class="splitcontentright"> <% if @issue.safe_attribute? 'parent_issue_id' %> <p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10, :required => @issue.required_attribute?('parent_issue_id') %></p> -<div id="parent_issue_candidates" class="autocomplete"></div> -<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @issue.project) }')" %> +<%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:id => @issue, :project_id => @issue.project)}')" %> <% end %> <% if @issue.safe_attribute? 'start_date' %> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 4a13fa07a..712bb1188 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -8,15 +8,13 @@ <% end %> <% if @issue.safe_attribute? 'project_id' %> -<p><%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), :required => true %></p> -<%= observe_field :issue_project_id, :url => project_issue_form_path(@project, :id => @issue), - :with => "Form.serialize('issue-form')" %> +<p><%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true}, + :onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p> <% end %> <% if @issue.safe_attribute? 'tracker_id' %> -<p><%= f.select :tracker_id, @issue.project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p> -<%= observe_field :issue_tracker_id, :url => project_issue_form_path(@project, :id => @issue), - :with => "Form.serialize('issue-form')" %> +<p><%= f.select :tracker_id, @issue.project.trackers.collect {|t| [t.name, t.id]}, {:required => true}, + :onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p> <% end %> <% if @issue.safe_attribute? 'subject' %> @@ -26,8 +24,7 @@ <% if @issue.safe_attribute? 'description' %> <p> <%= f.label_for_field :description, :required => @issue.required_attribute?('description') %> - <%= link_to_function image_tag('edit.png'), - 'Element.hide(this); Effect.toggle("issue_description_and_toolbar", "appear", {duration:0.3})' unless @issue.new_record? %> + <%= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %> <%= content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %> <%= f.text_area :description, :cols => 60, diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 62cf4e443..59f596452 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -3,7 +3,7 @@ <div class="autoscroll"> <table class="list issues"> <thead><tr> - <th class="checkbox hide-when-print"><%= link_to image_tag('toggle_check.png'), {}, :onclick => 'toggleIssuesSelection(Element.up(this, "form")); return false;', + <th class="checkbox hide-when-print"><%= link_to image_tag('toggle_check.png'), {}, :onclick => 'toggleIssuesSelection(this); return false;', :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> </th> <%= sort_header_tag('id', :caption => '#', :default_order => 'desc') %> diff --git a/app/views/issues/_relations.html.erb b/app/views/issues/_relations.html.erb index 3d661ba00..cb7e0e15e 100644 --- a/app/views/issues/_relations.html.erb +++ b/app/views/issues/_relations.html.erb @@ -35,7 +35,6 @@ :as => :relation, :remote => true, :url => {:controller => 'issue_relations', :action => 'create', :issue_id => @issue}, :method => :post, - :complete => "Form.Element.focus('relation_issue_to_id');", :html => {:id => 'new-relation-form', :style => (@relation ? '' : 'display: none;')} } do |f| %> <%= render :partial => 'issue_relations/form', :locals => {:f => f}%> diff --git a/app/views/issues/_update_form.js.erb b/app/views/issues/_update_form.js.erb index 89429fc20..46fc9722e 100644 --- a/app/views/issues/_update_form.js.erb +++ b/app/views/issues/_update_form.js.erb @@ -1,9 +1,7 @@ -Element.update('all_attributes', '<%= escape_javascript(render :partial => 'form') %>'); +$('#all_attributes').html('<%= escape_javascript(render :partial => 'form') %>'); -if ($('log_time')) { - <% if User.current.allowed_to?(:log_time, @issue.project) %> - Element.show('log_time'); - <% else %> - Element.hide('log_time'); - <% end %> -} +<% if User.current.allowed_to?(:log_time, @issue.project) %> + $('#log_time').show(); +<% else %> + $('#log_time').hide(); +<% end %> diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index 63bc1f7df..1312aa303 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -17,11 +17,9 @@ <% if @allowed_projects.present? %> <p> <label for="issue_project_id"><%= l(:field_project) %></label> - <%= select_tag('issue[project_id]', content_tag('option', l(:label_no_change_option), :value => '') + project_tree_options_for_select(@allowed_projects, :selected => @target_project)) %> + <%= select_tag('issue[project_id]', content_tag('option', l(:label_no_change_option), :value => '') + project_tree_options_for_select(@allowed_projects, :selected => @target_project), + :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %> </p> -<%= observe_field :issue_project_id, :url => {:action => 'bulk_edit'}, - :update => 'content', - :with => "Form.serialize('bulk_edit_form')" %> <% end %> <p> <label for="issue_tracker_id"><%= l(:field_tracker) %></label> @@ -97,8 +95,7 @@ <label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label> <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10 %> </p> -<div id="parent_issue_candidates" class="autocomplete"></div> -<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:project_id => @project) }')" %> +<%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project)}')" %> <% end %> <% if @safe_attributes.include?('start_date') %> diff --git a/app/views/issues/bulk_edit.js.erb b/app/views/issues/bulk_edit.js.erb new file mode 100644 index 000000000..98cdb8b82 --- /dev/null +++ b/app/views/issues/bulk_edit.js.erb @@ -0,0 +1 @@ +$('#content').html('<%= escape_javascript(render :template => 'issues/bulk_edit.html') %>'); diff --git a/app/views/issues/destroy.html.erb b/app/views/issues/destroy.html.erb index a8ca78826..02d842c3b 100644 --- a/app/views/issues/destroy.html.erb +++ b/app/views/issues/destroy.html.erb @@ -7,8 +7,8 @@ <p> <label><%= radio_button_tag 'todo', 'destroy', true %> <%= l(:text_destroy_time_entries) %></label><br /> <label><%= radio_button_tag 'todo', 'nullify', false %> <%= l(:text_assign_time_entries_to_project) %></label><br /> -<label><%= radio_button_tag 'todo', 'reassign', false, :onchange => 'if (this.checked) { $("reassign_to_id").focus(); }' %> <%= l(:text_reassign_time_entries) %></label> -<%= text_field_tag 'reassign_to_id', params[:reassign_to_id], :size => 6, :onfocus => '$("todo_reassign").checked=true;' %> +<label><%= radio_button_tag 'todo', 'reassign', false, :onchange => 'if (this.checked) { $("#reassign_to_id").focus(); }' %> <%= l(:text_reassign_time_entries) %></label> +<%= text_field_tag 'reassign_to_id', params[:reassign_to_id], :size => 6, :onfocus => '$("#todo_reassign").attr("checked", true);' %> </p> </div> <%= submit_tag l(:button_apply) %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 8e9b81fdc..d7679d65a 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -44,7 +44,7 @@ <%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %> <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %> <%= link_to_function l(:button_save), - "$('query_form').action='#{ @project ? new_project_query_path(@project) : new_query_path }'; submit_query_form('query_form')", + "$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }'); submit_query_form('query_form')", :class => 'icon icon-save' %> <% end %> </p> diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 1db43d726..8fdb9d854 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -39,7 +39,7 @@ <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form' %> - <%= javascript_tag "Form.Element.focus('issue_subject');" %> + <%= javascript_tag "$('#issue_subject').focus();" %> <% end %> <div id="preview" class="wiki"></div> diff --git a/app/views/journals/_notes_form.html.erb b/app/views/journals/_notes_form.html.erb index 5e02df1ca..63b87883a 100644 --- a/app/views/journals/_notes_form.html.erb +++ b/app/views/journals/_notes_form.html.erb @@ -11,8 +11,7 @@ <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @journal.issue), "journal-#{@journal.id}-form", "journal_#{@journal.id}_preview" %> | - <%= link_to l(:button_cancel), '#', :onclick => "Element.remove('journal-#{@journal.id}-form'); " + - "Element.show('journal-#{@journal.id}-notes'); return false;" %></p> + <%= link_to l(:button_cancel), '#', :onclick => "$('#journal-#{@journal.id}-form').remove(); $('#journal-#{@journal.id}-notes').show(); return false;" %></p> <div id="journal_<%= @journal.id %>_preview" class="wiki"></div> <% end %> diff --git a/app/views/journals/edit.js.erb b/app/views/journals/edit.js.erb index 18d85a4ce..73b8082a4 100644 --- a/app/views/journals/edit.js.erb +++ b/app/views/journals/edit.js.erb @@ -1,2 +1,2 @@ -Element.hide("journal-<%= @journal.id %>-notes"); -Element.insert("journal-<%= @journal.id %>-notes", {'after': '<%= escape_javascript(render :partial => 'notes_form') %>'}); +$("#journal-<%= @journal.id %>-notes").hide(); +$("#journal-<%= @journal.id %>-notes").after('<%= escape_javascript(render :partial => 'notes_form') %>'); diff --git a/app/views/journals/new.js.erb b/app/views/journals/new.js.erb index e2e6590ae..677bb8d63 100644 --- a/app/views/journals/new.js.erb +++ b/app/views/journals/new.js.erb @@ -1,5 +1,3 @@ -$('notes').value = "<%= raw escape_javascript(@content) %>"; -Element.show('update'); -Form.Element.focus('notes'); -Element.scrollTo('update'); -$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight; +$('#notes').val("<%= raw escape_javascript(@content) %>"); +showAndScrollTo("update", "notes"); +$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight; diff --git a/app/views/journals/update.js.erb b/app/views/journals/update.js.erb index 9b16273ab..65c198d59 100644 --- a/app/views/journals/update.js.erb +++ b/app/views/journals/update.js.erb @@ -1,9 +1,9 @@ <% if @journal.frozen? %> - Element.remove("change-<%= @journal.id %>"); + $("#change-<%= @journal.id %>").remove(); <% else %> - Element.replace("journal-<%= @journal.id %>-notes", '<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>'); - Element.show("journal-<%= @journal.id %>-notes"); - Element.remove("journal-<%= @journal.id %>-form"); + $("#journal-<%= @journal.id %>-notes").replaceWith('<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>'); + $("#journal-<%= @journal.id %>-notes").show(); + $("#journal-<%= @journal.id %>-form").remove(); <% end %> <%= call_hook(:view_journals_update_js_bottom, { :journal => @journal }) %> diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 57470c2c5..83cbd7786 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -8,7 +8,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" /> <%= csrf_meta_tag %> <%= favicon %> -<%= stylesheet_link_tag 'application', :media => 'all' %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.8.21', 'application', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> diff --git a/app/views/members/create.js.erb b/app/views/members/create.js.erb index c56390fd4..7ca4930b5 100644 --- a/app/views/members/create.js.erb +++ b/app/views/members/create.js.erb @@ -1,9 +1,9 @@ -Element.update('tab-content-members', '<%= escape_javascript(render :partial => 'projects/settings/members') %>'); +$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); hideOnLoad(); <% if @members.present? && @members.all? {|m| m.valid? } %> <% @members.each do |member| %> - new Effect.Highlight("member-<%= member.id %>"); + $("#member-<%= member.id %>").effect("highlight"); <% end %> <% else %> <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %> diff --git a/app/views/members/destroy.js.erb b/app/views/members/destroy.js.erb index ad7ac38d1..17beff44c 100644 --- a/app/views/members/destroy.js.erb +++ b/app/views/members/destroy.js.erb @@ -1,2 +1,2 @@ -Element.update('tab-content-members', '<%= escape_javascript(render :partial => 'projects/settings/members') %>'); +$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); hideOnLoad(); diff --git a/app/views/members/update.js.erb b/app/views/members/update.js.erb index 01eac2bcd..245828aac 100644 --- a/app/views/members/update.js.erb +++ b/app/views/members/update.js.erb @@ -1,3 +1,3 @@ -Element.update('tab-content-members', '<%= escape_javascript(render :partial => 'projects/settings/members') %>'); +$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); hideOnLoad(); -new Effect.Highlight("member-<%= @member.id %>"); +$("#member-<%= @member.id %>").effect("highlight"); diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index 706aa3a72..fe4bed91a 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -1,6 +1,4 @@ -$('message_subject').value = "<%= raw escape_javascript(@subject) %>"; -$('message_content').value = "<%= raw escape_javascript(@content) %>"; -Element.show('reply'); -Form.Element.focus('message_content'); -Element.scrollTo('reply'); -$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight; +$('#message_subject').val("<%= raw escape_javascript(@subject) %>"); +$('#message_content').val("<%= raw escape_javascript(@content) %>"); +showAndScrollTo("reply", "message_content"); +$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight; diff --git a/app/views/my/page_layout.html.erb b/app/views/my/page_layout.html.erb index a4d1888ba..4a60d97e1 100644 --- a/app/views/my/page_layout.html.erb +++ b/app/views/my/page_layout.html.erb @@ -5,7 +5,7 @@ <%= select_tag 'block', content_tag('option') + options_for_select(@block_options), :id => "block-select" %> - <%= link_to l(:button_add), '#', :onclick => '$("block-form").submit()', :class => 'icon icon-add' %> + <%= link_to l(:button_add), '#', :onclick => '$("#block-form").submit()', :class => 'icon icon-add' %> <% end %> <% end %> <%= link_to l(:button_back), {:action => 'page'}, :class => 'icon icon-cancel' %> @@ -34,34 +34,8 @@ <% end if @blocks['right'] %> </div> -<%= sortable_element 'list-top', - :tag => 'div', - :only => 'mypage-box', - :handle => "handle", - :dropOnEmpty => true, - :containment => ['list-top', 'list-left', 'list-right'], - :constraint => false, - :url => { :action => "order_blocks", :group => "top" } - %> - -<%= sortable_element 'list-left', - :tag => 'div', - :only => 'mypage-box', - :handle => "handle", - :dropOnEmpty => true, - :containment => ['list-top', 'list-left', 'list-right'], - :constraint => false, - :url => { :action => "order_blocks", :group => "left" } - %> - -<%= sortable_element 'list-right', - :tag => 'div', - :only => 'mypage-box', - :handle => "handle", - :dropOnEmpty => true, - :containment => ['list-top', 'list-left', 'list-right'], - :constraint => false, - :url => { :action => "order_blocks", :group => "right" } - %> +<%= javascript_tag "initMyPageSortable('top', '#{ escape_javascript url_for(:action => "order_blocks", :group => "top") }');" %> +<%= javascript_tag "initMyPageSortable('left', '#{ escape_javascript url_for(:action => "order_blocks", :group => "left") }');" %> +<%= javascript_tag "initMyPageSortable('right', '#{ escape_javascript url_for(:action => "order_blocks", :group => "right") }');" %> <% html_title(l(:label_my_page)) -%> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index e62cce498..38eecd262 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -2,7 +2,7 @@ <%= link_to(l(:label_news_new), new_project_news_path(@project), :class => 'icon icon-add', - :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %> + :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %> </div> <div id="add-news" style="display:none;"> @@ -12,7 +12,7 @@ <%= render :partial => 'news/form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | -<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %> +<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' %> <% end if @project %> <div id="preview" class="wiki"></div> </div> diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index 51a896e12..295aecfb2 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -4,7 +4,7 @@ edit_news_path(@news), :class => 'icon icon-edit', :accesskey => accesskey(:edit), - :onclick => 'Element.show("edit-news"); return false;') if User.current.allowed_to?(:manage_news, @project) %> + :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %> <%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @project) %> </div> @@ -17,7 +17,7 @@ <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | -<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %> +<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;' %> <% end %> <div id="preview" class="wiki"></div> </div> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 062073c5d..58d8192ce 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -4,5 +4,5 @@ <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> -<%= javascript_tag "Form.Element.focus('project_name');" %> +<%= javascript_tag "$('#project_name').focus();" %> <% end %> diff --git a/app/views/projects/settings/_members.html.erb b/app/views/projects/settings/_members.html.erb index 83fd3ae3f..fa7999687 100644 --- a/app/views/projects/settings/_members.html.erb +++ b/app/views/projects/settings/_members.html.erb @@ -29,13 +29,13 @@ <%= hidden_field_tag 'membership[role_ids][]', '' %> <p><%= submit_tag l(:button_change), :class => "small" %> <%= link_to_function l(:button_cancel), - "$('member-#{member.id}-roles').show(); $('member-#{member.id}-roles-form').hide(); return false;" + "$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;" %></p> <% end %> </td> <td class="buttons"> <%= link_to_function l(:button_edit), - "$('member-#{member.id}-roles').hide(); $('member-#{member.id}-roles-form').show(); return false;", + "$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %> <%= delete_link membership_path(member), :remote => true, @@ -55,23 +55,11 @@ <div class="splitcontentright"> <% if roles.any? && principals.any? %> - <%= form_for(@member, {:as => :membership, :remote => true, - :url => project_memberships_path(@project), :method => :post, - :loading => '$(\'member-add-submit\').disable();', - :complete => 'if($(\'member-add-submit\')) $(\'member-add-submit\').enable();' - } ) do |f| %> + <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> <fieldset><legend><%=l(:label_member_new)%></legend> <p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p> - <%= observe_field(:principal_search, - :frequency => 0.5, - :update => :principals, - :url => autocomplete_project_memberships_path(@project), - :method => :get, - :before => '$("principal_search").addClassName("ajax-loading")', - :complete => '$("principal_search").removeClassName("ajax-loading")', - :with => 'q') - %> + <%= javascript_tag "observeSearchfield('principal_search', 'principals', '#{ escape_javascript autocomplete_project_memberships_path(@project) }')" %> <div id="principals"> <%= principals_check_box_tags 'membership[user_ids][]', principals %> diff --git a/app/views/queries/_filters.html.erb b/app/views/queries/_filters.html.erb index 5bc6af2f3..d9f91ce2e 100644 --- a/app/views/queries/_filters.html.erb +++ b/app/views/queries/_filters.html.erb @@ -50,4 +50,4 @@ </tr> </table> <%= hidden_field_tag 'f[]', '' %> -<%= javascript_tag 'Event.observe(window,"load",apply_filters_observer);' %> +<%= javascript_tag '$(document).ready(function(){observeIssueFilters();});' %> diff --git a/app/views/queries/_form.html.erb b/app/views/queries/_form.html.erb index ba8c58070..76ce35ebe 100644 --- a/app/views/queries/_form.html.erb +++ b/app/views/queries/_form.html.erb @@ -8,7 +8,7 @@ <% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @project) %> <p><label for="query_is_public"><%=l(:field_is_public)%></label> <%= check_box 'query', 'is_public', - :onchange => (User.current.admin? ? nil : 'if (this.checked) {$("query_is_for_all").checked = false; $("query_is_for_all").disabled = true;} else {$("query_is_for_all").disabled = false;}') %></p> + :onchange => (User.current.admin? ? nil : 'if (this.checked) {$("#query_is_for_all").removeAttr("checked"); $("#query_is_for_all").attr("disabled", true);} else {$("#query_is_for_all").removeAttr("disabled");}') %></p> <% end %> <p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label> @@ -17,7 +17,7 @@ <p><label for="query_default_columns"><%=l(:label_default_columns)%></label> <%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns', - :onclick => 'if (this.checked) {Element.hide("columns")} else {Element.show("columns")}' %></p> + :onclick => 'if (this.checked) {$("#columns").hide();} else {$("#columns").show();}' %></p> <p><label for="query_group_by"><%= l(:field_group_by) %></label> <%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p> diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index 8ad228ded..e1eddb0cf 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -7,22 +7,14 @@ <td style="padding-left: <%=18 * depth%>px;" class="<%= @repository.report_last_commit ? "filename" : "filename_no_report" %>";> <% if entry.is_dir? %> -<span class="expander" onclick="<%= remote_function( - :url => { +<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for( :action => 'show', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev, :depth => (depth + 1), - :parent_id => tr_id - }, - :method => :get, - :update => { :success => tr_id }, - :position => :after, - :success => "scmEntryLoaded('#{tr_id}')", - :condition => "scmEntryClick('#{tr_id}')" - ) %>"> </span> + :parent_id => tr_id)) %>');"> </span> <% end %> <%= link_to h(ent_name), {:action => (entry.is_dir? ? 'show' : 'changes'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev}, diff --git a/app/views/repositories/_related_issues.html.erb b/app/views/repositories/_related_issues.html.erb index 961e5ad6b..bc843b3ec 100644 --- a/app/views/repositories/_related_issues.html.erb +++ b/app/views/repositories/_related_issues.html.erb @@ -29,7 +29,6 @@ :id => @project, :repository_id => @repository.identifier_param, :rev => @changeset.identifier}, :method => :post, - :complete => "Form.Element.focus('issue_id');", :html => {:id => 'new-relation-form', :style => (@issue ? '' : 'display: none;')}) do |f| %> <%= l(:label_issue) %> #<%= text_field_tag 'issue_id', '', :size => 10 %> <%= submit_tag l(:button_add) %> diff --git a/app/views/repositories/_revision_graph.html.erb b/app/views/repositories/_revision_graph.html.erb index a26682f27..9ab4b1e5a 100644 --- a/app/views/repositories/_revision_graph.html.erb +++ b/app/views/repositories/_revision_graph.html.erb @@ -2,17 +2,16 @@ <%= javascript_include_tag 'revision_graph.js' %> <script type="text/javascript" charset="utf-8"> +function revisionGraphHandler(){ + drawRevisionGraph( + document.getElementById('holder'), + <%= commits.to_json.html_safe %>, + <%= space %> + ); +} - ['load', 'resize'].each(function(window_event) { - - Event.observe(window, window_event, function(){ - - drawRevisionGraph( - document.getElementById('holder'), - <%= commits.to_json.html_safe %>, - <%= space %>); - }); - }); +$(document).ready(revisionGraphHandler); +$(window).resize(revisionGraphHandler); </script> <div id="holder" class="revision-graph"></div> diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index 3833e9788..844c06500 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -37,8 +37,8 @@ end %> <%= content_tag(:td, :class => 'id', :style => id_style) do %> <%= link_to_revision(changeset, @repository) %> <% end %> -<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td> -<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td> +<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td> +<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td> <td class="committed_on"><%= format_time(changeset.committed_on) %></td> <td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td> <td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td> diff --git a/app/views/repositories/add_related_issue.js.erb b/app/views/repositories/add_related_issue.js.erb index 66740af7f..bc156ebc2 100644 --- a/app/views/repositories/add_related_issue.js.erb +++ b/app/views/repositories/add_related_issue.js.erb @@ -1,6 +1,7 @@ <% if @issue %> - Element.update('related-issues', '<%= escape_javascript(render :partial => "related_issues") %>'); - Effect.highlight('related-issue-<%= @issue.id %>'); + $('#related-issues').html('<%= escape_javascript(render :partial => "related_issues") %>'); + $('#related-issue-<%= @issue.id %>').effect("highlight"); + $('#issue_id').focus(); <% else %> alert("<%= escape_javascript(l(:label_issue) + ' ' + l('activerecord.errors.messages.invalid')) %>"); <% end %> diff --git a/app/views/repositories/edit.html.erb b/app/views/repositories/edit.html.erb index 9a9443b8a..21926158f 100644 --- a/app/views/repositories/edit.html.erb +++ b/app/views/repositories/edit.html.erb @@ -1,5 +1,5 @@ <h2><%= l(:label_repository) %></h2> -<%= labelled_form_for :repository, @repository, :url => repository_path(@repository), :html => {:method => :put} do |f| %> +<%= labelled_form_for :repository, @repository, :url => repository_path(@repository), :html => {:method => :put, :id => 'repository-form'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> diff --git a/app/views/repositories/new.html.erb b/app/views/repositories/new.html.erb index 9f40c542f..df2b2c6bf 100644 --- a/app/views/repositories/new.html.erb +++ b/app/views/repositories/new.html.erb @@ -1,5 +1,5 @@ <h2><%= l(:label_repository_new) %></h2> -<%= labelled_form_for :repository, @repository, :url => project_repositories_path(@project) do |f| %> +<%= labelled_form_for :repository, @repository, :url => project_repositories_path(@project), :html => {:id => 'repository-form'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> diff --git a/app/views/repositories/new.js.erb b/app/views/repositories/new.js.erb new file mode 100644 index 000000000..d62580b05 --- /dev/null +++ b/app/views/repositories/new.js.erb @@ -0,0 +1 @@ +$('#content').html('<%= escape_javascript(render :template => 'repositories/new.html') %>'); diff --git a/app/views/repositories/remove_related_issue.js.erb b/app/views/repositories/remove_related_issue.js.erb index 6fb62cdee..c4dc0e974 100644 --- a/app/views/repositories/remove_related_issue.js.erb +++ b/app/views/repositories/remove_related_issue.js.erb @@ -1 +1 @@ -Element.remove('related-issue-<%= @issue.id %>'); +$('#related-issue-<%= @issue.id %>').remove(); diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 6c9c56f4c..bf3951263 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -4,7 +4,7 @@ <%= form_tag({}, :method => :get) do %> <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %> <p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %> -<%= javascript_tag "Field.focus('search-input')" %> +<%= javascript_tag "$('#search-input').focus()" %> <%= project_select_tag %> <%= hidden_field_tag 'all_words', '', :id => nil %> <label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label> diff --git a/app/views/settings/_mail_handler.html.erb b/app/views/settings/_mail_handler.html.erb index e4ddf5e99..1051436b5 100644 --- a/app/views/settings/_mail_handler.html.erb +++ b/app/views/settings/_mail_handler.html.erb @@ -9,12 +9,12 @@ <div class="box tabular settings"> <p><%= setting_check_box :mail_handler_api_enabled, - :onclick => "if (this.checked) { Form.Element.enable('settings_mail_handler_api_key'); } else { Form.Element.disable('settings_mail_handler_api_key'); }"%></p> + :onclick => "if (this.checked) { $('#settings_mail_handler_api_key').removeAttr('disabled'); } else { $('#settings_mail_handler_api_key').attr('disabled', true); }"%></p> <p><%= setting_text_field :mail_handler_api_key, :size => 30, :id => 'settings_mail_handler_api_key', :disabled => !Setting.mail_handler_api_enabled? %> - <%= link_to_function l(:label_generate_key), "if ($('settings_mail_handler_api_key').disabled == false) { $('settings_mail_handler_api_key').value = randomKey(20) }" %> + <%= link_to_function l(:label_generate_key), "if (!$('#settings_mail_handler_api_key').attr('disabled')) { $('#settings_mail_handler_api_key').val(randomKey(20)) }" %> </p> </div> diff --git a/app/views/settings/_repositories.html.erb b/app/views/settings/_repositories.html.erb index d63c1db45..6998cce50 100644 --- a/app/views/settings/_repositories.html.erb +++ b/app/views/settings/_repositories.html.erb @@ -49,7 +49,7 @@ <p><%= setting_check_box :sys_api_enabled, :onclick => - "if (this.checked) { Form.Element.enable('settings_sys_api_key'); } else { Form.Element.disable('settings_sys_api_key'); }" %></p> + "if (this.checked) { $('#settings_sys_api_key').removeAttr('disabled'); } else { $('#settings_sys_api_key').attr('disabled', true); }" %></p> <p><%= setting_text_field :sys_api_key, :size => 30, @@ -57,7 +57,7 @@ :disabled => !Setting.sys_api_enabled?, :label => :setting_mail_handler_api_key %> <%= link_to_function l(:label_generate_key), - "if ($('settings_sys_api_key').disabled == false) { $('settings_sys_api_key').value = randomKey(20) }" %> + "if (!$('#settings_sys_api_key').attr('disabled')) { $('#settings_sys_api_key').val(randomKey(20)) }" %> </p> <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p> @@ -85,7 +85,7 @@ <p><%= setting_check_box :commit_logtime_enabled, :onclick => - "if (this.checked) { Form.Element.enable('settings_commit_logtime_activity_id'); } else { Form.Element.disable('settings_commit_logtime_activity_id'); }"%></p> + "if (this.checked) { $('#settings_commit_logtime_activity_id').removeAttr('disabled'); } else { $('#settings_commit_logtime_activity_id').attr('disabled', true); }"%></p> <p><%= setting_select :commit_logtime_activity_id, [[l(:label_default), 0]] + diff --git a/app/views/timelog/_date_range.html.erb b/app/views/timelog/_date_range.html.erb index 086f78bc2..7c5523871 100644 --- a/app/views/timelog/_date_range.html.erb +++ b/app/views/timelog/_date_range.html.erb @@ -3,16 +3,16 @@ <div> <p> <%= label_tag "period_type_list", l(:description_date_range_list), :class => "hidden-for-sighted" %> -<%= radio_button_tag 'period_type', '1', !@free_period, :onclick => 'Form.Element.disable("from");Form.Element.disable("to");Form.Element.enable("period");', :id => "period_type_list"%> +<%= radio_button_tag 'period_type', '1', !@free_period, :onclick => '$("#from,#to").attr("disabled", true);$("#period").removeAttr("disabled");', :id => "period_type_list"%> <%= select_tag 'period', options_for_period_select(params[:period]), :onchange => 'this.form.submit();', - :onfocus => '$("period_type_1").checked = true;', + :onfocus => '$("#period_type_1").attr("checked", true);', :disabled => @free_period %> </p> <p> <%= label_tag "period_type_interval", l(:description_date_range_interval), :class => "hidden-for-sighted" %> -<%= radio_button_tag 'period_type', '2', @free_period, :onclick => 'Form.Element.enable("from");Form.Element.enable("to");Form.Element.disable("period");', :id => "period_type_interval" %> -<span onclick="$('period_type_interval').checked = true;Form.Element.enable('from');Form.Element.enable('to');Form.Element.disable('period');"> +<%= radio_button_tag 'period_type', '2', @free_period, :onclick => '$("#from,#to").removeAttr("disabled");$("#period").attr("disabled", true);', :id => "period_type_interval" %> +<span onclick="$('#period_type_interval').attr('checked', true);$('#from,#to').removeAttr('disabled');$('#period').attr('disabled', true);"> <%= l(:label_date_from_to, :start => ((label_tag "from", l(:description_date_from), :class => "hidden-for-sighted") + text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')), @@ -23,7 +23,7 @@ </div> </fieldset> <p class="buttons"> - <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %> + <%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %> <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %> </p> diff --git a/app/views/timelog/_list.html.erb b/app/views/timelog/_list.html.erb index 65a9000eb..764e622dd 100644 --- a/app/views/timelog/_list.html.erb +++ b/app/views/timelog/_list.html.erb @@ -7,7 +7,7 @@ <th class="checkbox hide-when-print"> <%= link_to image_tag('toggle_check.png'), {}, - :onclick => 'toggleIssuesSelection(Element.up(this, "form")); return false;', + :onclick => 'toggleIssuesSelection(this); return false;', :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> </th> <%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %> diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 96c8f04f1..ddc826fa8 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -25,7 +25,7 @@ <fieldset class="box tabular"> <legend><%=l(:label_authentication)%></legend> <% unless @auth_sources.empty? %> - <p><%= f.select :auth_source_id, ([[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] }), {}, :onchange => "if (this.value=='') {Element.show('password_fields');} else {Element.hide('password_fields');}" %></p> + <p><%= f.select :auth_source_id, ([[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] }), {}, :onchange => "if (this.value=='') {$('#password_fields').show();} else {$('#password_fields').hide();}" %></p> <% end %> <div id="password_fields" style="<%= 'display:none;' if @user.auth_source %>"> <p><%= f.password_field :password, :required => true, :size => 25 %> diff --git a/app/views/users/_mail_notifications.html.erb b/app/views/users/_mail_notifications.html.erb index 85c3e2ecf..9a6022b17 100644 --- a/app/views/users/_mail_notifications.html.erb +++ b/app/views/users/_mail_notifications.html.erb @@ -4,7 +4,7 @@ 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification), - :onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' + :onchange => 'if (this.value == "selected") {$("#notified-projects").show();} else {$("#notified-projects").hide();}' ) %> </p> <%= content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %> diff --git a/app/views/users/_memberships.html.erb b/app/views/users/_memberships.html.erb index 758064608..9a8241cb1 100644 --- a/app/views/users/_memberships.html.erb +++ b/app/views/users/_memberships.html.erb @@ -30,13 +30,13 @@ <%= hidden_field_tag 'membership[role_ids][]', '' %> <p><%= submit_tag l(:button_change) %> <%= link_to_function l(:button_cancel), - "$('member-#{membership.id}-roles').show(); $('member-#{membership.id}-roles-form').hide(); return false;" + "$('#member-#{membership.id}-roles').show(); $('#member-#{membership.id}-roles-form').hide(); return false;" %></p> <% end %> </td> <td class="buttons"> <%= link_to_function l(:button_edit), - "$('member-#{membership.id}-roles').hide(); $('member-#{membership.id}-roles-form').show(); return false;", + "$('#member-#{membership.id}-roles').hide(); $('#member-#{membership.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %> <%= delete_link user_membership_path(@user, membership), :remote => true if membership.deletable? %> diff --git a/app/views/users/destroy_membership.js.erb b/app/views/users/destroy_membership.js.erb index af06d5bed..53b769a73 100644 --- a/app/views/users/destroy_membership.js.erb +++ b/app/views/users/destroy_membership.js.erb @@ -1 +1 @@ -Element.update('tab-content-memberships', '<%= escape_javascript(render :partial => 'users/memberships') %>'); +$('#tab-content-memberships').html('<%= escape_javascript(render :partial => 'users/memberships') %>'); diff --git a/app/views/users/edit_membership.js.erb b/app/views/users/edit_membership.js.erb index ee33799e5..94507567f 100644 --- a/app/views/users/edit_membership.js.erb +++ b/app/views/users/edit_membership.js.erb @@ -1,6 +1,6 @@ <% if @membership.valid? %> - Element.update("tab-content-memberships", '<%= escape_javascript(render :partial => 'users/memberships') %>'); - new Effect.Highlight("member-<%= @membership.id %>") + $('#tab-content-memberships').html('<%= escape_javascript(render :partial => 'users/memberships') %>'); + $("#member-<%= @membership.id %>").effect("highlight"); <% else %> alert('<%= escape_javascript l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', ')) %>'); <% end %> diff --git a/app/views/versions/_issue_counts.html.erb b/app/views/versions/_issue_counts.html.erb index e4bb6e666..d4b33255c 100644 --- a/app/views/versions/_issue_counts.html.erb +++ b/app/views/versions/_issue_counts.html.erb @@ -5,8 +5,7 @@ select_tag('status_by', status_by_options_for_select(criteria), :id => 'status_by_select', - :onchange => remote_function(:url => status_by_version_path(version), - :with => "Form.serialize('status_by_form')"))).html_safe %> + :data => {:remote => true, :method => 'post', :url => status_by_version_path(version)})).html_safe %> </legend> <% if counts.empty? %> <p><em><%= l(:label_no_data) %></em></p> diff --git a/app/views/versions/create.js.erb b/app/views/versions/create.js.erb index 01720bf90..e6e0bec45 100644 --- a/app/views/versions/create.js.erb +++ b/app/views/versions/create.js.erb @@ -1,3 +1,3 @@ hideModal(); <% select = content_tag('select', content_tag('option') + version_options_for_select(@project.shared_versions.open, @version), :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]') %> -Element.replace('issue_fixed_version_id', '<%= escape_javascript(select) %>'); +$('#issue_fixed_version_id').replaceWith('<%= escape_javascript(select) %>'); diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index d8ac53401..a05320ac5 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -54,7 +54,7 @@ <% if @completed_versions.present? %> <p> <%= link_to_function l(:label_completed_versions), - 'Element.toggleClassName("toggle-completed-versions", "collapsed"); Element.toggle("completed-versions")', + '$("#toggle-completed-versions").toggleClass("collapsed"); $("#completed-versions").toggle()', :id => 'toggle-completed-versions', :class => 'collapsible collapsed' %><br /> <span id="completed-versions" style="display:none;"> <%= @completed_versions.map {|version| link_to format_version_name(version), version_path(version)}.join("<br />\n").html_safe %> diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb index cce80e029..114b9c7c5 100644 --- a/app/views/versions/new.js.erb +++ b/app/views/versions/new.js.erb @@ -1,3 +1,2 @@ -Element.update('ajax-modal', '<%= escape_javascript(render :partial => 'versions/new_modal') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'versions/new_modal') %>'); showModal('ajax-modal', '600px'); -Form.Element.focus('version_name'); diff --git a/app/views/versions/status_by.js.erb b/app/views/versions/status_by.js.erb index e3a667a89..94e01279c 100644 --- a/app/views/versions/status_by.js.erb +++ b/app/views/versions/status_by.js.erb @@ -1 +1 @@ -Element.update('status_by', '<%= escape_javascript(render_issue_status_by(@version, params[:status_by])) %>'); +$('#status_by').html('<%= escape_javascript(render_issue_status_by(@version, params[:status_by])) %>'); diff --git a/app/views/watchers/_new.html.erb b/app/views/watchers/_new.html.erb index 013317aa0..eba0665b4 100644 --- a/app/views/watchers/_new.html.erb +++ b/app/views/watchers/_new.html.erb @@ -9,18 +9,10 @@ :id => 'new-watcher-form') do %> <p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> - <%= observe_field(:user_search, - :frequency => 0.5, - :update => :users_for_watcher, - :method => :get, - :before => '$("user_search").addClassName("ajax-loading")', - :complete => '$("user_search").removeClassName("ajax-loading")', - :url => { - :controller => 'watchers', + <%= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript url_for(:controller => 'watchers', :action => 'autocomplete_for_user', :object_type => watched.class.name.underscore, - :object_id => watched}, - :with => 'q') %> + :object_id => watched) }')" %> <div id="users_for_watcher"> <%= principals_check_box_tags 'watcher[user_ids][]', (watched ? watched.addable_watcher_users : User.active.all(:limit => 100)) %> diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index 4f2a4318b..6283a3805 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -1,2 +1,2 @@ <% selector = ".#{watcher_css(watched)}" %> -$$("<%= selector %>").each(function(el){el.update("<%= escape_javascript watcher_link(watched, user) %>")}); +$("<%= selector %>").each(function(){$(this).html("<%= escape_javascript watcher_link(watched, user) %>")}); diff --git a/app/views/watchers/append.js.erb b/app/views/watchers/append.js.erb index b5bde1e6d..934865dfb 100644 --- a/app/views/watchers/append.js.erb +++ b/app/views/watchers/append.js.erb @@ -1,4 +1,4 @@ <% @users.each do |user| %> - $$("#issue_watcher_user_ids_<%= user.id %>").each(function(el){el.remove();}); + $("#issue_watcher_user_ids_<%= user.id %>").remove(); <% end %> -Element.insert('watchers_inputs', '<%= escape_javascript(watchers_checkboxes(nil, @users, true)) %>'); +$('#watchers_inputs').append('<%= escape_javascript(watchers_checkboxes(nil, @users, true)) %>'); diff --git a/app/views/watchers/create.js.erb b/app/views/watchers/create.js.erb index d18152b76..0f7e15a00 100644 --- a/app/views/watchers/create.js.erb +++ b/app/views/watchers/create.js.erb @@ -1,2 +1,2 @@ -Element.update('ajax-modal', '<%= escape_javascript(render(:partial => 'watchers/new', :locals => {:watched => @watched})) %>'); -Element.update('watchers', '<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); +$('#ajax-modal').html('<%= escape_javascript(render(:partial => 'watchers/new', :locals => {:watched => @watched})) %>'); +$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); diff --git a/app/views/watchers/destroy.js.erb b/app/views/watchers/destroy.js.erb index 4c3bb1930..e4d856549 100644 --- a/app/views/watchers/destroy.js.erb +++ b/app/views/watchers/destroy.js.erb @@ -1 +1 @@ -Element.update('watchers', '<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); +$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); diff --git a/app/views/watchers/new.js.erb b/app/views/watchers/new.js.erb index c89dd1c95..6b99f657e 100644 --- a/app/views/watchers/new.js.erb +++ b/app/views/watchers/new.js.erb @@ -1,3 +1,3 @@ -Element.update('ajax-modal', '<%= escape_javascript(render :partial => 'watchers/new', :locals => {:watched => @watched}) %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'watchers/new', :locals => {:watched => @watched}) %>'); showModal('ajax-modal', '400px'); -$('ajax-modal').addClassName('new-watcher'); +$('#ajax-modal').addClass('new-watcher'); diff --git a/app/views/wiki/destroy.html.erb b/app/views/wiki/destroy.html.erb index 05c0fd56d..08d2cc2bb 100644 --- a/app/views/wiki/destroy.html.erb +++ b/app/views/wiki/destroy.html.erb @@ -12,7 +12,7 @@ <label><%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_wiki_page_reassign_children) %></label>: <%= label_tag "reassign_to_id", l(:description_wiki_subpages_reassign), :class => "hidden-for-sighted" %> <%= select_tag 'reassign_to_id', wiki_page_options_for_select(@reassignable_to), - :onclick => "$('todo_reassign').checked = true;" %> + :onclick => "$('#todo_reassign').attr('checked', true);" %> <% end %> </p> </div> diff --git a/app/views/wiki/history.html.erb b/app/views/wiki/history.html.erb index fa9effd1a..005219e04 100644 --- a/app/views/wiki/history.html.erb +++ b/app/views/wiki/history.html.erb @@ -23,7 +23,7 @@ <% @versions.each do |ver| %> <tr class="wiki-page-version <%= cycle("odd", "even") %>"> <td class="id"><%= link_to h(ver.version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => ver.version %></td> - <td class="checkbox"><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < @versions.size) %></td> + <td class="checkbox"><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked', true);") if show_diff && (line_num < @versions.size) %></td> <td class="checkbox"><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %></td> <td class="updated_on"><%= format_time(ver.updated_on) %></td> <td class="author"><%= link_to_user ver.author %></td> diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 08763a335..90c1cc006 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -40,7 +40,7 @@ <% if @editable && authorize_for('wiki', 'add_attachment') %> <div id="wiki_add_attachment"> -<p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", +<p><%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;", :id => 'attach_files_link' %></p> <%= form_tag({:controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title}, @@ -50,7 +50,7 @@ <p><%= render :partial => 'attachments/form' %></p> </div> <%= submit_tag l(:button_add) %> -<%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %> +<%= link_to l(:button_cancel), {}, :onclick => "$('#add_attachment_form').hide(); return false;" %> <% end %> </div> <% end %> diff --git a/app/views/wikis/edit.js.erb b/app/views/wikis/edit.js.erb index 3d2d5b385..2c765d156 100644 --- a/app/views/wikis/edit.js.erb +++ b/app/views/wikis/edit.js.erb @@ -1 +1 @@ -Element.update('tab-content-wiki', '<%= escape_javascript(render :partial => 'projects/settings/wiki') %>'); +$('#tab-content-wiki').html('<%= escape_javascript(render :partial => 'projects/settings/wiki') %>'); diff --git a/app/views/workflows/edit.html.erb b/app/views/workflows/edit.html.erb index 71db6ad4e..a7f2dae62 100644 --- a/app/views/workflows/edit.html.erb +++ b/app/views/workflows/edit.html.erb @@ -41,7 +41,7 @@ <%= render :partial => 'form', :locals => {:name => 'author', :workflows => @workflows['author']} %> </div> </fieldset> - <%= javascript_tag "hideFieldset($('author_workflows'))" unless @workflows['author'].present? %> + <%= javascript_tag "hideFieldset($('#author_workflows'))" unless @workflows['author'].present? %> <fieldset class="collapsible" style="padding: 0;"> <legend onclick="toggleFieldset(this);"><%= l(:label_additional_workflow_transitions_for_assignee) %></legend> @@ -49,7 +49,7 @@ <%= render :partial => 'form', :locals => {:name => 'assignee', :workflows => @workflows['assignee']} %> </div> </fieldset> - <%= javascript_tag "hideFieldset($('assignee_workflows'))" unless @workflows['assignee'].present? %> + <%= javascript_tag "hideFieldset($('#assignee_workflows'))" unless @workflows['assignee'].present? %> </div> <%= submit_tag l(:button_save) %> <% end %> |