diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index baaa25dd..93bdb23e 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,27 +1,30 @@ -class SearchController < ApplicationController - - helper :todos, :application, :notes, :projects - - def results - @source_view = params['_source_view'] || 'search' - @page_title = "TRACKS::Search Results for #{params[:search]}" - terms = '%' + params[:search] + '%' - @found_todos = current_user.todos.find(:all, :conditions => ["todos.description LIKE ? OR todos.notes LIKE ?", terms, terms], :include => [:tags, :project, :context]) - @found_projects = current_user.projects.find(:all, :conditions => ["name LIKE ? or description LIKE ?", terms, terms]) - @found_notes = current_user.notes.find(:all, :conditions => ["body LIKE ?", terms]) - - @count = @found_todos.size + @found_projects.size + @found_notes.size - - init_not_done_counts(['project']) - init_project_hidden_todo_counts(['project']) - end - - def index - @page_title = "TRACKS::Search" - end - - def init - @source_view = params['_source_view'] || 'search' - end - -end +class SearchController < ApplicationController + + helper :todos, :application, :notes, :projects + + def results + @source_view = params['_source_view'] || 'search' + @page_title = "TRACKS::Search Results for #{params[:search]}" + terms = '%' + params[:search] + '%' + @found_todos = current_user.todos.find(:all, :conditions => ["todos.description LIKE ? OR todos.notes LIKE ?", terms, terms], :include => [:tags, :project, :context]) + @found_projects = current_user.projects.find(:all, :conditions => ["name LIKE ? OR description LIKE ?", terms, terms]) + @found_notes = current_user.notes.find(:all, :conditions => ["body LIKE ?", terms]) + @found_contexts = current_user.contexts.find(:all, :conditions => ["name LIKE ?", terms]) + # TODO: limit search to tags on todos + @found_tags = current_user.tags.find(:all, :conditions => ["name LIKE ?", terms]) + + @count = @found_todos.size + @found_projects.size + @found_notes.size + @found_contexts.size + @found_tags.size + + init_not_done_counts + init_project_hidden_todo_counts + end + + def index + @page_title = "TRACKS::Search" + end + + def init + @source_view = params['_source_view'] || 'search' + end + +end diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 06671b26..0b38d202 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -117,7 +117,7 @@ module TodosHelper "" + link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) + ""}.join('') - if not tag_list.empty? then "#{tag_list}" end + if tag_list.empty? then "" else "#{tag_list}" end end def deferred_due_date diff --git a/app/models/user.rb b/app/models/user.rb index fd649b10..33a9e4bc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -124,7 +124,7 @@ class User < ActiveRecord::Base #for will_paginate plugin cattr_accessor :per_page - @@per_page = 1 + @@per_page = 5 def validate unless Tracks::Config.auth_schemes.include?(auth_type) diff --git a/app/views/contexts/_context_listing.rhtml b/app/views/contexts/_context_listing.rhtml index 03ad73f3..32335457 100644 --- a/app/views/contexts/_context_listing.rhtml +++ b/app/views/contexts/_context_listing.rhtml @@ -1,9 +1,14 @@ -<% context = context_listing %> +<% context = context_listing + suppress_drag_handle ||= false + suppress_edit_button ||= false +%>
" class="list">
-
- DRAG -
+ <% unless suppress_drag_handle -%> +
+ DRAG +
+ <% end -%>
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
@@ -32,5 +37,5 @@ -%>
- <%= render :partial => 'context_form', :object => context %> + <%= render :partial => 'contexts/context_form', :object => context %> \ No newline at end of file diff --git a/app/views/contexts/_mobile_context.rhtml b/app/views/contexts/_mobile_context.rhtml index 71c3945d..52236e1f 100644 --- a/app/views/contexts/_mobile_context.rhtml +++ b/app/views/contexts/_mobile_context.rhtml @@ -6,9 +6,9 @@ if not @not_done.empty? # only show a context when there are actions in it -%>

<%=mobile_context.name%>

