mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Readonly fields
This commit is contained in:
parent
c8085ad39d
commit
9feef935f4
@ -169,16 +169,8 @@ function constructForm(url, method, options={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Construct a 'creation' (POST) form, to create a new model in the database.
|
function constructFormBody(url, fields, options={}) {
|
||||||
*
|
|
||||||
* arguments:
|
|
||||||
* - fields: The 'actions' object provided by the OPTIONS endpoint
|
|
||||||
*
|
|
||||||
* options:
|
|
||||||
* -
|
|
||||||
*/
|
|
||||||
function constructCreateForm(url, fields, options={}) {
|
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
@ -250,6 +242,22 @@ function constructCreateForm(url, fields, options={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Construct a 'creation' (POST) form, to create a new model in the database.
|
||||||
|
*
|
||||||
|
* arguments:
|
||||||
|
* - fields: The 'actions' object provided by the OPTIONS endpoint
|
||||||
|
*
|
||||||
|
* options:
|
||||||
|
* -
|
||||||
|
*/
|
||||||
|
function constructCreateForm(url, fields, options={}) {
|
||||||
|
|
||||||
|
// We should have enough information to create the form!
|
||||||
|
constructFormBody(url, fields, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct a 'change' (PATCH) form, to create a new model in the database.
|
* Construct a 'change' (PATCH) form, to create a new model in the database.
|
||||||
*
|
*
|
||||||
@ -280,7 +288,7 @@ function constructChangeForm(url, fields, options={}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constructCreateForm(url, fields, options);
|
constructFormBody(url, fields, options);
|
||||||
},
|
},
|
||||||
error: function(request, status, error) {
|
error: function(request, status, error) {
|
||||||
// TODO: Handle error here
|
// TODO: Handle error here
|
||||||
@ -446,6 +454,11 @@ function constructInputOptions(name, classes, type, parameters) {
|
|||||||
|
|
||||||
opts.push(`type='${type}'`);
|
opts.push(`type='${type}'`);
|
||||||
|
|
||||||
|
// Read only?
|
||||||
|
if (parameters.read_only) {
|
||||||
|
opts.push(`readonly=''`);
|
||||||
|
}
|
||||||
|
|
||||||
if (parameters.value) {
|
if (parameters.value) {
|
||||||
// Existing value?
|
// Existing value?
|
||||||
opts.push(`value='${parameters.value}'`);
|
opts.push(`value='${parameters.value}'`);
|
||||||
|
Loading…
Reference in New Issue
Block a user