mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 13:58:49 +01:00
changed edit forms for projects and context to make them consistent with edit form of actions. Fixes #610
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@643 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
df66ae7d0a
commit
cb648ef141
5 changed files with 94 additions and 82 deletions
|
|
@ -1,13 +1,36 @@
|
|||
<%
|
||||
@context = context_form
|
||||
%>
|
||||
<%= error_messages_for 'context' %>
|
||||
<tr>
|
||||
<td width="150"><label for="context_name">Name</label></td>
|
||||
<td width="300"><%= text_field 'context', 'name', :class => 'context-name' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"><label for="context_hide">Hidden?</label></td>
|
||||
<td width="300"><%= check_box 'context', 'hide', :class => 'context-hide' %></td>
|
||||
</tr>
|
||||
<% @context = nil %>
|
||||
<% context = context_form
|
||||
@context = context-%>
|
||||
<div id="<%= dom_id(context, 'edit') %>" class="edit-form" style="display:none;">
|
||||
<% form_tag(context_path(context), {:id => dom_id(context, 'edit_form'), :class => "inline-form "+dom_id(context, 'edit_form')+"-edit-context-form", :method => :put}) do -%>
|
||||
<%= error_messages_for 'context' %>
|
||||
|
||||
<label for="context_name">Context name</label><br/>
|
||||
<%= text_field('context', 'name', :class => 'context-name') %><br/>
|
||||
|
||||
<label for="context_hide">Hide from front page?</label>
|
||||
<%= check_box('context', 'hide', :class => 'context-hide') %>
|
||||
<input type="hidden" name="wants_render" value="true" />
|
||||
|
||||
<div class="submit_box">
|
||||
<div class="widgets">
|
||||
<button type="submit" class="positive" id="<%= dom_id(context, 'submit') %>" tabindex="15">
|
||||
<%=image_tag("accept.png", :alt => "") %>
|
||||
Update
|
||||
</button>
|
||||
<a href="javascript:void(0);" onclick="Element.toggle('<%= dom_id(context) %>');Element.toggle('<%= dom_id(context, 'edit') %>');" class="negative">
|
||||
<%=image_tag("cancel.png", :alt => "") %>
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<br/><br/>
|
||||
|
||||
<% end %>
|
||||
<%= apply_behavior "."+dom_id(context, 'edit_form')+"-edit-context-form", make_remote_form(
|
||||
:before => "$('"+dom_id(context, 'submit')+"').startWaiting()",
|
||||
:complete => "$('"+dom_id(context, 'submit')+"').stopWaiting(); Effect.Appear($(this).up('.list'))",
|
||||
:condition => "!$('"+dom_id(context, 'submit')+"').isWaiting()"),
|
||||
:external => true
|
||||
@context = nil %>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="data">
|
||||
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="buttons">
|
||||
<% if context.hide? %>
|
||||
<span class="grey">HIDDEN</span>
|
||||
|
|
@ -16,41 +16,25 @@
|
|||
<% end %>
|
||||
<a class="delete_context_button" href="<%= formatted_context_path(context, :js) %>" title="delete the context '<%= context.name %>'"><%= image_tag( "blank.png", :title => "Delete context", :class=>"delete_item") %></a>
|
||||
<%= apply_behavior "a.delete_context_button:click", { :prevent_default => true, :external => true} do |page|
|
||||
page << "if (confirm('Are you sure that you want to ' + this.title + '?')) {"
|
||||
page << " new Ajax.Request(this.href, {asynchronous:true,"
|
||||
page << " evalScripts:true, method:'delete'}); };"
|
||||
page << "if (confirm('Are you sure that you want to ' + this.title + '?')) {"
|
||||
page << " new Ajax.Request(this.href, {asynchronous:true,"
|
||||
page << " evalScripts:true, method:'delete'}); };"
|
||||
end -%>
|
||||
<a class="edit_context_button" href="#"><%= image_tag( "blank.png", :title => "Edit context", :class=>"edit_item") %></a>
|
||||
<%= apply_behavior 'a.edit_context_button:click', :prevent_default => true do |page, element|
|
||||
element.up('.context').toggle
|
||||
editform = element.up('.list').down('.edit-form')
|
||||
editform.toggle
|
||||
editform.visual_effect(:appear)
|
||||
editform.down('input').focus
|
||||
element.up('.context').toggle
|
||||
editform = element.up('.list').down('.edit-form')
|
||||
editform.toggle
|
||||
editform.visual_effect(:appear)
|
||||
editform.down('input').focus
|
||||
end
|
||||
-%>
|
||||
</div>
|
||||
</div>
|
||||
<div id="<%= dom_id(context, 'edit') %>" class="edit-form" style="display:none;">
|
||||
<% form_tag context_path(context), { :id => dom_id(context, 'edit_form'), :class => "inline-form edit-context-form", :method => :put } do -%>
|
||||
<table style="table-layout: fixed;" width="450">
|
||||
<%= render :partial => 'context_form', :object => context %>
|
||||
<tr>
|
||||
<td width="150"> <input type="hidden" name="wants_render" value="true" /> </td>
|
||||
<td width="300"><input type="submit" value="Update" /> <a href="#" class="form_reset">Cancel</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end -%>
|
||||
<%= apply_behavior ".edit-context-form", make_remote_form(:complete => "Effect.Appear($(this).up('.list'));" ), :external => true %>
|
||||
<%= apply_behavior "a.form_reset:click", :prevent_default => true do |page, element|
|
||||
element.up('.list').down('.context').toggle
|
||||
element.up('.edit-form').toggle
|
||||
element.up('form').reset
|
||||
end %>
|
||||
</div>
|
||||
<%= render :partial => 'context_form', :object => context %>
|
||||
</div>
|
||||
<% if controller.action_name == 'create' %>
|
||||
<script>
|
||||
new Effect.Appear('<%= dom_id(context) %>');
|
||||
</script>
|
||||
<script>
|
||||
new Effect.Appear('<%= dom_id(context) %>');
|
||||
</script>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,6 @@
|
|||
status_message = 'Context saved'
|
||||
page.notify :notice, status_message, 5.0
|
||||
page.replace_html dom_id(@context, 'container'), :partial => 'context_listing', :object => @context
|
||||
page.sortable "list-contexts", get_listing_sortable_options
|
||||
page.sortable "list-contexts", get_listing_sortable_options
|
||||
|
||||
page.hide "busy"
|
||||
|
|
@ -1,44 +1,45 @@
|
|||
<%
|
||||
project = project_form
|
||||
%>
|
||||
<% form_tag project_path(project), { :id => dom_id(project, 'edit_form'), :class => "inline-form edit-project-form", :method => :put } do -%>
|
||||
<table style="table-layout: fixed;" width="450">
|
||||
<% form_tag project_path(project), { :id => dom_id(project, 'edit_form'), :class => "inline-form "+dom_id(project, 'edit_form')+"-edit-project-form", :method => :put } do -%>
|
||||
|
||||
<tr>
|
||||
<td width="150"><label for="project_name">Name:</label></td>
|
||||
<td width="300"><%= text_field :project, 'name', :class => 'project-name' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"><label for="project_description">Description (optional):</label></td>
|
||||
<td width="300"><%= text_area :project, 'description', "cols" => 30, "rows" => 4, :class => 'project-description' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"><label for="project_done">Project status:</label></td>
|
||||
<td width="300">
|
||||
<% ['active', 'hidden', 'completed'].each do | state | %>
|
||||
<%= radio_button(:project, 'state', state) %> <%= state.titlecase %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"><label for="project[default_context_name]">Default Context</label></td>
|
||||
<td width="300">
|
||||
<%= text_field_tag("project[default_context_name]", project.default_context.name, {:tabindex=>1,:size=> 25}) %>
|
||||
<%= render :partial => 'default_context_autocomplete' %>
|
||||
</td>
|
||||
</tr>
|
||||
<label for="project_name">Name:</label><br/>
|
||||
<%= text_field :project, 'name', :class => 'project-name' %><br/>
|
||||
|
||||
<tr>
|
||||
<td width="150"> <input type="hidden" name="wants_render" value="true" /></td>
|
||||
<td width="300"><input type="submit" value="Update" /> <a href="#" class="form_reset">Cancel</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<label for="project_description">Description (optional):</label><br/>
|
||||
<%= text_area :project, 'description', "cols" => 30, "rows" => 4, :class => 'project-description' %><br/>
|
||||
|
||||
<%= apply_behavior ".edit-project-form", make_remote_form(:external => false) %>
|
||||
<%= apply_behavior "a.form_reset:click", :prevent_default => false do |page, element|
|
||||
element.up('.list').down('.project').toggle
|
||||
element.up('.edit-form').toggle
|
||||
element.up('form').reset
|
||||
end %>
|
||||
<label for="project_done">Project status:</label><br/>
|
||||
<% ['active', 'hidden', 'completed'].each do | state | %>
|
||||
<%= radio_button(:project, 'state', state) %> <%= state.titlecase %>
|
||||
<% end %><br/>
|
||||
|
||||
<label for="project[default_context_name]">Default Context</label><br/>
|
||||
<%= text_field_tag("project[default_context_name]", project.default_context.name, {:tabindex=>1,:size=> 25}) %>
|
||||
<%= render :partial => 'default_context_autocomplete' %>
|
||||
<br/>
|
||||
|
||||
<input type="hidden" name="wants_render" value="true" />
|
||||
<div class="submit_box">
|
||||
<div class="widgets" id="<%= dom_id(project, 'widgets') %>">
|
||||
<button type="submit" class="positive" id="<%= dom_id(project, 'submit') %>" tabindex="15">
|
||||
<%=image_tag("accept.png", :alt => "") %>
|
||||
Update
|
||||
</button>
|
||||
<a href="javascript:void(0);" id="<%= dom_id(project, 'cancel') %>" onclick="Element.toggle('<%= dom_id(project) %>');Element.toggle('<%= dom_id(project, 'edit') %>');" class="negative">
|
||||
<%=image_tag("cancel.png", :alt => "") %>
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<br/><br/>
|
||||
|
||||
<% end -%>
|
||||
|
||||
|
||||
<%= apply_behavior "."+dom_id(project, 'edit_form')+"-edit-project-form", make_remote_form(
|
||||
:before => "$('"+dom_id(project, 'submit')+"').startWaiting();",
|
||||
:complete => "$('"+dom_id(project, 'submit')+"').stopWaiting();Effect.Appear($(this).up('.list'))",
|
||||
:condition => "!$('"+dom_id(project, 'submit')+"').isWaiting()",
|
||||
:external => false) %>
|
||||
|
||||
<% end -%>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
page[dom_id(@project, 'edit')].replace_html :partial => 'project_form', :locals => { :project_form => @project }
|
||||
page[@project].stop_waiting
|
||||
page[@project].hide
|
||||
page[@project].stop_waiting
|
||||
page[dom_id(@project, 'edit')].show
|
||||
page[dom_id(@project, 'form')].down('table').down('input').focus
|
||||
page[dom_id(@project, 'form')].down('table').down('input').focus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue