Author: gjm
Date: Mon Mar 11 11:55:11 2013
New Revision: 1455103
URL: http://svn.apache.org/r1455103
Log:
replace scrollspy with update button and make summary contenteditable - towards
#451
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css?rev=1455103&r1=1455102&r2=1455103&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
(original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
Mon Mar 11 11:55:11 2013
@@ -356,6 +356,31 @@ h1, h2, h3, h4 {
.table tbody tr:hover td { background: #eed !important }
+/* copied from bootstrap for appropriate focus/unfocused state for
contenteditable*/
+span[contenteditable="true"] {
+ border-radius: 4px 4px 4px 4px;
+ background-color: #ffffff;
+ border: 1px solid #cccccc;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
+ -moz-transition: border linear 0.2s, box-shadow linear 0.2s;
+ -o-transition: border linear 0.2s, box-shadow linear 0.2s;
+ transition: border linear 0.2s, box-shadow linear 0.2s;
+}
+
+span[contenteditable="true"]:focus {
+ border-color: rgba(82, 168, 236, 0.8);
+ outline: 0;
+ outline: thin dotted \9;
+ /* IE6-9 */
+
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82,
168, 236, 0.6);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82,
168, 236, 0.6);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82,
168, 236, 0.6);
+}
+
/* @end */
/* @group Alternate download links */
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html?rev=1455103&r1=1455102&r2=1455103&view=diff
==============================================================================
---
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
(original)
+++
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
Mon Mar 11 11:55:11 2013
@@ -86,15 +86,24 @@
if ($('#vc-summary').is('.edit-active'))
// Already in editable state
return;
+ $('h2#vc-summary span').attr('contenteditable', 'true');
$('[data-edit="inplace"]').each(function() {
var fc = $(this).addClass('edit-active');
var fieldnm = fc.attr('id').substr(3);
- fc.attr('data-edit-orig', fc.html()).empty();
+ fc.attr('data-edit-orig', fc.html());
+
+ if (fieldnm != 'summary') {
+ fc.empty();
+ }
var editor = $('#properties #field-' + fieldnm);
if (editor.length == 0)
editor = $('#editor-' + fieldnm);
var fieldval = editor.val();
- editor = editor.clone(false).appendTo(fc).val(fieldval);
+ editor = editor.clone(false);
+ if (fieldnm === 'summary') {
+ editor.hide();
+ }
+ editor.appendTo(fc).val(fieldval);
if (editor.prop('tagName') === 'TEXTAREA') {
if (editor.is('.wikitext'))
addWikiFormattingToolbar(editor.get(0));
@@ -146,8 +155,9 @@
//$('#inplace-propertyform').autoSubmit({preview : 1},
// full_preview, '#overview .trac-loading')
$('#inplace-propertyform').submit(function() {
- $('#hidden-comment').val($('#comment').val())
+ $('#hidden-comment').val($('#comment').val());
})
+ $('#inplace-edit-button').hide();
}
function revert_ticket() {
@@ -155,9 +165,20 @@
var fc = $(this).removeClass('edit-active');
fc.html(fc.attr('data-edit-orig')).attr('data-edit-orig', '');
});
+ $('#inplace-edit-button').show();
+ $('h2#vc-summary span').attr('contenteditable', 'false');
}
- $('.local-nav a[href = "#inplace-edit"]').click(modify_ticket);
+ $('h2#vc-summary span').blur(function () {
+ if ($('#vc-summary.edit-active').length == 1) {
+ $('#vc-summary.ticket-summary
input#field-summary').val($('#vc-summary span').text());
+ }
+ });
+
+ $('#inplace-edit-button button#inplace-edit').click(function (e) {
+ modify_ticket();
+ e.preventDefault();
+ });
</py:if>
$('body').scrollspy({
@@ -239,33 +260,18 @@
<py:def function="render_ticket_summary(t, showid)">
<h2 class="ticket-summary searchable clip-affix" py:choose=""
data-edit="${'inplace' if can_modify or can_create else None}" id="vc-summary">
- <py:when test="t.exists"><py:if test="showid"><span
class="visible-phone">#$t.id - </span></py:if> ☆ $t.summary</py:when>
+ <py:when test="t.exists"><py:if test="showid">
+ <span class="visible-phone">#$t.id - </span></py:if> ☆ <span
contenteditable="false">$t.summary</span></py:when>
<py:otherwise>Create Ticket</py:otherwise>
</h2>
- </py:def>
-
- <py:def function="render_ticket_navbar(t)">
- <div class="ticket-navbar" py:if="t.exists"
- py:with="sections = (
- (_('Overview'), 'content', True, _('View ticket fields and
description'), 'icon-list'),
- (_('Attachments'), 'attachments', attachments.attachments or
attachments.can_create, _('Go to the list of attachments'), 'icon-file'),
- (_('Comments'), 'changelog', True, _('Go to the changelog'),
'icon-comment'),
- (_('Add comment'), 'propertyform', t.exists and can_append,
_('Go to the ticket editor'), 'icon-plus-sign'),
- (_('Modify Ticket'), 'inplace-edit', can_modify or can_edit
or can_create, _('Modify ticket fields and description'), 'icon-edit'),
- )">
- <ul class="btn-group local-nav nav">
- <li py:for="s in sections" py:if="s[2]" class="btn">
- <a href="#${s[1]}" title="${s[3]}">
- <i class="${s[4]}"></i>
- <!-- show first three descriptions on tables, hide all on
phones -->
- <py:choose>
- <span py:when="sections.index(s) > 2" class="hidden-phone
hidden-tablet">${s[0]}</span>
- <span py:otherwise="" class="hidden-phone">${s[0]}</span>
- </py:choose>
- </a>
- </li>
- </ul>
- </div>
+ <py:if test="t.exists">
+ <div id="inplace-edit-button" py:if="can_modify or can_edit or
can_create" class="btn-toolbar">
+ <button id="inplace-edit" class="btn">
+ <i class="icon-edit"></i>
+ <span class="hidden-phone hidden-tablet">${_('Modify
Ticket')}</span>
+ </button>
+ </div>
+ </py:if>
</py:def>
<div class="ticket">
@@ -314,9 +320,6 @@
</span>
</h5>
</div>
-
- <!--! ticket navbar -->
- ${render_ticket_navbar(ticket)}
</div>
<!--! activity header -->