mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
25 lines
No EOL
764 B
Text
25 lines
No EOL
764 B
Text
<%- object_name = unique_object_name_for("edit_context_#{@context.id}") %>
|
|
|
|
var <%=object_name%> = {
|
|
animate: function() {
|
|
<%=object_name%>.replace_context_with_edit_form();
|
|
},
|
|
replace_context_with_edit_form: function() {
|
|
$('div#<%=dom_id(@context)%>').fadeOut(250, function() {
|
|
<%=object_name%>.show_edit_form();
|
|
<%=object_name%>.set_focus();
|
|
});
|
|
},
|
|
show_edit_form: function() {
|
|
$('div#<%=dom_id(@context, 'edit')%>').html(<%=object_name%>.html_for_edit_form());
|
|
$('div#<%=dom_id(@context, 'edit')%>').fadeIn(500);
|
|
},
|
|
set_focus: function() {
|
|
$('input.context-name').focus();
|
|
},
|
|
html_for_edit_form: function() {
|
|
return "<%= js_render('context_form', {}, @context) %>";
|
|
}
|
|
};
|
|
|
|
<%= object_name %>.animate(); |