mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-07 05:10:19 +01:00
DRY up javascript for form visibility toggling.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@644 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
cb648ef141
commit
ae95f03c5b
6 changed files with 46 additions and 43 deletions
|
|
@ -9,7 +9,17 @@
|
|||
|
||||
<div id="input_box">
|
||||
<div id="context_new_container">
|
||||
<a id="toggle-new-context-form" href="#" accesskey="n" title="Create a new context">Create new context »</a>
|
||||
|
||||
<div id="toggle_context_new" class="hide_form">
|
||||
<a title="Hide new context form" accesskey="n">« Hide form</a>
|
||||
<% apply_behavior '#toggle_context_new a:click', :prevent_default => true do |page|
|
||||
page << "TracksForm.toggle('toggle_context_new', 'context_new', 'context-form',
|
||||
'« Hide form', 'Hide new context form',
|
||||
'Create a new context »', 'Add a context');"
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
<div id="context_new" class="context_new" style="display:block">
|
||||
<% form_remote_tag(
|
||||
:url => contexts_path,
|
||||
|
|
@ -41,10 +51,4 @@
|
|||
</div>
|
||||
<%
|
||||
sortable_element 'list-contexts', get_listing_sortable_options
|
||||
|
||||
apply_behavior '#toggle-new-context-form:click', :prevent_default => true do |page|
|
||||
page['context_new'].toggle
|
||||
page['context-form'].down('input').focus
|
||||
#page << "Form.focusFirstElement('context-form');"
|
||||
end
|
||||
-%>
|
||||
|
|
@ -12,10 +12,16 @@
|
|||
<div id="project_new_project_filler">
|
||||
<div id="project_new_project_container">
|
||||
|
||||
<%= link_to_function("Create a new project »",
|
||||
"Element.toggle('project_new');Form.focusFirstElement('project-form');",
|
||||
{:title => "Add a next action", :accesskey => "n"}) %>
|
||||
|
||||
<div id="toggle_project_new" class="hide_form">
|
||||
<a title="Hide new project form" accesskey="n">« Hide form</a>
|
||||
<% apply_behavior '#toggle_project_new a:click', :prevent_default => true do |page|
|
||||
page << "TracksForm.toggle('toggle_project_new', 'project_new', 'project-form',
|
||||
'« Hide form', 'Hide new project form',
|
||||
'Create a new project »', 'Add a project');"
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
<div id="project_new" class="project_new" style="display:block">
|
||||
<% form_remote_tag(:url => projects_path, :method => :post,
|
||||
:html=> { :id=>'project-form', :name=>'project', :class => 'inline-form'},
|
||||
|
|
|
|||
|
|
@ -7,16 +7,15 @@
|
|||
%>
|
||||
<div id="todo_new_action_container">
|
||||
|
||||
<div id="show_todo_new_action" style="display:none">
|
||||
<%= link_to_function("Add a next action »",
|
||||
"todoItems.showNewActionForm();return false;",
|
||||
{:title => "Add a next action"}) %>
|
||||
</div>
|
||||
<div id="hide_todo_new_action" style="display:block">
|
||||
<%= link_to_function("« Hide form",
|
||||
"todoItems.hideNewActionForm();return false;",
|
||||
{:title => "Hide next action form", :accesskey => "n"}) %>
|
||||
</div>
|
||||
<div id="toggle_action_new" class="hide_form">
|
||||
<a title="Hide new action form" accesskey="n">« Hide form</a>
|
||||
<% apply_behavior '#toggle_action_new a:click', :prevent_default => true do |page|
|
||||
page << "TracksForm.toggle('toggle_action_new', 'todo_new_action', 'todo-form-new-action',
|
||||
'« Hide form', 'Hide next action form',
|
||||
'Add a next action »', 'Add a next action');"
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
<div id="todo_new_action" style="display:block">
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue