fixed new sample type/group form

This commit is contained in:
zmagod 2016-12-06 12:01:02 +01:00
parent 7725374c42
commit 787b8b1600
5 changed files with 27 additions and 8 deletions
app
assets
views
sample_groups
sample_types

View file

@ -43,6 +43,8 @@
destroySampleTypeGroup();
initSampleGroupColor();
appendCarretToColorPickerDropdown();
editSampleGroupColor();
editSampleGroupForm();
}
});
@ -106,7 +108,7 @@
function editSampleGroupColor() {
$(document).ready(function() {
$('.color-btn').on('click', function() {
$('.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]"]')
@ -126,6 +128,7 @@
appendCarretToColorPickerDropdown();
editSampleGroupColor();
editSampleGroupForm();
destroySampleTypeGroup();
}).bind('ajax:error', function(ev, error) {
$(this).clearFormErrors();
var msg = $.parseJSON(error.responseText);

View file

@ -9,7 +9,7 @@
}
.btn-colorselector{
background-color: transparent;
background-color: transparent;
}
.step-container .row {

View file

@ -21,6 +21,7 @@
#remove {
margin-left: 5px;
margin-top: 10px;
}
}
@ -47,10 +48,9 @@
.sample-group-colorselector {
border-radius: 0;
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
width: 20px;
}
.color-picker {
@ -94,3 +94,7 @@
}
}
}
#new_sample_group .color-picker {
margin-top: 7px;
}

View file

@ -21,15 +21,25 @@
<ul class="list-unstyled sample_types_groups_list"
id="sample_groups_list">
<li class="new-resource-form">
<%= form_for SampleGroup.new,
<%= bootstrap_form_for SampleGroup.new,
remote: true,
html: { class: 'form-inline' },
url: organization_sample_groups_path(current_organization) do |f| %>
<div class="form-group">
<%= f.text_field :name, id: 'name-input', class: 'form-control' %>
<%= f.text_field :name,
id: 'name-input',
class: 'form-control',
hide_label: true %>
<span id="submit" class="glyphicon glyphicon-ok"></span>
<span id="remove" class="glyphicon glyphicon-remove"></span>
</div>
<span class="pull-right sample-group-controls">
<span class="color-picker">
<%= f.color_picker_select :color,
Constants::TAG_COLORS,
class: 'new-sample-group-color' %>
</span>
<span id="remove" class="glyphicon glyphicon-trash"></span>
</span>
<% end %>
</li>
<% @sample_groups.sorted.each do |sample_group| %>

View file

@ -27,8 +27,10 @@
<div class="form-group">
<%= f.text_field :name, id: 'name-input', class: 'form-control' %>
<span id="submit" class="glyphicon glyphicon-ok"></span>
<span id="remove" class="glyphicon glyphicon-remove"></span>
</div>
<span class="pull-right">
<span id="remove" class="glyphicon glyphicon-trash"></span>
</span>
<% end %>
</li>
<% @sample_types.sorted.each do |sample_type| %>