Adds a button on each page, which links to file into the repository
This commit is contained in:
parent
671dd6a564
commit
c428b438a0
@ -13,6 +13,7 @@
|
|||||||
"float": true,
|
"float": true,
|
||||||
"file_editor": false,
|
"file_editor": false,
|
||||||
"repo": "justinwalsh/daux.io",
|
"repo": "justinwalsh/daux.io",
|
||||||
|
"repo_to_fix": "https://github.com/justinwalsh/daux.io/blob/master/",
|
||||||
"ignore": {
|
"ignore": {
|
||||||
"files": ["Work_In_Progress.md"],
|
"files": ["Work_In_Progress.md"],
|
||||||
"folders": ["99_Not_Ready"]
|
"folders": ["99_Not_Ready"]
|
||||||
|
@ -101,6 +101,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->docs_path = $this->local_base . DIRECTORY_SEPARATOR . $global_config['docs_directory'];
|
$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)) {
|
if (!is_dir($this->docs_path)) {
|
||||||
$this->generate_error_page('Docs Directory not found',
|
$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);
|
'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 = '') {
|
private function get_page_params($mode = '') {
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['local_base'] = $this->local_base;
|
$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;
|
if ($mode === '') $mode = $this->mode;
|
||||||
$params['mode'] = $mode;
|
$params['mode'] = $mode;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
public $index_page;
|
public $index_page;
|
||||||
public $first_page;
|
public $first_page;
|
||||||
public $value;
|
public $value;
|
||||||
|
public $extension;
|
||||||
public $uri;
|
public $uri;
|
||||||
public $local_path;
|
public $local_path;
|
||||||
public $last_modified;
|
public $last_modified;
|
||||||
@ -31,6 +32,8 @@
|
|||||||
} else {
|
} else {
|
||||||
$this->type = Directory_Entry::FILE_TYPE;
|
$this->type = Directory_Entry::FILE_TYPE;
|
||||||
$this->value = $this->uri;
|
$this->value = $this->uri;
|
||||||
|
$pathinfo = DauxHelper::pathinfo($path);
|
||||||
|
$this->extension = $pathinfo['extension'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,9 +112,16 @@
|
|||||||
$this->title = $file->title;
|
$this->title = $file->title;
|
||||||
$this->filename = $file->name;
|
$this->filename = $file->name;
|
||||||
$this->path = $file->local_path;
|
$this->path = $file->local_path;
|
||||||
|
$this->repo_path = $params['repo_to_fix'];
|
||||||
|
$this->extension = $file->extension;
|
||||||
$this->mtime = $file->last_modified;
|
$this->mtime = $file->last_modified;
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
|
|
||||||
|
$this->folderPaths = '';
|
||||||
|
foreach ($file->parents as $parent) {
|
||||||
|
$this->folderPaths .= DIRECTORY_SEPARATOR . $parent->name;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->title === 'index') {
|
if ($this->title === 'index') {
|
||||||
$this->homepage = ($this->filename === '_index');
|
$this->homepage = ($this->filename === '_index');
|
||||||
$minimum_parent_dir_size = ($params['multilanguage']) ? 2 : 1;
|
$minimum_parent_dir_size = ($params['multilanguage']) ? 2 : 1;
|
||||||
@ -184,6 +191,7 @@
|
|||||||
}
|
}
|
||||||
$page['language'] = $this->language;
|
$page['language'] = $this->language;
|
||||||
$page['path'] = $this->path;
|
$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['request'] = utf8_encode($params['request']);
|
||||||
$page['theme'] = $params['theme'];
|
$page['theme'] = $params['theme'];
|
||||||
$page['modified_time'] = filemtime($this->path);
|
$page['modified_time'] = filemtime($this->path);
|
||||||
|
@ -225,6 +225,7 @@
|
|||||||
else echo $page['title'];
|
else echo $page['title'];
|
||||||
?>
|
?>
|
||||||
<?php if ($page['file_editor']) echo '<a href="javascript:;" id="editThis" class="btn">Edit this page</a>'; ?>
|
<?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>
|
</h1>
|
||||||
<span style="float: left; font-size: 10px; color: gray;">
|
<span style="float: left; font-size: 10px; color: gray;">
|
||||||
<?php echo date("l, F j, Y", $page['modified_time']);?>
|
<?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);
|
if ($page['breadcrumbs']) echo $this->get_breadcrumb_title($page, $base_page);
|
||||||
else echo $page['title'];
|
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>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
@ -256,6 +259,7 @@
|
|||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user