Skip to content

Commit

Permalink
MINOR: remove dependency on RootURLController and show a default Cont…
Browse files Browse the repository at this point in the history
…roller template as a failback.
  • Loading branch information
wilr authored and chillu committed Jun 20, 2012
1 parent eb2a042 commit 8b43780
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
10 changes: 8 additions & 2 deletions _config/routes.yml
@@ -1,4 +1,11 @@
--- ---
Name: rootroutes
Before: '*'
---
Director:
rules:
'': 'Controller'
---
Name: coreroutes Name: coreroutes
After: cms/routes#modelascontrollerroutes After: cms/routes#modelascontrollerroutes
Before: '*' Before: '*'
Expand All @@ -19,5 +26,4 @@ After: framework/routes#coreroutes
Director: Director:
rules: rules:
'admin': 'AdminRootController' 'admin': 'AdminRootController'
'': 'RootURLController' 'dev/buildcache/$Action': 'RebuildStaticCacheTask'
'dev/buildcache/$Action': 'RebuildStaticCacheTask'
4 changes: 4 additions & 0 deletions control/Controller.php
Expand Up @@ -274,6 +274,7 @@ function getViewer($action) {
$templates = $this->template; $templates = $this->template;
} else { } else {
// Add action-specific templates for inheritance chain // Add action-specific templates for inheritance chain
$templates = array();
$parentClass = $this->class; $parentClass = $this->class;
if($action && $action != 'index') { if($action && $action != 'index') {
$parentClass = $this->class; $parentClass = $this->class;
Expand All @@ -289,9 +290,12 @@ function getViewer($action) {
$parentClass = get_parent_class($parentClass); $parentClass = get_parent_class($parentClass);
} }


$templates[] = 'Controller';

// remove duplicates // remove duplicates
$templates = array_unique($templates); $templates = array_unique($templates);
} }

return new SSViewer($templates); return new SSViewer($templates);
} }


Expand Down
22 changes: 22 additions & 0 deletions templates/Controller.ss
@@ -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.