Module: Web::SimpleDispatcher::TemplateClassMixin

Included in:
Template, Wiki::PageEditor
Defined in:
lib/web/simpledispatcher.rb

Instance Method Summary collapse

Instance Method Details

#format_descriptionObject



87
88
89
# File 'lib/web/simpledispatcher.rb', line 87

def format_description
  "Template: #{template_filename}, formclass #{name}"
end

#handle(aTemplate) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/web/simpledispatcher.rb', line 95

def handle aTemplate
  if was_not_a_submit
 #             trace_dispatcher format_description
  else
#              trace_dispatcher "Submit to: #{name}"
    aTemplate.assign_params
    aTemplate.on_submit({})
  end
  
  Web.print_template template_filename, 
               aTemplate, Web.encode_objects(Web.query)
end

#redirect_to(params) ⇒ Object



78
79
80
81
# File 'lib/web/simpledispatcher.rb', line 78

def redirect_to params
  Web.reset_headers
  Web.set_redirect File.join(Web.script_name, "#{template}?#{Web.make_query_string(Web.encode_objects(params))}")
end

#templateObject



74
75
76
# File 'lib/web/simpledispatcher.rb', line 74

def template
  SimpleDispatcher::template_from_class self
end

#template_filenameObject



83
84
85
# File 'lib/web/simpledispatcher.rb', line 83

def template_filename
  template + ".html"
end

#was_not_a_submitObject



91
92
93
# File 'lib/web/simpledispatcher.rb', line 91

def was_not_a_submit
  Web["__submitted"] == ""
end