From 7ebce22300ef35c81ba043a55494c83a9c4c1b18 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 1 Aug 2013 22:28:19 -0500 Subject: [PATCH] Adding the ability to add tabs to documentation and issue editing Adding the ability to have syntax highlighted wiki (ie documentation) ex:
int main()
{
	cout << "test" << endl;
}
--- indefero/src/IDF/Views/User.php | 9 ++++++++- indefero/src/IDF/templates/idf/source/git/file.html | 5 ++--- .../src/IDF/templates/idf/source/mercurial/file.html | 5 ++--- indefero/src/IDF/templates/idf/source/svn/file.html | 5 ++--- indefero/www/media/idf/js/allowtabs.js | 11 +++++++++++ 5 files changed, 25 insertions(+), 10 deletions(-) create mode 100755 indefero/www/media/idf/js/allowtabs.js diff --git a/indefero/src/IDF/Views/User.php b/indefero/src/IDF/Views/User.php index 59543cd..50ae5c6 100644 --- a/indefero/src/IDF/Views/User.php +++ b/indefero/src/IDF/Views/User.php @@ -281,6 +281,13 @@ class IDF_Views_User $user = $users[0]; $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); $sql_results = $db->select( 'SELECT id FROM '.$db->pfx.'idf_projects '. @@ -291,7 +298,7 @@ class IDF_Views_User foreach ($sql_results as $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->class = 'recent-issues'; diff --git a/indefero/src/IDF/templates/idf/source/git/file.html b/indefero/src/IDF/templates/idf/source/git/file.html index 01691ad..7aec286 100644 --- a/indefero/src/IDF/templates/idf/source/git/file.html +++ b/indefero/src/IDF/templates/idf/source/git/file.html @@ -1,5 +1,5 @@ {extends "idf/source/base.html"} -{block extraheader}{/block} +{block extraheader} {/block} {block docclass}yui-t1{assign $inSourceTree=true}{/block} {block body}

{trans 'Root'}/{if $breadcrumb}{$breadcrumb|safe}{/if}

@@ -26,6 +26,5 @@ {/block} {block javascript} - - + {/block} diff --git a/indefero/src/IDF/templates/idf/source/mercurial/file.html b/indefero/src/IDF/templates/idf/source/mercurial/file.html index 25d4572..8a870b6 100644 --- a/indefero/src/IDF/templates/idf/source/mercurial/file.html +++ b/indefero/src/IDF/templates/idf/source/mercurial/file.html @@ -1,5 +1,5 @@ {extends "idf/source/base.html"} -{block extraheader}{/block} +{block extraheader} {/block} {block docclass}yui-t1{assign $inSourceTree=true}{/block} {block body} @@ -27,6 +27,5 @@ {/block} {block javascript} - - + {/block} diff --git a/indefero/src/IDF/templates/idf/source/svn/file.html b/indefero/src/IDF/templates/idf/source/svn/file.html index 4e08bdc..c309f02 100644 --- a/indefero/src/IDF/templates/idf/source/svn/file.html +++ b/indefero/src/IDF/templates/idf/source/svn/file.html @@ -1,5 +1,5 @@ {extends "idf/source/base.html"} -{block extraheader}{/block} +{block extraheader} {/block} {block docclass}yui-t1{assign $inSourceTree=true}{/block} {block body}

{trans 'Root'}/{if $breadcrumb}{$breadcrumb|safe}{/if}

@@ -43,6 +43,5 @@ {/block} {block javascript} - - + {/block} diff --git a/indefero/www/media/idf/js/allowtabs.js b/indefero/www/media/idf/js/allowtabs.js new file mode 100755 index 0000000..d782940 --- /dev/null +++ b/indefero/www/media/idf/js/allowtabs.js @@ -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; + } +}); \ No newline at end of file