You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by da...@apache.org on 2016/10/08 05:38:51 UTC
svn commit: r1763853 - in
/bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme:
htdocs/bloodhound.css htdocs/js/batchcreate.js theme.py
Author: dammina
Date: Sat Oct 8 05:38:51 2016
New Revision: 1763853
URL: http://svn.apache.org/viewvc?rev=1763853&view=rev
Log:
modified styling for macro generated tables
Modified:
bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/bloodhound.css
bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js
bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py
Modified: bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/bloodhound.css
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/bloodhound.css?rev=1763853&r1=1763852&r2=1763853&view=diff
==============================================================================
--- bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/bloodhound.css (original)
+++ bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/bloodhound.css Sat Oct 8 05:38:51 2016
@@ -1390,4 +1390,17 @@ input[type="radio"]:not(:checked) + labe
}
/* @end */
+/* @group Related tickets */
+
+/*#wikipage form[id^='batchcreate-'] div[id^='div-empty-table-'] div[id^='empty-table-'] form[id^='bct-form-'] table
+tbody tr td input.id {
+ width: 5%;
+}*/
+#wikipage form[id^='batchcreate-'] div[id^='div-empty-table-'] div[id^='empty-table-'] form[id^='bct-form-'] table
+tbody tr td select{
+ width: 100%;
+}
+
+/* @end */
+
#batchmod_action { line-height: 2.75em }
Modified: bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js?rev=1763853&r1=1763852&r2=1763853&view=diff
==============================================================================
--- bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js (original)
+++ bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js Sat Oct 8 05:38:51 2016
@@ -26,6 +26,7 @@ function emptyTable(numOfRows, products,
var created_rows = numOfRows;
var form_token = token.split(";")[0].split("=")[1];
+ href = href + "/bct";
var headers = {
"ticket": "", "summary": "Summary", "description": "Description", "product": "Product",
@@ -37,16 +38,19 @@ function emptyTable(numOfRows, products,
var contentDiv = $('#div-empty-table' + unique_key);
var div = $('<div/>', {
- 'id': 'empty-table' + unique_key,
- 'class': 'span12'
+ 'id': 'empty-table' + unique_key
}).appendTo(contentDiv);
- var h5 = $('<h5/>').html('Batch Create Tickets').appendTo(div);
+ $('<div/>', {
+ 'id': 'numrows' + unique_key,
+ 'class': 'numrows'
+ }).html('(' + numOfRows + ' total rows.)').appendTo(div);
var form = $('<form/>', {
'id': 'bct-form' + unique_key,
'name': 'bct',
- 'method': 'post'
+ 'method': 'post',
+ 'style': 'margin-bottom:60px'
}).appendTo(div);
$('<input/>', {
@@ -56,58 +60,68 @@ function emptyTable(numOfRows, products,
}).appendTo($('<div>').appendTo(form));
var table = $('<table/>', {
- 'class': 'listing tickets table table-bordered table-condensed query',
- 'style': 'border-radius: 0px 0px 4px 4px'
+ 'id': 'table' + unique_key,
+ 'class': 'table table-condensed tickets'
}).appendTo(form);
- var tr = $('<tr/>', {
- 'class': 'trac-columns'
- }).appendTo(table);
+ var thead = $('<thead/>').appendTo(table);
+ var header_tr = $('<tr/>', {
+ 'class': 'row'
+ }).appendTo(thead);
for (header in headers) {
- var th = $('<th/>').appendTo(tr);
- $('<font/>', {
- 'color': '#1975D1'
- }).html(headers[header]).appendTo(th);
+ var th = $('<th/>').html(headers[header]).appendTo(header_tr);
}
- var tbody = $('<tbody>').appendTo(table);
+ var tbody = $('<tbody>', {
+ 'id': 'tbody' + unique_key
+ }).appendTo(table);
for (var i = 0; i < numOfRows; i++) {
- var tr_rows = $('<tr>').appendTo(tbody);
+ var tr_rows = $('<tr>', {
+ 'class': 'row'
+ }).appendTo(tbody);
for (var header in headers) {
var td;
if (header == "ticket") {
td = $('<td>').appendTo(tr_rows);
- var input_ticket = $('<input/>', {
- 'id': 'field-ticket' + unique_key + '-' + i,
- 'type': 'checkbox',
- 'name': 'field_ticket' + i,
- 'class': 'input-block-level'
+
+ var button = $('<button/>', {
+ 'id': 'bct-rmv-empty-row' + i + '' + unique_key,
+ 'type': 'button',
+ 'class': 'btn pull-right',
+ 'click': function () {
+ numOfRows = $("#tbody" + unique_key).children().length - 1;
+ $('#numrows' + unique_key).empty();
+ $('#numrows' + unique_key).html('(' + numOfRows + ' total rows.)');
+ $(this).parent().parent().remove();
+ }
}).appendTo(td);
+ $('<i/>', {
+ 'class': 'icon-trash'
+ }).appendTo(button);
+
} else if (header == "summary") {
td = $('<td>').appendTo(tr_rows);
- var input_summary = $('<input/>', {
+ $('<input/>', {
'id': 'field-summary' + unique_key + '-' + i,
'type': 'text',
'name': 'field_summary' + i,
- 'class': 'input-block-level'
+ 'class': 'summary'
}).appendTo(td);
} else if (header == "description") {
td = $('<td>').appendTo(tr_rows);
- var input_description = $('<textarea/>', {
+ $('<textarea/>', {
'id': 'field-description' + unique_key + '-' + i,
'name': 'field_description' + i,
- 'class': 'input-block-level',
- 'rows': '2',
- 'cols': '28'
+ 'class': 'description'
}).appendTo(td);
} else if (header == "priority") {
@@ -116,7 +130,7 @@ function emptyTable(numOfRows, products,
var input_priority = $('<select/>', {
'id': 'field-priority' + unique_key + '-' + i,
'name': 'field_priority' + i,
- 'class': 'input-block-level'
+ 'class': 'priority'
}).appendTo(td);
for (var priority in priorities) {
@@ -131,7 +145,7 @@ function emptyTable(numOfRows, products,
var field_product = $('<select/>', {
'id': 'field-product' + unique_key + '-' + i,
'name': 'field_product' + i,
- 'class': 'input-block-level'
+ 'class': 'product'
}).appendTo(td);
for (var product in products) {
@@ -146,7 +160,7 @@ function emptyTable(numOfRows, products,
var field_milestone = $('<select/>', {
'id': 'field-milestone' + unique_key + '-' + i,
'name': 'field_milestone' + i,
- 'class': 'input-block-level'
+ 'class': 'milestone'
}).appendTo(td);
for (var milestone in milestones) {
@@ -161,7 +175,7 @@ function emptyTable(numOfRows, products,
var field_component = $('<select/>', {
'id': 'field-component' + unique_key + '-' + i,
'name': 'field_component' + i,
- 'class': 'input-block-level'
+ 'class': 'component'
}).appendTo(td);
for (var component in components) {
@@ -174,15 +188,6 @@ function emptyTable(numOfRows, products,
}
$('<button/>', {
- 'id': 'bct-rmv-empty-row' + unique_key,
- 'type': 'button',
- 'class': 'btn pull-right',
- 'click': function () {
- numOfRows = parseInt(numOfRows) - parseInt(remove_row_btn_action(numOfRows, unique_key));
- }
- }).html('-').appendTo(form);
-
- $('<button/>', {
'id': 'bct-add-empty-row' + unique_key,
'type': 'button',
'class': 'btn pull-right',
@@ -222,15 +227,16 @@ function emptyTable(numOfRows, products,
submit_btn_action(unique_key);
}
}
- }).html('save').appendTo(form);
+ }).html('Create tickets').appendTo(form);
$('<button/>', {
- 'type': 'button',
+ 'type': 'hidden',
'class': 'btn pull-right',
'click': function () {
deleteForm(unique_key);
}
}).html('cancel').appendTo(form);
+ //todo remove wiki macro from wiki content
}
@@ -266,32 +272,21 @@ function submit_btn_action(unique_key) {
var contentDiv = $("#div-empty-table" + unique_key);
- var div = $('<div/>', {
- 'class': 'span12'
- }).appendTo(contentDiv);
+ var div = $('<div/>').appendTo(contentDiv);
var h5 = $('<h5/>', {
'class': 'span12'
}).html("Created Tickets").appendTo(div);
var table = $('<table/>', {
- 'class': 'listing tickets table table-bordered table-condensed query',
- 'style': 'border-radius: 0px 0px 4px 4px'
+ 'class': 'table table-condensed tickets'
}).appendTo(div);
- var header_tr = $('<tr/>', {
- 'class': 'trac-columns'
- }).appendTo(table);
+ var thead = $('<thead/>').appendTo(table);
+ var header_tr = $('<tr/>').appendTo(thead);
for (var header in headers) {
-
- var th = $('<th/>', {
- 'class': 'trac-columns'
- }).appendTo(header_tr);
-
- $('<font/>', {
- 'color': '#1975D1'
- }).html(headers[header]).appendTo(th);
+ var th = $('<th/>').html(headers[header]).appendTo(header_tr);
}
for (var json_ticket in ticket.tickets) {
@@ -332,7 +327,6 @@ function add_row_btn_action(products, mi
$('<input/>', {
'id': 'field-ticket' + unique_key,
'name': 'field_ticket' + unique_key,
- 'class': 'input-block-level',
'type': 'checkbox'
}).appendTo(td);
} else if (header == "summary") {
@@ -340,24 +334,19 @@ function add_row_btn_action(products, mi
$('<input/>', {
'id': 'field-summary' + unique_key,
'name': 'field_summary' + unique_key,
- 'class': 'input-block-level',
'type': 'text'
}).appendTo(td);
} else if (header == "description") {
$('<textarea/>', {
'id': 'field-description' + unique_key,
- 'name': 'field_description' + unique_key,
- 'class': 'input-block-level',
- 'rows': '2',
- 'cols': '28'
+ 'name': 'field_description' + unique_key
}).appendTo(td);
} else if (header == "priority") {
var input_priority = $('<select/>', {
'id': 'field-priority' + unique_key,
- 'name': 'field_priority' + unique_key,
- 'class': 'input-block-level'
+ 'name': 'field_priority' + unique_key
}).appendTo(td);
for (var priority in priorities) {
$('<option/>', {
@@ -368,8 +357,7 @@ function add_row_btn_action(products, mi
var field_product = $('<select/>', {
'id': 'field-product' + unique_key,
- 'name': 'field_product' + unique_key,
- 'class': 'input-block-level'
+ 'name': 'field_product' + unique_key
}).appendTo(td);
for (var product in products) {
$('<option/>', {
@@ -380,8 +368,7 @@ function add_row_btn_action(products, mi
var field_milestone = $('<select/>', {
'id': 'field-milestone' + unique_key,
- 'name': 'field_milestone' + unique_key,
- 'class': 'input-block-level'
+ 'name': 'field_milestone' + unique_key
}).appendTo(td);
for (var milestone in milestones) {
$('<option/>', {
@@ -392,8 +379,7 @@ function add_row_btn_action(products, mi
var field_component = $('<select/>', {
'id': 'field-component' + unique_key,
- 'name': 'field_component' + unique_key,
- 'class': 'input-block-level'
+ 'name': 'field_component' + unique_key
}).appendTo(td);
for (var component in components) {
$('<option/>', {
@@ -432,26 +418,21 @@ function display_created_tickets(tickets
};
var contentDiv = $('#div-created-ticket-table' + unique_key);
- var div = $('<div/>', {
- 'class': 'span12'
- }).appendTo(contentDiv);
+ var div = $('<div/>').appendTo(contentDiv);
- $('<h5/>').html('Created Tickets').appendTo(div);
+ $('<div/>', {
+ 'class': 'numrows'
+ }).html('(' + tickets.length + ' total rows.)').appendTo(div);
var table = $('<table/>', {
- 'class': 'listing tickets table table-bordered table-condensed query',
- 'style': 'border-radius: 0px 0px 4px 4px'
+ 'class': 'table table-condensed tickets'
}).appendTo(div);
- var tr_headers = $('<tr/>', {
- 'class': 'trac-columns'
- }).appendTo(table);
+ var thead = $('<thead/>').appendTo(table);
+ var header_tr = $('<tr/>').appendTo(thead);
for (var header in headers) {
- var th = $('<th/>').appendTo(tr_headers);
- var font = $('<font/>', {
- 'color': '#1975D1'
- }).html(headers[header]).appendTo(th);
+ var th = $('<th/>').html(headers[header]).appendTo(header_tr);
}
for (var index in tickets) {
Modified: bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py?rev=1763853&r1=1763852&r2=1763853&view=diff
==============================================================================
--- bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py Sat Oct 8 05:38:51 2016
@@ -17,7 +17,9 @@
# specific language governing permissions and limitations
# under the License.
+import random
import re
+import string
import sys
from bhdashboard import wiki
@@ -30,6 +32,7 @@ from genshi.filters.transform import Tra
from genshi.output import DocType
from multiproduct.env import ProductEnvironment
from multiproduct.web_ui import PRODUCT_RE, ProductModule
+from pkg_resources import get_distribution
from themeengine.api import ThemeBase, ThemeEngineSystem
from trac.config import ListOption, Option
from trac.core import Component, TracError, implements
@@ -51,7 +54,6 @@ from trac.web.main import IRequestHandle
from trac.wiki.admin import WikiAdmin
from trac.wiki.formatter import format_to_html
from trac.wiki.macros import WikiMacroBase
-import random, string
try:
from multiproduct.ticket.web_ui import ProductTicketModule
@@ -382,7 +384,7 @@ class BloodhoundTheme(ThemeBase):
self._modify_resource_breadcrumb(req, template, data, content_type,
is_active)
- #add a creation event to the changelog if the ticket exists
+ # add a creation event to the changelog if the ticket exists
ticket = data['ticket']
if ticket.exists:
data['changes'] = [{'comment': '',
@@ -394,7 +396,7 @@ class BloodhoundTheme(ThemeBase):
'date': ticket['time'],
},
] + data['changes']
- #and set default order
+ # and set default order
if not req.session.get('ticket_comments_order'):
req.session['ticket_comments_order'] = 'newest'
@@ -466,7 +468,7 @@ class BloodhoundTheme(ThemeBase):
SELECT product, value FROM bloodhound_productconfig
WHERE product IN (%s) AND section='project' AND
option='icon'""" % ', '.join(["%s"] * len(products)),
- tuple(p.prefix for p in products))
+ tuple(p.prefix for p in products))
icons = dict(icons)
data['thumbsize'] = 64
# FIXME: Gray icon for missing products
@@ -481,11 +483,11 @@ class BloodhoundTheme(ThemeBase):
product_ctx(product),
product.description),
links={'extras': (([{'href': req.href.products(
- product.prefix, action='edit'),
- 'title': _('Edit product %(prefix)s',
- prefix=product.prefix),
- 'icon': tag.i(class_='icon-edit'),
- 'label': _('Edit')},]
+ product.prefix, action='edit'),
+ 'title': _('Edit product %(prefix)s',
+ prefix=product.prefix),
+ 'icon': tag.i(class_='icon-edit'),
+ 'label': _('Edit')}, ]
if 'PRODUCT_MODIFY' in req.perm
else []) +
[{'href': product.href(),
@@ -521,6 +523,7 @@ class BloodhoundTheme(ThemeBase):
tag.a(_('Source'),
href=req.href.wiki('TracRepositoryAdmin')))
+
class QCTSelectFieldUpdate(Component):
implements(IRequestHandler)
@@ -532,8 +535,8 @@ class QCTSelectFieldUpdate(Component):
fields_to_update = req.args.get('fields_to_update[]');
env = ProductEnvironment(self.env.parent, req.args.get('product'))
ticket_fields = TicketSystem(env).get_ticket_fields()
- data = dict([f['name'], f['options']] for f in ticket_fields
- if f['type'] == 'select' and f['name'] in fields_to_update)
+ data = dict([f['name'], f['options']] for f in ticket_fields
+ if f['type'] == 'select' and f['name'] in fields_to_update)
req.send(to_json(data), 'application/json')
@@ -542,7 +545,7 @@ class QuickCreateTicketDialog(Component)
qct_fields = ListOption('ticket', 'quick_create_fields',
'product, version, type',
- doc="""Multiple selection fields displayed in create ticket menu""",
+ doc="""Multiple selection fields displayed in create ticket menu""",
doc_domain='bhtheme')
def __init__(self, *args, **kwargs):
@@ -593,8 +596,7 @@ class QuickCreateTicketDialog(Component)
dict(value=p,
new_ticket_url=dum_req.href.products(p, 'newticket'),
description=ProductEnvironment.lookup_env(self.env, p)
- .product.name
- )
+ .product.name)
for p in product_field['options']
if req.perm.has_permission('TICKET_CREATE',
Neighborhood('product', p)
@@ -612,7 +614,7 @@ class QuickCreateTicketDialog(Component)
'fields': [all_fields[k] for k in self.qct_fields
if k in all_fields],
'hidden_fields': [all_fields[k] for k in all_fields.keys()
- if k not in self.qct_fields] }
+ if k not in self.qct_fields]}
return template, data, content_type
# IRequestHandler methods
@@ -689,11 +691,13 @@ class QuickCreateTicketDialog(Component)
"of ticket #%s: %s" % (t.id, e))
return t['product'], t.id
-from pkg_resources import get_distribution
application_version = get_distribution('BloodhoundTheme').version
class BatchCreateTicketsMacro(WikiMacroBase):
+ def parse_macro(self, parser, name, content):
+ pass
+
implements(
IRequestFilter,
IRequestHandler,
@@ -759,10 +763,11 @@ class BatchCreateTicketsMacro(WikiMacroB
self.rows = args
# check the permission conditions and allow the feature only on wiki formatted pages.
if (
- self.env.product is not None) and (
- self.file == 'bh_wiki_view.html' or self.file == 'bh_wiki_edit.html' or self.file is None) and (
- self.rqst.perm.has_permission('TRAC_ADMIN') or self.rqst.perm.has_permission('TICKET_BATCH_CREATE')):
- #todo let the user select the product when creating tickets
+ self.env.product is not None) and (
+ self.file == 'bh_wiki_view.html' or self.file == 'bh_wiki_edit.html' or self.file is None) and (
+ self.rqst.perm.has_permission('TRAC_ADMIN') or self.rqst.perm.has_permission(
+ 'TICKET_BATCH_CREATE')):
+ # todo let the user select the product when creating tickets
# generate the required data to be parsed to the js functions too create the empty ticket table.
product_id = str(self.env.product.resource.id)
@@ -773,29 +778,29 @@ class BatchCreateTicketsMacro(WikiMacroB
components = self.env.db_query(
"SELECT * FROM component WHERE product=%s", (product_id,))
- random_string = '%s%s'%('-',''.join(random.choice(string.lowercase) for i in range(10)))
+ random_string = '%s%s' % ('-', ''.join(random.choice(string.lowercase) for i in range(10)))
form = tag.form(
- tag.div(
- tag.span(
- tag.script(
- type="text/javascript",
- charset="utf-8",
- src=str(self.rqst.href.chrome('theme/js/batchcreate.js'))),
- tag.script(
- # pass the relevant arguments to the js function as JSON parameters.
- "emptyTable(" + to_json(str(self.rows)) + "," + to_json(product_name) + "," +
- to_json(milestones) + "," + to_json(components) + "," +
- to_json(self.rqst.href() + "/bct") + "," +
- to_json(str(self.rqst.environ["HTTP_COOKIE"])) + "," +
- to_json(random_string)+ ")",
- id="js-caller" + random_string,
- type="text/javascript"),
- class_="input-group-btn"),
- style="display:inline-block;position:relative;left: -30px;",
- id="div-empty-table" + random_string),
- method="get",
- style="display:inline",
- id="batchcreate" + random_string)
+ tag.div(
+ tag.span(
+ tag.script(
+ type="text/javascript",
+ charset="utf-8",
+ src=str(self.rqst.href.chrome('theme/js/batchcreate.js'))),
+ tag.script(
+ # pass the relevant arguments to the js function as JSON parameters.
+ "emptyTable(" + to_json(str(self.rows)) + "," + to_json(product_name) + "," +
+ to_json(milestones) + "," + to_json(components) + "," +
+ to_json(self.rqst.href()) + "," +
+ to_json(str(self.rqst.environ["HTTP_COOKIE"])) + "," +
+ to_json(random_string) + ")",
+ id="js-caller" + random_string,
+ type="text/javascript"),
+ class_="input-group-btn"),
+ class_='report',
+ id="div-empty-table" + random_string),
+ method="get",
+ style="display:inline",
+ id="batchcreate" + random_string)
try:
int(self.rows)
except TracError:
@@ -838,7 +843,7 @@ class BatchCreateTicketsMacro(WikiMacroB
# product at current scope. When at global scope the default
# selection is determined by [ticket] default_product
if self.env.product and \
- self.env.product.prefix in product_field['options']:
+ self.env.product.prefix in product_field['options']:
product_field['value'] = self.env.product.prefix
# Transform the options field to dictionary of product
# attributes and filter out products for which user doesn't
@@ -847,7 +852,7 @@ class BatchCreateTicketsMacro(WikiMacroB
dict(value=p,
new_ticket_url=dum_req.href.products(p, 'newticket'),
description=ProductEnvironment.lookup_env(self.env, p)
- .product.name
+ .product.name
)
for p in product_field['options']
if req.perm.has_permission('TICKET_CREATE',
@@ -856,7 +861,7 @@ class BatchCreateTicketsMacro(WikiMacroB
else:
msg = _("Missing ticket field '%(field)s'.", field='product')
if ProductTicketModule is not None and \
- self.env[ProductTicketModule] is not None:
+ self.env[ProductTicketModule] is not None:
# Display warning alert to users
add_warning(req, msg)
else:
@@ -876,7 +881,7 @@ class BatchCreateTicketsMacro(WikiMacroB
"""
m = PRODUCT_RE.match(req.path_info)
return req.path_info == '/bct' or \
- (m and m.group('pathinfo').strip('/') == 'bct')
+ (m and m.group('pathinfo').strip('/') == 'bct')
def process_request(self, req):
@@ -1135,7 +1140,7 @@ class CreatedTicketsMacro(WikiMacroBase)
id='js-caller' + random_string,
type='text/javascript'),
class_='input-group-btn'),
- style='display:inline-block;position:relative;left: -30px;',
+ class_='report',
id='div-created-ticket-table' + random_string),
method='get',
style='display:inline',