Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major new content-negotiation features, view selection logic, and !Pr…
…efix replacing !View and !RoutesPrefix. Should not break backwards compatibility except for if data is being posted as JSON. Inbound content-type handling is on its way. Changed name for Annotation helper method validOnInstancesOf to validOnSubclassesOf Major refactoring to view selection pipeline. Adding RecessView back for backwards compatibility with old edge. This will disappear in 0.3 New content-negotiation system should now be backwards compatible with pre-0.2
- Loading branch information
1 parent
a4da91f
commit d3f8f0c
Showing
32 changed files
with
302 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
recess/recess/framework/controllers/annotations/PrefixAnnotation.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
Library::import('recess.lang.Annotation'); | ||
|
||
class PrefixAnnotation extends Annotation { | ||
|
||
public function usage() { | ||
return '!Prefix prefix/of/route/ [, Views: prefix/, Routes: prefix/]'; | ||
} | ||
|
||
public function isFor() { | ||
return Annotation::FOR_CLASS; | ||
} | ||
|
||
protected function validate($class) { | ||
$this->acceptedKeys(array('views', 'routes')); | ||
$this->minimumParameterCount(1); | ||
$this->maximumParameterCount(3); | ||
$this->validOnSubclassesOf($class, Controller::CLASSNAME); | ||
} | ||
|
||
protected function expand($class, $reflection, $descriptor) { | ||
if(isset($this->values[0])) { | ||
$viewsPrefix = $routesPrefix = $this->values[0]; | ||
} else { | ||
$viewsPrefix = $routesPrefix = ''; | ||
} | ||
|
||
if(isset($this->views)) { $viewsPrefix = $this->views; } | ||
if($viewsPrefix == '/') { $viewsPrefix = ''; } | ||
$descriptor->viewsPrefix = $viewsPrefix; | ||
|
||
if(isset($this->routes)) { $routesPrefix = $this->routes; } | ||
if($routesPrefix == '/') { $routesPrefix = ''; } | ||
$descriptor->routesPrefix = $routesPrefix; | ||
} | ||
} | ||
?> |
Oops, something went wrong.