Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:recess/recess
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisJordan committed Jun 11, 2009
2 parents 1adaf70 + 054bb7a commit ff91b35
Show file tree
Hide file tree
Showing 49 changed files with 648 additions and 223 deletions.
Expand Up @@ -88,15 +88,20 @@ private function generateApp() {
$this->messages[] = $this->tryCreatingDirectory($appDir . '/models', 'models');

$this->messages[] = $this->tryCreatingDirectory($appDir . '/controllers', 'controllers');
$this->messages[] = $this->tryGeneratingFile('Home Controller', $this->application->codeTemplatesDir . 'HomeController.template.php', $appDir . '/controllers/' . $programmaticName . 'HomeController.class.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Home Controller', $this->application->codeTemplatesDir . 'scaffolding/controllers/HomeController.template.php', $appDir . '/controllers/' . $programmaticName . 'HomeController.class.php', $appReplacements);

$this->messages[] = $this->tryCreatingDirectory($appDir . '/views', 'views');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views/common', 'common views');
$this->messages[] = $this->tryGeneratingFile('Header View Template', $this->application->codeTemplatesDir . 'header.template.php', $appDir . '/views/common/header.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Navigation Template', $this->application->codeTemplatesDir . 'navigation.template.php', $appDir . '/views/common/navigation.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Footer Template', $this->application->codeTemplatesDir . 'footer.template.php', $appDir . '/views/common/footer.php', $appReplacements);
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views/parts', 'common parts');
$this->messages[] = $this->tryGeneratingFile('Navigation Part', $this->application->codeTemplatesDir . 'scaffolding/views/parts/navigation.part.template.php', $appDir . '/views/parts/navigation.part.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Style Part', $this->application->codeTemplatesDir . 'scaffolding/views/parts/style.part.template.php', $appDir . '/views/parts/style.part.php', $appReplacements);
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views/home', 'home views');
$this->messages[] = $this->tryGeneratingFile('Home Template', $this->application->codeTemplatesDir . 'index.template.php', $appDir . '/views/home/index.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Home Template', $this->application->codeTemplatesDir . 'scaffolding/views/home/index.template.php', $appDir . '/views/home/index.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Master Layout', $this->application->codeTemplatesDir . 'scaffolding/views/master.template.php', $appDir . '/views/master.php', $appReplacements);

$this->messages[] = $this->tryCreatingDirectory($appDir . '/public', 'public');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/public/css', 'css');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/public/js', 'javascript');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/public/img', 'images');
}

