module UnstaticHelper def unstatic_authorized? @unstatic_authorized ||= UnstaticPassword.find_by_encrypted(session[:unstatic_password]) end def unstatic_content(name, options = {}) returning("") do |content| node = UnstaticNode.find_by_name(name) content << markdown(node.content) if node if unstatic_authorized? content << content_tag(:div, :id => "unstatic-edit") do params = { :origin => request.request_uri, :name => name } edit_path = node ? edit_unstatic_node_path(node, params) : new_unstatic_node_path(params) link_to("Edit Unstatic Content", edit_path) + " | " + link_to("Log out", unstatic_logout_path) end end end end end