replace old prototype/jrails code for periodic checks and start work on autocomplete and edit projects

Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
Reinier Balt 2010-10-05 21:27:00 +02:00
parent 69c811e365
commit c834403340
24 changed files with 588 additions and 53 deletions

View file

@ -136,7 +136,7 @@ class ApplicationController < ActionController::Base
def for_autocomplete(coll, substr)
filtered = coll.find_all{|item| item.name.downcase.include? substr.downcase}
return filtered.map {|item| "#{item.name}|#{item.id}"}.join("\n")
return "[{" + filtered.map {|item| "\"value\"=\"#{item.name}\", \"id\"=\"#{item.id}\""}.join("},{") + "}]"
end
# Uses RedCloth to transform text using either Textile or Markdown Need to

View file

@ -22,7 +22,7 @@ class ContextsController < ApplicationController
format.rss &render_contexts_rss_feed
format.atom &render_contexts_atom_feed
format.text { render :action => 'index', :layout => false, :content_type => Mime::TEXT }
format.autocomplete { render :text => for_autocomplete(@active_contexts + @hidden_contexts, params[:q])}
format.autocomplete { render :text => for_autocomplete(@active_contexts + @hidden_contexts, params[:term])}
end
end

View file

@ -86,12 +86,17 @@ class LoginController < ApplicationController
return unless should_expire_sessions?
# Get expiry time (allow ten seconds window for the case where we have none)
expiry_time = session['expiry_time'] || Time.now + 10
<<<<<<< HEAD
@time_left = expiry_time - Time.now
if @time_left < (10*60) # Session will time out before the next check
@msg = 'login.session_time_out'
else
@msg = ""
end
=======
time_left = expiry_time - Time.now
@session_expired = ( time_left < (10*60) ) # Session will time out before the next check
>>>>>>> replace old prototype/jrails code for periodic checks and start work on autocomplete and edit projects
end
end
respond_to do |format|