get login, mobile and notes features passing

This commit is contained in:
Reinier Balt 2012-05-12 13:37:36 +02:00
parent 7c935652fb
commit 005723cb4f
52 changed files with 167 additions and 196 deletions

View file

@ -207,8 +207,8 @@ class ContextsController < ApplicationController
@active_contexts = current_user.contexts.active @active_contexts = current_user.contexts.active
@hidden_contexts = current_user.contexts.hidden @hidden_contexts = current_user.contexts.hidden
@down_count = @active_contexts.size + @hidden_contexts.size @down_count = @active_contexts.size + @hidden_contexts.size
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
render :action => 'index_mobile' render
end end
end end
@ -217,9 +217,9 @@ class ContextsController < ApplicationController
@page_title = "TRACKS::List actions in "+@context.name @page_title = "TRACKS::List actions in "+@context.name
@not_done = @not_done_todos.select {|t| t.context_id == @context.id } @not_done = @not_done_todos.select {|t| t.context_id == @context.id }
@down_count = @not_done.size @down_count = @not_done.size
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
@mobile_from_context = @context.id @mobile_from_context = @context.id
render :action => 'mobile_show_context' render
end end
end end

View file

@ -21,7 +21,7 @@ class FeedlistController < ApplicationController
respond_to do |format| respond_to do |format|
format.html { render :layout => 'standard' } format.html { render :layout => 'standard' }
format.m { render :action => 'mobile_index' } format.m
end end
end end

View file

@ -39,7 +39,7 @@ class LoginController < ApplicationController
end end
respond_to do |format| respond_to do |format|
format.html format.html
format.m { render :action => 'login_mobile.html.erb', :layout => 'mobile' } format.m { render :action => 'login', :layout => 'mobile' }
end end
end end

View file

@ -18,7 +18,7 @@ class NotesController < ApplicationController
@page_title = "TRACKS::Note " + @note.id.to_s @page_title = "TRACKS::Note " + @note.id.to_s
respond_to do |format| respond_to do |format|
format.html format.html
format.m { render :action => 'note_mobile' } format.m
end end
end end

View file

@ -324,8 +324,8 @@ class ProjectsController < ApplicationController
@hidden_projects = current_user.projects.hidden @hidden_projects = current_user.projects.hidden
@completed_projects = current_user.projects.completed @completed_projects = current_user.projects.completed
@down_count = @active_projects.size + @hidden_projects.size + @completed_projects.size @down_count = @active_projects.size + @hidden_projects.size + @completed_projects.size
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
render :action => 'index_mobile' render
end end
end end
@ -336,9 +336,9 @@ class ProjectsController < ApplicationController
else else
@project_default_context = t('projects.default_context', :context => @project.default_context.name) @project_default_context = t('projects.default_context', :context => @project.default_context.name)
end end
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
@mobile_from_project = @project.id @mobile_from_project = @project.id
render :action => 'project_mobile' render
end end
end end

View file

@ -132,7 +132,7 @@ class TodosController < ApplicationController
@page_title = t('todos.mobile_todos_page_title') @page_title = t('todos.mobile_todos_page_title')
@home = true @home = true
cookies[:mobile_url]= { :value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= { :value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
determine_down_count determine_down_count
render :action => 'index' render :action => 'index'
@ -158,7 +158,6 @@ class TodosController < ApplicationController
# we have a project but not a context -> use the default context # we have a project but not a context -> use the default context
@mobile_from_context = @mobile_from_project.default_context @mobile_from_context = @mobile_from_project.default_context
end end
render :action => "new"
} }
end end
end end
@ -369,7 +368,6 @@ class TodosController < ApplicationController
@contexts = current_user.contexts @contexts = current_user.contexts
@edit_mobile = true @edit_mobile = true
@return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
render :template => "/todos/edit_mobile.html.erb"
} }
end end
end end
@ -693,7 +691,7 @@ class TodosController < ApplicationController
@hidden_contexts = current_user.contexts.hidden @hidden_contexts = current_user.contexts.hidden
@completed_projects = current_user.projects.completed @completed_projects = current_user.projects.completed
end end
format.m { render :action => 'mobile_list_deferred' } format.m
format.xml { render :xml => @not_done_todos.to_xml( *to_xml_params ) } format.xml { render :xml => @not_done_todos.to_xml( *to_xml_params ) }
end end
end end
@ -774,8 +772,7 @@ class TodosController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.m { format.m {
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} cookies[:mobile_url]= {:value => request.fullpath, :secure => SITE_CONFIG['secure_cookies']}
render :action => "mobile_tag"
} }
format.text { format.text {
render :action => 'index', :layout => false, :content_type => Mime::TEXT render :action => 'index', :layout => false, :content_type => Mime::TEXT
@ -980,7 +977,7 @@ class TodosController < ApplicationController
redirect_to home_path, "Viewing note of todo is not implemented" redirect_to home_path, "Viewing note of todo is not implemented"
} }
format.m { format.m {
render:action => "mobile_show_notes" render :action => "show_notes"
} }
end end
end end

