diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb index 6ca43477..6d40b8f7 100644 --- a/tracks/app/controllers/application.rb +++ b/tracks/app/controllers/application.rb @@ -38,17 +38,21 @@ class ApplicationController < ActionController::Base def set_session_expiration # http://wiki.rubyonrails.com/rails/show/HowtoChangeSessionOptions - return if @controller_name == 'feed' - # If no session we don't care - if @session - # Get expiry time (allow ten seconds window for the case where we have none) - expiry_time = @session['expiry_time'] || Time.now + 10 - if expiry_time < Time.now - # Too late, matey... bang goes your session! - reset_session - else - # Okay, you get another hour - @session['expiry_time'] = Time.now + (60*60) + unless @session == nil + return if @controller_name == 'feed' or @session['noexpiry'] == "on" + # If the method is called by the feed controller (which we don't have under session control) + # or if we checked the box to keep logged in on login + # don't set the session expiry time. + if @session + # Get expiry time (allow ten seconds window for the case where we have none) + expiry_time = @session['expiry_time'] || Time.now + 10 + if expiry_time < Time.now + # Too late, matey... bang goes your session! + reset_session + else + # Okay, you get another hour + @session['expiry_time'] = Time.now + (60*60) + end end end end diff --git a/tracks/app/controllers/login_controller.rb b/tracks/app/controllers/login_controller.rb index bc66f287..394077e2 100644 --- a/tracks/app/controllers/login_controller.rb +++ b/tracks/app/controllers/login_controller.rb @@ -1,13 +1,22 @@ class LoginController < ApplicationController model :user layout 'login' + skip_before_filter :set_session_expiration def login - @page_title = "Login" + @page_title = "TRACKS::Login" case @request.method when :post if @session['user'] = User.authenticate(@params['user_login'], @params['user_password']) - flash['notice'] = "Login successful" + # If checkbox on login page checked, we don't expire the session after 1 hour + # of inactivity + @session['noexpiry']= @params['user_noexpiry'] + if @session['noexpiry'] == "on" + msg = "will not expire." + else + msg = "will expire after 1 hour of inactivity." + end + flash['notice'] = "Login successful: session #{msg}" redirect_back_or_default :controller => "todo", :action => "list" else @login = @params['user_login'] diff --git a/tracks/app/views/feed/na_feed.rxml b/tracks/app/views/feed/na_feed.rxml index 26d754e4..32852a95 100644 --- a/tracks/app/views/feed/na_feed.rxml +++ b/tracks/app/views/feed/na_feed.rxml @@ -2,11 +2,11 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do xml.channel do xml.title("Tracks - Next Actions") xml.link("http://#{@request.host}:#{@request.port}/todo/list") - xml.description("Lists the last 15 undone next actions") + xml.description("Lists the last 15 uncompleted next actions") @not_done.each { |i| xml.item do xml.title(i.description) - @link = url_for(:controller => 'context', :action => 'show', :id => "#{i.context_id}") + @link = url_for(:controller => 'context', :action => 'show', :name => "#{i.context.name}") xml.link("http://#{@request.host}:#{@request.port}#{@link}") xml.description(i.context['name']) end diff --git a/tracks/app/views/login/login.rhtml b/tracks/app/views/login/login.rhtml index f972919a..99878e51 100644 --- a/tracks/app/views/login/login.rhtml +++ b/tracks/app/views/login/login.rhtml @@ -12,15 +12,19 @@ - - + + - - - + + + - - + + + + + +
diff --git a/tracks/app/views/todo/_completed.rhtml b/tracks/app/views/todo/_completed.rhtml index 73244f38..56a92e1a 100644 --- a/tracks/app/views/todo/_completed.rhtml +++ b/tracks/app/views/todo/_completed.rhtml @@ -9,7 +9,7 @@
-

Currently there are no completed actions in this context

+

Currently there are no completed actions <%= append_descriptor %>

<%= render :partial => "todo/item", :collection => done %>