Sha256: 6c78af31d485d8b3ffa32d206be186a3c4a93f8ec1a0f7c3e5b99e1eec6b47a0

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

<% @record.errors.each do |k, v| %>
  var $errorOBJ_<%= k %> = $('#_form_id_<%= k %>');
  var $errorFormGroup_<%= k %> = $errorOBJ_<%= k %>.parents('div.form-group');

  $errorFormGroup_<%= k %>.removeClass('has-error');
  $errorFormGroup_<%= k %>.find('p.help-block').remove();
  $errorFormGroup_<%= k %>.addClass('has-error');
  $errorOBJ_<%= k %>.after('<p class="help-block"><%= v %></p>');

  $errorOBJ_<%= k %>.bind('keydown mousedown', function () {
      $errorFormGroup_<%= k %>.removeClass('has-error');
      $errorFormGroup_<%= k %>.find('p.help-block').remove();
  });
<% end %>

<% if @record.errors.empty? %>
  bootbox.alert("操作成功!", function(){
    location.href = "<%= polymorphic_url [:admin, model] %>"
  })
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sofav-0.2.0 app/views/admin/application/_save_js.js.erb