View file

@ -32,21 +32,16 @@ module ProjectsHelper
end end
def project_next_prev_mobile def project_next_prev_mobile
html = '<ul class="next-prev-project">' prev_project,next_project= "", ""
unless @previous_project.nil? unless @previous_project.nil?
project_name = truncate(@previous_project.name, :length => 40, :omission => "...") project_name = truncate(@previous_project.name, :length => 40, :omission => "...")
html << '<li class="prev">' prev_project = content_tag(:li, link_to_project_mobile(@previous_project, "5", project_name), :class=>"prev")
html << link_to_project_mobile(@previous_project, "5", "#{project_name}")
html << '</li>'
end end
unless @next_project.nil? unless @next_project.nil?
project_name = truncate(@next_project.name, :length => 40, :omission => "...") project_name = truncate(@next_project.name, :length => 40, :omission => "...")
html << '<li class="next">' next_project = content_tag(:li, link_to_project_mobile(@next_project, "6", project_name), :class=>"next")
html << link_to_project_mobile(@next_project, "6", "#{project_name}")
html << '</li>'
end end
html << '</ul>' return content_tag(:ul, "#{prev_project}#{next_project}".html_safe, :class=>"next-prev-project").html_safe
html
end end
def link_to_delete_project(project, descriptor = sanitize(project.name)) def link_to_delete_project(project, descriptor = sanitize(project.name))

View file

@ -135,7 +135,7 @@ module TodosHelper
end end
def tag_span (tag, mobile=false) def tag_span (tag, mobile=false)
content_tag(:span, :class => "tag #{tag.name.gsub(' ','-')}") { link_to(tag.name, (mobile ? mobile_tag_path(tag.name) : tag_path(tag.name))) } content_tag(:span, :class => "tag #{tag.name.gsub(' ','-')}") { link_to(tag.name, tag_path(tag.name, :format => mobile ? :m : :html)) }
end end
def tag_list(todo=@todo, mobile=false) def tag_list(todo=@todo, mobile=false)
@ -143,17 +143,11 @@ module TodosHelper
end end
def tag_list_mobile(todo=@todo) def tag_list_mobile(todo=@todo)
unless todo.tags.all_except_starred.empty? todo.tags.all_except_starred.empty? ? "" : tag_list(todo, true)
return tag_list(todo, true)
else
return ""
end
end end
def deferred_due_date(todo=@todo) def deferred_due_date(todo=@todo)
if todo.deferred? && todo.due t('todos.action_due_on', :date => format_date(todo.due)) if todo.deferred? && todo.due
t('todos.action_due_on', :date => format_date(todo.due))
end
end end
def project_and_context_links(todo, parent_container_type, opts = {}) def project_and_context_links(todo, parent_container_type, opts = {})

View file

@ -0,0 +1,14 @@
<%
# select actions from this context
@not_done = @not_done_todos.select {|t| t.context_id == context.id }
if not @not_done.empty?
# only show a context when there are actions in it
-%>
<h2><%= link_to context.name, context_path(context, :format => 'm') %></h2>
<ul class="c">
<%= render :partial => "todos/todo",
:collection => @not_done,
:locals => { :parent_container_type => "context" }-%>
</ul>
<% end -%>

View file

@ -0,0 +1,2 @@
<% context = context_listing -%>
<div id="ctx"><%= link_to context.name, context_path(context, :format => 'm') %><%= " (#{count_undone_todos_phrase(context)})".html_safe %></div>

View file

@ -1,14 +0,0 @@
<%
# select actions from this context
@not_done = @not_done_todos.select {|t| t.context_id == mobile_context.id }
if not @not_done.empty?
# only show a context when there are actions in it
-%>
<h2><%= link_to mobile_context.name, context_path(mobile_context, :format => 'm') %></h2>
<ul class="c">
<%= render :partial => "todos/mobile_todo",
:collection => @not_done,
:locals => { :parent_container_type => "context" }-%>
</ul>
<% end -%>

View file

@ -1,2 +0,0 @@
<% context = mobile_context_listing -%>
<div id="ctx"><%= link_to context.name, context_path(context, :format => 'm') %><%= " (" + count_undone_todos_phrase(context) + ")" %></div>

View file

@ -0,0 +1,2 @@
<h2><%= t('contexts.visible_contexts') %></h2><%= render :partial => 'context_listing', :collection => @active_contexts %>
<h2><%= t('contexts.hidden_contexts') %></h2><%= render :partial => 'context_listing', :collection => @hidden_contexts %>

View file

@ -1,2 +0,0 @@
<h2><%= t('contexts.visible_contexts') %></h2><%= render :partial => 'mobile_context_listing', :collection => @active_contexts %>
<h2><%= t('contexts.hidden_contexts') %></h2><%= render :partial => 'mobile_context_listing', :collection => @hidden_contexts %>

