mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Set modal form title
This commit is contained in:
parent
565631ef87
commit
949c7dd81b
@ -337,8 +337,9 @@ class PartDetail(generics.RetrieveUpdateDestroyAPIView):
|
|||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
|
||||||
|
# By default, include 'category_detail' information in the detail view
|
||||||
try:
|
try:
|
||||||
kwargs['category_detail'] = str2bool(self.request.query_params.get('category_detail', False))
|
kwargs['category_detail'] = str2bool(self.request.query_params.get('category_detail', True))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -161,17 +161,18 @@ function constructChangeForm(url, fields, options={}) {
|
|||||||
* and construct a modal form based on the response.
|
* and construct a modal form based on the response.
|
||||||
*
|
*
|
||||||
* arguments:
|
* arguments:
|
||||||
* - method: The HTTP method e.g. 'PUT', 'POST', 'DELETE',
|
* - url: API URL
|
||||||
*
|
*
|
||||||
* options:
|
* options:
|
||||||
* - method:
|
* - method: The HTTP method e.g. 'PUT', 'POST', 'DELETE',
|
||||||
|
* - title: The form title
|
||||||
|
* - fields: list of fields to display
|
||||||
|
* - exclude: List of fields to exclude
|
||||||
*/
|
*/
|
||||||
function constructForm(url, method, options={}) {
|
function constructForm(url, options={}) {
|
||||||
|
|
||||||
method = method.toUpperCase();
|
// Default HTTP method
|
||||||
|
options.method = options.method || 'PATCH';
|
||||||
// Store the method in the options struct
|
|
||||||
options.method = method;
|
|
||||||
|
|
||||||
// Request OPTIONS endpoint from the API
|
// Request OPTIONS endpoint from the API
|
||||||
getApiEndpointOptions(url, function(OPTIONS) {
|
getApiEndpointOptions(url, function(OPTIONS) {
|
||||||
@ -183,7 +184,7 @@ function constructForm(url, method, options={}) {
|
|||||||
* First we must determine if the user has the correct permissions!
|
* First we must determine if the user has the correct permissions!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (method) {
|
switch (options.method) {
|
||||||
case 'POST':
|
case 'POST':
|
||||||
if (canCreate(OPTIONS)) {
|
if (canCreate(OPTIONS)) {
|
||||||
constructCreateForm(url, OPTIONS.actions.POST, options);
|
constructCreateForm(url, OPTIONS.actions.POST, options);
|
||||||
@ -322,6 +323,10 @@ function constructFormBody(url, fields, options={}) {
|
|||||||
$(modal + ' .select2-container').css('width', '100%');
|
$(modal + ' .select2-container').css('width', '100%');
|
||||||
|
|
||||||
modalShowSubmitButton(modal, true);
|
modalShowSubmitButton(modal, true);
|
||||||
|
|
||||||
|
var title = options.title || '{% trans "Form Title" %}';
|
||||||
|
|
||||||
|
modalSetTitle(modal, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user