mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-18 22:58:53 +08:00
fixed new sample type/group form
This commit is contained in:
parent
7725374c42
commit
787b8b1600
5 changed files with 27 additions and 8 deletions
|
|
@ -43,6 +43,8 @@
|
||||||
destroySampleTypeGroup();
|
destroySampleTypeGroup();
|
||||||
initSampleGroupColor();
|
initSampleGroupColor();
|
||||||
appendCarretToColorPickerDropdown();
|
appendCarretToColorPickerDropdown();
|
||||||
|
editSampleGroupColor();
|
||||||
|
editSampleGroupForm();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -106,7 +108,7 @@
|
||||||
|
|
||||||
function editSampleGroupColor() {
|
function editSampleGroupColor() {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.color-btn').on('click', function() {
|
$('.edit_sample_group a.color-btn').on('click', function() {
|
||||||
var color = $(this).attr('data-value');
|
var color = $(this).attr('data-value');
|
||||||
var form = $(this).closest('form');
|
var form = $(this).closest('form');
|
||||||
$('select[name="sample_group[color]"]')
|
$('select[name="sample_group[color]"]')
|
||||||
|
|
@ -126,6 +128,7 @@
|
||||||
appendCarretToColorPickerDropdown();
|
appendCarretToColorPickerDropdown();
|
||||||
editSampleGroupColor();
|
editSampleGroupColor();
|
||||||
editSampleGroupForm();
|
editSampleGroupForm();
|
||||||
|
destroySampleTypeGroup();
|
||||||
}).bind('ajax:error', function(ev, error) {
|
}).bind('ajax:error', function(ev, error) {
|
||||||
$(this).clearFormErrors();
|
$(this).clearFormErrors();
|
||||||
var msg = $.parseJSON(error.responseText);
|
var msg = $.parseJSON(error.responseText);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#remove {
|
#remove {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,10 +48,9 @@
|
||||||
.sample-group-colorselector {
|
.sample-group-colorselector {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
height: 20px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
width: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.color-picker {
|
.color-picker {
|
||||||
|
|
@ -94,3 +94,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#new_sample_group .color-picker {
|
||||||
|
margin-top: 7px;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,25 @@
|
||||||
<ul class="list-unstyled sample_types_groups_list"
|
<ul class="list-unstyled sample_types_groups_list"
|
||||||
id="sample_groups_list">
|
id="sample_groups_list">
|
||||||
<li class="new-resource-form">
|
<li class="new-resource-form">
|
||||||
<%= form_for SampleGroup.new,
|
<%= bootstrap_form_for SampleGroup.new,
|
||||||
remote: true,
|
remote: true,
|
||||||
html: { class: 'form-inline' },
|
html: { class: 'form-inline' },
|
||||||
url: organization_sample_groups_path(current_organization) do |f| %>
|
url: organization_sample_groups_path(current_organization) do |f| %>
|
||||||
<div class="form-group">
|
<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="submit" class="glyphicon glyphicon-ok"></span>
|
||||||
<span id="remove" class="glyphicon glyphicon-remove"></span>
|
|
||||||
</div>
|
</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 %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% @sample_groups.sorted.each do |sample_group| %>
|
<% @sample_groups.sorted.each do |sample_group| %>
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,10 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.text_field :name, id: 'name-input', class: 'form-control' %>
|
<%= f.text_field :name, id: 'name-input', class: 'form-control' %>
|
||||||
<span id="submit" class="glyphicon glyphicon-ok"></span>
|
<span id="submit" class="glyphicon glyphicon-ok"></span>
|
||||||
<span id="remove" class="glyphicon glyphicon-remove"></span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<span class="pull-right">
|
||||||
|
<span id="remove" class="glyphicon glyphicon-trash"></span>
|
||||||
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% @sample_types.sorted.each do |sample_type| %>
|
<% @sample_types.sorted.each do |sample_type| %>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue