Permalink
Browse files

MINOR: remove dependency on RootURLController and show a default Cont…

…roller template as a failback.
  • Loading branch information...
1 parent eb2a042 commit 8b43780e23745b65766e376a7261adfd51a1de4a @wilr wilr committed with chillu Jun 19, 2012
Showing with 34 additions and 2 deletions.
  1. +8 −2 _config/routes.yml
  2. +4 −0 control/Controller.php
  3. +22 −0 templates/Controller.ss
View
@@ -1,4 +1,11 @@
---
+Name: rootroutes
+Before: '*'
+---
+Director:
+ rules:
+ '': 'Controller'
+---
Name: coreroutes
After: cms/routes#modelascontrollerroutes
Before: '*'
@@ -19,5 +26,4 @@ After: framework/routes#coreroutes
Director:
rules:
'admin': 'AdminRootController'
- '': 'RootURLController'
- 'dev/buildcache/$Action': 'RebuildStaticCacheTask'
+ 'dev/buildcache/$Action': 'RebuildStaticCacheTask'
@@ -274,6 +274,7 @@ function getViewer($action) {
$templates = $this->template;
} else {
// Add action-specific templates for inheritance chain
+ $templates = array();
$parentClass = $this->class;
if($action && $action != 'index') {
$parentClass = $this->class;
@@ -289,9 +290,12 @@ function getViewer($action) {
$parentClass = get_parent_class($parentClass);
}
+ $templates[] = 'Controller';
+
// remove duplicates
$templates = array_unique($templates);
}
+
return new SSViewer($templates);
}
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+
+ <head>
+ <meta charset="utf-8">
+ <% base_tag %>
+
+ $MetaTags
+ </head>
+ <body>
+ <h1><% if $Title %>$Title<% else %>Welcome to SilverStripe<% end_if %></h1>
+ <% if $Content %>$Content<% else %>
+ <p>To get started with the SilverStripe framework:</p>
+ <ol>
+ <li>Create a <code>Controller</code> subclass (<a href="http://doc.silverstripe.org/sapphire/en/topics/controller">doc.silverstripe.org/sapphire/en/topics/controller</a>)</li>
+ <li>Setup the routes to your <code>Controller</code>.</li>
+ <li>Create a template for your <code>Controller</code> (<a href="http://doc.silverstripe.org/sapphire/en/trunk/reference/templates">doc.silverstripe.org/sapphire/en/trunk/reference/templates</a>)</li>
+ </ol>
+ <% end_if %>
+ <p><em>Generated with the default Controller.ss template.</em></p>
+ </body>
+</html>

0 comments on commit 8b43780

Please sign in to comment.