- +
+ <% end -%> diff --git a/app/views/layouts/mobile.m.erb b/app/views/layouts/mobile.m.erb index c53ea4c3..3ee740a5 100644 --- a/app/views/layouts/mobile.m.erb +++ b/app/views/layouts/mobile.m.erb @@ -2,35 +2,40 @@ new_todo_params = {} new_todo_params[:from_project] = @mobile_from_project if @mobile_from_project new_todo_params[:from_context] = @mobile_from_context if @mobile_from_context --%> +-%> + -<%= stylesheet_link_tag "mobile"%> +<%= stylesheet_link_tag "mobile", :media => 'handheld,all' %> <%= @page_title %> <% if !(@new_mobile || @edit_mobile) if !@prefs.nil? -%>

<%= @down_count %> <%= user_time.strftime(@prefs.title_date_format) -%>

-<%= (link_to("0-Add new action", formatted_new_todo_path(:m, new_todo_params))+" | ") unless @new_mobile -%> + +<%= yield -%>
<% if !@prefs.nil? -%> + <% end -%> <%= render :partial => "shared/mobile_footer" -%> \ No newline at end of file diff --git a/app/views/login/login.html.erb b/app/views/login/login.html.erb index 317b7d69..039fdc59 100644 --- a/app/views/login/login.html.erb +++ b/app/views/login/login.html.erb @@ -14,19 +14,19 @@ <% form_tag :action=> 'login' do %> - - + + - - + + - - + + - +
@@ -39,15 +39,15 @@ <% form_tag :action=> 'login', :action => 'begin' do %> - - + + - - + + - +
diff --git a/app/views/login/login_mobile.html.erb b/app/views/login/login_mobile.html.erb index d88b3316..f3ff6511 100644 --- a/app/views/login/login_mobile.html.erb +++ b/app/views/login/login_mobile.html.erb @@ -14,19 +14,19 @@ <% form_tag formatted_login_path(:format => 'm') do %> - - + + - - + + - - + + - +
 
diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index 7065746b..8cfcbd76 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -1,6 +1,9 @@ - + + \ No newline at end of file diff --git a/app/views/search/results.rhtml b/app/views/search/results.rhtml index 679360c5..e18516ee 100644 --- a/app/views/search/results.rhtml +++ b/app/views/search/results.rhtml @@ -1,32 +1,48 @@ -
- <% if @count == 0 -%> -

Your search yielded no results.

- <% else -%> - <% source_view_is = :search %> - <% parent_container_type = 'search' %> - <% if not @found_todos.empty? -%> -
-

<%= @found_todos.size %>Todos matching query

- <%= render :partial => "todos/todo", :collection => @found_todos, :locals => { :parent_container_type => 'search', :suppress_context => false, :suppress_project => false, :suppress_edit_button => true } %> -
- <% end -%> - - <% if not @found_projects.empty? -%> -
-

<%= @found_projects.size %>Projects matching query

- <%= render :partial => "projects/project_listing", :collection => @found_projects, :locals => { :suppress_drag_handle => true, :suppress_edit_button => true } %> -
- <% end -%> - - <% if not @found_notes.empty? -%> -
-

<%= @found_notes.size %>Notes matching query

- <% for notes in @found_notes -%> -
- <%= render :partial => "notes/notes_summary", :object => notes %> -
- <% end -%> -
- <% end -%> - <% end -%> -
+
+<% if @count == 0 -%> +

Your search yielded no results.

+<% else -%> + <% unless @found_todos.empty? -%> +
+

<%= @found_todos.size %>Todos matching query

+ <%= render :partial => "todos/todo", :collection => @found_todos, :locals => { :parent_container_type => 'search', :suppress_context => false, :suppress_project => false, :suppress_edit_button => true } %> +
+ <% end -%> + + <% unless @found_projects.empty? -%> +
+

<%= @found_projects.size %>Projects matching query

+ <%= render :partial => "projects/project_listing", :collection => @found_projects, :locals => { :suppress_drag_handle => true, :suppress_edit_button => true } %> +
+ <% end -%> + + <% unless @found_notes.empty? -%> +
+