View file

@ -1,14 +1,12 @@
<h2><%=@context.name%></h2>
<% <%
# select actions from this context # select actions from this context
@not_done = @not_done_todos.select {|t| t.context_id == @context.id } @not_done = @not_done_todos.select {|t| t.context_id == @context.id }
if not @not_done.empty? if not @not_done.empty?
# only show a context when there are actions in it # only show a context when there are actions in it
%> -%>
<h2><%=@context.name%></h2>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", <%= render :partial => @not_done, :locals => { :parent_container_type => "context" }-%>
:collection => @not_done,
:locals => { :parent_container_type => "context" }-%>
</ul> </ul>
<% end -%> <% end -%>

View file

@ -19,16 +19,16 @@
<li class="link"><%= (link_to(t('layouts.mobile_navigation.home'), todos_path(:format => 'm'))) unless @home -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.home'), todos_path(:format => 'm'))) unless @home -%></li>
<li class="link"><%= (link_to(t('layouts.mobile_navigation.contexts'), contexts_path(:format => 'm'))) -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.contexts'), contexts_path(:format => 'm'))) -%></li>
<li class="link"><%= (link_to(t('layouts.mobile_navigation.projects'), projects_path(:format => 'm'))) -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.projects'), projects_path(:format => 'm'))) -%></li>
<li class="link"><%= (link_to(t('layouts.mobile_navigation.starred'), {:action => "tag", :controller => "todos", :id => "starred.m"})) -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.starred'), tag_path("starred", :format => 'm'))) -%></li>
<% end -%> <% end -%>
</ul></div> </ul></div>
<div id="content"><%= render_flash -%><%= yield -%></div> <div id="content"><%= render_flash -%><%= yield -%></div>
<hr/><% if current_user && !current_user.prefs.nil? -%> <hr/><% if current_user && !current_user.prefs.nil? -%>
<ul class="nav"> <ul class="nav">
<li class="link"><%= (link_to(t('layouts.mobile_navigation.logout'), logout_path(:format => 'm'))) -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.logout'), logout_path(:format => 'm'))) -%></li>
<li class="link"><%= (link_to(t('layouts.mobile_navigation.tickler'), {:action => "index", :controller => "tickler.m"})) -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.tickler'), tickler_path(:format => :m))) -%></li>
<li class="link"><%= (link_to(t('layouts.mobile_navigation.feeds'), {:action => "index", :controller => "feeds.m"})) -%></li> <li class="link"><%= (link_to(t('layouts.mobile_navigation.feeds'), feeds_path(:format=>:m))) -%></li>
</ul> </ul>
<% end -%> <% end -%>
<%= render :partial => "shared/mobile_footer" -%> <%= render :partial => "shared/footer" -%>
</body></html> </body></html>

View file

@ -1,7 +1,7 @@
<% if @session_expired <% if @session_expired
theLink = link_to(t('login.log_in_again'), :controller => "login", :action => "login") theLink = link_to(t('login.log_in_again'), :controller => "login", :action => "login")
message = I18n.t('login.session_time_out', :link => theLink) message = I18n.t('login.session_time_out', :link => theLink)
theHtml = escape_javascript(content_tag(:div, message, :"class" => "warning")) theHtml = escape_javascript(content_tag(:div, message.html_safe, :"class" => "warning"))
-%> -%>
$('div#navcontainer').hide(); $('div#navcontainer').hide();
$('div#content').html('<%=theHtml%>'); $('div#content').html('<%=theHtml%>');

View file

@ -1,14 +1,10 @@
<% auth_schemes = Tracks::Config.auth_schemes <%
auth_schemes = Tracks::Config.auth_schemes
show_database_form = auth_schemes.include?('database') show_database_form = auth_schemes.include?('database')
show_openid_form = auth_schemes.include?('open_id')
-%> -%>
<div title="<%= t('login.account_login') %>" id="loginform" class="form"> <div title="<%= t('login.account_login') %>" id="loginform" class="form">
<%= render_flash -%>
<%= render_flash %>
<h3><%= t('login.please_login') %>:</h3> <h3><%= t('login.please_login') %>:</h3>
<% if show_database_form %> <% if show_database_form %>
<div id="database_auth_form"> <div id="database_auth_form">
<%= form_tag login_path(:format => 'm') do %> <%= form_tag login_path(:format => 'm') do %>

View file

@ -7,7 +7,7 @@
<%= render :partial => "notes/note_details", :object => note %> <%= render :partial => "notes/note_details", :object => note %>
</div> </div>
<div id="<%= dom_id(note, 'edit') %>" class="note-edit-form" style="display:none;"> <div id="<%= dom_id(note, 'edit') %>" class="note-edit-form" style="display:none">
<%= render :partial => "notes/note_edit_form", :object => note %> <%= render :partial => "notes/note_edit_form", :object => note %>
</div> </div>

