You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/03/22 23:54:28 UTC
[01/21] git commit: [#4299] ticket:281 Load user list via ajax
Updated Branches:
refs/heads/master 03649359d -> 57ce1a414
[#4299] ticket:281 Load user list via ajax
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/180eab4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/180eab4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/180eab4e
Branch: refs/heads/master
Commit: 180eab4e067ca122695de45615d45f70b8f115c3
Parents: 5bcc603
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 1 13:32:55 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:15 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/form_fields.py | 5 +--
Allura/allura/lib/widgets/resources/js/combobox.js | 25 ++++++++++++++-
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/180eab4e/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index afd12e5..4322b98 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -98,10 +98,7 @@ class ProjectUserCombo(ew.SingleSelectField):
template = 'jinja:allura:templates/widgets/project_user_combo.html'
def options(self):
- users = []
- for i in range(10):
- users.append(ew.Option(py_value=i, label='User %s' % i))
- return users
+ return [] # will be loaded later via ajax
def resources(self):
for r in super(ProjectUserCombo, self).resources():
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/180eab4e/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index 7db3dc8..6948b01 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -2,7 +2,7 @@
$.widget('ui.combobox', {
options: {
- source_url: '' // caller must provide this
+ source_url: null // caller must provide this
},
_create: function() {
@@ -17,6 +17,21 @@
.addClass('ui-combobox')
.insertAfter(select);
+ function populateSelect(data) {
+ for (var i = 0; i < data.options.length; i++) {
+ var label = data.options[i].label,
+ value = data.options[i].value;
+ $('<option>' + label + '</option>')
+ .val(value)
+ .appendTo(select);
+ }
+ loaded = true;
+ input.autocomplete('search', input.val()); // trigger search to re-render options
+ }
+
+ // Load options list with ajax and populate underlying select with loaded data
+ $.get(this.options.source_url, populateSelect);
+
function removeIfInvalid(element) {
var value = $(element).val(),
matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex(value) + '$'),
@@ -44,6 +59,14 @@
delay: 0,
minLength: 0,
source: function (request, response) {
+ if (!loaded) {
+ response([{
+ label: 'Loading...',
+ value: '',
+ option: {item: ''}
+ }]);
+ return;
+ }
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i');
response(select.children('option').map(function() {
var text = $(this).text();
[13/21] git commit: [#4299] ticket:293 Use ProjectUserCombo for
'user' type custom field
Posted by tv...@apache.org.
[#4299] ticket:293 Use ProjectUserCombo for 'user' type custom field
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/672f7ba5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/672f7ba5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/672f7ba5
Branch: refs/heads/master
Commit: 672f7ba5c3e6338a6136a8965dd753d0bb7f293f
Parents: 3c5a73b
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 14 14:34:20 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/widgets/ticket_form.py | 51 +++++++++++-----
1 files changed, 35 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/672f7ba5/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index c870686..1334b37 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -7,20 +7,24 @@ import ew as ew_core
import ew.jinja2_ew as ew
from allura import model as M
-from forgetracker import model
class TicketCustomFields(ew.CompoundField):
template='jinja:forgetracker:templates/tracker_widgets/ticket_custom_fields.html'
+ def __init__(self, *args, **kwargs):
+ super(TicketCustomFields, self).__init__(*args, **kwargs)
+ self._fields = None
+
@property
def fields(self):
# milestone is kind of special because of the layout
# add it to the main form rather than handle with the other customs
- fields = []
- for cf in c.app.globals.custom_fields:
- if cf.name != '_milestone':
- fields.append(TicketCustomField.make(cf))
- return fields
+ if self._fields is None:
+ self._fields = []
+ for cf in c.app.globals.custom_fields:
+ if cf.name != '_milestone':
+ self._fields.append(TicketCustomField.make(cf))
+ return self._fields
class GenericTicketForm(ew.SimpleForm):
defaults=dict(
@@ -40,21 +44,36 @@ class GenericTicketForm(ew.SimpleForm):
del field.options[field.options.index(milestone)]
ctx = self.context_for(field)
elif idx == 'assigned_to':
- user = ctx.get('value')
- if isinstance(user, basestring):
- user = M.User.by_username(user)
- if user:
- field.options = [
- ew.Option(
- py_value=user.username,
- label='%s (%s)' % (user.display_name, user.username))
- ]
+ self._add_current_value_to_user_field(field, ctx.get('value'))
+ elif idx == 'custom_fields':
+ for cf in c.app.globals.custom_fields:
+ if cf.type == 'user':
+ user = ctx.get('value', {}).get(cf.name)
+ for f in field.fields:
+ if f.name == cf.name:
+ self._add_current_value_to_user_field(f, user)
display = field.display(**ctx)
if ctx['errors'] and field.show_errors and not ignore_errors:
display = "%s<div class='error'>%s</div>" % (display, ctx['errors'])
return display
+ def _add_current_value_to_user_field(self, field, user):
+ """Adds current field's value to `ProjectUserCombo` options.
+
+ This is done to be able to select default value when widget loads,
+ since normally `ProjectUserCombo` shows without any options, and loads
+ them asynchronously (via ajax).
+ """
+ if isinstance(user, basestring):
+ user = M.User.by_username(user)
+ if user and user != M.User.anonymous():
+ field.options = [
+ ew.Option(
+ py_value=user.username,
+ label='%s (%s)' % (user.display_name, user.username))
+ ]
+
@property
def fields(self):
fields = [
@@ -146,7 +165,7 @@ class TicketCustomField(object):
return ew.NumberField(label=field.label, name=str(field.name))
def _user(field):
- return ffw.ProjectUserSelect(label=field.label, name=str(field.name))
+ return ffw.ProjectUserCombo(label=field.label, name=str(field.name))
@staticmethod
def _default(field):
[11/21] git commit: [#4299] ticket:281 Make widget work for
neighborhood-level trackers
Posted by tv...@apache.org.
[#4299] ticket:281 Make widget work for neighborhood-level trackers
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4ae56190
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4ae56190
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4ae56190
Branch: refs/heads/master
Commit: 4ae561901f3a60feb002e6f3e4b1844f133e7425
Parents: 6c4eaa6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 09:45:06 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/project.py | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ae56190/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 4dca148..ebeba77 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -217,6 +217,17 @@ class NeighborhoodController(object):
raise exc.HTTPNotFound
return icon.serve()
+ @expose('json:')
+ def users(self):
+ p = self.neighborhood.neighborhood_project
+ return {
+ 'options': [{
+ 'value': u.username,
+ 'label': '%s (%s)' % (u.display_name, u.username)
+ } for u in p.users()]
+ }
+
+
class NeighborhoodProjectBrowseController(ProjectBrowseController):
def __init__(self, neighborhood=None, category_name=None, parent_category=None):
self.neighborhood = neighborhood
[14/21] git commit: [#4299] ticket:281 Show notification when invalid
option is chosen
Posted by tv...@apache.org.
[#4299] ticket:281 Show notification when invalid option is chosen
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3c5a73bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3c5a73bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3c5a73bb
Branch: refs/heads/master
Commit: 3c5a73bb9c98ad8816d2422cb667b44db37e42d9
Parents: a41db53
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 10:24:44 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/combobox.js | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3c5a73bb/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index 557a14e..c1e6ee0 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -54,6 +54,10 @@
$(element).val('');
select.val('');
input.data('autocomplete').term = '';
+ wrapper.children('.error').fadeIn('fast');
+ setTimeout(function() {
+ wrapper.children('.error').fadeOut('fast');
+ }, 2500);
}
}
@@ -126,6 +130,12 @@
.appendTo(wrapper)
.addClass('ui-combobox-toggle')
.click(openDropdown);
+
+ $('<div>')
+ .hide()
+ .addClass('error')
+ .text('Choose a valid option')
+ .appendTo(wrapper);
},
_destroy: function() {
[09/21] git commit: [#4299] ticket:281 Select user if username is
typed in combobox and not selected from the list
Posted by tv...@apache.org.
[#4299] ticket:281 Select user if username is typed in combobox and not selected from the list
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4662ab4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4662ab4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4662ab4f
Branch: refs/heads/master
Commit: 4662ab4f1318cb7dcec985092780ab102278daa8
Parents: 180eab4
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 1 13:51:21 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/combobox.js | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4662ab4f/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index 6948b01..a1c59d3 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -37,8 +37,9 @@
matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex(value) + '$'),
valid = false;
select.children('option').each(function() {
- if ($(this).text().match(matcher)) {
+ if ($(this).val().match(matcher)) {
this.selected = valid = true;
+ input.val(this.text);
return false;
}
});
[15/21] git commit: [#4299] ticket:281 Open dropdown on input click
Posted by tv...@apache.org.
[#4299] ticket:281 Open dropdown on input click
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a41db539
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a41db539
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a41db539
Branch: refs/heads/master
Commit: a41db539cf4f314592b249dab006c86d55fd87b2
Parents: bf11c62
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 10:05:11 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/combobox.js | 22 ++++++++-------
1 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a41db539/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index 462c2c3..557a14e 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -109,21 +109,23 @@
.appendTo(ul);
};
+ function openDropdown() {
+ wasOpen = input.autocomplete('widget').is(':visible');
+ input.focus();
+ if (wasOpen) {
+ return;
+ }
+ input.autocomplete('search', '');
+ }
+
+ input.click(openDropdown);
+
$('<span>▼</span>')
.attr('tabIndex', -1)
.attr('title', 'Show all options')
.appendTo(wrapper)
.addClass('ui-combobox-toggle')
- .mousedown(function() {
- wasOpen = input.autocomplete('widget').is(':visible');
- })
- .click(function() {
- input.focus();
- if (wasOpen) {
- return;
- }
- input.autocomplete('search', '');
- });
+ .click(openDropdown);
},
_destroy: function() {
[17/21] git commit: [#4299] ticket:293 Fix failing tests due to new
widget
Posted by tv...@apache.org.
[#4299] ticket:293 Fix failing tests due to new widget
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9e7ed96e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9e7ed96e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9e7ed96e
Branch: refs/heads/master
Commit: 9e7ed96e1fed1ea24c03cbff33a602dbba7fe73c
Parents: d7b357a
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 14 16:40:03 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:17 2013 +0000
----------------------------------------------------------------------
.../forgetracker/tests/functional/test_root.py | 42 +++++++++++----
1 files changed, 31 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9e7ed96e/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 35b7014..b7f4ae2 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -8,6 +8,7 @@ import allura
from mock import patch
from nose.tools import assert_true, assert_false, assert_equal, assert_in
+from nose.tools import assert_raises
from formencode.variabledecode import variable_encode
from alluratest.controller import TestController
@@ -35,6 +36,17 @@ class TrackerTestController(TestController):
response = self.app.get(mount_point + 'new/',
extra_environ=extra_environ)
form = response.forms[1]
+ # If this is ProjectUserCombo's select populate it
+ # with all the users in the project. This is a workaround for tests,
+ # in real enviroment this is populated via ajax.
+ p = M.Project.query.get(shortname='test')
+ for f in form.fields:
+ field = form[f] if f else None
+ is_usercombo = (field and field.tag == 'select' and
+ field.attrs.get('class') == 'project-user-combobox')
+ if is_usercombo:
+ field.options = [('', False)] + [(u.username, False) for u in p.users()]
+
for k, v in kw.iteritems():
form['ticket_form.%s' % k] = v
resp = form.submit()
@@ -1620,21 +1632,20 @@ class TestCustomUserField(TrackerTestController):
assert ticket_view.html.findAll('label', 'simple',
text='Code Review:')[1].parent.parent.text == 'Code Review:nobody'
# form input is blank
- assert ticket_view.html.find('input',
- dict(name='ticket_form.custom_fields._code_review'))['value'] == ''
+ select = ticket_view.html.find('select',
+ dict(name='ticket_form.custom_fields._code_review'))
+ selected = None
+ for option in select.findChildren():
+ if option.get('selected'):
+ selected = option
+ assert selected is None
def test_non_project_member(self):
""" Test that you can't put a non-project-member user in a custom
user field.
"""
kw = {'custom_fields._code_review': 'test-user-0'}
- ticket_view = self.new_ticket(summary='test custom fields', **kw).follow()
- # summary header shows 'nobody'
- assert ticket_view.html.findAll('label', 'simple',
- text='Code Review:')[1].parent.parent.text == 'Code Review:nobody'
- # form input is blank
- assert ticket_view.html.find('input',
- dict(name='ticket_form.custom_fields._code_review'))['value'] == ''
+ assert_raises(ValueError, self.new_ticket, summary='test custom fields', **kw)
def test_project_member(self):
kw = {'custom_fields._code_review': 'test-admin'}
@@ -1643,13 +1654,22 @@ class TestCustomUserField(TrackerTestController):
assert ticket_view.html.findAll('label', 'simple',
text='Code Review:')[1].parent.parent.text == 'Code Review:Test Admin'
# form input is blank
- assert ticket_view.html.find('input',
- dict(name='ticket_form.custom_fields._code_review'))['value'] == 'test-admin'
+ select = ticket_view.html.find('select',
+ dict(name='ticket_form.custom_fields._code_review'))
+ selected = None
+ for option in select.findChildren():
+ if option.get('selected'):
+ selected = option
+ assert_equal(selected['value'], 'test-admin')
def test_change_user_field(self):
kw = {'custom_fields._code_review': ''}
r = self.new_ticket(summary='test custom fields', **kw).follow()
f = r.forms[1]
+ # Populate ProjectUserCombo's select with option we want.
+ # This is a workaround for tests,
+ # in real enviroment this is populated via ajax.
+ f['ticket_form.custom_fields._code_review'].options = [('test-admin', False)]
f['ticket_form.custom_fields._code_review'] = 'test-admin'
r = f.submit().follow()
assert '<li><strong>code_review</strong>: Test Admin' in r
[04/21] git commit: [#4299] ticket:281 Added simple combobox widget
Posted by tv...@apache.org.
[#4299] ticket:281 Added simple combobox widget
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/70af6ba4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/70af6ba4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/70af6ba4
Branch: refs/heads/master
Commit: 70af6ba4096326d7618f7957f5c6cb33ae2904bf
Parents: 6fb7292
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Feb 28 16:02:12 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:15 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/form_fields.py | 16 ++
.../lib/widgets/resources/js/project_user_combo.js | 109 +++++++++++++++
.../templates/widgets/project_user_combo.html | 5 +
.../forgetracker/templates/tracker/ticket.html | 1 +
ForgeTracker/forgetracker/tracker_main.py | 1 +
5 files changed, 132 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70af6ba4/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index 24330c7..32ae7f6 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -93,6 +93,22 @@ class ProjectUserSelect(ew.InputField):
minLength: 2
});''' % c.project.url())
+
+class ProjectUserCombo(ew.SingleSelectField):
+ template = 'jinja:allura:templates/widgets/project_user_combo.html'
+
+ def options(self):
+ users = []
+ for i in range(10):
+ users.append(ew.Option(py_value=i, label='User %s' % i))
+ return users
+
+ def resources(self):
+ for r in super(ProjectUserCombo, self).resources():
+ yield r
+ yield ew.JSLink('js/project_user_combo.js')
+
+
class NeighborhoodProjectSelect(ew.InputField):
template='jinja:allura:templates/widgets/neighborhood_project_select.html'
defaults=dict(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70af6ba4/Allura/allura/lib/widgets/resources/js/project_user_combo.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/project_user_combo.js b/Allura/allura/lib/widgets/resources/js/project_user_combo.js
new file mode 100644
index 0000000..46b84c6
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/js/project_user_combo.js
@@ -0,0 +1,109 @@
+(function($) {
+ $.widget('ui.combobox', {
+ _create: function() {
+ var input,
+ that = this,
+ wasOpen = false,
+ select = this.element.hide(),
+ selected = select.children(':selected'),
+ value = selected.val() ? selected.text() : "",
+ wrapper = this.wrapper = $('<span>')
+ .addClass('ui-combobox')
+ .insertAfter(select);
+
+ function removeIfInvalid(element) {
+ var value = $(element).val(),
+ matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex(value) + '$'),
+ valid = false;
+ select.children('option').each(function() {
+ if ($(this).text().match(matcher)) {
+ this.selected = valid = true;
+ return false;
+ }
+ });
+
+ if (!valid) {
+ $(element).val('');
+ select.val('');
+ input.data('autocomplete').term = '';
+ }
+ }
+
+ input = $('<input>')
+ .appendTo(wrapper)
+ .val(value)
+ .attr('title', '')
+ .addClass('ui-state-default ui-combobox-input')
+ .autocomplete({
+ delay: 0,
+ minLength: 0,
+ source: function (request, response) {
+ var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i');
+ response(select.children('option').map(function() {
+ var text = $(this).text();
+ if (this.value && (!request.term || matcher.test(text))) {
+ return {
+ label: text.replace(
+ new RegExp(
+ '(?![^&;]+;)(?!<[^<>]*)(' +
+ $.ui.autocomplete.escapeRegex(request.term) +
+ ')(?![^<>]*>)(?![^&;]+;)', 'gi'
+ ), '<strong>$1</strong>'),
+ value: text,
+ option: this
+ };
+ }
+ }));
+ },
+ select: function(event, ui) {
+ ui.item.option.selected = true;
+ that._trigger('selected', event, {item: ui.item.option});
+ },
+ change: function(event, ui) {
+ if (!ui.item) {
+ removeIfInvalid(this);
+ }
+ }
+ }).addClass('ui-widget ui-widget-content ui-corner-left');
+
+ input.data('autocomplete')._renderItem = function(ul, item) {
+ return $('<li>')
+ .data('item.autocomplete', item)
+ .append('<a>' + item.label + '</a>')
+ .appendTo(ul);
+ };
+
+ $('<a>')
+ .attr('tabIndex', -1)
+ .attr('title', 'Show all users')
+ .appendTo(wrapper)
+ .button({
+ icons: {
+ primary: 'ui-icon-triangle-1-s'
+ },
+ text: false
+ })
+ .removeClass('ui-corner-all')
+ .addClass('ui-corner-right ui-combobox-toggle')
+ .mousedown(function() {
+ wasOpen = input.autocomplete('widget').is(':visible');
+ })
+ .click(function() {
+ input.focus();
+ if (wasOpen) {
+ return;
+ }
+ input.autocomplete('search', '');
+ });
+ },
+
+ _destroy: function() {
+ this.wrapper.remove();
+ this.element.show();
+ }
+ });
+})(jQuery);
+
+$(function() {
+ $('select.project-user-combobox').combobox();
+});
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70af6ba4/Allura/allura/templates/widgets/project_user_combo.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/project_user_combo.html b/Allura/allura/templates/widgets/project_user_combo.html
new file mode 100644
index 0000000..cf5af39
--- /dev/null
+++ b/Allura/allura/templates/widgets/project_user_combo.html
@@ -0,0 +1,5 @@
+<select id="{{id}}" name="{{name}}" class="project-user-combobox{{className and ' %s' % className or ''}}">
+{% for o in options %}
+ <option{% if o.selected %} selected{% endif %} value="{{o.html_value}}">{{o.label|e}}</option>
+{% endfor %}
+</select>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70af6ba4/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 1d229fe..892a45d 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -34,6 +34,7 @@
{% block edit_box %}
<div class="editbox">
<div class="form_holder" style="display: none">
+ {{c.user_combo.display()}}
{{c.ticket_form.display(action='%supdate_ticket_from_widget' % ticket.url(),
value=ticket, ticket=ticket, show_comment=True)}}
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70af6ba4/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index cc477d6..cb6db70 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1138,6 +1138,7 @@ class TicketController(BaseController):
c.subscribe_form = W.ticket_subscribe_form
c.ticket_custom_field = W.ticket_custom_field
c.vote_form = W.vote_form
+ c.user_combo = ffw.ProjectUserCombo()
tool_subscribed = M.Mailbox.subscribed()
if tool_subscribed:
subscribed = False
[10/21] git commit: [#4299] ticket:281 Styles for combobox
Posted by tv...@apache.org.
[#4299] ticket:281 Styles for combobox
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/967e105e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/967e105e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/967e105e
Branch: refs/heads/master
Commit: 967e105e3326bc37b9bd24b3f578548ab5e543a4
Parents: 590ce54
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Mar 4 15:49:14 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/form_fields.py | 2 +
.../allura/lib/widgets/resources/css/combobox.css | 17 +++++++++++++++
Allura/allura/lib/widgets/resources/js/combobox.js | 15 +++---------
3 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/967e105e/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index 25c2e32..67ea947 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -109,6 +109,8 @@ class ProjectUserCombo(ew.SingleSelectField):
def resources(self):
for r in super(ProjectUserCombo, self).resources():
yield r
+ yield ew.CSSLink('css/autocomplete.css')
+ yield ew.CSSLink('css/combobox.css')
yield ew.JSLink('js/combobox.js')
yield onready('''
$('select.project-user-combobox').combobox({
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/967e105e/Allura/allura/lib/widgets/resources/css/combobox.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/combobox.css b/Allura/allura/lib/widgets/resources/css/combobox.css
new file mode 100644
index 0000000..9e3471d
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/css/combobox.css
@@ -0,0 +1,17 @@
+.ui-combobox {
+ position: relative;
+ display: inline-block;
+}
+
+.ui-combobox-toggle {
+ color: black;
+ background-color: transparent;
+ cursor: default;
+ display: inline-block;
+ font-size: .7em;
+ padding: 5px;
+ position: absolute;
+ top: 0;
+ margin-top: 2px;
+ margin-left: -21px;
+}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/967e105e/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index 1a59e35..462c2c3 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -61,7 +61,7 @@
.appendTo(wrapper)
.val(value)
.attr('title', '')
- .addClass('ui-state-default ui-combobox-input')
+ .addClass('ui-combobox-input')
.autocomplete({
delay: 0,
minLength: 0,
@@ -100,7 +100,7 @@
removeIfInvalid(this);
}
}
- }).addClass('ui-widget ui-widget-content ui-corner-left');
+ });
input.data('autocomplete')._renderItem = function(ul, item) {
return $('<li>')
@@ -109,18 +109,11 @@
.appendTo(ul);
};
- $('<a>')
+ $('<span>▼</span>')
.attr('tabIndex', -1)
.attr('title', 'Show all options')
.appendTo(wrapper)
- .button({
- icons: {
- primary: 'ui-icon-triangle-1-s'
- },
- text: false
- })
- .removeClass('ui-corner-all')
- .addClass('ui-corner-right ui-combobox-toggle')
+ .addClass('ui-combobox-toggle')
.mousedown(function() {
wasOpen = input.autocomplete('widget').is(':visible');
})
[18/21] git commit: [#4299] ticket:293 Fix bug with custom fields
mass update
Posted by tv...@apache.org.
[#4299] ticket:293 Fix bug with custom fields mass update
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d5861f77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d5861f77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d5861f77
Branch: refs/heads/master
Commit: d5861f77fb87dff98a46c93d70da93e395abbf99
Parents: 2f619e9
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 14 15:00:25 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:17 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/tracker_main.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d5861f77/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 14233b5..02910d1 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -782,7 +782,7 @@ class RootController(BaseController):
message += get_change_text(
get_label(k),
v,
- ticket.custom_fields[k])
+ ticket.custom_fields.get(k) or '')
ticket.custom_fields[k] = v
if message != '':
ticket.discussion_thread.post(message)
[06/21] git commit: [#4299] ticket:281 Fix tests failing due to new
ajax widget
Posted by tv...@apache.org.
[#4299] ticket:281 Fix tests failing due to new ajax widget
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6c4eaa61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6c4eaa61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6c4eaa61
Branch: refs/heads/master
Commit: 6c4eaa6180fa161dd6770da86fc1611af706b572
Parents: 967e105
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Mar 4 16:09:31 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
.../forgetracker/tests/functional/test_root.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c4eaa61/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index a7ffc20..35b7014 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -206,9 +206,10 @@ class TestFunctionalController(TrackerTestController):
response = self.app.get('/bugs/new/')
form = response.forms[1]
form['ticket_form.summary'] = 'test new ticket form'
- form['ticket_form.assigned_to'] = 'test_admin'
+ form['ticket_form.description'] = 'test new ticket form description'
response = form.submit().follow()
- assert 'Test Admin' in response
+ assert 'test new ticket form' in response
+ assert 'test new ticket form description' in response
def test_mass_edit(self):
ticket_view = self.new_ticket(summary='First Ticket').follow()
@@ -532,7 +533,7 @@ class TestFunctionalController(TrackerTestController):
self.new_ticket(summary=summary)
response = self.app.get('/p/test/bugs/1/')
assert response.html.find('input', {'name': 'ticket_form.summary'})
- assert response.html.find('input', {'name': 'ticket_form.assigned_to'})
+ assert response.html.find('select', {'name': 'ticket_form.assigned_to'})
assert response.html.find('textarea', {'name': 'ticket_form.description'})
assert response.html.find('select', {'name': 'ticket_form.status'})
assert response.html.find('select', {'name': 'ticket_form._milestone'})
[02/21] git commit: [#4299] ticket:281 Refactored users controller
Posted by tv...@apache.org.
[#4299] ticket:281 Refactored users controller
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5bcc6030
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5bcc6030
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5bcc6030
Branch: refs/heads/master
Commit: 5bcc6030f0350cffe2c1ecb7c0203ef5a88b1d6f
Parents: 1b10b49
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 1 11:30:10 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:15 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/project.py | 2 +-
Allura/allura/tests/functional/test_home.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5bcc6030/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index e687cd0..4dca148 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -383,7 +383,7 @@ class ProjectController(object):
@expose('json:')
def users(self):
return {
- 'users': [{
+ 'options': [{
'value': u.username,
'label': '%s (%s)' % (u.display_name, u.username)
} for u in c.project.users()]
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5bcc6030/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index cdd131f..1bb626a 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -55,4 +55,4 @@ class TestProjectHome(TestController):
'value': u'test-admin',
'label': u'Test Admin (test-admin)'
}]
- assert_equal(j['users'], expected)
+ assert_equal(j['options'], expected)
[21/21] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-allura
Posted by tv...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-allura
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/57ce1a41
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/57ce1a41
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/57ce1a41
Branch: refs/heads/master
Commit: 57ce1a414afc664ed7e6d417450156f85fad9010
Parents: 97765c8 0364935
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Fri Mar 22 22:53:29 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 22:53:29 2013 +0000
----------------------------------------------------------------------
requirements-common.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[07/21] git commit: [#4299] ticket:281 Select current value by default
Posted by tv...@apache.org.
[#4299] ticket:281 Select current value by default
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/590ce54f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/590ce54f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/590ce54f
Branch: refs/heads/master
Commit: 590ce54ffe58a5fcd0a76580479c476674ac0b47
Parents: 0f9a52e
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Mar 4 12:11:03 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/form_fields.py | 9 ++++-----
Allura/allura/lib/widgets/resources/js/combobox.js | 12 ++++++++----
ForgeTracker/forgetracker/widgets/ticket_form.py | 8 ++++++++
3 files changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/590ce54f/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index f6ee98b..25c2e32 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -97,16 +97,15 @@ class ProjectUserSelect(ew.InputField):
class ProjectUserCombo(ew.SingleSelectField):
template = 'jinja:allura:templates/widgets/project_user_combo.html'
+ # No options for widget initially.
+ # It'll be populated later via ajax call.
+ options = []
+
def to_python(self, value, state):
# Skipping validation, 'cause widget has no values initially.
# All values loaded later via ajax.
return value
- def options(self):
- # No options for widget initially.
- # It'll be populated later via ajax call.
- return []
-
def resources(self):
for r in super(ProjectUserCombo, self).resources():
yield r
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/590ce54f/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index b441f7b..1a59e35 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -23,12 +23,16 @@
for (var i = 0; i < data.options.length; i++) {
var label = data.options[i].label,
value = data.options[i].value;
- $('<option>' + label + '</option>')
- .val(value)
- .appendTo(select);
+ var option = $('<option>' + label + '</option>').val(value);
+ if (selected.val() === value) {
+ option.attr('selected', 'selected'); // select initial value, if any
+ }
+ option.appendTo(select);
}
loaded = true;
- input.autocomplete('search', input.val()); // trigger search to re-render options
+ if (wasOpen) {
+ input.autocomplete('search', input.val()); // trigger search to re-render options
+ }
}
// Load options list with ajax and populate underlying select with loaded data
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/590ce54f/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 79b5513..de44f8a 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -38,6 +38,14 @@ class GenericTicketForm(ew.SimpleForm):
if milestone.complete and (milestone.py_value != milestone_value):
del field.options[field.options.index(milestone)]
ctx = self.context_for(field)
+ elif idx == 'assigned_to':
+ user = ctx.get('value')
+ if user:
+ field.options = [
+ ew.Option(
+ py_value=user.username,
+ label='%s (%s)' % (user.display_name, user.username))
+ ]
display = field.display(**ctx)
if ctx['errors'] and field.show_errors and not ignore_errors:
[08/21] git commit: [#4299] ticket:281 Added combobox to ticket's
edit page
Posted by tv...@apache.org.
[#4299] ticket:281 Added combobox to ticket's edit page
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0f9a52e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0f9a52e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0f9a52e1
Branch: refs/heads/master
Commit: 0f9a52e142cde0002400f720ba41e8b1b4840ef4
Parents: 4662ab4
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 1 14:32:59 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/form_fields.py | 9 ++++++++-
Allura/allura/lib/widgets/resources/js/combobox.js | 2 ++
.../forgetracker/templates/tracker/ticket.html | 1 -
ForgeTracker/forgetracker/tracker_main.py | 1 -
ForgeTracker/forgetracker/widgets/ticket_form.py | 2 +-
5 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9a52e1/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index 4322b98..f6ee98b 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -97,8 +97,15 @@ class ProjectUserSelect(ew.InputField):
class ProjectUserCombo(ew.SingleSelectField):
template = 'jinja:allura:templates/widgets/project_user_combo.html'
+ def to_python(self, value, state):
+ # Skipping validation, 'cause widget has no values initially.
+ # All values loaded later via ajax.
+ return value
+
def options(self):
- return [] # will be loaded later via ajax
+ # No options for widget initially.
+ # It'll be populated later via ajax call.
+ return []
def resources(self):
for r in super(ProjectUserCombo, self).resources():
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9a52e1/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
index a1c59d3..b441f7b 100644
--- a/Allura/allura/lib/widgets/resources/js/combobox.js
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -18,6 +18,8 @@
.insertAfter(select);
function populateSelect(data) {
+ select.children('option').remove();
+ $('<option></option>').val('').appendTo(select);
for (var i = 0; i < data.options.length; i++) {
var label = data.options[i].label,
value = data.options[i].value;
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9a52e1/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 892a45d..1d229fe 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -34,7 +34,6 @@
{% block edit_box %}
<div class="editbox">
<div class="form_holder" style="display: none">
- {{c.user_combo.display()}}
{{c.ticket_form.display(action='%supdate_ticket_from_widget' % ticket.url(),
value=ticket, ticket=ticket, show_comment=True)}}
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9a52e1/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index cb6db70..cc477d6 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1138,7 +1138,6 @@ class TicketController(BaseController):
c.subscribe_form = W.ticket_subscribe_form
c.ticket_custom_field = W.ticket_custom_field
c.vote_form = W.vote_form
- c.user_combo = ffw.ProjectUserCombo()
tool_subscribed = M.Mailbox.subscribed()
if tool_subscribed:
subscribed = False
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0f9a52e1/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 44bed56..79b5513 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -54,7 +54,7 @@ class GenericTicketForm(ew.SimpleForm):
attrs={'style':'width: 95%'}),
ew.SingleSelectField(name='status', label='Status',
options=lambda: c.app.globals.all_status_names.split()),
- ffw.ProjectUserSelect(name='assigned_to', label='Assigned To'),
+ ffw.ProjectUserCombo(name='assigned_to', label='Owner'),
ffw.LabelEdit(label='Labels',name='labels', className='ticket_form_tags'),
ew.Checkbox(name='private', label='Mark as Private', attrs={'class':'unlabeled'}),
ew.InputField(name='attachment', label='Attachment', field_type='file', validator=fev.FieldStorageUploadConverter(if_missing=None)),
[19/21] git commit: [#4299] ticket:293 Prevent exception on ticket
creation
Posted by tv...@apache.org.
[#4299] ticket:293 Prevent exception on ticket creation
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d7b357ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d7b357ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d7b357ac
Branch: refs/heads/master
Commit: d7b357acefafac1f2b2a5d21501dacb42449970a
Parents: d5861f7
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 14 15:09:57 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:17 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/widgets/ticket_form.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7b357ac/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 1334b37..465dce5 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -47,8 +47,9 @@ class GenericTicketForm(ew.SimpleForm):
self._add_current_value_to_user_field(field, ctx.get('value'))
elif idx == 'custom_fields':
for cf in c.app.globals.custom_fields:
- if cf.type == 'user':
- user = ctx.get('value', {}).get(cf.name)
+ if cf and cf.type == 'user':
+ val = ctx.get('value')
+ user = val.get(cf.name) if val else None
for f in field.fields:
if f.name == cf.name:
self._add_current_value_to_user_field(f, user)
[05/21] git commit: [#4299] ticket:281 Refactored combobox widget a
bit
Posted by tv...@apache.org.
[#4299] ticket:281 Refactored combobox widget a bit
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1b10b49f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1b10b49f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1b10b49f
Branch: refs/heads/master
Commit: 1b10b49f08a39502cc018c5d7737b5b1f33d0bb3
Parents: 8427b1f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 1 11:16:03 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:15 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/form_fields.py | 6 +-
Allura/allura/lib/widgets/resources/js/combobox.js | 111 +++++++++++++++
.../lib/widgets/resources/js/project_user_combo.js | 109 --------------
3 files changed, 116 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1b10b49f/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index 32ae7f6..afd12e5 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -106,7 +106,11 @@ class ProjectUserCombo(ew.SingleSelectField):
def resources(self):
for r in super(ProjectUserCombo, self).resources():
yield r
- yield ew.JSLink('js/project_user_combo.js')
+ yield ew.JSLink('js/combobox.js')
+ yield onready('''
+ $('select.project-user-combobox').combobox({
+ source_url: "%susers"
+ });''' % c.project.url())
class NeighborhoodProjectSelect(ew.InputField):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1b10b49f/Allura/allura/lib/widgets/resources/js/combobox.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/combobox.js b/Allura/allura/lib/widgets/resources/js/combobox.js
new file mode 100644
index 0000000..7db3dc8
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/js/combobox.js
@@ -0,0 +1,111 @@
+(function($) {
+ $.widget('ui.combobox', {
+
+ options: {
+ source_url: '' // caller must provide this
+ },
+
+ _create: function() {
+ var input,
+ that = this,
+ wasOpen = false,
+ loaded = false, // options list loaded with ajax already?
+ select = this.element.hide(),
+ selected = select.children(':selected'),
+ value = selected.val() ? selected.text() : "",
+ wrapper = this.wrapper = $('<span>')
+ .addClass('ui-combobox')
+ .insertAfter(select);
+
+ function removeIfInvalid(element) {
+ var value = $(element).val(),
+ matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex(value) + '$'),
+ valid = false;
+ select.children('option').each(function() {
+ if ($(this).text().match(matcher)) {
+ this.selected = valid = true;
+ return false;
+ }
+ });
+
+ if (!valid) {
+ $(element).val('');
+ select.val('');
+ input.data('autocomplete').term = '';
+ }
+ }
+
+ input = $('<input>')
+ .appendTo(wrapper)
+ .val(value)
+ .attr('title', '')
+ .addClass('ui-state-default ui-combobox-input')
+ .autocomplete({
+ delay: 0,
+ minLength: 0,
+ source: function (request, response) {
+ var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i');
+ response(select.children('option').map(function() {
+ var text = $(this).text();
+ if (this.value && (!request.term || matcher.test(text))) {
+ return {
+ label: text.replace(
+ new RegExp(
+ '(?![^&;]+;)(?!<[^<>]*)(' +
+ $.ui.autocomplete.escapeRegex(request.term) +
+ ')(?![^<>]*>)(?![^&;]+;)', 'gi'
+ ), '<strong>$1</strong>'),
+ value: text,
+ option: this
+ };
+ }
+ }));
+ },
+ select: function(event, ui) {
+ ui.item.option.selected = true;
+ that._trigger('selected', event, {item: ui.item.option});
+ },
+ change: function(event, ui) {
+ if (!ui.item) {
+ removeIfInvalid(this);
+ }
+ }
+ }).addClass('ui-widget ui-widget-content ui-corner-left');
+
+ input.data('autocomplete')._renderItem = function(ul, item) {
+ return $('<li>')
+ .data('item.autocomplete', item)
+ .append('<a>' + item.label + '</a>')
+ .appendTo(ul);
+ };
+
+ $('<a>')
+ .attr('tabIndex', -1)
+ .attr('title', 'Show all options')
+ .appendTo(wrapper)
+ .button({
+ icons: {
+ primary: 'ui-icon-triangle-1-s'
+ },
+ text: false
+ })
+ .removeClass('ui-corner-all')
+ .addClass('ui-corner-right ui-combobox-toggle')
+ .mousedown(function() {
+ wasOpen = input.autocomplete('widget').is(':visible');
+ })
+ .click(function() {
+ input.focus();
+ if (wasOpen) {
+ return;
+ }
+ input.autocomplete('search', '');
+ });
+ },
+
+ _destroy: function() {
+ this.wrapper.remove();
+ this.element.show();
+ }
+ });
+})(jQuery);
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1b10b49f/Allura/allura/lib/widgets/resources/js/project_user_combo.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/project_user_combo.js b/Allura/allura/lib/widgets/resources/js/project_user_combo.js
deleted file mode 100644
index 46b84c6..0000000
--- a/Allura/allura/lib/widgets/resources/js/project_user_combo.js
+++ /dev/null
@@ -1,109 +0,0 @@
-(function($) {
- $.widget('ui.combobox', {
- _create: function() {
- var input,
- that = this,
- wasOpen = false,
- select = this.element.hide(),
- selected = select.children(':selected'),
- value = selected.val() ? selected.text() : "",
- wrapper = this.wrapper = $('<span>')
- .addClass('ui-combobox')
- .insertAfter(select);
-
- function removeIfInvalid(element) {
- var value = $(element).val(),
- matcher = new RegExp('^' + $.ui.autocomplete.escapeRegex(value) + '$'),
- valid = false;
- select.children('option').each(function() {
- if ($(this).text().match(matcher)) {
- this.selected = valid = true;
- return false;
- }
- });
-
- if (!valid) {
- $(element).val('');
- select.val('');
- input.data('autocomplete').term = '';
- }
- }
-
- input = $('<input>')
- .appendTo(wrapper)
- .val(value)
- .attr('title', '')
- .addClass('ui-state-default ui-combobox-input')
- .autocomplete({
- delay: 0,
- minLength: 0,
- source: function (request, response) {
- var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i');
- response(select.children('option').map(function() {
- var text = $(this).text();
- if (this.value && (!request.term || matcher.test(text))) {
- return {
- label: text.replace(
- new RegExp(
- '(?![^&;]+;)(?!<[^<>]*)(' +
- $.ui.autocomplete.escapeRegex(request.term) +
- ')(?![^<>]*>)(?![^&;]+;)', 'gi'
- ), '<strong>$1</strong>'),
- value: text,
- option: this
- };
- }
- }));
- },
- select: function(event, ui) {
- ui.item.option.selected = true;
- that._trigger('selected', event, {item: ui.item.option});
- },
- change: function(event, ui) {
- if (!ui.item) {
- removeIfInvalid(this);
- }
- }
- }).addClass('ui-widget ui-widget-content ui-corner-left');
-
- input.data('autocomplete')._renderItem = function(ul, item) {
- return $('<li>')
- .data('item.autocomplete', item)
- .append('<a>' + item.label + '</a>')
- .appendTo(ul);
- };
-
- $('<a>')
- .attr('tabIndex', -1)
- .attr('title', 'Show all users')
- .appendTo(wrapper)
- .button({
- icons: {
- primary: 'ui-icon-triangle-1-s'
- },
- text: false
- })
- .removeClass('ui-corner-all')
- .addClass('ui-corner-right ui-combobox-toggle')
- .mousedown(function() {
- wasOpen = input.autocomplete('widget').is(':visible');
- })
- .click(function() {
- input.focus();
- if (wasOpen) {
- return;
- }
- input.autocomplete('search', '');
- });
- },
-
- _destroy: function() {
- this.wrapper.remove();
- this.element.show();
- }
- });
-})(jQuery);
-
-$(function() {
- $('select.project-user-combobox').combobox();
-});
[20/21] git commit: [#4299] Use combo box for user-type custom fields
on mass edit
Posted by tv...@apache.org.
[#4299] Use combo box for user-type custom fields on mass edit
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/97765c8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/97765c8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/97765c8a
Branch: refs/heads/master
Commit: 97765c8a7eebf6faad9538b8d540de1e651d81ad
Parents: 9e7ed96
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Fri Mar 22 22:48:13 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 22:48:13 2013 +0000
----------------------------------------------------------------------
.../templates/tracker_widgets/mass_edit_form.html | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/97765c8a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html b/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
index 67de1f0..2f1a42d 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/mass_edit_form.html
@@ -57,6 +57,8 @@
{% endif %}
{% endfor %}
</select>
+ {% elif field.type == 'user' %}
+ {{c.user_select.display(name=field.name, id=field.name, value='', className='wide')}}
{% else %}
<input name="{{field.name}}" type="text" value="" class="wide"/>
{% endif %}
@@ -69,4 +71,5 @@
<a href="{{cancel_href}}" class="btn link">Cancel</a>
<!-- tg.url(c.app.url+'search/', dict(q=query, limit=limit, sort=sort))}}" class="btn link">Cancel</a>-->
</div>
+ <div class="grid-12" id="result"></div>
</form>
[03/21] git commit: [#4299] ticket:281 Added controller to retrieve
all users in the project via ajax
Posted by tv...@apache.org.
[#4299] ticket:281 Added controller to retrieve all users in the project via ajax
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8427b1ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8427b1ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8427b1ff
Branch: refs/heads/master
Commit: 8427b1ffa10e478e58c2e705d446976344a04325
Parents: 70af6ba
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 1 11:04:05 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:15 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/project.py | 9 +++++++++
Allura/allura/tests/functional/test_home.py | 11 +++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8427b1ff/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 646f9d7..e687cd0 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -380,6 +380,15 @@ class ProjectController(object):
id=u.username)
for u in users])
+ @expose('json:')
+ def users(self):
+ return {
+ 'users': [{
+ 'value': u.username,
+ 'label': '%s (%s)' % (u.display_name, u.username)
+ } for u in c.project.users()]
+ }
+
class ScreenshotsController(object):
@expose()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8427b1ff/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index 6685809..cdd131f 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -5,6 +5,8 @@ from allura.tests import TestController
from allura.tests import decorators as td
from allura import model as M
+from nose.tools import assert_equal
+
class TestProjectHome(TestController):
@@ -45,3 +47,12 @@ class TestProjectHome(TestController):
def test_user_search_shortparam(self):
r = self.app.get('/p/test/user_search?term=ad', status=400)
+
+ def test_users(self):
+ r = self.app.get('/p/test/users', status=200)
+ j = json.loads(r.body)
+ expected = [{
+ 'value': u'test-admin',
+ 'label': u'Test Admin (test-admin)'
+ }]
+ assert_equal(j['users'], expected)
[16/21] git commit: [#4299] ticket:293 Use ProjectUserCombo
everywhere for tracker
Posted by tv...@apache.org.
[#4299] ticket:293 Use ProjectUserCombo everywhere for tracker
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2f619e9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2f619e9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2f619e9c
Branch: refs/heads/master
Commit: 2f619e9ca0e988a8ed4be29dbccdabd34d529f2a
Parents: 672f7ba
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 14 14:47:57 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:17 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/tracker_main.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2f619e9c/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index cc477d6..14233b5 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -728,7 +728,7 @@ class RootController(BaseController):
result['cancel_href'] = url(
c.app.url + 'search/',
dict(q=q, limit=limit, sort=sort))
- c.user_select = ffw.ProjectUserSelect()
+ c.user_select = ffw.ProjectUserCombo()
c.mass_edit = W.mass_edit
c.mass_edit_form = W.mass_edit_form
return result
@@ -835,7 +835,7 @@ class RootController(BaseController):
week_comments=self.ticket_comments_since(week_ago)
fortnight_comments=self.ticket_comments_since(fortnight_ago)
month_comments=self.ticket_comments_since(month_ago)
- c.user_select = ffw.ProjectUserSelect()
+ c.user_select = ffw.ProjectUserCombo()
if dates is None:
today = datetime.utcnow()
dates = "%s to %s" % ((today - timedelta(days=61)).strftime('%Y-%m-%d'), today.strftime('%Y-%m-%d'))
@@ -1704,7 +1704,7 @@ class MilestoneController(BaseController):
result.pop('q')
result['globals'] = c.app.globals
result['cancel_href'] = '..'
- c.user_select = ffw.ProjectUserSelect()
+ c.user_select = ffw.ProjectUserCombo()
c.mass_edit = W.mass_edit
c.mass_edit_form = W.mass_edit_form
return result
[12/21] git commit: [#4299] ticket:281 Handle case when field value
is string (username), not User object
Posted by tv...@apache.org.
[#4299] ticket:281 Handle case when field value is string (username), not User object
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bf11c62c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bf11c62c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bf11c62c
Branch: refs/heads/master
Commit: bf11c62c5e8fa29fba6fa51d690306fd285199e1
Parents: 4ae5619
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 09:57:04 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 22 21:55:16 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/widgets/ticket_form.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bf11c62c/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index de44f8a..c870686 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -6,6 +6,7 @@ from formencode import validators as fev
import ew as ew_core
import ew.jinja2_ew as ew
+from allura import model as M
from forgetracker import model
class TicketCustomFields(ew.CompoundField):
@@ -40,6 +41,8 @@ class GenericTicketForm(ew.SimpleForm):
ctx = self.context_for(field)
elif idx == 'assigned_to':
user = ctx.get('value')
+ if isinstance(user, basestring):
+ user = M.User.by_username(user)
if user:
field.options = [
ew.Option(