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

View file

@ -6,7 +6,7 @@ class FeedlistController < ApplicationController
@page_title = 'TRACKS::Feeds'
unless mobile?
init_data_for_sidebar
init_data_for_sidebar
else
@projects = current_user.projects
@contexts = current_user.contexts
@ -21,7 +21,7 @@ class FeedlistController < ApplicationController
respond_to do |format|
format.html { render :layout => 'standard' }
format.m { render :action => 'mobile_index' }
format.m
end
end

View file

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

View file

@ -18,7 +18,7 @@ class NotesController < ApplicationController
@page_title = "TRACKS::Note " + @note.id.to_s
respond_to do |format|
format.html
format.m { render :action => 'note_mobile' }
format.m
end
end
@ -29,7 +29,7 @@ class NotesController < ApplicationController
@saved = @note.save
respond_to do |format|
format.js
format.js
format.xml do
if @saved
head :created, :location => note_url(@note), :text => "new note with id #{@note.id}"

View file

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

View file

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

View file

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

View file

@ -135,7 +135,7 @@ module TodosHelper
end
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
def tag_list(todo=@todo, mobile=false)
@ -143,17 +143,11 @@ module TodosHelper
end
def tag_list_mobile(todo=@todo)
unless todo.tags.all_except_starred.empty?
return tag_list(todo, true)
else
return ""
end
todo.tags.all_except_starred.empty? ? "" : tag_list(todo, true)
end
def deferred_due_date(todo=@todo)
if todo.deferred? && todo.due
t('todos.action_due_on', :date => format_date(todo.due))
end
t('todos.action_due_on', :date => format_date(todo.due)) if todo.deferred? && todo.due
end
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
@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
%>
<h2><%=@context.name%></h2>
-%>
<ul class="c">
<%= render :partial => "todos/mobile_todo",
:collection => @not_done,
:locals => { :parent_container_type => "context" }-%>
<%= render :partial => @not_done, :locals => { :parent_container_type => "context" }-%>
</ul>
<% 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.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.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 -%>
</ul></div>
<div id="content"><%= render_flash -%><%= yield -%></div>
<hr/><% if current_user && !current_user.prefs.nil? -%>
<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.tickler'), {:action => "index", :controller => "tickler.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.tickler'), tickler_path(:format => :m))) -%></li>
<li class="link"><%= (link_to(t('layouts.mobile_navigation.feeds'), feeds_path(:format=>:m))) -%></li>
</ul>
<% end -%>
<%= render :partial => "shared/mobile_footer" -%>
<%= render :partial => "shared/footer" -%>
</body></html>

View file

@ -1,7 +1,7 @@
<% if @session_expired
theLink = link_to(t('login.log_in_again'), :controller => "login", :action => "login")
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#content').html('<%=theHtml%>');

View file

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

View file

@ -7,7 +7,7 @@
<%= render :partial => "notes/note_details", :object => note %>
</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 %>
</div>

View file

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

View file

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

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>
<% 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() {
return "<%= escape_javascript(error_messages_for('note')) %>";
return "<%= escape_javascript(get_list_of_error_messages_for(@note)) %>";
}
function html_for_updated_note_form(){

View file

@ -1,4 +1,4 @@
<% project = mobile_project_listing -%>
<div id="pjr"><%=
<% project = project_listing -%>
<div id="pjr"><%=
link_to(project.name, project_path(project, :format => 'm')) +
" (" + 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,33 +5,27 @@
<div class="project_description"><%= sanitize(@project.description) %></div>
<% end -%>
<ul class="c">
<%= render :partial => "todos/mobile_todo",
:collection => @not_done,
:locals => { :parent_container_type => "project" }%>
<%= render :partial => @not_done, :locals => { :parent_container_type => "project" }%>
</ul>
<h2><%= t('projects.deferred_actions')%></h2>
<% if @deferred.empty? -%>
<%= t('projects.deferred_actions_empty') %>
<% else -%>
<ul class="c">
<%= render :partial => "todos/mobile_todo",
:collection => @deferred,
:locals => { :parent_container_type => "project" }%>
</ul><% end
<%= render :partial => @deferred, :locals => { :parent_container_type => "project" }%>
</ul><% end
-%>
<h2><%= t('projects.completed_actions')%></h2>
<% if @done.empty? -%>
<%= t('projects.completed_actions_empty') %>
<% else -%>
<ul class="c">
<%= render :partial => "todos/mobile_todo",
:collection => @done,
:locals => { :parent_container_type => "project" }%>
<%= render :partial => @done, :locals => { :parent_container_type => "project" }%>
</ul><% end %>
<h2><%= t('projects.notes') %></h2>
<% if @project.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 -%>
<h2><%= t('projects.settings') %></h2>
<%= 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 if @todo -%>
<span class="errors">
<%= error_messages_for("todo") %>
<%= get_list_of_error_messages_for(@todo) if @todo %>
</span>
<% this_year = current_user.time.to_date.strftime("%Y").to_i -%>
<h2><label for="todo_description"><%= t('common.description') %></label></h2>
@ -23,7 +23,8 @@ end %>
else
# manually add blank option since :include_blank does not work
# 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),
{"id" => :todo_project_id, :tabindex => 4} )
end %>

View file

@ -1,13 +1,13 @@
<% if @not_done_todos.empty? -%>
<p><%= t('todos.no_incomplete_actions') %></p>
<% else -%>
<%= render :partial => "contexts/mobile_context", :collection => @contexts_to_show -%>
<%= render :partial => @contexts_to_show -%>
<% end -%>
<% unless @done.nil? -%>
<div id="completed_container">
<h2><%= t('todos.completed_actions') %></h2>
<ul class="c">
<%= render :partial => "todos/mobile_todo", :collection => @done %>
<%= render :partial => @done %>
</ul>
</div>
<% 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 %>
<%= 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>
<% end -%>
<%= 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 %>
<%= render :partial => 'edit_mobile_form' %>
<%= form_tag todos_path, :method => :post do %>
<%= render :partial => 'edit_form' %>
<p><input type="submit" value="<%= t('common.create') %>" tabindex="12" accesskey="#" /></p>
<% end -%>
<%= 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') -%>
<h2><%= t('todos.notes') %></h2>
<%= 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>
<% 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>
<% unless (@deferred.nil? or @deferred.size == 0) -%>
<ul class="c">
<%= render :partial => "todos/mobile_todo", :collection => @deferred, :locals => { :parent_container_type => "tag" } -%>
<%= render :partial => @deferred, :locals => { :parent_container_type => "tag" } -%>
</ul>
<% else -%>
<%= 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>
<% unless (@done.nil? or @done.size == 0) -%>
<ul class="c">
<%= render :partial => "todos/mobile_todo", :collection => @done, :locals => { :parent_container_type => "tag" } %>
<%= render :partial => @done, :locals => { :parent_container_type => "tag" } %>
</ul>
<% else -%>
<%= t('todos.no_completed_actions_with', :tag_name => @tag_title) %>

View file

@ -8,45 +8,24 @@
<h3><%= @heading -%></h3>
<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>
<td><label for="user_login"><%= t('users.desired_login') %>:</label></td>
<td> <%= text_field "user", "login", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_login"><%= t('users.desired_login') %>:</label></td>
<td> <%= text_field "user", "login", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password"><%= t('users.choose_password') %>:</label></td>
<td><%= password_field "user", "password", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password_confirmation"><%= t('users.confirm_password') %>:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20 %></td>
</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%>
<td><label for="user_password"><%= t('users.choose_password') %>:</label></td>
<td><%= password_field "user", "password", :size => 20 %></td>
</tr>
<tr>
<td><label for="user_password_confirmation"><%= t('users.confirm_password') %>:</label></td>
<td><%= password_field "user", "password_confirmation", :size => 20 %></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="signup" value="<%= t('users.signup') %> &#187;" class="primary" /></td>
</tr>
</table>
<% end %>
<%end-%>
</div>

View file

@ -58,10 +58,13 @@ Tracksapp::Application.routes.draw do
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 'review' => "projects#review"
match 'login' => 'login#login'
match 'logout' => 'login#logout'
match 'calendar' => "todos#calendar"
match 'stats' => 'stats#index'
match 'done' => "stats#done", :as => 'done_overview'
@ -109,6 +112,7 @@ Tracksapp::Application.routes.draw do
put 'toggle_check'
put 'toggle_star'
put 'defer'
get 'show_notes'
end
collection do
get 'done'
@ -123,6 +127,7 @@ Tracksapp::Application.routes.draw do
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 'auto_complete_for_predecessor' => 'todos#auto_complete_for_predecessor'
match 'mobile' => 'todos#index', :format => 'm'
resources :recurring_todos 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) |
| 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
When I go to the login page
And I submit the login form as user "testuser" with password "secret"

View file

@ -1,9 +1,9 @@
Feature: Create project from 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
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
Background:
@ -14,7 +14,7 @@ Feature: Create project from template
And I have logged in as "testuser" with password "secret"
And I have a context called "Context A"
@javascript
@javascript @announce @wip
Scenario: Create a project with one task
Given a template that looks like
"""

View file

@ -27,4 +27,4 @@ Feature: Manage users
Scenario: Delete account from users page
When I go to the manage users page
And I delete the user "testuser"
Then I should see that a user named "testuser" is not present
Then I should see that a user named "testuser" is not present

View file

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

View file

@ -11,19 +11,17 @@ When /^I execute the script$/ do
step "I cd to \"../..\""
context_id = @current_user.contexts.first.id
port = Capybara.current_session.driver.rack_server.port
# assumes there is a context with id=1
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}"
step "I run \"#{command}\""
# puts "output = #{combined_output}"
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 `#{cli}`"
end

View file

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

View file

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