kopia lustrzana https://github.com/inkstitch/inkstitch
populate fields on load
rodzic
85a8b6b1cf
commit
78532e8efe
|
@ -48,10 +48,17 @@ $(function() {
|
|||
$('[contenteditable="true"]').on('focusout', function() {
|
||||
var content = $(this).html();
|
||||
var field_name = $(this).attr('data-field-name');
|
||||
$('[data-field-name="' + field_name + '"]').html(content);
|
||||
$('[data-field-name="' + field_name + '"]').text(content);
|
||||
$.post('/metadata/' + field_name + '/set', {value: content});
|
||||
});
|
||||
|
||||
// load up initial metadata values
|
||||
$.getJSON('/metadata', function(metadata) {
|
||||
$.each(metadata, function(field_name, value) {
|
||||
$('[data-field-name="' + field_name + '"]').text(value);
|
||||
});
|
||||
});
|
||||
|
||||
$('[contenteditable="true"]').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
// pressing enter defocuses the element
|
||||
|
|
Ładowanie…
Reference in New Issue