<%= @found_notes.size %>Notes matching query

+ <% for notes in @found_notes -%> +
+ <%= render :partial => "notes/notes_summary", :object => notes %> +
+ <% end -%> +
+ <% end -%> + + <% unless @found_contexts.empty? -%> +
+

<%= @found_contexts.size %>Contexts matching query

+ <%= render :partial => "contexts/context_listing", :collection => @found_contexts, :locals => { :suppress_drag_handle => true, :suppress_edit_button => true } %> +
+ <% end -%> + + <% unless @found_tags.empty? -%> +
+

<%= @found_tags.size %>Tags matching query

+ <% @found_tags.each do |tag| -%> + <%= link_to tag.name, {:controller => "todos", :action => "tag", :id => tag.name} -%> + <% end %> + +
+
+ <% end %> +<% end -%> +
diff --git a/app/views/todos/_edit_mobile.rhtml b/app/views/todos/_edit_mobile.rhtml index 0837f026..ef1de808 100644 --- a/app/views/todos/_edit_mobile.rhtml +++ b/app/views/todos/_edit_mobile.rhtml @@ -10,7 +10,7 @@ if parent_container_type == 'show_mobile' -%>

<%= text_field( "todo", "description", "tabindex" => 2) %>

-<%= text_area( "todo", "notes", "cols" => 30, "rows" => 5, "tabindex" => 3) %> +<%= text_area( "todo", "notes", "cols" => 30, "rows" => 2, "tabindex" => 3) %>

<%= unless @mobile_from_context collection_select( "todo", "context_id", @contexts, "id", "name", {}, {"tabindex" => 4} ) @@ -22,7 +22,7 @@ end %>

<%= unless @mobile_from_project collection_select( "todo", "project_id", @projects, "id", "name", - {:include_blank => true}, {"tabindex" => 5} ) + {:include_blank => '--No project--'}, {"tabindex" => 5} ) else # manually add blank option since :include_blank does not work # with options_from_collection_for_select @@ -34,7 +34,7 @@ end %> <%= text_field_tag "tag_list", @tag_list_text, :size => 30, :tabindex => 6 %>

<%= date_select("todo", "due", {:order => [:day, :month, :year], - :start_year => this_year, :include_blank => true}, :tabindex => 7) %> + :start_year => this_year, :include_blank => '--'}, :tabindex => 7) %>

<%= date_select("todo", "show_from", {:order => [:day, :month, :year], :start_year => this_year, :include_blank => true}, :tabindex => 8) %> diff --git a/app/views/todos/_mobile_todo.rhtml b/app/views/todos/_mobile_todo.rhtml index 8537d98d..59e16bba 100644 --- a/app/views/todos/_mobile_todo.rhtml +++ b/app/views/todos/_mobile_todo.rhtml @@ -1,10 +1,10 @@ <% @todo = mobile_todo if mobile_todo.starred? - bullet = ""+image_tag("menustar_small.gif")+"" + li_class = " class=\"star\"" else - bullet = "» " + li_class = "" end -%> -<%= bullet %><% +
  • ><% if mobile_todo.completed? -%> <% else @@ -22,4 +22,4 @@ end -%> ")" -%> <% end -%> <%= tag_list_mobile -%> - +
  • diff --git a/public/.htaccess b/public/.htaccess index 3b66fccd..51a97fd7 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -39,4 +39,4 @@ RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] # Example: # ErrorDocument 500 /500.html -ErrorDocument 500 "

    Application error

    Rails application failed to start properly" \ No newline at end of file +ErrorDocument 500 "

    Application error

    Rails application failed to start properly" diff --git a/public/stylesheets/mobile.css b/public/stylesheets/mobile.css index f51b46db..06af678d 100644 --- a/public/stylesheets/mobile.css +++ b/public/stylesheets/mobile.css @@ -29,15 +29,18 @@ div.footer a { } h1 { - color: #f00; - font-size: small; + color: #f00; + font-size: small; + margin-top:.3em; + margin-bottom:.3em; } h2 { - background-color: #cccccc; - font-size : small; - margin-top: 10px; - margin-bottom: 0; + background-color: #aaaaaa; + font-size : small; + margin: .3em 0; + padding: .3em 0 .1em .3em; + border-top: 1px solid #777777; } h4.alert { @@ -61,7 +64,7 @@ h4.notice { } span.tag { - font-size: XX-small; + font-size: x-small; background-color: #CCE7FF; color: #000; padding: 1px; @@ -82,47 +85,78 @@ span.prj, span.ctx{ color: #fff; background: #f00; padding: 1px; - font-size: 10px; + font-size: 1em; } .amber { color: #fff; background: #ff6600; padding: 1px; - font-size: 10px; + font-size: 1em; } .orange { color: #fff; background: #FFA500; padding: 1px; - font-size: 10px; + font-size: 1em; } .green { color: #fff; background: #33cc00; padding: 1px; - font-size: 10px; + font-size: 1em; } .grey { color: #fff; background: #999; padding: 1px; - font-size: 10px; + font-size: 1em; } .count { color: #fff; background: #000; - font-size: medium; + font-size: medium; } .errors { background: #FFC2C2; } +ul.c li.star { + list-style-image:url(../images/menustar_small.gif) +} + +ul.c { + padding: 0; + margin: 0; + padding-left: 1.1em; +} + +ul.c li { + padding: 0; + margin: 0; +} + +ul.c li span.r { + display: none; +} + +span.r { + display:none; +} + +.nav { + font-size: x-small; +} + +#database_auth_form table td { + width:7em; +} + table.c { margin-left: 5px; } diff --git a/test/selenium/project_detail/changing_project_name_should_change_default_project.rsel b/test/selenium/project_detail/changing_project_name_should_change_default_project.rsel new file mode 100644 index 00000000..e78dcd21 --- /dev/null +++ b/test/selenium/project_detail/changing_project_name_should_change_default_project.rsel @@ -0,0 +1,13 @@ +setup :fixtures => :all +login :as => 'admin' +open "/projects/1" + +# change project name +click "project_name_in_place_editor" +wait_for_element_present "css=#project_name_in_place_editor-inplaceeditor input.editor_field" +type "css=#project_name_in_place_editor-inplaceeditor input.editor_field", "Test Foo" +click "css=#project_name_in_place_editor-inplaceeditor input.editor_ok_button" +wait_for_text "project_name_in_place_editor", "Test Foo" + +# check that the default project name is changed too +assert_value "todo_project_name", "Test Foo" \ No newline at end of file diff --git a/test/selenium/tags/change_context_in_tag_view.rsel b/test/selenium/tags/change_context_in_tag_view.rsel new file mode 100644 index 00000000..74bf8b85 --- /dev/null +++ b/test/selenium/tags/change_context_in_tag_view.rsel @@ -0,0 +1,17 @@ +setup :fixtures => :all +login :as => 'admin' +open "/todos/tag/foo" +wait_for_element_present "xpath=//div[@id='c1'] //h2" + +# change context name +click "edit_icon_todo_1" +wait_for_element_present "submit_todo_1" +type "//input[@name='context_name']", "call" +click "//button[@id='submit_todo_1']" +wait_for_visible "flash" + +# check context agenda is gone +wait_for_not_visible "c1" +verify_text_present "Call Bill Gates to find out how much he makes per day" + + diff --git a/test/selenium/users/delete_user.rsel b/test/selenium/users/delete_user.rsel new file mode 100644 index 00000000..32ff3545 --- /dev/null +++ b/test/selenium/users/delete_user.rsel @@ -0,0 +1,7 @@ +setup :fixtures => :all +login :as => 'admin' +open '/users' +assert_text_present "John Deere" +click "//tr[@id='user-3']//img" +assert_confirmation "Warning: this will delete user 'john', all their actions, contexts, project and notes. Are you sure that you want to continue?" +wait_for_text_not_present "John Deere" \ No newline at end of file