Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
7d20c9d6
Commit
7d20c9d6
authored
Nov 23, 2018
by
Tugce Nur Tas
Browse files
fix api_button helper $(target)
parent
be95958a
Pipeline
#31617
passed with stage
in 37 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/api_button.es6
View file @
7d20c9d6
$(() => {
$('.api-button').click(({target}) => {
const { method, url, template } = $(target).data()
const tableCell = target.closest('td')
const tableCell =
$(
target
)
.closest('td')
$.ajax({ method, url, dataType: 'json' })
.done(data => {
...
...
@@ -9,9 +9,9 @@ $(() => {
$(tableCell).append(`<p class="text-danger">Es gab einen Fehler: ${data.errors.join('; ')}</p>`)
} else {
const compiled = _.template(template, { 'variable': 'data', 'imports': { 'data': data } })
target.remove()
$(
target
)
.remove()
$(tableCell).append(compiled(data))
}
})
})
})
\ No newline at end of file
})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment