Merge pull request #471 from opf/fix/work_package_js

pull/475/head
Hagen Schink 11 years ago
commit 8d58524bcb
  1. 2
      app/assets/javascripts/application.js
  2. 101
      app/assets/javascripts/issues.js.erb
  3. 56
      app/assets/javascripts/work_packages.js.erb
  4. 1
      app/views/work_packages/show.html.erb
  5. 1
      doc/CHANGELOG.md

@ -58,8 +58,6 @@
//= require context_menu
//= require jstoolbar
//= require ajaxappender
//= require issues
//= require work_packages
//= require settings
//= require modal

@ -1,101 +0,0 @@
<%#-- copyright
OpenProject is a project management system.
Copyright (C) 2012-2013 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See doc/COPYRIGHT.rdoc for more details.
++#%>
var WorkPackage = WorkPackage || {};
WorkPackage.Show = (function($) {
var init;
init = function () {
$.ajaxAppend({
trigger: '.action_menu_main .edit',
indicator_class: 'ajax-indicator',
load_target: '#update',
loading_text: I18n.t("js.ajax.loading"),
loading_class: 'box loading',
loading: function(update) {
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
},
loaded: function(update) {
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
$("#work_package_notes").focus();
}
});
$.ajaxAppend({
trigger: '.quote-link',
indicator_class: 'ajax-indicator',
load_target: '#update',
loading_text: I18n.t("js.ajax.loading"),
loading_class: 'box loading',
loading: function(update) {
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
},
loaded: function(update, target) {
var content = $(target.context).parent().siblings('.wikicontent');
var text = content.text();
var user = content.attr('data-user');
text = text.trim().replace(/<pre>((.|\s)*?)<\/pre>/g, '[...]');
// remove blank lines generated by redmine textilizable
text = text.replace(/^\s*$[\n\r]{1,}/gm, '');
var quotedText = "<%= ::I18n.t(:text_user_wrote, :value => "{{{user}}}", :locale => Setting.default_language.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }) %>\n> ";
quotedText = quotedText.replace("{{{user}}}", user);
quotedText += text.replace(/(\r?\n|\r\n?)/g, "\n> ") + "\n\n";
$('#notes').text(quotedText);
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
$("#notes").focus();
}
});
$.ajaxAppend({
trigger: '.description-details',
indicator_class: 'ajax-indicator',
loading_class: 'text-diff',
hide_text: I18n.t("js.ajax.hide")
} );
};
$('document').ready(function () {
if ($('body.controller-work_packages.action-show').size() > 0) {
init();
}
});
})(jQuery);

@ -29,10 +29,62 @@ See doc/COPYRIGHT.rdoc for more details.
var WorkPackage = WorkPackage || {};
WorkPackage.Show = (function($) {
(function($) {
var init;
init = function () {
$.ajaxAppend({
trigger: '.action_menu_main .edit',
indicator_class: 'ajax-indicator',
load_target: '#update',
loading_text: I18n.t("js.ajax.loading"),
loading_class: 'box loading',
loading: function(update) {
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
},
loaded: function(update) {
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
$("#work_package_notes").focus();
}
});
$.ajaxAppend({
trigger: '.quote-link',
indicator_class: 'ajax-indicator',
load_target: '#update',
loading_text: I18n.t("js.ajax.loading"),
loading_class: 'box loading',
loading: function(update) {
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
},
loaded: function(update, target) {
var content = $(target.context).parent().siblings('.wikicontent');
var text = content.text();
var user = content.attr('data-user');
text = text.trim().replace(/<pre>((.|\s)*?)<\/pre>/g, '[...]');
// remove blank lines generated by redmine textilizable
text = text.replace(/^\s*$[\n\r]{1,}/gm, '');
var quotedText = "<%= ::I18n.t(:text_user_wrote, :value => "{{{user}}}", :locale => Setting.default_language.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }) %>\n> ";
quotedText = quotedText.replace("{{{user}}}", user);
quotedText += text.replace(/(\r?\n|\r\n?)/g, "\n> ") + "\n\n";
$('#notes').text(quotedText);
$('html, body').animate({
scrollTop: $(update).offset().top
}, 200);
$("#notes").focus();
}
});
$.ajaxAppend({
trigger: '.description-details',
indicator_class: 'ajax-indicator',
@ -42,8 +94,6 @@ WorkPackage.Show = (function($) {
};
$('document').ready(function () {
if ($('body.controller-work_packages.action-show').size() > 0) {
init();
}
});
})(jQuery);

@ -28,6 +28,7 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= header_tags %>
<%= javascript_include_tag("work_packages.js") %>
<%= render :partial => 'work_packages/action_menu', :locals => { work_package: work_package } %>
<% work_package_breadcrumb %>

@ -34,6 +34,7 @@ See doc/COPYRIGHT.rdoc for more details.
* `#1946` Modal shown within in Modal
* `#1949` External links within modals do not work
* `#1992` Prepare schema migrations table
* `#2125` All AJAX actions on work package not working after update
## 3.0.0pre19

Loading…
Cancel
Save