Changed the input forms for project and context. They are now more consistent with the new action form. Solves #600

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@638 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lrbalt 2007-11-13 21:49:54 +00:00
parent 289637f6e1
commit 4b3cad8b81
6 changed files with 96 additions and 48 deletions

View file

@ -2,6 +2,7 @@ if @saved
page.hide 'contexts-empty-nd'
page.insert_html :bottom, "list-contexts", :partial => 'context_listing', :locals => { :context_listing => @context }
page.sortable "list-contexts", get_listing_sortable_options
page.hide 'status'
page.call "Form.reset", "context-form"
page.call "Form.focusFirstElement", "context-form"
else

View file

@ -1,6 +1,6 @@
<div id="display_box">
<div id="list-contexts">
<div id="contexts-empty-nd" style="display:<%= @no_contexts ? 'block' : 'none'%>;">
<div id="contexts-empty-nd" style="<%= @no_contexts ? 'display:block' : 'display:none'%>">
<div class="message"><p>Currently there are no contexts</p></div>
</div>
<%= render :partial => 'context_listing', :collection => @contexts %>
@ -8,20 +8,35 @@
</div>
<div id="input_box">
<a id="toggle-new-context-form" href="#" accesskey="n" title="Create a new context">Create new context &#187;</a>
<div id="context_new" class="context_new" style="display:block">
<% form_remote_tag :url => contexts_path, :method => :post, :html=> { :id => 'context-form', :name => 'context', :class => 'inline-form' } do -%>
<div id="status"><%= error_messages_for('context') %></div>
<label for="context_name">Context name</label><br />
<%= text_field( "context", "name" ) %><br />
<label for="new_context_on_front">Hide from front page?</label>
<%= check_box( "context", "hide" ) %><br />
<div id="context_new_container">
<a id="toggle-new-context-form" href="#" accesskey="n" title="Create a new context">Create new context &#187;</a>
<div id="context_new" class="context_new" style="display:block">
<% form_remote_tag(
:url => contexts_path,
:method => :post,
:html=> { :id => 'context-form', :name => 'context', :class => 'inline-form'},
:before => "$('context_new_submit').startWaiting()",
:complete => "$('context_new_submit').stopWaiting()",
:condition => "!$('context_new_submit').isWaiting()") do -%>
<input type="submit" value="Add" />
<% end -%>
<div id="status"><%= error_messages_for('context') %></div>
<label for="context_name">Context name</label><br />
<%= text_field( "context", "name" ) %><br />
<label for="context_hide">Hide from front page?</label>
<%= check_box( "context", "hide" ) %><br />
<div class="submit_box">
<div class="widgets">
<button type="submit" class="positive" id="context_new_submit">
<%= image_tag("accept.png", :alt => "") + 'Add Context' %>
</button>
</div>
</div>
<br/><br/>
<% end -%>
</div>
</div>
</div>
<%

View file

@ -16,6 +16,8 @@
<script type="text/javascript">
window.onload=function(){
Nifty("div#todo_new_action_container","normal");
Nifty("div#project_new_project_container","normal");
Nifty("div#context_new_container","normal");
if ($('flash').visible()) { new Effect.Fade("flash",{duration:5.0}); }
}
</script>

View file

@ -1,6 +1,7 @@
if @saved and @go_to_project
page.redirect_to project_path(@project)
elsif @saved
page.hide 'status'
page.hide 'projects-empty-nd'
page.show 'list-active-projects-container'
page.replace_html "active-projects-count", @active_projects_count

View file