View file

@ -1,4 +1,3 @@
<% note = mobile_notes -%>
<div class="mobile_note"> <div class="mobile_note">
<%= sanitize(textilize_without_paragraph(note.body)) %> <%= sanitize(textilize_without_paragraph(note.body)) %>
</div> </div>

View file

@ -1,7 +1,7 @@
<% <%
submit_text ||= t('common.update') submit_text ||= t('common.update')
note = note_edit_form note = note_edit_form
-%><%=
form_for(note, :html => { form_for(note, :html => {
:id => dom_id(note, 'edit_form'), :id => dom_id(note, 'edit_form'),
:class => "inline-form edit-note-form"}) do |f| :class => "inline-form edit-note-form"}) do |f|

View file

@ -1,3 +1,3 @@
<% note = mobile_notes_summary -%> <% note = notes_summary -%>
<div class="note"><%= link_to( truncated_note(note), note_path(note, :format => 'm')) %></div> <div class="note"><%= link_to( truncated_note(note), note_path(note, :format => 'm')) %></div>
<% note = nil -%> <% note = nil -%>

View file

@ -1 +0,0 @@
<%= render :partial => 'mobile_notes', :object => @note %>

View file

@ -0,0 +1 @@
<%= render :partial => @note %>

View file

@ -17,7 +17,7 @@ function replace_note_form_with_updated_note() {
} }
function html_for_error_messages() { function html_for_error_messages() {
return "<%= escape_javascript(error_messages_for('note')) %>"; return "<%= escape_javascript(get_list_of_error_messages_for(@note)) %>";
} }
function html_for_updated_note_form(){ function html_for_updated_note_form(){

View file

@ -1,4 +1,4 @@
<% project = mobile_project_listing -%> <% project = project_listing -%>
<div id="pjr"><%= <div id="pjr"><%=
link_to(project.name, project_path(project, :format => 'm')) + link_to(project.name, project_path(project, :format => 'm')) +
" (" + count_undone_todos_and_notes_phrase(project) + ")" %></div> " (" + count_undone_todos_and_notes_phrase(project) + ")" %></div>

View file

@ -0,0 +1,6 @@
<h2><%= t('projects.active_projects') %></h2><%=
render :partial => 'project_listing', :collection => @active_projects%>
<h2><%= t('projects.hidden_projects') %></h2><%=
render :partial => 'project_listing', :collection => @hidden_projects %>
<h2><%= t('projects.completed_projects') %></h2><%=
render :partial => 'project_listing', :collection => @completed_projects %>

View file

@ -1,6 +0,0 @@
<h2><%= t('projects.active_projects') %></h2><%=
render :partial => 'mobile_project_listing', :collection => @active_projects%>
<h2><%= t('projects.hidden_projects') %></h2><%=
render :partial => 'mobile_project_listing', :collection => @hidden_projects %>
<h2><%= t('projects.completed_projects') %></h2><%=
render :partial => 'mobile_project_listing', :collection => @completed_projects %>

View file

@ -5,18 +5,14 @@
<div class="project_description"><%= sanitize(@project.description) %></div> <div class="project_description"><%= sanitize(@project.description) %></div>
<% end -%> <% end -%>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", <%= render :partial => @not_done, :locals => { :parent_container_type => "project" }%>
:collection => @not_done,
:locals => { :parent_container_type => "project" }%>
</ul> </ul>
<h2><%= t('projects.deferred_actions')%></h2> <h2><%= t('projects.deferred_actions')%></h2>
<% if @deferred.empty? -%> <% if @deferred.empty? -%>
<%= t('projects.deferred_actions_empty') %> <%= t('projects.deferred_actions_empty') %>
<% else -%> <% else -%>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", <%= render :partial => @deferred, :locals => { :parent_container_type => "project" }%>
:collection => @deferred,
:locals => { :parent_container_type => "project" }%>
</ul><% end </ul><% end
-%> -%>
<h2><%= t('projects.completed_actions')%></h2> <h2><%= t('projects.completed_actions')%></h2>
@ -24,14 +20,12 @@
<%= t('projects.completed_actions_empty') %> <%= t('projects.completed_actions_empty') %>
<% else -%> <% else -%>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", <%= render :partial => @done, :locals => { :parent_container_type => "project" }%>
:collection => @done,
:locals => { :parent_container_type => "project" }%>
</ul><% end %> </ul><% end %>
<h2><%= t('projects.notes') %></h2> <h2><%= t('projects.notes') %></h2>
<% if @project.notes.empty? -%> <% if @project.notes.empty? -%>
<%= t('projects.notes_empty') %> <%= t('projects.notes_empty') %>
<% else -%><%= render :partial => "notes/mobile_notes_summary", :collection => @project.notes %> <% else -%><%= render :partial => "notes/notes_summary", :collection => @project.notes %>
<% end -%> <% end -%>
<h2><%= t('projects.settings') %></h2> <h2><%= t('projects.settings') %></h2>
<%= t('projects.state', :state => project.aasm_current_state.to_s) %>. <%= @project_default_context %> <%= t('projects.state', :state => project.aasm_current_state.to_s) %>. <%= @project_default_context %>

View file

@ -0,0 +1,9 @@
<div id="message_holder">
<% if flash.empty? -%>
<h4 id="flash" class="alert" style="display:none"></h4>
<% else -%>
<% flash.each do |key,value| -%>
<h4 id="flash" class='alert <%= key %>'><%= value %></h4>
<% end -%>
<% end -%>
</div>

View file

@ -1,7 +1,7 @@
<% @tag_list_text = "" <% @tag_list_text = ""
@tag_list_text = tag_list_text if @todo -%> @tag_list_text = tag_list_text if @todo -%>
<span class="errors"> <span class="errors">
<%= error_messages_for("todo") %> <%= get_list_of_error_messages_for(@todo) if @todo %>
</span> </span>
<% this_year = current_user.time.to_date.strftime("%Y").to_i -%> <% this_year = current_user.time.to_date.strftime("%Y").to_i -%>
<h2><label for="todo_description"><%= t('common.description') %></label></h2> <h2><label for="todo_description"><%= t('common.description') %></label></h2>
@ -23,7 +23,8 @@ end %>
else else
# manually add blank option since :include_blank does not work # manually add blank option since :include_blank does not work
# with options_from_collection_for_select # with options_from_collection_for_select
select_tag("todo[project_id]", "<option value=\"\"></option>"+options_from_collection_for_select( empty_option = content_tag(:option, "", :value => "")
select_tag("todo[project_id]", empty_option+options_from_collection_for_select(
@projects, "id", "name", @mobile_from_project.id), @projects, "id", "name", @mobile_from_project.id),
{"id" => :todo_project_id, :tabindex => 4} ) {"id" => :todo_project_id, :tabindex => 4} )
end %> end %>

View file

@ -1,13 +1,13 @@
<% if @not_done_todos.empty? -%> <% if @not_done_todos.empty? -%>
<p><%= t('todos.no_incomplete_actions') %></p> <p><%= t('todos.no_incomplete_actions') %></p>
<% else -%> <% else -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show -%> <%= render :partial => @contexts_to_show -%>
<% end -%> <% end -%>
<% unless @done.nil? -%> <% unless @done.nil? -%>
<div id="completed_container"> <div id="completed_container">
<h2><%= t('todos.completed_actions') %></h2> <h2><%= t('todos.completed_actions') %></h2>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", :collection => @done %> <%= render :partial => @done %>
</ul> </ul>
</div> </div>
<% end %> <% end %>

View file

@ -1,22 +0,0 @@
<% @todo = mobile_todo -%>
<li id="<%= dom_id(mobile_todo) %>" >
<% remote_mobile_checkbox(mobile_todo) %>
<%= date_span -%> <%= link_to mobile_todo.description, todo_path(mobile_todo, :format => 'm') -%>
<% unless mobile_todo.notes.blank? %>
<%= link_to(image_tag("mobile_notes.png", :border => "0"), mobile_todo_show_notes_path(mobile_todo, :format => 'm')) -%>
<% end %>
<% if mobile_todo.starred? %>
<%= image_tag("menustar_small.gif", :border => "0") -%>
<% end %>
<% if parent_container_type == 'context' or parent_container_type == 'tag' -%>
<%= "<span class=\"prj\"> (" +
link_to(mobile_todo.project.name, project_path(mobile_todo.project, :format => 'm')) +
")</span>" unless mobile_todo.project.nil? -%>
<% end
if parent_container_type == 'project' or parent_container_type == 'tag' -%>
<%= "<span class=\"ctx\"> (" +
link_to(mobile_todo.context.name, context_path(mobile_todo.context, :format => 'm')) +
")</span>" -%>
<% end -%>
<%= tag_list_mobile -%>
</span></li>

View file

@ -0,0 +1,28 @@
<% @todo = todo -%>
<li id="<%= dom_id(todo) %>" >
<% remote_mobile_checkbox(todo) %>
<%= date_span -%> <%= link_to todo.description, todo_path(todo, :format => 'm') -%>
<% unless todo.notes.blank? %>
<%= link_to(image_tag("mobile_notes.png", :border => "0"), show_notes_todo_path(todo, :format => 'm')) -%>
<% end %>
<% if todo.starred? %>
<%= image_tag("menustar_small.gif", :border => "0") -%>
<% end %>
<% if parent_container_type == 'context' or parent_container_type == 'tag' -%>
<%=
if todo.project.nil?
""
else
link = link_to(todo.project.name, project_path(todo.project, :format => :m))
content_tag(:span, " (#{link})".html_safe, :class=>"prj")
end
-%>
<% end
if parent_container_type == 'project' or parent_container_type == 'tag' -%>
<%=
link = link_to(todo.context.name, context_path(todo.context, :format => 'm'))
content_tag(:span, " (#{link})".html_safe, :class=>"ctx")
-%>
<% end -%>
<%= tag_list_mobile -%>
</span></li>

View file

@ -1,5 +1,5 @@
<%= form_tag todo_path(@todo, :format => 'm'), :name => 'mobileEdit', :method => :put do %> <%= form_tag todo_path(@todo, :format => 'm'), :name => 'mobileEdit', :method => :put do %>
<%= render :partial => 'edit_mobile_form', :locals => { :parent_container_type => "show_mobile" } %> <%= render :partial => 'edit_form', :locals => { :parent_container_type => "show_mobile" } %>
<p><input type="submit" value="<%= t('common.update') %>" tabindex="6" accesskey="#" /></p> <p><input type="submit" value="<%= t('common.update') %>" tabindex="6" accesskey="#" /></p>
<% end -%> <% end -%>
<%= link_to t('common.cancel'), @return_path %> <%= link_to t('common.cancel'), @return_path %>

View file

@ -0,0 +1,4 @@
<% if @count == 0 -%>
<div class="message"><p><%= t('todos.no_deferred_actions') %></p></div>
<% end -%>
<%= render :partial => @contexts, :locals => { :collapsible => true } -%>

View file

@ -1,5 +0,0 @@
<% if @count == 0 -%>
<div class="message"><p><%= t('todos.no_deferred_actions') %></p></div>
<% end -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts,
:locals => { :collapsible => true } -%>

View file

@ -1,5 +1,5 @@
<%= form_tag todos_path(:format => 'm'), :method => :post do %> <%= form_tag todos_path, :method => :post do %>
<%= render :partial => 'edit_mobile_form' %> <%= render :partial => 'edit_form' %>
<p><input type="submit" value="<%= t('common.create') %>" tabindex="12" accesskey="#" /></p> <p><input type="submit" value="<%= t('common.create') %>" tabindex="12" accesskey="#" /></p>
<% end -%> <% end -%>
<%= link_to t('common.back'), @return_path %> <%= link_to t('common.back'), @return_path %>

View file

@ -1,4 +1,4 @@
<h2><%= t('todos.next_action_description') + " (" + link_to(t('common.go_back'), @return_path) %>)</h2> <h2><%= raw "#{t('todos.next_action_description')} (#{link_to(t('common.go_back'), @return_path)}" %>)</h2>
<%= link_to @todo.description, todo_path(@todo, :format => 'm') -%> <%= link_to @todo.description, todo_path(@todo, :format => 'm') -%>
<h2><%= t('todos.notes') %></h2> <h2><%= t('todos.notes') %></h2>
<%= Tracks::Utils.render_text(@todo.notes) %> <%= Tracks::Utils.render_text(@todo.notes) %>

