added the edit link to the code blame view

This commit is contained in:
hyung-hwan 2015-05-14 01:45:33 +00:00
parent 2c511a5b6d
commit ede07c8778
5 changed files with 33 additions and 12 deletions

View File

@ -221,7 +221,7 @@ class Code extends Controller
} }
} }
function edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD) protected function _edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD, $caller = 'file')
{ {
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
@ -291,6 +291,7 @@ class Code extends Controller
$data['headpath'] = $path; $data['headpath'] = $path;
$data['file'] = $file; $data['file'] = $file;
$data['revision'] = $rev; $data['revision'] = $rev;
$data['caller'] = $caller;
$this->load->view ($this->VIEW_EDIT, $data); $this->load->view ($this->VIEW_EDIT, $data);
} }
@ -305,6 +306,16 @@ class Code extends Controller
} }
} }
function edit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD)
{
return $this->_edit ($projectid, $path, $rev, 'file');
}
function bledit ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD)
{
return $this->_edit ($projectid, $path, $rev, 'blame');
}
function enjson_save ($projectid = '', $path = '') function enjson_save ($projectid = '', $path = '')
{ {
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');

View File

@ -51,6 +51,7 @@ $(function () {
} }
}); });
$("#code_blame_mainarea_edit_button").button();
prettyPrint (); prettyPrint ();
}); });
</script> </script>
@ -153,7 +154,8 @@ $xpar = $this->converter->AsciiToHex ($headpath);
if ($file['created_rev'] != $file['head_rev']) if ($file['created_rev'] != $file['head_rev'])
{ {
print anchor ("code/blame/{$project->id}/${xpar}", $this->lang->line('Head revision')); $head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision');
print anchor ("code/blame/{$project->id}/${xpar}", $head_revision_text);
print ' | '; print ' | ';
} }
@ -190,18 +192,24 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_tex
sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev']) sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev'])
); );
if (!empty($file['created_tag'])) if (!empty($file['created_tag']))
{ {
print ' '; print ' ';
print ('<span class="left_arrow_indicator">'); print ('<span class="left_arrow_indicator">');
print htmlspecialchars($file['created_tag']); print htmlspecialchars($file['created_tag']);
print ('</span>'); print ('</span>');
} }
print ' '; print ' ';
print anchor ("code/blame/{$project->id}/${xpar}/{$file['next_rev']}", '<i class="fa fa-arrow-circle-right"></i>'); print anchor ("code/blame/{$project->id}/${xpar}/{$file['next_rev']}", '<i class="fa fa-arrow-circle-right"></i>');
print ' | '; print ' | ';
printf ('%s: %s', $this->lang->line('Size'), $file['size']); printf ('%s: %s', $this->lang->line('Size'), $file['size']);
if ((isset($login['id']) && $login['id'] != ''))
{
print ' ';
print anchor ("code/bledit/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Edit'), 'id="code_blame_mainarea_edit_button"');
}
?> ?>
<a id="code_blame_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a> <a id="code_blame_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div> </div>

View File

@ -33,7 +33,7 @@ $hex_headpath = $this->converter->AsciiToHex($headpath);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
var base_return_anchor = codepot_merge_path('<?php print site_url() ?>', '<?php print "/code/file/{$project->id}/{$hex_headpath}" ?>'); var base_return_anchor = codepot_merge_path('<?php print site_url() ?>', '<?php print "/code/${caller}/{$project->id}/{$hex_headpath}" ?>');
function resize_editor() function resize_editor()
{ {
@ -253,7 +253,7 @@ $this->load->view (
<div class="title" id="code_edit_mainarea_title"> <div class="title" id="code_edit_mainarea_title">
<?php <?php
print anchor ( print anchor (
"code/file/{$project->id}{$revreqroot}", "code/${caller}/{$project->id}{$revreqroot}",
htmlspecialchars($project->name)); htmlspecialchars($project->name));
$exps = explode ('/', $headpath); $exps = explode ('/', $headpath);
@ -266,7 +266,7 @@ $this->load->view (
print '/'; print '/';
print anchor ( print anchor (
"code/file/{$project->id}/{$xpar}{$revreq}", "code/${caller}/{$project->id}/{$xpar}{$revreq}",
htmlspecialchars($exps[$i])); htmlspecialchars($exps[$i]));
} }
@ -284,9 +284,9 @@ $this->load->view (
/* Saving file work on the head only. so the links here don't include the given revision anymore */ /* Saving file work on the head only. so the links here don't include the given revision anymore */
print '<select id="code_edit_mainarea_mode"></select>'; print '<select id="code_edit_mainarea_mode"></select>';
print ' '; print ' ';
print anchor ("code/file/{$project->id}/{$hex_headpath}", $this->lang->line('Save'), 'id="code_edit_mainarea_save_button"'); print anchor ("code/${caller}/{$project->id}/{$hex_headpath}", $this->lang->line('Save'), 'id="code_edit_mainarea_save_button"');
print ' '; print ' ';
print anchor ("code/file/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Return'), 'id="code_edit_mainarea_return_button"'); print anchor ("code/${caller}/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Return'), 'id="code_edit_mainarea_return_button"');
?> ?>
</div> </div>

View File

@ -173,9 +173,10 @@ $this->load->view (
if ($file['created_rev'] != $file['head_rev']) if ($file['created_rev'] != $file['head_rev'])
{ {
$head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision');
print anchor ( print anchor (
"code/file/{$project->id}/${xpar}", "code/file/{$project->id}/${xpar}",
$this->lang->line('Head revision')); $head_revision_text);
print ' | '; print ' | ';
} }

View File

@ -487,7 +487,8 @@ $this->load->view (
$xpar = $this->converter->AsciiTohex ($headpath); $xpar = $this->converter->AsciiTohex ($headpath);
if ($revision > 0 && $revision < $next_revision) if ($revision > 0 && $revision < $next_revision)
{ {
print anchor ("code/file/{$project->id}/{$xpar}", $this->lang->line('Head revision')); $head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision');
print anchor ("code/file/{$project->id}/{$xpar}", $head_revision_text);
print ' | '; print ' | ';
} }