mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
When showing the project edit form, we disable the ability to edit the project name in place. When the project edit form is saved or cancelled, then we reenable the editing of the project name in place. Fixes #1205
31 lines
765 B
Text
31 lines
765 B
Text
function html_for_edit_form() {
|
|
return "<%= escape_javascript(render(:partial => 'project_form', :object => @project)) %>";
|
|
}
|
|
|
|
function remove_edit_form() {
|
|
$('div#<%= dom_id(@project, 'edit') %>').fadeOut(250, function() {
|
|
$('div#<%= dom_id(@project) %>').fadeIn(250);
|
|
});
|
|
}
|
|
|
|
function show_edit_form() {
|
|
$('div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form());
|
|
$('div#<%=dom_id(@project, 'edit')%>').fadeIn(500);
|
|
$('div#project_name').editable('disable');
|
|
}
|
|
|
|
function set_focus() {
|
|
$('input.project-name').focus();
|
|
}
|
|
|
|
|
|
function replace_project_with_edit_form() {
|
|
$('div#<%=dom_id(@project)%>').fadeOut(250, function() {
|
|
show_edit_form();
|
|
set_focus();
|
|
enable_rich_interaction();
|
|
});
|
|
}
|
|
|
|
|
|
replace_project_with_edit_form();
|