Project default tags

This commit is contained in:
Eric Allen 2009-10-16 19:15:50 -04:00
parent e1079b4bc7
commit bfc6189611
6 changed files with 23 additions and 3 deletions

View file

@ -53,6 +53,7 @@ class ProjectsController < ApplicationController
@down_count = @count + @deferred.size
@next_project = current_user.projects.next_from(@project)
@previous_project = current_user.projects.previous_from(@project)
@default_tags = @project.default_tags
respond_to do |format|
format.html
format.m &render_project_mobile

View file

@ -95,6 +95,7 @@ class TodosController < ApplicationController
@projects = current_user.projects.find(:all) if @new_project_created
@initial_context_name = params['default_context_name']
@initial_project_name = params['default_project_name']
@default_tags = @todo.project.default_tags unless @todo.project.nil?
render :action => 'create'
end
format.xml do

View file

@ -20,9 +20,10 @@ else
page.replace_html dom_id(@project, 'container'), :partial => 'project_settings', :locals => { :project => @project }
page[dom_id(@project)].show
page << "$('#todo_context_name').val('#{@project.default_context.name}');" if @project.default_context
page['todo_context_name'].value = @project.default_context.name if @project.default_context
page['#todo_project_name'].value = @project.name
page['tag_list'].value = @project.default_tags if @project.default_tags
page << "$('input[name=default_context_name]').val('#{@project.default_context.name}');" if @project.default_context
page << "$('#todo_project_name').val('#{@project.name}');"
page << "defaultContexts = #{default_contexts_for_autocomplete};"
page << "defaultTags = #{default_tags_for_autocomplete};"
end

View file

@ -38,7 +38,7 @@
<div class="page_name_auto_complete" id="context_list" style="display:none"></div>
<label for="tag_list">Tags (separate with commas)</label>
<%= text_field_tag "tag_list", nil, :size => 30, :tabindex => 5 %>
<%= text_field_tag "tag_list", @default_tags, :size => 30, :tabindex => 5 %>
<%= content_tag("div", "", :id => "tag_list_auto_complete", :class => "auto_complete") %>
<div class="due_input">

View file

@ -9,6 +9,7 @@ if @saved
page.send :record, "$('#todo-form-new-action').clearForm();$('#todo-form-new-action input:first').focus();"
page['todo_context_name'].value = @initial_context_name
page['todo_project_name'].value = @initial_project_name
page['tag_list'].value = @default_tags
#page << "updateContextNamesForAutoComplete(#{context_names_for_autocomplete})" if @new_context_created
#page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}" if @new_project_created
if should_show_new_item()

View file

@ -0,0 +1,16 @@
setup :fixtures => :all
login :as => 'admin'
#first, defer a todo
open "/projects/1"
click 'css=.project_settings a'
wait_for_visible "project[default_context_name]"
type "project_default_tags", "atag"
click 'css=.positive'
wait_for_value "tag_list", "atag"
open "/projects/1"
assert_value "tag_list", "atag"
type "todo_description", "a new task"
type "tag_list", "foo"
click "todo_new_action_submit"
wait_for_value "tag_list", "atag"