Merge pull request #233 from nicosomb/master

#229 Adds a button on each page, which links to file into the repository
This commit is contained in:
Gautham Warrier 2014-10-29 13:24:14 +05:30
bovenliggende 671dd6a564 c428b438a0
commit 0f74ccc067
5 gewijzigde bestanden met toevoegingen van 20 en 1 verwijderingen

Bestand weergeven

@ -13,6 +13,7 @@
"float": true,
"file_editor": false,
"repo": "justinwalsh/daux.io",
"repo_to_fix": "https://github.com/justinwalsh/daux.io/blob/master/",
"ignore": {
"files": ["Work_In_Progress.md"],
"folders": ["99_Not_Ready"]

Bestand weergeven

@ -101,6 +101,7 @@
return;
}
$this->docs_path = $this->local_base . DIRECTORY_SEPARATOR . $global_config['docs_directory'];
$this->relative_path = $global_config['docs_directory'];
if (!is_dir($this->docs_path)) {
$this->generate_error_page('Docs Directory not found',
'The Docs directory does not exist. Check the path again : ' . $this->docs_path, ErrorPage::FATAL_ERROR_TYPE);
@ -192,6 +193,8 @@
private function get_page_params($mode = '') {
$params = array();
$params['local_base'] = $this->local_base;
$params['relative_path'] = $this->relative_path;
$params['repo_to_fix'] = $this->options['repo_to_fix'];
if ($mode === '') $mode = $this->mode;
$params['mode'] = $mode;

Bestand weergeven

@ -10,6 +10,7 @@
public $index_page;
public $first_page;
public $value;
public $extension;
public $uri;
public $local_path;
public $last_modified;
@ -31,6 +32,8 @@
} else {
$this->type = Directory_Entry::FILE_TYPE;
$this->value = $this->uri;
$pathinfo = DauxHelper::pathinfo($path);
$this->extension = $pathinfo['extension'];
}
}

Bestand weergeven

@ -112,9 +112,16 @@
$this->title = $file->title;
$this->filename = $file->name;
$this->path = $file->local_path;
$this->repo_path = $params['repo_to_fix'];
$this->extension = $file->extension;
$this->mtime = $file->last_modified;
$this->params = $params;
$this->folderPaths = '';
foreach ($file->parents as $parent) {
$this->folderPaths .= DIRECTORY_SEPARATOR . $parent->name;
}
if ($this->title === 'index') {
$this->homepage = ($this->filename === '_index');
$minimum_parent_dir_size = ($params['multilanguage']) ? 2 : 1;
@ -184,6 +191,7 @@
}
$page['language'] = $this->language;
$page['path'] = $this->path;
$page['url_for_fix'] = $this->repo_path . $this->folderPaths . DIRECTORY_SEPARATOR . $this->filename . '.' . $this->extension;
$page['request'] = utf8_encode($params['request']);
$page['theme'] = $params['theme'];
$page['modified_time'] = filemtime($this->path);

Bestand weergeven

@ -225,6 +225,7 @@
else echo $page['title'];
?>
<?php if ($page['file_editor']) echo '<a href="javascript:;" id="editThis" class="btn">Edit this page</a>'; ?>
<?php echo '<a href="'.$page['url_for_fix'].'" class="btn">Fix this page</a>'; ?>
</h1>
<span style="float: left; font-size: 10px; color: gray;">
<?php echo date("l, F j, Y", $page['modified_time']);?>
@ -239,7 +240,9 @@
if ($page['breadcrumbs']) echo $this->get_breadcrumb_title($page, $base_page);
else echo $page['title'];
?>
<?php if ($page['file_editor']) echo '<a href="javascript:;" id="editThis" class="btn">Edit this page</a>'; ?> </h1>
<?php if ($page['file_editor']) echo '<a href="javascript:;" id="editThis" class="btn">Edit this page</a>'; ?>
<?php echo '<a href="'.$page['url_for_fix'].'" class="btn">Fix this page</a>'; ?>
</h1>
</div>
<?php } ?>
@ -256,6 +259,7 @@
<div class="clearfix"></div>
</div>
<?php } ?>
</article>
</div>
</div>