First version of new preview. Only plain text

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-09-04 12:31:27 +08:00
1 parent ecb3b5b25c
commit 671f86b612
14 files changed
+100 -14

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ class SessionsController < Devise::SessionsController
if ($nccu_ldap_connection.bind rescue false)
logger.info "=LDAP Binded password ok..."
result =check_auth_with_ldap(login_uid,login_password)
if result && login_password!=''
if result #&& login_password!=''
logger.info "==LDAP password passed..."
nccu_id = get_nccu_id_from_mid_site(login_uid)
resource = nccu_id.nil? ? nil : (User.first(conditions:{ nccu_ldap_uid: nccu_id }))
+25
View File
@@ -0,0 +1,25 @@
class Preview
include Mongoid::Document
include Mongoid::Timestamps
field :object, :type => Hash
field :preview_at_link
field :expired_at , :type => DateTime
field :link_args, :type => Array
field :object_class_type
def get_arg_hash
object.slice(*link_args).inject({}){|la,(k,v)| la[k.to_sym] = v; la}
end
def get_preview_link
ap = Rails.application.routes.url_helpers
ap.send preview_at_link,({:id=>id,:preview=>true}.merge get_arg_hash)
#func = eval("Rails.application.routes.url_helpers.#{preview_at_link}").send
end
def get_virtual_object
eval(self.object_class_type).new object
end
end