universal_table/app/views/admin/universal_tables/_integer_field.html.erb

25 lines
780 B
Plaintext

<div class="control-group">
<%= f.label :number, column.title, :class => "control-label" %>
<div class="controls">
<div class="input-append">
<%= f.number_field :number, :value => integer_field.number %>
</div>
<% if column.make_categorizable %>
<%= render_unique_number(f,column,i).html_safe %>
<script type="text/javascript">
$("select#<%= column.key + "_" + i.to_s %>").on("change",function(){
var el = $(this),
value = el.val(),
inputs = el.parent().parent().find("input[type=number]");
inputs.val(value);
})
</script>
<% end %>
</div>
<% if !integer_field.new_record? %>
<%= f.hidden_field :id %>
<% else %>
<%= f.hidden_field :table_column_id, :value => column.id %>
<% end %>
</div>