remove timelines prefix from js autocompleter and move empty elements translations

Conflicts:
	app/assets/javascripts/timelines_select_boxes.js
	config/locales/de.yml
	config/locales/en.yml
pull/695/head
jwollert 11 years ago committed by Hagen Schink
parent 2b4528c118
commit 7e91b86544
  1. 24
      app/assets/javascripts/autocompleter.js
  2. 21
      app/assets/javascripts/timelines_select_boxes.js
  3. 2
      app/views/project_associations/new.html.erb
  4. 2
      app/views/reportings/edit.html.erb
  5. 2
      app/views/reportings/new.html.erb
  6. 2
      app/views/timelines/_form.html.erb
  7. 2
      app/views/timelines/_timeline.html.erb
  8. 6
      config/locales/de.yml

@ -33,7 +33,7 @@
(function ($, undefined) {
"use strict";
function TimelinesAutocompleter (object, args) {
function Autocompleter (object, args) {
this.element = object;
this.opts = null;
this.fakeInput = null;
@ -42,10 +42,10 @@
this.initSelect2();
}
TimelinesAutocompleter.prototype = $.extend(TimelinesAutocompleter.prototype, {
Autocompleter.prototype = $.extend(Autocompleter.prototype, {
initOptions: function (args) {
var self = this;
this.opts = $.extend(true, {}, $.fn.timelinesAutocomplete.defaults);
this.opts = $.extend(true, {}, $.fn.autocomplete.defaults);
this.opts = $.extend(true, this.opts, args[0]);
if (!(this.element.attr("data-ajaxURL") === "" || this.element.attr("data-ajaxURL") === null || this.element.attr("data-ajaxURL") === undefined)) {
this.opts.ajax.url = this.element.attr("data-ajaxURL");
@ -105,17 +105,17 @@
}
});
$.fn.timelinesAutocomplete = function () {
$.fn.autocomplete = function () {
var args = Array.prototype.slice.call(arguments, 0),
autocompleter;
$(this).each(function () {
autocompleter = new TimelinesAutocompleter($(this), args);
autocompleter = new Autocompleter($(this), args);
});
};
$.fn.timelinesAutocomplete.defaults = {
multiple: true,
$.fn.autocomplete.defaults = {
multiple: false,
data: {},
allowedAttributes: ["title", "placeholder", "id", "name"],
minimumInputLength: 0,
@ -170,10 +170,18 @@
return item.name;
},
initSelection: function (element, callback) {
var data = [];
var data,
multiple = $(element).attr("multiple");
if (multiple !== null && multiple !== undefined && multiple) {
data = []
};
if (!($(element).attr("data-selected") === "" || $(element).attr("data-selected") === null || $(element).attr("data-selected") === undefined)) {
JSON.parse($(element).attr('data-selected')).each(function (elem) {
if (multiple) {
data.push({id: elem[1], name: elem[0]});
} else {
data = {id: elem[1], name: elem[0]};
}
});
} else if (element.is("input") && !(element.attr("data-values") === "" || element.attr("data-values") === null || element.attr("data-values") === undefined)) {
var possible = JSON.parse(element.attr('data-values'));

@ -55,7 +55,9 @@ jQuery(document).ready(function($) {
$("#timeline_options_planning_element_responsibles"),
$("#timeline_options_grouping_two_selection")
].each(function (item) {
$(item).timelinesAutocomplete({ ajax: {null_element: {id: -1, name: I18n.t("js.timelines.filter.noneElement")}} });
$(item).autocomplete({ multiple: true,
ajax: {null_element: {id: -1, name: I18n.t("js.filter.noneElement")}}
});
});
[
@ -63,11 +65,12 @@ jQuery(document).ready(function($) {
$("#timeline_options_planning_element_time_types"),
$("#timeline_options_planning_element_status")
].each(function (item) {
$(item).timelinesAutocomplete({});
$(item).autocomplete({});
});
var item = $("#timeline_options_columns_");
item.timelinesAutocomplete({
item.autocomplete({
multiple: true,
sortable: true
});
@ -76,7 +79,7 @@ jQuery(document).ready(function($) {
$("#project_association_select_project_b_id")
].each(function (item) {
// Stuff borrowed from Core application.js Project Jump Box
$(item).timelinesAutocomplete({
$(item).autocomplete({
multiple: false,
formatSelection: function (item) {
return item.name || item.project.name;
@ -94,7 +97,8 @@ jQuery(document).ready(function($) {
$("#timeline_options_grouping_one_selection")
].each(function (item) {
// Stuff borrowed from Core application.js Project Jump Box
$(item).timelinesAutocomplete({
$(item).autocomplete({
multiple: true,
sortable: true,
formatSelection: function (item) {
return item.name || item.project.name;
@ -104,7 +108,7 @@ jQuery(document).ready(function($) {
query : OpenProject.Helpers.Search.projectQueryWithHierarchy(
jQuery.proxy(openProject, 'fetchProjects'),
20),
ajax: {null_element: {id: -1, name: I18n.t("js.timelines.filter.noneElement")}}
ajax: {null_element: {id: -1, name: I18n.t("js.filter.noneElement")}}
});
});
@ -112,7 +116,8 @@ jQuery(document).ready(function($) {
$("#timeline_options_parents")
].each(function (item) {
// Stuff borrowed from Core application.js Project Jump Box
$(item).timelinesAutocomplete({
$(item).autocomplete({
multiple: true,
formatSelection: function (item) {
return item.name || item.project.name;
},
@ -121,7 +126,7 @@ jQuery(document).ready(function($) {
query : OpenProject.Helpers.Search.projectQueryWithHierarchy(
jQuery.proxy(openProject, 'fetchProjects'),
20),
ajax: {null_element: {id: -1, name: I18n.t("js.timelines.filter.noneElement")}}
ajax: {null_element: {id: -1, name: I18n.t("js.filter.noneElement")}}
});
});

@ -33,7 +33,7 @@ See doc/COPYRIGHT.rdoc for more details.
For lack of a requiring policy (such as requirejs), just include the
autocompleter on its own.
%>
<%= javascript_include_tag "timelines_autocompleter.js" %>
<%= javascript_include_tag "autocompleter.js" %>
<%= javascript_include_tag "timelines_select_boxes.js" %>
<% end %>

@ -33,7 +33,7 @@ See doc/COPYRIGHT.rdoc for more details.
For lack of a requiring policy (such as requirejs), just include the
autocompleter on its own.
%>
<%= javascript_include_tag "timelines_autocompleter.js" %>
<%= javascript_include_tag "autocompleter.js" %>
<%= javascript_include_tag "timelines_select_boxes.js" %>
<% end %>

@ -33,7 +33,7 @@ See doc/COPYRIGHT.rdoc for more details.
For lack of a requiring policy (such as requirejs), just include the
autocompleter on its own.
%>
<%= javascript_include_tag "timelines_autocompleter.js" %>
<%= javascript_include_tag "autocompleter.js" %>
<%= javascript_include_tag "timelines_select_boxes.js" %>
<% end %>

@ -33,7 +33,7 @@ See doc/COPYRIGHT.rdoc for more details.
For lack of a requiring policy (such as requirejs), just include the
autocompleter on its own.
%>
<%= javascript_include_tag "timelines_autocompleter.js" %>
<%= javascript_include_tag "autocompleter.js" %>
<%= javascript_include_tag "timelines_select_boxes.js" %>
<% end %>

@ -35,7 +35,7 @@ See doc/COPYRIGHT.rdoc for more details.
For lack of a requiring policy (such as requirejs), just include the
autocompleter on its own.
%>
<%= javascript_include_tag "timelines_autocompleter.js" %>
<%= javascript_include_tag "autocompleter.js" %>
<%= javascript_include_tag "timelines_select_boxes.js" %>
<% end %>

@ -556,9 +556,6 @@ de:
create_planning_select_project: "Projekt:"
due_date: "Abschlussdatum"
error: "Ein Fehler ist aufgetreten."
filter:
noneElement: "(keines)"
noneSelection: "(keine)"
name: "Name"
project_status: "Projekt-Status"
project_type: "Projekt-Typ"
@ -566,6 +563,9 @@ de:
save: "Speichern"
start_date: "Startdatum"
really_close_dialog: "Dialog schließen und eingegebene Daten verwerfen?"
filter:
noneElement: "(keines)"
noneSelection: "(keine)"
label_account: "Konto"
label_activity: "Aktivität"

Loading…
Cancel
Save