Merge pull request #374 from Ducz0r/lm-sci-808-814-fix

Fix some bugs on sample groups & types page [SCI-808, SCI-814]
This commit is contained in:
Luka Murn 2017-01-04 09:50:26 +01:00 committed by GitHub
commit 37cd6417c8
4 changed files with 19 additions and 17 deletions

View file

@ -39,10 +39,11 @@
url: href,
data: { id: id },
success: function(data) {
$(li).replaceWith($.parseHTML(data.html));
var newLi = $.parseHTML(data.html);
$(li).replaceWith(newLi);
editSampleTypeForm();
destroySampleTypeGroup();
initSampleColorPicker(li)
initSampleColorPicker(newLi);
appendCarretToColorPickerDropdown();
editSampleGroupColor();
editSampleGroupForm();
@ -111,15 +112,13 @@
}
function editSampleGroupColor() {
$(document).ready(function() {
$('.edit_sample_group a.color-btn').off();
$('.edit_sample_group a.color-btn').on('click', function() {
var color = $(this).attr('data-value');
var form = $(this).closest('form');
$('select[name="sample_group[color]"]')
.val(color);
form.submit();
});
$('.edit_sample_group a.color-btn').off();
$('.edit_sample_group a.color-btn').on('click', function() {
var color = $(this).attr('data-value');
var form = $(this).closest('form');
$('select[name="sample_group[color]"]')
.val(color);
form.submit();
});
}
@ -187,12 +186,13 @@
$.ajax({
url: li.attr('data-edit'),
success: function(data) {
$(li).replaceWith($.parseHTML(data.html));
var newLi = $.parseHTML(data.html);
$(li).replaceWith(newLi);
submitEditSampleTypeGroupForm();
abortEditSampleTypeGroupAction();
destroySampleTypeGroup();
initSampleColorPicker(li);
initSampleColorPicker(newLi);
appendCarretToColorPickerDropdown();
editSampleGroupColor();
@ -203,10 +203,11 @@
$('#edit_sample_group_' + data.id).off();
$('#edit_sample_group_' + data.id)
.bind('ajax:success', function(ev, data) {
$(this).closest('li').replaceWith($.parseHTML(data.html));
var newLi = $.parseHTML(data.html);
$(this).closest('li').replaceWith(newLi);
editSampleGroupForm();
destroySampleTypeGroup();
initSampleColorPicker($(this).closest('li'));
initSampleColorPicker(newLi);
appendCarretToColorPickerDropdown();
editSampleGroupColor();
}).bind('ajax:error', function(ev, error){

View file

@ -12,7 +12,7 @@
</div>
<div class="col-xs-4 text-right">
<button type="button"
class="edit-confirm btn btn-primary"><%= t('general.edit') %></button>
class="edit-confirm btn btn-primary"><%= t('general.save') %></button>
<button type="button"
class="abort btn btn-default"
data-element="<%=

View file

@ -11,7 +11,7 @@
</div>
<div class="col-xs-4 text-right">
<button type="button"
class="edit-confirm btn btn-primary"><%= t('general.edit') %></button>
class="edit-confirm btn btn-primary"><%= t('general.save') %></button>
<button type="button"
class="abort btn btn-default"
data-element="<%=

View file

@ -1458,6 +1458,7 @@ en:
update: "Update"
edit: "Edit"
cancel: "Cancel"
save: "Save"
close: "Close"
create: 'Create'
check_all: "Check all"