Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow overriding the template being rendered from the controller
added action to view the source of a given file
- Loading branch information
1 parent
4b92154
commit 57d77d5
Showing
6 changed files
with
60 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,49 @@ | ||
<?php | ||
|
||
class ProjectsController extends Controller { | ||
|
||
protected function beforeFilter() { | ||
Git::loadRepositories(); | ||
} | ||
class ProjectsController extends AppController { | ||
|
||
public function show() { | ||
$this->_breadcrumbs = array( | ||
'home' => '/', | ||
$this->_request->params['project'] => "/{$this->_request->params['project']}", | ||
$this->_request->params['branch'] => "/{$this->_request->params['project']}/{$this->_request->params['branch']}", | ||
); | ||
if (!empty($this->_request->params['filepath'])) { | ||
$paths = explode('/', $this->_request->params['filepath']); | ||
$prevPath = "/{$this->_request->params['project']}/{$this->_request->params['branch']}"; | ||
foreach ($paths as $i => $path) { | ||
$prevPath = $prevPath . '/' . $path; | ||
$this->_breadcrumbs[$path] = $prevPath; | ||
} | ||
} | ||
|
||
System::set('title', $this->_request->params['project']); | ||
$tree = $this->Project->getTree( | ||
$this->_request->params['project'], | ||
$this->_request->params['filepath'] | ||
); | ||
$this->set(compact('tree')); | ||
} | ||
|
||
public function blob() { | ||
$this->_breadcrumbs = array( | ||
'home' => '/', | ||
$this->_request->params['project'] => "/{$this->_request->params['project']}", | ||
$this->_request->params['branch'] => "/{$this->_request->params['project']}/tree/{$this->_request->params['branch']}", | ||
); | ||
|
||
if (!empty($this->_request->params['filepath'])) { | ||
$paths = explode('/', $this->_request->params['filepath']); | ||
$prevPath = "/{$this->_request->params['project']}/{$this->_request->params['branch']}"; | ||
foreach ($paths as $i => $path) { | ||
$prevPath = $prevPath . '/' . $path; | ||
$this->_breadcrumbs[$path] = $prevPath; | ||
} | ||
} | ||
|
||
$data = $this->Project->getBlob( | ||
$this->_request->params['project'], | ||
$this->_request->params['filepath'] | ||
); | ||
$this->set(compact('data')); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="gitspacer"> </div> | ||
<?php echo $this->element('summary_title'); ?> | ||
<div class="gitspacer"> </div> | ||
<div class="table-wrapper"> | ||
<div class="gitcode"><?php echo $this->Geshi->highlight($data['content'], $data['ext']); ?></div> | ||
</div> |
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