@ -1,7 +1,7 @@
<div id="display_box">
<div id="projects-empty-nd" style="display:<%= @no_projects ? 'block' : 'none'%>;">
<div class="message"><p>Currently there are no projects</p></div>
</div>
<div id="projects-empty-nd" style="<%= @no_projects ? 'display:block' : 'display:none'%>">
<div class="message"><p>Currently there are no projects</p></div>
</div>
<%= render :partial => 'project_state_group', :object => @active_projects, :locals => { :state => 'active'} %>
<%= render :partial => 'project_state_group', :object => @hidden_projects, :locals => { :state => 'hidden'} %>
<%= render :partial => 'project_state_group', :object => @completed_projects, :locals => { :state => 'completed'} %>
@ -9,33 +9,50 @@
<% @project = @new_project -%>
<div id="input_box">
<%= link_to_function("Create a new project &#187;",
"Element.toggle('project_new');Form.focusFirstElement('project-form');",
{:title => "Add a next action", :accesskey => "n"}) %>
<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' } do -%>
<div id="status"><%= error_messages_for('project') %></div>
<label for="project_name">Name:</label><br />
<%= text_field 'project', 'name', "tabindex" => 1 %><br />
<label for="project_description">Description (optional):</label><br />
<%= text_area 'project', 'description', "cols" => 30, "rows" => 4, "tabindex" => 2 %><br />
<% unless @contexts.empty? -%>
<label for="default_context_name">Default Context (optional):</label><br />
<%= text_field_tag("project[default_context_name]", @project.default_context.name, :tabindex => 3) %>
<%= render :partial => 'default_context_autocomplete' %>
<br />
<% end -%>
<input type="submit" value="Add Project" tabindex="4" /><br />
<div id="project_new_project_filler">
<div id="project_new_project_container">
<input id="go_to_project" type="checkbox" tabindex="5" name="go_to_project"/><label for="go_to_project"> Take me to the new project page</label><br />
<% end -%>
<%= link_to_function("Create a new project &#187;",
"Element.toggle('project_new');Form.focusFirstElement('project-form');",
{:title => "Add a next action", :accesskey => "n"}) %>
<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'},
:before => "$('project_new_project_submit').startWaiting()",
:complete => "$('project_new_project_submit').stopWaiting()",
:condition => "!$('project_new_project_submit').isWaiting()") do -%>
<div id="status"><%= error_messages_for('project') %></div>
<label for="project_name">Name:</label><br />
<%= text_field 'project', 'name', "tabindex" => 1 %><br />
<label for="project_description">Description (optional):</label><br />
<%= text_area 'project', 'description', "cols" => 30, "rows" => 4, "tabindex" => 2 %><br />
<% unless @contexts.empty? -%>
<label for="default_context_name">Default Context (optional):</label><br />
<%= text_field_tag("project[default_context_name]", @project.default_context.name, :tabindex => 3) %>
<%= render :partial => 'default_context_autocomplete' %>
<br />
<% end -%>
<br/>
<div class="submit_box">
<div class="widgets">
<button type="submit" class="positive" id="project_new_project_submit">
<%= image_tag("accept.png", :alt => "") + 'Add Project' %>
</button>
</div>
</div>
<br/><br/>
<input id="go_to_project" type="checkbox" tabindex="5" name="go_to_project"/><label for="go_to_project"> Take me to the new project page</label><br />
<% end -%>
</div>
</div>
</div>
</div>
</div>

View file

@ -665,7 +665,7 @@ form {
.inline-form table td.label {
width: 13ex;
}
#todo_new_action_container {
#todo_new_action_container, #project_new_project_container, #context_new_container {
background: #ddd;
width: 270px;
padding: 5px 10px;
@ -676,10 +676,22 @@ form {
color: #eee;
}
#todo_new_action_container input, #todo_new_action_container textarea {
#project_new_project_filler {
padding-top: 50px;
}
#todo_new_action_container input,
#todo_new_action_container textarea,
#project_new_project_container input,
#project_new_project_container textarea,
#context_new_container input {
width: 100%;
}
input#go_to_project, input#context_hide {
width: 5%;
}
#todo_new_action_container .show_from_input, #todo_new_action_container .due_input {
width: 45%;
}
@ -688,7 +700,7 @@ form {
float: right;
}
#todo-form-new-action .submit_box {
#todo-form-new-action .submit_box, #project_form .submit_box, #context_form .submit_box {
height: 25px;
padding: 5px 0;
text-align: center;