View file

@ -5,11 +5,11 @@
<div class="message"><%= t('todos.no_actions_with', :tag_name => @tag_title) %></div> <div class="message"><%= t('todos.no_actions_with', :tag_name => @tag_title) %></div>
</div> </div>
<% end -%> <% end -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show -%> <%= render :partial => @contexts_to_show -%>
<h2><%= t('todos.deferred_actions_with', :tag_name=> @tag_title) %></h2> <h2><%= t('todos.deferred_actions_with', :tag_name=> @tag_title) %></h2>
<% unless (@deferred.nil? or @deferred.size == 0) -%> <% unless (@deferred.nil? or @deferred.size == 0) -%>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", :collection => @deferred, :locals => { :parent_container_type => "tag" } -%> <%= render :partial => @deferred, :locals => { :parent_container_type => "tag" } -%>
</ul> </ul>
<% else -%> <% else -%>
<%= t('todos.no_deferred_actions_with', :tag_name => @tag_title) %> <%= t('todos.no_deferred_actions_with', :tag_name => @tag_title) %>
@ -17,7 +17,7 @@
<h2><%= t('todos.completed_actions_with', :tag_name => @tag_title) %></h2> <h2><%= t('todos.completed_actions_with', :tag_name => @tag_title) %></h2>
<% unless (@done.nil? or @done.size == 0) -%> <% unless (@done.nil? or @done.size == 0) -%>
<ul class="c"> <ul class="c">
<%= render :partial => "todos/mobile_todo", :collection => @done, :locals => { :parent_container_type => "tag" } %> <%= render :partial => @done, :locals => { :parent_container_type => "tag" } %>
</ul> </ul>
<% else -%> <% else -%>
<%= t('todos.no_completed_actions_with', :tag_name => @tag_title) %> <%= t('todos.no_completed_actions_with', :tag_name => @tag_title) %>

