Sha256: 3dba561223bbfdbe4f56e77938145ef50cac9a27a98b40c05545d60001798568

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

<% # Close the dropdown menu %>
var section = $(".section.<%= escape_javascript(params[:section]) %>");
section.find(".dropdown.open").removeClass("open");

<% # Create a new relationships list item %>
created_profile_field = $("<%= j(render partial: 'profile_fields/profile_field', object: @profile_field)  %>");

<% # Insert this new list item as the last one in the section of the list items
   # that can be seen also when not in edit_mode. %>
section.find("ul.profile_fields").append(created_profile_field);

<% # Add all methods and triggers that are needed for the edit mode to the new
   # elements. %>
created_profile_field.apply_edit_mode();

<% # Trigger the edit_mode in order to make the new entry be shown as text fields. %>
created_profile_field.find(".editable").trigger("edit");

<% # Set the focus to the first field (except for the label => second) %>
if (created_profile_field.find("input[type=text]").length > 1){
  created_profile_field.find("input[type=text]")[1].focus();
}else{
  var textBox = created_profile_field.find("textarea");
  textBox.focus();
  textBox.select();
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 app/views/profile_fields/create.js.erb
your_platform-1.0.0 app/views/profile_fields/create.js.erb
your_platform-0.0.2 app/views/profile_fields/create.js.erb