updated the code file view to use the title-band class partially

This commit is contained in:
hyung-hwan 2016-01-08 17:51:39 +00:00
parent bd541815a2
commit 6f5815bd9b
2 changed files with 151 additions and 147 deletions

View File

@ -37,17 +37,17 @@ var base_return_anchor = codepot_merge_path('<?php print site_url() ?>', '<?php
function resize_editor() function resize_editor()
{ {
var infostrip = $("#code_edit_mainarea_infostrip"); var titleband = $("#code_edit_mainarea_title_band");
var code = $("#code_edit_mainarea_result_code"); var code = $("#code_edit_mainarea_result_code");
var footer = $("#codepot_footer"); var footer = $("#codepot_footer");
var ioff = infostrip.offset(); var ioff = titleband.offset();
var foff = footer.offset(); var foff = footer.offset();
ioff.top += infostrip.outerHeight() + 5; ioff.top += titleband.outerHeight() + 5;
code.offset (ioff); code.offset (ioff);
code.innerHeight (foff.top - ioff.top - 5); code.innerHeight (foff.top - ioff.top - 5);
code.innerWidth (infostrip.innerWidth()); code.innerWidth (titleband.innerWidth());
} }
function show_alert (outputMsg, titleMsg) function show_alert (outputMsg, titleMsg)
@ -266,36 +266,36 @@ $this->load->view (
<div class="mainarea" id="code_edit_mainarea"> <div class="mainarea" id="code_edit_mainarea">
<div class="title" id="code_edit_mainarea_title"> <div class="title-band" id="code_edit_mainarea_title_band">
<?php <div class="title" id="code_edit_mainarea_title">
print anchor ( <?php
"code/${caller}/{$project->id}{$revreqroot}",
htmlspecialchars($project->name));
$exps = explode ('/', $headpath);
$expsize = count($exps);
$par = '';
for ($i = 1; $i < $expsize; $i++)
{
$par .= '/' . $exps[$i];
$xpar = $this->converter->AsciiToHex ($par);
print '/';
print anchor ( print anchor (
"code/${caller}/{$project->id}/{$xpar}{$revreq}", "code/${caller}/{$project->id}{$revreqroot}",
htmlspecialchars($exps[$i])); htmlspecialchars($project->name));
}
if ($headpath != $file['fullpath']) $exps = explode ('/', $headpath);
{ $expsize = count($exps);
print ' - '; $par = '';
print htmlspecialchars($file['fullpath']); for ($i = 1; $i < $expsize; $i++)
} {
?> $par .= '/' . $exps[$i];
</div> <!-- code_edit_mainarea_title --> $xpar = $this->converter->AsciiToHex ($par);
<div class="infostrip" id="code_edit_mainarea_infostrip"> print '/';
print anchor (
"code/${caller}/{$project->id}/{$xpar}{$revreq}",
htmlspecialchars($exps[$i]));
}
if ($headpath != $file['fullpath'])
{
print ' - ';
print htmlspecialchars($file['fullpath']);
}
?>
</div> <!-- code_edit_mainarea_title -->
<div class="actions">
<?php <?php
/* 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>';
@ -304,7 +304,8 @@ $this->load->view (
print ' '; print ' ';
print anchor ("code/${caller}/{$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 style="clear: both;"></div>
</div> </div>
<div class="result" id="code_edit_mainarea_result"> <div class="result" id="code_edit_mainarea_result">

View File

@ -34,23 +34,23 @@ $(function () {
print '$("#code_file_mainarea_result_info").hide();'; print '$("#code_file_mainarea_result_info").hide();';
?> ?>
if ($("#code_file_mainarea_result_info").is(":visible")) //if ($("#code_file_mainarea_result_info").is(":visible"))
btn_label = "<?php print $this->lang->line('Hide metadata')?>"; // btn_label = "<?php print $this->lang->line('Hide metadata')?>";
else //else
btn_label = "<?php print $this->lang->line('Show metadata')?>"; // btn_label = "<?php print $this->lang->line('Show metadata')?>";
btn = $("#code_file_mainarea_metadata_button").button({"label": btn_label}).click (function () { btn = $("#code_file_mainarea_metadata_button").button().click (function () {
if ($("#code_file_mainarea_result_info").is(":visible")) if ($("#code_file_mainarea_result_info").is(":visible"))
{ {
$("#code_file_mainarea_result_info").hide("blind",{},200); $("#code_file_mainarea_result_info").hide("blind",{},200);
$("#code_file_mainarea_metadata_button").button( //$("#code_file_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Show metadata')?>"); // "option", "label", "<?php print $this->lang->line('Show metadata')?>");
} }
else else
{ {
$("#code_file_mainarea_result_info").show("blind",{},200); $("#code_file_mainarea_result_info").show("blind",{},200);
$("#code_file_mainarea_metadata_button").button( //$("#code_file_mainarea_metadata_button").button(
"option", "label", "<?php print $this->lang->line('Hide metadata')?>"); // "option", "label", "<?php print $this->lang->line('Hide metadata')?>");
} }
return false; // prevent the default behavior return false; // prevent the default behavior
@ -124,44 +124,86 @@ $this->load->view (
<div class="mainarea" id="code_file_mainarea"> <div class="mainarea" id="code_file_mainarea">
<div class="title" id="code_file_mainarea_title"> <div class="title-band" id="code_file_mainarea_title_band">
<?php <div class="title" id="code_file_mainarea_title">
if ($revision <= 0) <?php
{ if ($revision <= 0)
$revreq = ''; {
$revreqroot = ''; $revreq = '';
} $revreqroot = '';
else }
{ else
$revreq = "/{$file['created_rev']}"; {
$revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq; $revreq = "/{$file['created_rev']}";
} $revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq;
}
print anchor (
"code/file/{$project->id}{$revreqroot}",
htmlspecialchars($project->name));
$exps = explode ('/', $headpath);
$expsize = count($exps);
$par = '';
for ($i = 1; $i < $expsize; $i++)
{
$par .= '/' . $exps[$i];
$xpar = $this->converter->AsciiToHex ($par);
print '/';
print anchor ( print anchor (
"code/file/{$project->id}/{$xpar}{$revreq}", "code/file/{$project->id}{$revreqroot}",
htmlspecialchars($exps[$i])); htmlspecialchars($project->name));
}
if ($headpath != $file['fullpath']) $exps = explode ('/', $headpath);
{ $expsize = count($exps);
print ' - '; $par = '';
print htmlspecialchars($file['fullpath']); for ($i = 1; $i < $expsize; $i++)
} {
?> $par .= '/' . $exps[$i];
</div> <!-- code_file_mainarea_title --> $xpar = $this->converter->AsciiToHex ($par);
print '/';
print anchor (
"code/file/{$project->id}/{$xpar}{$revreq}",
htmlspecialchars($exps[$i]));
}
if ($headpath != $file['fullpath'])
{
print ' - ';
print htmlspecialchars($file['fullpath']);
}
?>
</div> <!-- code_file_mainarea_title -->
<div class="actions">
<?php
print anchor ("code/file/{$project->id}/${xpar}/{$file['prev_rev']}", '<i class="fa fa-arrow-circle-left"></i>');
print ' ';
// anchor to the revision history at the root directory
print anchor (
//"code/revision/{$project->id}/!/{$file['created_rev']}",
"code/revision/{$project->id}/${xpar}/{$file['created_rev']}",
sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev'])
);
if (!empty($file['created_tag']))
{
print ' ';
print ('<span class="left_arrow_indicator">');
print htmlspecialchars($file['created_tag']);
print ('</span>');
}
print ' ';
print anchor ("code/file/{$project->id}/${xpar}/{$file['next_rev']}", '<i class="fa fa-arrow-circle-right"></i>');
print ' | ';
printf ('%s: %s', $this->lang->line('Size'), $file['size']);
if ((isset($login['id']) && $login['id'] != ''))
{
print ' ';
print anchor ("code/edit/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Edit'), 'id="code_file_mainarea_edit_button"');
}
?>
<a id="code_file_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div>
<div style="clear: both;"></div>
</div>
<div class="menu" id="code_file_mainarea_menu"> <div class="menu" id="code_file_mainarea_menu">
<?php <?php
@ -213,44 +255,6 @@ $this->load->view (
?> ?>
</div> <!-- code_file_mainarea_menu --> </div> <!-- code_file_mainarea_menu -->
<div class="infostrip" id="code_file_mainarea_infostrip">
<?php
print anchor ("code/file/{$project->id}/${xpar}/{$file['prev_rev']}", '<i class="fa fa-arrow-circle-left"></i>');
print ' ';
// anchor to the revision history at the root directory
print anchor (
//"code/revision/{$project->id}/!/{$file['created_rev']}",
"code/revision/{$project->id}/${xpar}/{$file['created_rev']}",
sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev'])
);
if (!empty($file['created_tag']))
{
print ' ';
print ('<span class="left_arrow_indicator">');
print htmlspecialchars($file['created_tag']);
print ('</span>');
}
print ' ';
print anchor ("code/file/{$project->id}/${xpar}/{$file['next_rev']}", '<i class="fa fa-arrow-circle-right"></i>');
print ' | ';
printf ('%s: %s', $this->lang->line('Size'), $file['size']);
if ((isset($login['id']) && $login['id'] != ''))
{
print ' ';
print anchor ("code/edit/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Edit'), 'id="code_file_mainarea_edit_button"');
}
?>
<a id="code_file_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div>
<div style="display:none"> <div style="display:none">
<pre id="code_file_mainarea_result_raw"> <pre id="code_file_mainarea_result_raw">
@ -335,47 +339,46 @@ if ($login['settings'] != NULL &&
</pre> </pre>
<div id="code_file_mainarea_result_info" class="infobox"> <div id="code_file_mainarea_result_info" class="infobox">
<div class="title"><?php print $this->lang->line('CODE_COMMIT') ?></div> <div class="title"><?php print $this->lang->line('CODE_COMMIT') ?></div>
<ul> <ul>
<li><?php printf ($this->lang->line('CODE_MSG_COMMITTED_BY_ON'), $file['last_author'], $file['time']); ?></li> <li><?php printf ($this->lang->line('CODE_MSG_COMMITTED_BY_ON'), $file['last_author'], $file['time']); ?></li>
</ul> </ul>
<div class="title"><?php print $this->lang->line('Message') ?></div> <div class="title"><?php print $this->lang->line('Message') ?></div>
<pre id="code_file_mainarea_result_info_logmsg" class="pre-wrapped"> <pre id="code_file_mainarea_result_info_logmsg" class="pre-wrapped">
<?php print htmlspecialchars ($file['logmsg']) ?> <?php print htmlspecialchars ($file['logmsg']) ?>
</pre> </pre>
<?php <?php
if (array_key_exists('properties', $file) && count($file['properties']) > 0) if (array_key_exists('properties', $file) && count($file['properties']) > 0)
{
print '<div class="title">';
print $this->lang->line('CODE_PROPERTIES');
print '</div>';
print '<ul id="code_file_mainarea_result_info_property_list">';
foreach ($file['properties'] as $pn => $pv)
{ {
print '<li>'; print '<div class="title">';
print htmlspecialchars($pn); print $this->lang->line('CODE_PROPERTIES');
if ($pv != '') print '</div>';
print '<ul id="code_file_mainarea_result_info_property_list">';
foreach ($file['properties'] as $pn => $pv)
{ {
print ' - '; print '<li>';
print htmlspecialchars($pv); print htmlspecialchars($pn);
if ($pv != '')
{
print ' - ';
print htmlspecialchars($pv);
}
print '</li>';
} }
print '</li>'; print '</ul>';
} }
print '</ul>'; ?>
} </pre>
?>
</pre>
<div class="title">LOC</div>
<?php
/* TODO: show this if it's enabled in the user settings */
$graph_url = codepot_merge_path (site_url(), "/code/graph/cloc-file/{$project->id}/{$xpar}{$revreq}");
print "<img src='{$graph_url}' id='code_file_mainarea_result_info_locgraph' />";
?>
<div class="title">LOC</div>
<?php
/* TODO: show this if it's enabled in the user settings */
$graph_url = codepot_merge_path (site_url(), "/code/graph/cloc-file/{$project->id}/{$xpar}{$revreq}");
print "<img src='{$graph_url}' id='code_file_mainarea_result_info_locgraph' />";
?>
</div> <!-- code_file_mainarea_result_info --> </div> <!-- code_file_mainarea_result_info -->