Added the autocompletion of the owner and cosmetic changes.

This commit is contained in:
Loic d'Anterroches 2008-07-25 14:15:58 +02:00
parent e5d296d863
commit 4eea3797b2
6 changed files with 51 additions and 3 deletions

View File

@ -181,7 +181,9 @@ class IDF_Views_Issue
$issue = $form->save();
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
array($prj->shortname));
$request->user->setMessage(sprintf(__('Issue %d has been updated.'), $issue->id));
$urlissue = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($prj->shortname, $issue->id));
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been updated.'), $urlissue, $issue->id));
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
@ -334,6 +336,22 @@ class IDF_Views_Issue
}
$auto[$key] = substr($auto[$key], 0, -1);
}
// Get the members/owners
$m = $project->getMembershipData();
$auto['_auto_owner'] = $m['members'];
$auto['auto_owner'] = '';
foreach ($m['owners'] as $owner) {
if (!Pluf_Model_InArray($owner, $auto['_auto_owner'])) {
$auto['_auto_owner'][] = $owner;
}
}
foreach ($auto['_auto_owner'] as $owner) {
$auto['auto_owner'] .= sprintf('{ name: "%s", to: "%s" }, ',
Pluf_esc($owner),
Pluf_esc($owner->login));
}
$auto['auto_owner'] = substr($auto['auto_owner'], 0, -1);
unset($auto['_auto_owner']);
return $auto;
}
}

View File

@ -67,5 +67,16 @@
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
{include 'js-hotkeys.html'}
{block javascript}{/block}
{if $project}
<script type="text/javascript">{literal}
<!-- //
$(document).ready(function(){
var frag = location.hash;
if (frag.length > 3 && frag.substring(0, 3) == '#ic') {
$(frag).addClass("issue-comment-focus");
}
});
// -->{/literal}
</script>{/if}
</body>
</html>

View File

@ -1,3 +1,4 @@
{if $isOwner or $isMember}
<script type="text/javascript" src="{media '/idf/js/jquery.bgiframe.min.js'}"></script>
<script type="text/javascript" src="{media '/idf/js/jquery.autocomplete.min.js'}"></script>
<script type="text/javascript" charset="utf-8">
@ -5,6 +6,7 @@
$(document).ready(function(){
var auto_labels = [{/literal}{$auto_labels|safe}{literal}];
var auto_status = [{/literal}{$auto_status|safe}{literal}];
var auto_owner = [{/literal}{$auto_owner|safe}{literal}];
var j=0;
for (j=1;j<7;j=j+1) {
$("#id_label"+j).autocomplete(auto_labels, {
@ -34,7 +36,21 @@
return row.to;
}
});
$("#id_owner").autocomplete(auto_owner, {
minChars: 0,
width: 310,
matchContains: true,
max: 50,
highlightItem: false,
formatItem: function(row, i, max, term) {
return row.to.replace(new RegExp("(" + term + ")", "gi"), "<strong>$1</strong>") + " <span style='font-size: 80%;'>" + row.name + "</span>";
},
formatResult: function(row) {
return row.to;
}
});
});
{/literal} //-->
</script>
{/if}

View File

@ -10,7 +10,7 @@
{aurl 'url', 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}
{assign $id = $c.id}
{assign $url = $url~'#ic'~$c.id}
<p>{blocktrans}Comment <a href="{$url}">{$id}</a> by {$who}, {$c.creation_dtime|date}{/blocktrans}</p>
<p>{blocktrans}Comment <a href="{$url}">{$i}</a> by {$who}, {$c.creation_dtime|date}{/blocktrans}</p>
{/if}
<p class="issue-comment-text">{if strlen($c.content) > 0}{$c.content|nl2br}{else}<i>{trans '(No comments were given for this change.)'}</i>{/if}</p>

View File

@ -9,5 +9,4 @@
{hotkey 'Shift+w', 'IDF_Views_Issue::myIssues', array($project.shortname, 'owner')}
{/if} //-->
</script>
{/if}

View File

@ -126,6 +126,10 @@ div.issue-comment {
padding: 0.5em;
}
.issue-comment-focus {
border-right: 3px solid #8ae234 !important;
}
div.issue-comment-first {
border-top: 1px solid #d3d7cf;
}