mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-19 05:38:08 +01:00
migrate editing a context and refactor project with it
This commit is contained in:
parent
4e9777dc88
commit
fb39d841a7
13 changed files with 163 additions and 43 deletions
|
|
@ -1,9 +1,21 @@
|
|||
newHtml = "<%= escape_javascript(render(:partial => 'project_form', :locals => { :project_form => @project })) %>"
|
||||
replace_project_with_edit_form();
|
||||
|
||||
$('div#<%=dom_id(@project)%>').fadeOut(250, function() {
|
||||
$('div#<%=dom_id(@project, 'edit')%>').html(newHtml);
|
||||
function replace_project_with_edit_form() {
|
||||
$('div#<%=dom_id(@project)%>').fadeOut(250, function() {
|
||||
show_edit_form();
|
||||
set_focus();
|
||||
});
|
||||
}
|
||||
|
||||
function show_edit_form() {
|
||||
$('div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form());
|
||||
$('div#<%=dom_id(@project, 'edit')%>').fadeIn(500);
|
||||
}
|
||||
|
||||
function set_focus() {
|
||||
$('input.project-name').focus();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function html_for_edit_form() {
|
||||
return "<%= escape_javascript(render(:partial => 'project_form', :locals => { :project_form => @project })) %>"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue