diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 1661f22f..ffce91b9 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -361,6 +361,49 @@ class TodosController < ApplicationController end end + def mobile_done + # copied from toggle_check, left out other formats as they shouldn't come here + # ultimately would like to just use toggle_check + @todo = current_user.todos.find(params['id']) + @source_view = params['_source_view'] || 'todo' + @original_item_due = @todo.due + @original_item_was_deferred = @todo.deferred? + @original_item_was_pending = @todo.pending? + @original_item_was_hidden = @todo.hidden? + @original_item_context_id = @todo.context_id + @original_item_project_id = @todo.project_id + @todo_was_completed_from_deferred_or_blocked_state = @original_item_was_deferred || @original_item_was_pending + @saved = @todo.toggle_completion! + + @todo_was_blocked_from_completed_state = @todo.pending? # since we toggled_completion the previous state was completed + + # check if this todo has a related recurring_todo. If so, create next todo + @new_recurring_todo = check_for_next_todo(@todo) if @saved + + @predecessors = @todo.uncompleted_predecessors + if @saved + if @todo.completed? + @pending_to_activate = @todo.activate_pending_todos + else + @active_to_block = @todo.block_successors + end + end + + if @saved + if cookies[:mobile_url] + old_path = cookies[:mobile_url] + cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']} + notify(:notice, t("todos.action_marked_complete", :description => @todo.description, :completed => @todo.completed? ? 'complete' : 'incomplete')) + redirect_to old_path + else + notify(:notice, t("todos.action_marked_complete", :description => @todo.description, :completed => @todo.completed? ? 'complete' : 'incomplete')) + redirect_to todos_path(:format => 'm') + end + else + render :action => "edit", :format => :m + end + end + def toggle_star @todo = current_user.todos.find(params['id']) @todo.toggle_star! @@ -1176,6 +1219,10 @@ class TodosController < ApplicationController lambda do @page_title = t('todos.mobile_todos_page_title') @home = true + + max_completed = current_user.prefs.show_number_completed + @done = current_user.todos.completed.find(:all, :limit => max_completed, :include => Todo::DEFAULT_INCLUDES) unless max_completed == 0 + cookies[:mobile_url]= { :value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} determine_down_count diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 2f3ef48e..d6f3ed53 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -89,6 +89,12 @@ module TodosHelper :title => todo.pending? ? t('todos.blocked_by', :predecessors => todo.uncompleted_predecessors.map(&:description).join(', ')) : "", :readonly => todo.pending?) end + def remote_mobile_checkbox(todo=@todo) + form_tag mobile_done_todo_path(@todo, :format => 'm'), :method => :put, :class => "mobile-done", :name => "mobile_complete_#{@todo.id}" do + check_box_tag('_source_view', 'todo', @todo && @todo.completed?, "onClick" => "document.mobile_complete_#{@todo.id}.submit()") + end + end + def date_span(todo=@todo) if todo.completed? content_tag(:span, {:class => :grey}) { format_date( todo.completed_at ) } diff --git a/app/views/contexts/mobile_show_context.rhtml b/app/views/contexts/mobile_show_context.rhtml index d960a66e..3bf1fc3b 100644 --- a/app/views/contexts/mobile_show_context.rhtml +++ b/app/views/contexts/mobile_show_context.rhtml @@ -7,10 +7,8 @@ if not @not_done.empty? %>

<%=@context.name%>

<% end -%> diff --git a/app/views/layouts/mobile.m.erb b/app/views/layouts/mobile.m.erb index ab8ff179..e11432da 100644 --- a/app/views/layouts/mobile.m.erb +++ b/app/views/layouts/mobile.m.erb @@ -7,13 +7,12 @@ - + <%= stylesheet_link_tag "mobile", :media => 'handheld,all' %> <%= @page_title %> -<% if !(@new_mobile || @edit_mobile) - if current_user && !current_user.prefs.nil? -%> -

<%= @down_count %> <%= +<% if current_user && !current_user.prefs.nil? -%> +

<% if @down_count -%><%= @down_count %><% end -%> <%= l(Date.today, :format => current_user.prefs.title_date_format) -%>

-<%= yield -%> +<% end -%> +
+
<%= render_flash -%><%= yield -%>

<% if current_user && !current_user.prefs.nil? -%> \ No newline at end of file + diff --git a/config/locales/de.yml b/config/locales/de.yml index db86e9b2..700c1684 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -99,12 +99,12 @@ de: mobile_navigation: logout: Abmelden feeds: Feeds - new_action: 0-Neue Aufgabe - starred: 4-Markiert - projects: 3-Projekte + new_action: Neue Aufgabe + starred: Markiert + projects: Projekte tickler: Notizbuch - contexts: 2-Kontexte - home: 1-Home + contexts: Kontexte + home: Home navigation: api_docs: REST API Docs recurring_todos: Sich wiederholende To-Dos diff --git a/config/locales/en.yml b/config/locales/en.yml index f356bfb3..e2dd9b6e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -7,14 +7,14 @@ en: next_actions_rss_feed: RSS feed of next actions toggle_notes_title: Toggle all notes mobile_navigation: - new_action: 0-New action + new_action: New logout: Logout feeds: Feeds - starred: 4-Starred - projects: 3-Projects + starred: Starred + projects: Projects tickler: Tickler - contexts: 2-Contexts - home: 1-Home + contexts: Contexts + home: Home navigation: manage_users_title: Add or delete users recurring_todos: Repeating todos diff --git a/config/locales/es.yml b/config/locales/es.yml index ce747b98..61933464 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -88,12 +88,12 @@ es: mobile_navigation: logout: "Cerrar sesi\xC3\xB3n" feeds: Feeds - new_action: 0-Nueva tarea - starred: 4-Favoritos - projects: 3-Proyectos + new_action: Nueva tarea + starred: avoritos + projects: Proyectos tickler: Tickler - contexts: 2-Contextos - home: 1-Inicio + contexts: Contextos + home: Inicio navigation: api_docs: REST API Docs recurring_todos: Tareas repetitivas diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 46641bf5..32aa6c92 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -99,11 +99,11 @@ fr: logout: "D\xC3\xA9connexion" feeds: Flux new_action: 0-Nouvelle action - starred: "4-Marqu\xC3\xA9" - projects: 3-Projets + starred: "Marqu\xC3\xA9" + projects: Projets tickler: Reporteur - contexts: 2-Contextes - home: 1-Accueil + contexts: Contextes + home: Accueil navigation: api_docs: Doc REST API recurring_todos: "T\xC3\xA2ches (todos) r\xC3\xA9p\xC3\xA9titives" diff --git a/config/locales/nl.yml b/config/locales/nl.yml index ce3b958a..655f8d0a 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -86,12 +86,12 @@ nl: mobile_navigation: logout: Afmelden feeds: Feeds - new_action: 0-Nieuwe actie - starred: 4-Ster - projects: 3-Projecten + new_action: Nieuwe actie + starred: Ster + projects: Projecten tickler: Tickler - contexts: 2-Contexten - home: 1-Start + contexts: Contexten + home: Start navigation: api_docs: REST API Docs recurring_todos: Terugkerende acties diff --git a/config/routes.rb b/config/routes.rb index ec0ed738..adf1fbca 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ ActionController::Routing::Routes.draw do |map| map.resources :notes map.resources :todos, - :member => {:toggle_check => :put, :toggle_star => :put, :defer => :put}, + :member => {:toggle_check => :put, :toggle_star => :put, :defer => :put, :mobile_done => :put}, :collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post, :done => :get, :all_done => :get } diff --git a/features/mobile_add_action.feature b/features/mobile_add_action.feature index 80d9939d..86537d9f 100644 --- a/features/mobile_add_action.feature +++ b/features/mobile_add_action.feature @@ -14,7 +14,7 @@ Feature: Add new next action from mobile page Scenario Outline: The new action form is prefilled with context and project Given I am on the - When I follow "0-New action" + When I follow "New" Then the selected project should be "" And the selected context should be "" @@ -29,7 +29,7 @@ Feature: Add new next action from mobile page Scenario: I can add a new todo using the mobile interface Given I am on the home page Then the badge should show 0 - When I follow "0-New action" + When I follow "New" And I fill in "Description" with "test me" And I press "Create" Then I should see "test me" diff --git a/features/mobile_edit_a_todo.feature b/features/mobile_edit_a_todo.feature index 5726d99a..3589d072 100644 --- a/features/mobile_edit_a_todo.feature +++ b/features/mobile_edit_a_todo.feature @@ -14,6 +14,7 @@ Feature: Edit a next action from the mobile view | context | description | | @mobile | test action | + @selenium Scenario: I can edit an action on the mobile page When I am on the home page Then the badge should show 1 @@ -27,10 +28,8 @@ Feature: Edit a next action from the mobile view Then I should see "changed action" And I should not see "test action" When I follow "changed action" - And I press "Edit this action" - And I check "done" - And I press "Update" - Then I should not see "changed action" + And I press "Mark complete" + Then I should see "changed action" in the completed container Scenario: Navigate from home page move this to separate features when other scenarios are created for these features diff --git a/public/stylesheets/mobile.css b/public/stylesheets/mobile.css index 08d0426d..f4795a55 100644 --- a/public/stylesheets/mobile.css +++ b/public/stylesheets/mobile.css @@ -3,36 +3,41 @@ body { font-size: smaller; } +#content { + margin-top: 50px; +} + div.footer { font-size: XX-small; color: #999999; text-align: center; } +a, a:link, a:active, a:visited { + color: #CC3334; + padding-left: 1px; + padding-right: 1px; + text-decoration: none; +} + +a:hover { + background-color: #CC3334; + color: #FFFFFF; +} + div.footer a { text-decoration: underline; color: #999999; } -.m_t_d a { - text-decoration: none; - color: #000000; -} - -.m_t_d a:hover { - text-decoration: underline; - color: #0000FF; -} - -.m_t_d .red, .m_t_d .amber, .m_t_d .orange, .m_t_d .green{ - background-color: #999999; -} - h1 { - color: #f00; + color: #fff; font-size: small; - margin-top:.3em; - margin-bottom:.3em; + padding-top: 0.2em; + padding-bottom: 0.2em; + padding-left:8px; + margin-top:0; + margin-bottom:0; } h2 { @@ -43,6 +48,17 @@ h2 { border-top: 1px solid #777777; } +h2 a, h2 a:link, h2 a:active, h2 a:visited { + color: #666666; + text-decoration: none; +} + +h2 a:hover { + background-color: transparent; + color: #CC3334; + text-decoration: none; +} + h4.alert { border: 1px solid #666666; text-align: center; @@ -79,6 +95,15 @@ span.r { span.prj, span.ctx{ font-size: X-small; } + +#ctx, #pjr { + margin: 0.5em 0; +} + +#ctx a, #pjr a { + padding: 0.1em 0; +} + /* Draw attention to some text Same format as traffic lights */ .red { @@ -118,22 +143,22 @@ span.prj, span.ctx{ .count { color: #fff; - background: #000; - font-size: medium; + background: #f00; + padding: 0.2em; } .errors { background: #FFC2C2; } -ul.c li.star { -list-style-type: circle; +ul.c li { +list-style-type: none; } ul.c { padding: 0; margin: 0; - padding-left: 1.1em; + padding-left: 0.1em; } ul.c li { @@ -149,8 +174,44 @@ span.r { display:none; } +#topbar { + background-color: #000000; + clear: both; + color: #EEEEEE; + height: 45px; + left: 0; + margin-bottom: 5px; + position: fixed; + top: 0; + width: 100%; + z-index: 501; +} + .nav { - font-size: x-small; + color: #fff; + background: #000; + padding-top: 0.2em; + padding-bottom: 0.2em; +} + +#topbar .nav { + padding-left:8px; + margin-bottom:0.3em; +} + +.nav a, .nav a:link, .nav a:active, .nav a:visited { + color: #fff; + padding-top: 1.0em; + padding-bottom: 0.5em; +} + +.nav a:focus, .nav a:hover, .nav a:active { + background: transparent; + text-decoration: underline; +} + +.nav li:hover, .nav a:focus, .nav a:hover, .nav a:active { + color: #CCCCCC; } #database_auth_form table td { @@ -160,3 +221,10 @@ span.r { table.c { margin-left: 5px; } +.mobile-done { + display:inline; +} + +input#todo_description, input#tag_list, textarea#todo_notes, select#todo_project_id, select#todo_context_id { + width: 95%; +}