Adding the ability to add tabs to documentation and issue editing

Adding the ability to have syntax highlighted wiki (ie documentation)
ex:

<pre class="prettyprint">
int main()
{
	cout << "test" << endl;
}
</pre>
This commit is contained in:
Nathan Adams 2013-08-01 22:28:19 -05:00
parent 2f981e42e5
commit 7ebce22300
5 changed files with 25 additions and 10 deletions

View File

@ -281,6 +281,13 @@ class IDF_Views_User
$user = $users[0]; $user = $users[0];
$user_data = IDF_UserData::factory($user); $user_data = IDF_UserData::factory($user);
$otags = array();
// Note that this approach does not scale, we will need to add
// a table to cache the meaning of the tags for large forges.
foreach (IDF_Views::getProjects($user) as $project) {
$otags = array_merge($otags, $project->getTagIdsByStatus('open'));
}
$false = Pluf_DB_BooleanToDb(false, $db); $false = Pluf_DB_BooleanToDb(false, $db);
$sql_results = $db->select( $sql_results = $db->select(
'SELECT id FROM '.$db->pfx.'idf_projects '. 'SELECT id FROM '.$db->pfx.'idf_projects '.
@ -291,7 +298,7 @@ class IDF_Views_User
foreach ($sql_results as $id) { foreach ($sql_results as $id) {
$ids[] = $id['id']; $ids[] = $id['id'];
} }
$f_sql = new Pluf_SQL('owner=%s AND project IN (' . implode(', ', $ids) . ' )', array($user->id)); $f_sql = new Pluf_SQL('owner=%s AND status IN (' .implode(', ', $otags) . ') AND project IN (' . implode(', ', $ids) . ' )', array($user->id));
$pag = new Pluf_Paginator(new IDF_Issue()); $pag = new Pluf_Paginator(new IDF_Issue());
$pag->class = 'recent-issues'; $pag->class = 'recent-issues';

View File

@ -1,5 +1,5 @@
{extends "idf/source/base.html"} {extends "idf/source/base.html"}
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block} {block extraheader} {/block}
{block docclass}yui-t1{assign $inSourceTree=true}{/block} {block docclass}yui-t1{assign $inSourceTree=true}{/block}
{block body} {block body}
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2> <h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
@ -26,6 +26,5 @@
{/block} {/block}
{block javascript} {block javascript}
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
<script type="text/javascript">prettyPrint();</script>
{/block} {/block}

View File

@ -1,5 +1,5 @@
{extends "idf/source/base.html"} {extends "idf/source/base.html"}
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block} {block extraheader} {/block}
{block docclass}yui-t1{assign $inSourceTree=true}{/block} {block docclass}yui-t1{assign $inSourceTree=true}{/block}
{block body} {block body}
@ -27,6 +27,5 @@
{/block} {/block}
{block javascript} {block javascript}
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
<script type="text/javascript">prettyPrint();</script>
{/block} {/block}

View File

@ -1,5 +1,5 @@
{extends "idf/source/base.html"} {extends "idf/source/base.html"}
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block} {block extraheader} {/block}
{block docclass}yui-t1{assign $inSourceTree=true}{/block} {block docclass}yui-t1{assign $inSourceTree=true}{/block}
{block body} {block body}
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2> <h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
@ -43,6 +43,5 @@
{/block} {/block}
{block javascript} {block javascript}
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
<script type="text/javascript">prettyPrint();</script>
{/block} {/block}

View File

@ -0,0 +1,11 @@
$("textarea").keydown(function(e) {
var $this, end, start;
if (e.keyCode === 9) {
start = this.selectionStart;
end = this.selectionEnd;
$this = $(this);
$this.val($this.val().substring(0, start) + "\t" + $this.val().substring(end));
this.selectionStart = this.selectionEnd = start + 1;
return false;
}
});