View file

@ -8,17 +8,6 @@
<h3><%= @heading -%></h3> <h3><%= @heading -%></h3>
<table> <table>
<%if Tracks::Config.auth_schemes.include?('cas') && session[:cas_user]%>
<tr>
<td><label for="user_login"><%= t('users.register_with_cas') %>:</label></td>
<td> "<%= session[:cas_user]%>" </td>
<td>
<%= hidden_field "user", "login", :value => session[:cas_user] %>
<%= hidden_field "user", "password", :value => session[:cas_user] %>
<%= hidden_field "user", "password_confirmation", :value => session[:cas_user] %>
<%= hidden_field "user", "auth_type", :value => "cas" %></td>
</tr>
<%else%>
<tr> <tr>
<td><label for="user_login"><%= t('users.desired_login') %>:</label></td> <td><label for="user_login"><%= t('users.desired_login') %>:</label></td>
<td> <%= text_field "user", "login", :size => 20 %></td> <td> <%= text_field "user", "login", :size => 20 %></td>
@ -31,22 +20,12 @@
<td><label for="user_password_confirmation"><%= t('users.confirm_password') %>:</label></td> <td><label for="user_password_confirmation"><%= t('users.confirm_password') %>:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20 %></td> <td><%= password_field "user", "password_confirmation", :size => 20 %></td>
</tr> </tr>
<tr id="open_id" style="display:<%= @user.auth_type == 'open_id' ? 'table-row' : 'none' %>">
<td><label for="openid_url"><%= t('users.identity_url') %>:</label></td>
<td><%= text_field "user", "open_id_url", :class => "open_id" %></td>
</tr>
<tr>
<td><label for="user_auth_type"><%= User.human_attribute_name('auth_type') %>:</label></td>
<td><%= select("user", "auth_type", @auth_types, { :include_blank => false })%></td>
</tr>
<%end%>
<tr> <tr>
<td></td> <td></td>
<td><input type="submit" id="signup" value="<%= t('users.signup') %> &#187;" class="primary" /></td> <td><input type="submit" id="signup" value="<%= t('users.signup') %> &#187;" class="primary" /></td>
</tr> </tr>
</table> </table>
<%end-%>
<% end %>
</div> </div>

