bugfix for API selects (#780)

This commit is contained in:
Kevin Papst
2019-05-12 17:22:24 +02:00
committed by GitHub
parent 5c227888f2
commit 392f8239f5
15 changed files with 1667 additions and 1118 deletions

View File

@@ -18,7 +18,7 @@ export default class KimaiAPI extends KimaiPlugin {
return 'api';
}
get(url, data, callback) {
get(url, data, callbackSuccess, callbackError) {
jQuery.ajax({
url: url,
headers: {
@@ -28,11 +28,12 @@ export default class KimaiAPI extends KimaiPlugin {
method: 'GET',
data: data,
dataType: 'json',
success: callback
success: callbackSuccess,
error: callbackError
});
}
patch(url, callbackSuccess, callbackError) {
patch(url, data, callbackSuccess, callbackError) {
jQuery.ajax({
url: url,
headers: {
@@ -40,6 +41,7 @@ export default class KimaiAPI extends KimaiPlugin {
'Content-Type':'application/json'
},
method: 'PATCH',
data: data,
dataType: 'json',
success: callbackSuccess,
error: callbackError

View File

@@ -59,7 +59,7 @@ export default class KimaiAPILink extends KimaiClickHandlerReducedInTableRow {
{
const method = attributes['method'];
const eventName = attributes['event'];
const api = this.getContainer().getPlugin('api');
const API = this.getContainer().getPlugin('api');
const eventing = this.getContainer().getPlugin('event');
const alert = this.getContainer().getPlugin('alert');
const successHandle = function(result) {
@@ -80,9 +80,9 @@ export default class KimaiAPILink extends KimaiClickHandlerReducedInTableRow {
};
if (method === 'PATCH') {
api.patch(url, successHandle, errorHandle);
API.patch(url, {}, successHandle, errorHandle);
} else if (method === 'DELETE') {
api.delete(url, successHandle, errorHandle);
API.delete(url, successHandle, errorHandle);
}
}

View File

@@ -103,9 +103,9 @@ export default class KimaiActiveRecords extends KimaiPlugin {
reloadActiveRecords() {
const self = this;
const apiService = this.getContainer().getPlugin('api');
const API= this.getContainer().getPlugin('api');
apiService.get(this.attributes['api'], {}, function(result) {
API.get(this.attributes['api'], {}, function(result) {
self.setEntries(result);
});
}

View File

@@ -39,6 +39,7 @@ export default class KimaiAutocomplete extends KimaiPlugin {
{
const apiUrl = jQuery(selector).attr('data-autocomplete-url');
const self = this;
const API = self.getContainer().getPlugin('api');
jQuery(selector)
// don't navigate away from the field on tab when selecting an item
@@ -51,7 +52,7 @@ export default class KimaiAutocomplete extends KimaiPlugin {
.autocomplete({
source: function (request, response) {
const lastEntry = self.extractLastTag(request.term);
self.getContainer().getPlugin('api').get(apiUrl, {'name': lastEntry}, function(data){
API.get(apiUrl, {'name': lastEntry}, function(data){
response(data);
});
},

View File

@@ -72,9 +72,9 @@ export default class KimaiRecentActivities extends KimaiPlugin {
reloadRecentActivities() {
const self = this;
const apiService = this.getContainer().getPlugin('api');
const API = this.getContainer().getPlugin('api');
apiService.get(this.attributes['api'], {}, function(result) {
API.get(this.attributes['api'], {}, function(result) {
self.setEntries(result);
});
}

View File

@@ -51,7 +51,7 @@ export default class KimaiSelectDataAPI extends KimaiPlugin {
jQuery(targetSelect).removeAttr('disabled');
API.get(apiUrl, function(data){
API.get(apiUrl, {}, function(data){
self._updateSelect(targetSelect, data);
});
});

392
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,18 @@
{
"homepage": "https://github.com/kevinpapst/kimai2",
"license": "MIT",
"maintainers": [
{
"name": "Kevin Papst",
"email": "kpapst@gmx.net",
"url": "https://www.kevinpapst.de"
}
],
"name": "kimai2",
"repository": {
"type": "git",
"url": "git+https://github.com/kevinpapst/kimai2.git"
},
"scripts": {
"dev-server": "./node_modules/.bin/encore dev-server",
"dev": "./node_modules/.bin/encore dev",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"build/app.js": "./app.js?64fa6fc1a131686a13f2",
"build/app.css": "./app.css?bb4a993eb752077ba0e70e8a014ef365",
"build/app.js": "./app.js?b2225d72491af37dec94",
"build/app.css": "./app.css?52d21a4cca9a4768126cc7e11f6a78e9",
"build/fonts/fa-solid-900.woff2": "./fonts/fa-solid-900.woff2?e8a92a29",
"build/images/fa-solid-900.svg": "./images/fa-solid-900.svg?666a82cb",
"build/images/glyphicons-halflings-regular.svg": "./images/glyphicons-halflings-regular.svg?89889688",

View File

@@ -62,7 +62,7 @@
</table>
</article>
<article>
<h2>{{ model.template.title|default('invoice_renderer.timesheet'|trans) }}</h2>
<h2>{{ model.template.title|default('timesheet'|trans({}, 'invoice-renderer')) }}</h2>
<p contenteditable="true">
{{ 'label.invoice_salutation'|trans|nl2br }}
</p>

View File

@@ -5,7 +5,7 @@
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<span contenteditable="true">{{ model.template.title|default('invoice_renderer.timesheet'|trans) }}</span>
<span contenteditable="true">{{ model.template.title|default('timesheet'|trans({}, 'invoice-renderer')) }}</span>
</h2>
</div>
</div>

View File

@@ -740,10 +740,6 @@ För närvarande har %user% användare %records% tidsrekord som räknas upp till
<source>invoice.preview</source>
<target state="translated">Detta är en förhandsvisning av de data som kommer att visas i ditt fakturatokument.</target>
</trans-unit>
<trans-unit id="invoice_renderer.timesheet">
<source>invoice_renderer.timesheet</source>
<target>Foo</target>
</trans-unit>
<trans-unit id="button.print">
<source>button.print</source>

2250
yarn.lock

File diff suppressed because it is too large Load Diff