Commit 1bb386bf authored by jplang's avatar jplang

JQuery in, Prototype/Scriptaculous out (#11445).

git-svn-id: https://svn.redmine.org/redmine/trunk@10068 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 0527bb48
source 'http://rubygems.org'
gem 'rails', '3.2.6'
gem 'prototype-rails', '3.2.1'
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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)
......
......@@ -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 %>
<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
%>
......@@ -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 %>
......
......@@ -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 %>
......
......@@ -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| -%>
......
......@@ -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;
}
}
......
<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>
......
......@@ -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">
......
......@@ -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},
......
......@@ -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 %>
......
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 %>
Element.update('tab-content-memberships', '<%= escape_javascript(render :partial => 'groups/memberships') %>');
$('#tab-content-memberships').html('<%= escape_javascript(render :partial => 'groups/memberships') %>');
<% 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 %>
Element.update('tab-content-users', '<%= escape_javascript(render :partial => 'groups/users') %>');
$('#tab-content-users').html('<%= escape_javascript(render :partial => 'groups/users') %>');
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) %>');
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');
......@@ -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();" %>
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 %>
Element.remove('<%= "relation-#{@relation.id}" %>');
$('#relation-<%= @relation.id %>').remove();
......@@ -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' %>
......
......@@ -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,
......
......@@ -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') %>
......
......@@ -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}%>
......
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 %>
......@@ -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') %>
......
$('#content').html('<%= escape_javascript(render :template => 'issues/bulk_edit.html') %>');
......@@ -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) %>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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 %>
......
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') %>');
$('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;
<% 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 }) %>