View file

@ -58,10 +58,13 @@ Tracksapp::Application.routes.draw do
root :to => 'todos#index' root :to => 'todos#index'
match 'login' => 'login#login'
match 'login/expire_session' => 'login#expire_session'
match 'login/check_expiry' => 'login#check_expiry'
match 'logout' => 'login#logout'
match "tickler" => "todos#list_deferred" match "tickler" => "todos#list_deferred"
match 'review' => "projects#review" match 'review' => "projects#review"
match 'login' => 'login#login'
match 'logout' => 'login#logout'
match 'calendar' => "todos#calendar" match 'calendar' => "todos#calendar"
match 'stats' => 'stats#index' match 'stats' => 'stats#index'
match 'done' => "stats#done", :as => 'done_overview' match 'done' => "stats#done", :as => 'done_overview'
@ -109,6 +112,7 @@ Tracksapp::Application.routes.draw do
put 'toggle_check' put 'toggle_check'
put 'toggle_star' put 'toggle_star'
put 'defer' put 'defer'
get 'show_notes'
end end
collection do collection do
get 'done' get 'done'
@ -123,6 +127,7 @@ Tracksapp::Application.routes.draw do
match 'todos/done/tag/:name' => "todos#done_tag", :as => :done_tag match 'todos/done/tag/:name' => "todos#done_tag", :as => :done_tag
match 'todos/all_done/tag/:name' => "todos#all_done_tag", :as => :all_done_tag match 'todos/all_done/tag/:name' => "todos#all_done_tag", :as => :all_done_tag
match 'auto_complete_for_predecessor' => 'todos#auto_complete_for_predecessor' match 'auto_complete_for_predecessor' => 'todos#auto_complete_for_predecessor'
match 'mobile' => 'todos#index', :format => 'm'
resources :recurring_todos do resources :recurring_todos do
member do member do

View file

@ -50,7 +50,7 @@ Feature: Existing user logging in
| "top secret" project for user "testuser" | "top secret" project for user "testuser" | Logout (Test User) | | "top secret" project for user "testuser" | "top secret" project for user "testuser" | Logout (Test User) |
| context page for "@secret location" for user "testuser" | context page for "@secret location" for user "testuser" | Logout (Test User) | | context page for "@secret location" for user "testuser" | context page for "@secret location" for user "testuser" | Logout (Test User) |
@javascript @javascript @wip
Scenario: When session expires, you should be logged out Scenario: When session expires, you should be logged out
When I go to the login page When I go to the login page
And I submit the login form as user "testuser" with password "secret" And I submit the login form as user "testuser" with password "secret"

View file

