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(); $issue = $form->save();
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index', $url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
array($prj->shortname)); 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); return new Pluf_HTTP_Response_Redirect($url);
} }
} else { } else {
@ -334,6 +336,22 @@ class IDF_Views_Issue
} }
$auto[$key] = substr($auto[$key], 0, -1); $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; return $auto;
} }
} }

View File

@ -67,5 +67,16 @@
<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script> <script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
{include 'js-hotkeys.html'} {include 'js-hotkeys.html'}
{block javascript}{/block} {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> </body>
</html> </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.bgiframe.min.js'}"></script>
<script type="text/javascript" src="{media '/idf/js/jquery.autocomplete.min.js'}"></script> <script type="text/javascript" src="{media '/idf/js/jquery.autocomplete.min.js'}"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
@ -5,6 +6,7 @@
$(document).ready(function(){ $(document).ready(function(){
var auto_labels = [{/literal}{$auto_labels|safe}{literal}]; var auto_labels = [{/literal}{$auto_labels|safe}{literal}];
var auto_status = [{/literal}{$auto_status|safe}{literal}]; var auto_status = [{/literal}{$auto_status|safe}{literal}];
var auto_owner = [{/literal}{$auto_owner|safe}{literal}];
var j=0; var j=0;
for (j=1;j<7;j=j+1) { for (j=1;j<7;j=j+1) {
$("#id_label"+j).autocomplete(auto_labels, { $("#id_label"+j).autocomplete(auto_labels, {
@ -34,7 +36,21 @@
return row.to; 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} //--> {/literal} //-->
</script> </script>
{/if}

View File

@ -10,7 +10,7 @@
{aurl 'url', 'IDF_Views_Issue::view', array($project.shortname, $issue.id)} {aurl 'url', 'IDF_Views_Issue::view', array($project.shortname, $issue.id)}
{assign $id = $c.id} {assign $id = $c.id}
{assign $url = $url~'#ic'~$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} {/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> <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')} {hotkey 'Shift+w', 'IDF_Views_Issue::myIssues', array($project.shortname, 'owner')}
{/if} //--> {/if} //-->
</script> </script>
{/if} {/if}

View File

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