Allows to define custom class name in CoffeeScript when frontend and backend class names don't match

This commit is contained in:
Mantas Masalskis 2019-12-23 11:10:16 +01:00 committed by Martin Edenhofer
parent ebe4746ace
commit 14dfdb4db9
2 changed files with 5 additions and 3 deletions

View file

@ -806,7 +806,7 @@ set new attributes of model (remove already available attributes)
type: 'GET' type: 'GET'
url: "#{@apiPath}/tags" url: "#{@apiPath}/tags"
data: data:
object: @.className object: @serverClassName || @className
o_id: id o_id: id
processData: true processData: true
success: (data, status, xhr) -> success: (data, status, xhr) ->
@ -818,7 +818,7 @@ set new attributes of model (remove already available attributes)
type: 'GET' type: 'GET'
url: "#{@apiPath}/tags/add" url: "#{@apiPath}/tags/add"
data: data:
object: @.className object: @serverClassName || @className
o_id: id o_id: id
item: item item: item
processData: true processData: true
@ -829,7 +829,7 @@ set new attributes of model (remove already available attributes)
type: 'GET' type: 'GET'
url: "#{@apiPath}/tags/remove" url: "#{@apiPath}/tags/remove"
data: data:
object: @.className object: @serverClassName || @className
o_id: id o_id: id
item: item item: item
processData: true processData: true

View file

@ -4,6 +4,8 @@ class App.KnowledgeBaseAnswer extends App.Model
@extend App.KnowledgeBaseActions @extend App.KnowledgeBaseActions
@extend App.KnowledgeBaseCanBePublished @extend App.KnowledgeBaseCanBePublished
@serverClassName: 'KnowledgeBase::Answer'
url: -> url: ->
@knowledge_base().generateURL('answers') @knowledge_base().generateURL('answers')