Merge pull request #4193 from ulferts/fix/remove_outdated_js_file
Fix/remove outdated js filepull/4212/head
commit
83e56441bc
@ -1,194 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2015 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.
|
||||
//++
|
||||
|
||||
(function ($) { |
||||
var AjaxAppender = function (options) { |
||||
var append_href, |
||||
close, |
||||
target_container, |
||||
is_inplace, |
||||
is_loaded, |
||||
state_loading, |
||||
state_loaded, |
||||
replace_with_close, |
||||
replace_with_open, |
||||
slideIn, |
||||
init; |
||||
|
||||
options = $.extend(true, |
||||
{}, |
||||
{ loading_class: 'loading', |
||||
loading: null, |
||||
loaded: null, |
||||
load_target: null, |
||||
trigger: '.ajax_append', |
||||
container_class: 'ajax_appended_information', |
||||
indicator_class: 'ajax_indicator', |
||||
hide_text: 'Hide', |
||||
loading_text: null |
||||
}, |
||||
options); |
||||
|
||||
close = function () { |
||||
var close_link = $(this), |
||||
information_window = close_link.siblings('.' + options.container_class); |
||||
|
||||
replace_with_open(close_link); |
||||
|
||||
information_window.slideUp(); |
||||
}; |
||||
|
||||
append_href = function (link) { |
||||
var target = target_container(link), |
||||
loading_div, |
||||
url = link.attr('href'); |
||||
|
||||
if (is_loaded(link)) { |
||||
state_loaded(target, link); |
||||
} |
||||
else { |
||||
state_loading(target); |
||||
|
||||
$.ajax({ url: url, |
||||
headers: { Accept: 'text/javascript' }, |
||||
complete: function (jqXHR) { |
||||
target.html(jqXHR.responseText); |
||||
|
||||
state_loaded(target, link); |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
is_inplace = function() { |
||||
return options.load_target === null; |
||||
}; |
||||
|
||||
is_loaded = function(link) { |
||||
var container = target_container(link); |
||||
|
||||
return container.children().not('.' + options.indicator_class).size() > 0; |
||||
}; |
||||
|
||||
target_container = function(link) { |
||||
var target, |
||||
container_string = '<div class="' + options.container_class + '"></div>', |
||||
container; |
||||
|
||||
if (is_inplace()) { |
||||
target = link.parent(); |
||||
} |
||||
else { |
||||
target = $(options.load_target); |
||||
} |
||||
|
||||
container = target.find('.' + options.container_class); |
||||
|
||||
if (container.size() === 0) { |
||||
container = $(container_string); |
||||
|
||||
target.append(container); |
||||
} |
||||
|
||||
return container; |
||||
}; |
||||
|
||||
state_loading = function (target) { |
||||
var loading = $('<span class="' + options.indicator_class + '"></span>'); |
||||
|
||||
if (options.loading_text !== null) { |
||||
loading.html(options.loading_text); |
||||
} |
||||
|
||||
target.addClass(options.loading_class); |
||||
target.append(loading); |
||||
|
||||
if (options.loading !== null) { |
||||
options.loading.call(this, target); |
||||
} |
||||
}; |
||||
|
||||
state_loaded = function (target, link) { |
||||
target.removeClass(options.loading_class); |
||||
|
||||
if (is_inplace()) { |
||||
replace_with_close(link, true); |
||||
} |
||||
|
||||
if (options.loaded !== null) { |
||||
target.slideDown(function() { |
||||
options.loaded.call(this, target, link); |
||||
}); |
||||
} |
||||
else{ |
||||
target.slideDown(); |
||||
} |
||||
}; |
||||
|
||||
replace_with_close = function (to_replace, hide) { |
||||
var close_link = $('<a href="javascript:void(0)">' + options.hide_text + '</a>'); |
||||
|
||||
to_replace.after(close_link); |
||||
|
||||
if (hide) { |
||||
to_replace.hide(); |
||||
} |
||||
else { |
||||
to_replace.remove(); |
||||
} |
||||
|
||||
close_link.click(close); |
||||
}; |
||||
|
||||
replace_with_open = function(to_replace) { |
||||
var load_link = to_replace.siblings(options.trigger); |
||||
|
||||
to_replace.remove(); |
||||
|
||||
/* this link is never removed, only hidden */ |
||||
load_link.show(); |
||||
}; |
||||
|
||||
$(options.trigger).click(function(link) { |
||||
append_href($(this)); |
||||
|
||||
return false; |
||||
}); |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
if ($.ajaxAppend) { |
||||
return; |
||||
} |
||||
|
||||
$.ajaxAppend = function (options) { |
||||
AjaxAppender(options); |
||||
return this; |
||||
}; |
||||
}(jQuery)); |
@ -1,128 +0,0 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2015 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. |
||||
|
||||
++#%> |
||||
|
||||
// TODO check if this is still needed |
||||
|
||||
var WorkPackage = WorkPackage || {}; |
||||
|
||||
(function($) { |
||||
var init; |
||||
|
||||
// TODO: remove this, once the issue edit view is completely angular based |
||||
var bodyInjector = function() { return angular.element('body').injector(); }; |
||||
|
||||
var manuallyCompile = function(button) { |
||||
if (!window.angular || button.length < 1) { |
||||
return; |
||||
} |
||||
bodyInjector().invoke(['$compile', function($compile) { |
||||
var scope = angular.element(button).scope(); |
||||
$compile(button)(scope); |
||||
}]) |
||||
}; |
||||
|
||||
var initializeAtWho = function(section) { |
||||
var textareas = section.find('textarea'); |
||||
bodyInjector().invoke(['AutoCompleteHelper', function(AutoCompleteHelper) { |
||||
AutoCompleteHelper.enableTextareaAutoCompletion(textareas); |
||||
}]); |
||||
} |
||||
|
||||
init = function () { |
||||
|
||||
$.ajaxAppend({ |
||||
trigger: '.action_menu_specific .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); |
||||
enable_textarea_auto_completion($("#work_package_notes")); |
||||
$("#work_package_notes").focus(); |
||||
|
||||
// TODO: see last todo |
||||
var previewButton = update.find(".preview.button") |
||||
manuallyCompile(previewButton); |
||||
initializeAtWho(update); |
||||
} |
||||
}); |
||||
|
||||
$.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 format_text |
||||
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}" }.presence || 'en') %>\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); |
||||
enable_textarea_auto_completion($("#work_package_notes")); |
||||
$("#work_package_notes").focus(); |
||||
} |
||||
}); |
||||
|
||||
$.ajaxAppend({ |
||||
trigger: '.description-details', |
||||
indicator_class: 'ajax-indicator', |
||||
loading_class: 'text-diff', |
||||
hide_text: I18n.t("js.ajax.hide") |
||||
} ); |
||||
}; |
||||
|
||||
$('document').ready(function () { |
||||
init(); |
||||
}); |
||||
})(jQuery); |
Loading…
Reference in new issue