private function tryCreatingDirectory($path, $name) {
Expand Down Expand Up @@ -304,9 +309,9 @@ public function generateScaffolding($app, $model) {

$this->messages[] = $this->tryGeneratingFile('RESTful ' . $model . ' Controller', $this->application->codeTemplatesDir . 'scaffolding/controllers/ResourceController.template.php', $controllersDir . $model . 'Controller.class.php', $replacements);

$indexFieldTemplate = $this->getTemplate($this->application->codeTemplatesDir . 'scaffolding/views/indexField.template.php');
$indexDateFieldTemplate = $this->getTemplate($this->application->codeTemplatesDir . 'scaffolding/views/indexDateField.template.php');
$editFormInputTemplate = $this->getTemplate($this->application->codeTemplatesDir . 'scaffolding/views/editFormInput.template.php');
$indexFieldTemplate = $this->getTemplate($this->application->codeTemplatesDir . 'scaffolding/views/resource/indexField.template.php');
$indexDateFieldTemplate = $this->getTemplate($this->application->codeTemplatesDir . 'scaffolding/views/resource/indexDateField.template.php');
$editFormInputTemplate = $this->getTemplate($this->application->codeTemplatesDir . 'scaffolding/views/resource/editFormInput.template.php');

$indexFields = '';
$formFields = '';
Expand Down Expand Up @@ -338,9 +343,12 @@ public function generateScaffolding($app, $model) {

$viewsDir = $app->viewsDir . $replacements['viewsPrefix'] . '/';
$this->messages[] = $this->tryCreatingDirectory($viewsDir, $model . ' views dir');
$this->messages[] = $this->tryGeneratingFile('index view', $this->application->codeTemplatesDir . 'scaffolding/views/index.template.php', $viewsDir . 'index.php', $replacements);
$this->messages[] = $this->tryGeneratingFile('editForm view', $this->application->codeTemplatesDir . 'scaffolding/views/editForm.template.php', $viewsDir . 'editForm.php', $replacements, true);
$this->messages[] = $this->tryGeneratingFile('static details', $this->application->codeTemplatesDir . 'scaffolding/views/details.template.php', $viewsDir . 'details.php', $replacements);
$this->messages[] = $this->tryGeneratingFile('resource layout', $this->application->codeTemplatesDir . 'scaffolding/views/resource/layout.template.php', $viewsDir . 'layout.php', $replacements);
$this->messages[] = $this->tryGeneratingFile('index view', $this->application->codeTemplatesDir . 'scaffolding/views/resource/index.template.php', $viewsDir . 'index.php', $replacements);
$this->messages[] = $this->tryGeneratingFile('editForm view', $this->application->codeTemplatesDir . 'scaffolding/views/resource/editForm.template.php', $viewsDir . 'editForm.php', $replacements, true);
$this->messages[] = $this->tryGeneratingFile('form part', $this->application->codeTemplatesDir . 'scaffolding/views/resource/form.part.template.php', $viewsDir . 'form.part.php', $replacements, true);
$this->messages[] = $this->tryGeneratingFile('static details', $this->application->codeTemplatesDir . 'scaffolding/views/resource/details.template.php', $viewsDir . 'details.php', $replacements);
$this->messages[] = $this->tryGeneratingFile('details part', $this->application->codeTemplatesDir . 'scaffolding/views/resource/details.part.template.php', $viewsDir . 'details.part.php', $replacements);
$this->appName = get_class($app);
$this->modelName = $model;
}
Expand Down
9 changes: 0 additions & 9 deletions recess/recess/apps/tools/templates/footer.template.php

This file was deleted.

44 changes: 0 additions & 44 deletions recess/recess/apps/tools/templates/header.template.php

This file was deleted.

9 changes: 0 additions & 9 deletions recess/recess/apps/tools/templates/home.template.php

This file was deleted.

10 changes: 0 additions & 10 deletions recess/recess/apps/tools/templates/index.template.php

This file was deleted.

15 changes: 0 additions & 15 deletions recess/recess/apps/tools/templates/navigation.template.php

This file was deleted.

Expand Up @@ -2,7 +2,7 @@
Library::import('recess.framework.controllers.Controller');

/**
* !View Native, Prefix: home/
* !View Prefix: home/
*/
class {{programmaticName}}HomeController extends Controller {

Expand Down
Expand Up @@ -3,7 +3,7 @@
Library::import('recess.framework.forms.ModelForm');

/**
* !View Native, Prefix: {{viewsPrefix}}/
* !View Prefix: {{viewsPrefix}}/
* !RoutesPrefix {{routesPrefix}}/
*/
class {{modelName}}Controller extends Controller {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,19 @@
<?php
Layout::extend('master');
Layout::blockAssign('title', 'Home');
?>
<h1>Hello Kick-ass Developer!</h1>
<h2 class="highlight"><?php echo $flash; ?></h2>
<ul>
<?php
// This is a really slow way to generate navigation.
// You probably should not use this in a real app. Thx -Kris
Library::import('recess.lang.Inflector');
$app = $controller->application();
$controllers = $app->listControllers();
foreach($controllers as $controllerClass):
$title = Inflector::toEnglish(str_replace('Controller','',$controllerClass));
?>
<li><?php echo Html::anchor(Url::action($controllerClass . '::index'), $title)?></li>
<?php endforeach; ?>
</ul>

This file was deleted.

@@ -0,0 +1,35 @@
<html>
<head>
<?php
Layout::slot('style');
Part::render('parts/style');
Layout::slotEnd();
?>
<title>{{appName}} - <?php Layout::slot('title'); Layout::slotEnd() ?></title>
</head>
<body>
<div class="container">
<div class="span-24">
<h1>{{appName}}</h1>
</div>
<div class="span-24 last">
<div class="navigation">
<?php
Layout::slot('navigation');
Layout::slotEnd();
?>
</div>
<?php
Layout::slot('body');
Layout::slotEnd();
?>
</div>
<div class="span-24 footer">
<p class="quiet bottom">
<?php echo Html::anchor('/{{camelProgrammaticName}}/', '{{appName}}') ?> is &copy; <?php echo date('Y'); ?>
{Insert Kick-ass App Developer Name Here}. All rights reserved.
</p>
</div>
</div>
</body>
</html>
@@ -0,0 +1,6 @@
<ul>
<li><?php echo Html::anchor(Url::action('{{programmaticName}}HomeController::index'), 'Home') ?></li>
<!--
Add your application's navigation links here.
-->
</ul>
@@ -0,0 +1,35 @@
<!-- Blue Print -->
<?php
// Scaffolding uses Recess Tools' stylesheets. You should place your apps stylesheets
// in apps/yourApp/public/css/ and get rid of $recessToolsCss
$recessToolsCss = '../../../../recess/recess/apps/tools/public/css/';
?>
<?php echo Html::css($recessToolsCss . 'blueprint/screen','screen') ?>
<?php echo Html::css($recessToolsCss . 'blueprint/print',array('print')) ?>
<!--[if IE]>
<?php echo Html::css('blueprint/ie',array('screen', 'projection')) ?>
<![endif]-->
<style type="text/css">
.error,.notice,.success{ margin: 0 0 1em 0; padding: 0.8em; border: 2px solid #000; }
.error{ background: #FBE3E4; border-color: #FBC2C4; }
.error, .error a{ color: #8A1F11; }
.notice{ background: #FFF6BF; border-color: #FFD324; }
.notice, .notice a{ color: #514721; }
.success{ background: #E6EFC2; border-color: #C6D880; }
.success, .success a{ color: #264409; }
body { font-size: .8em; }
p { font-size: 1.2em; }
form{ margin: 0; padding: 0; }
fieldset{ margin: 0 0 1em 0; padding: 1em; border: 2px solid #a9b5c7; background: #f0f6fe; }
legend{ margin: 0; padding: 0 0.5em; font-size: 1.5em; font-weight: bold; color: #222; }
label{ font-weight: bold; color: #222; }

input.text,textarea{ width: 300px; padding: 3px; font-size: 14px; font-family: arial, verdana, sans-serif; color: #333; }
input.short{ width: 100px; }
input.long{ width: 500px; }
textarea{ width: 500px; height: 150px; }
.navigation { font-size: 1.6em; }
.navigation ul { margin: 0 0 1em 0; }
.navigation ul li { display: inline; background: #E6EFC2; border: 2px solid #C6D880; }
.navigation ul li a { color: #000; text-decoration: none; margin: .5em; }
</style>
@@ -0,0 +1,14 @@
<?php
assert(${{modelNameLower}} instanceof {{modelName}});
?>
<form method="POST" action="<?php echo Url::action('{{modelName}}Controller::delete', ${{modelNameLower}}->{{primaryKey}}) ?>">
<fieldset>
<h3><?php echo Html::anchor(Url::action('{{modelName}}Controller::details', ${{modelNameLower}}->{{primaryKey}}), '{{modelName}} #' . ${{modelNameLower}}->{{primaryKey}}) ?></h3>
<p>
{{fields}}
</p>
<?php echo Html::anchor(Url::action('{{modelName}}Controller::editForm', ${{modelNameLower}}->{{primaryKey}}), 'Edit') ?> -
<input type="hidden" name="_METHOD" value="DELETE" />
<input type="submit" name="delete" value="Delete" />
</fieldset>
</form>
@@ -0,0 +1,9 @@
<?php
Layout::extend('{{modelNameLower}}/layout');
Layout::blockAssign('title', 'Details of {{modelName}} #' . ${{modelNameLower}}->{{primaryKey}} );
?>

<?php Part::render('{{modelNameLower}}/details', ${{modelNameLower}}) ?>

<?php echo Html::anchor(Url::action('{{modelName}}Controller::index'), 'Back to list of {{modelNameLower}}s') ?>
<hr />
@@ -0,0 +1,13 @@
<?php
Layout::extend('{{modelNameLower}}/layout');
if(isset(${{modelNameLower}}->{{primaryKey}})) {
$title = 'Edit {{modelName}} #' . ${{modelNameLower}}->{{primaryKey}};
} else {
$title = 'Create New {{modelName}}';
}
Layout::blockAssign('title', $title);
?>

<?php Part::render('{{modelNameLower}}/form', $_form, $title) ?>

<?php echo Html::anchor(Url::action('{{modelName}}Controller::index'), '{{modelName}} List') ?>
@@ -0,0 +1,4 @@
<p>
<label for="<?php echo $form->{{fieldName}}->getName(); ?>">{{fieldNameEnglish}}</label><br />
<?php $form->input('{{fieldName}}'); ?>
</p>

0 comments on commit ff91b35

Please sign in to comment.