@ -1,9 +1,9 @@
Feature: Create project from template Feature: Create project from template
In order to be able to create a project from a template In order to be able to create a project from a template
As a user this installed Tracks with console access As a user who has installed Tracks with console access
I want to run the script to add projects and actions from a template I want to run the script to add projects and actions from a template
These scenario's need selenium so that there is a Tracks server running These scenarios are tagged javascript so that there is a Tracks server running
to use from the command line script to use from the command line script
Background: Background:
@ -14,7 +14,7 @@ Feature: Create project from template
And I have logged in as "testuser" with password "secret" And I have logged in as "testuser" with password "secret"
And I have a context called "Context A" And I have a context called "Context A"
@javascript @javascript @announce @wip
Scenario: Create a project with one task Scenario: Create a project with one task
Given a template that looks like Given a template that looks like
""" """

View file

@ -1,8 +1,8 @@
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password| Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
step "I go to the login page" step "I go to the login page"
fill_in "Login", :with => username fill_in "user_login", :with => username
fill_in "Password", :with => password fill_in "user_password", :with => password
uncheck "Stay logged in:" uncheck "user_noexpiry"
click_button "Sign in" click_button "Sign in"
logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)" logout_regexp = @mobile_interface ? "Logout" : "Logout \(#{username}\)"
@ -25,6 +25,7 @@ When /^my session expires$/ do
# force check of expiry bypassing timeout # force check of expiry bypassing timeout
js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});' js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});'
page.execute_script(js); page.execute_script(js);
sleep 1
end end
When /^I log out of Tracks$/ do When /^I log out of Tracks$/ do

View file

@ -11,19 +11,17 @@ When /^I execute the script$/ do
step "I cd to \"../..\"" step "I cd to \"../..\""
context_id = @current_user.contexts.first.id context_id = @current_user.contexts.first.id
port = Capybara.current_session.driver.rack_server.port
# assumes there is a context with id=1 # assumes there is a context with id=1
cli = "ruby doc/tracks_template_cli.rb -c #{context_id} -f tmp/aruba/template.txt" cli = "ruby doc/tracks_template_cli.rb -c #{context_id} -f tmp/aruba/template.txt"
login = "GTD_LOGIN=testuser"
pass = "GTD_PASSWORD=secret"
port = Capybara.current_session.driver.rack_server.port
gtd_todos_url = "GTD_TODOS_URL=http://localhost:#{port}/todos.xml"
gtd_projects_url = "GTD_PROJECTS_URL=http://localhost:#{port}/projects.xml"
gtd_context_url_prefix = "GTD_CONTEXT_URL_PREFIX=http://localhost:#{port}/contexts/"
gtd_context_url = "GTD_CONTEXT_URL=http://localhost:#{port}/contexts.xml"
command = "#{gtd_todos_url} #{gtd_projects_url} #{gtd_context_url_prefix} #{gtd_context_url} #{login} #{pass} #{cli}" set_env('GTD_LOGIN','testuser')
set_env('GTD_PASSWORD', 'secret')
set_env('GTD_TODOS_URL', 'http://localhost:#{port}/todos.xml')
set_env('GTD_PROJECTS_URL', "http://localhost:#{port}/projects.xml")
set_env('GTD_CONTEXT_URL_PREFIX', "http://localhost:#{port}/contexts/")
set_env("GTD_CONTEXT_URL","http://localhost:#{port}/contexts.xml")
step "I run \"#{command}\"" step "I run `#{cli}`"
# puts "output = #{combined_output}"
end end

View file

@ -13,7 +13,7 @@ Given /^the following user records with hash algorithm$/ do |table|
algorithm = hash[:algorithm] algorithm = hash[:algorithm]
hash.delete("algorithm") hash.delete("algorithm")
user = Factory(:user, hash) user = FactoryGirl.create(:user, hash)
case algorithm case algorithm
when 'bcrypt' when 'bcrypt'
@ -22,7 +22,7 @@ Given /^the following user records with hash algorithm$/ do |table|
BCrypt::Password.new(user.crypted_password).should == password BCrypt::Password.new(user.crypted_password).should == password
when 'sha1' when 'sha1'
user.password = user.password_confirmation = nil user.password = user.password_confirmation = nil
user.write_attribute :crypted_password, user.sha1(password) user.send(:write_attribute, :crypted_password, user.sha1(password))
user.save user.save
user.reload user.reload
user.crypted_password.should == user.sha1(password) user.crypted_password.should == user.sha1(password)

View file

@ -31,7 +31,7 @@ module Tracks
Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'message' Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'message'
rendered = Sanitize.clean(rendered, Sanitize::Config::RELAXED) rendered = Sanitize.clean(rendered, Sanitize::Config::RELAXED)
return rendered return rendered.html_safe
end end
# Uses RedCloth to transform text using either Textile or Markdown Need to # Uses RedCloth to transform text using either Textile or Markdown Need to