summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BugModal/lib/WebService.pm17
-rw-r--r--extensions/BugModal/web/new_bug.js30
-rw-r--r--new_bug.cgi8
-rw-r--r--template/en/default/bug/new_bug.html.tmpl9
4 files changed, 45 insertions, 19 deletions
diff --git a/extensions/BugModal/lib/WebService.pm b/extensions/BugModal/lib/WebService.pm
index 99d0383cc..b69d609dd 100644
--- a/extensions/BugModal/lib/WebService.pm
+++ b/extensions/BugModal/lib/WebService.pm
@@ -30,9 +30,9 @@ sub rest_resources {
return [
# return all the products accessible by the user.
# required by new-bug
- qr{^/bug_modal/products}, {
+ qr{^/bug_modal/initial_field_values}, {
GET => {
- method => 'products'
+ method => 'initial_field_values'
},
},
@@ -82,9 +82,12 @@ sub rest_resources {
]
}
-sub products {
+sub initial_field_values {
my $user = Bugzilla->user;
- return { products => _name($user->get_enterable_products) };
+ return {
+ products => _name($user->get_enterable_products),
+ keywords => _name([Bugzilla::Keyword->get_all()]),
+ };
}
sub product_info {
@@ -103,8 +106,10 @@ sub product_info {
description => $_->description,
}
} @{ $product->components };
- my @versions = map { { name => $_->name } } grep { $_->is_active } @{ $product->versions };
- return { components => \@components, versions => \@versions };
+ return {
+ components => \@components,
+ versions => _name($product->versions),
+ };
}
# everything we need for edit mode in a single call, returning just the fields
diff --git a/extensions/BugModal/web/new_bug.js b/extensions/BugModal/web/new_bug.js
index cd471fc2e..d00770e3a 100644
--- a/extensions/BugModal/web/new_bug.js
+++ b/extensions/BugModal/web/new_bug.js
@@ -1,20 +1,18 @@
+var initial = {}
var comp_desc = {}
-function load_products(query, callback) {
+$(document).ready(function() {
bugzilla_ajax(
{
- url: 'rest/bug_modal/products'
+ url: 'rest/bug_modal/initial_field_values'
},
function(data) {
- callback(data.products);
+ initial = data
},
function() {
- callback();
+ alert("Network issues. Please refresh the page and try again");
}
);
-}
-
-$(document).ready(function() {
var product_sel = $("#product").selectize({
valueField: 'name',
labelField: 'name',
@@ -22,7 +20,9 @@ $(document).ready(function() {
options: [],
preload: true,
create: false,
- load: load_products
+ load: function(query, callback) {
+ callback(initial.products);
+ }
});
var component_sel = $("#component").selectize({
valueField: 'name',
@@ -38,6 +38,19 @@ $(document).ready(function() {
options: [],
});
+ var keywords_sel = $("#keywords").selectize({
+ delimiter: ', ',
+ valueField: 'name',
+ labelField: 'name',
+ searchField: 'name',
+ options: [],
+ preload: true,
+ create: false,
+ load: function(query, callback) {
+ callback(initial.keywords);
+ }
+ });
+
product_sel.on("change", function () {
$('#product-throbber').show();
$('#component').attr('disabled', true);
@@ -46,7 +59,6 @@ $(document).ready(function() {
url: 'rest/bug_modal/product_info?product=' + encodeURIComponent($('#product').val())
},
function(data) {
- product_info = data;
$('#product-throbber').hide();
$('#component').attr('disabled', false);
$('#comp_desc').text('Select a component to read its description.');
diff --git a/new_bug.cgi b/new_bug.cgi
index 8462bb6ff..2e903cfce 100644
--- a/new_bug.cgi
+++ b/new_bug.cgi
@@ -42,13 +42,14 @@ use List::MoreUtils qw(uniq);
my $user = Bugzilla->login(LOGIN_REQUIRED);
-my $cgi = Bugzilla->cgi;
+my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
-my $vars = {};
+my $vars = {};
if (lc($cgi->request_method) eq 'post') {
my $token = $cgi->param('token');
check_hash_token($token, ['new_bug']);
+ my @keywords = $cgi->param('keywords');
my $new_bug = Bugzilla::Bug->create({
short_desc => scalar($cgi->param('short_desc')),
product => scalar($cgi->param('product')),
@@ -57,7 +58,8 @@ if (lc($cgi->request_method) eq 'post') {
groups => [],
op_sys => 'Unspecified',
rep_platform => 'Unspecified',
- version => join(' ', split('_', scalar($cgi->param('version')))),
+ version => scalar( $cgi->param('version')),
+ keywords => \@keywords,
cc => [],
comment => scalar($cgi->param('comment')),
});
diff --git a/template/en/default/bug/new_bug.html.tmpl b/template/en/default/bug/new_bug.html.tmpl
index 274064be3..5228ceb2d 100644
--- a/template/en/default/bug/new_bug.html.tmpl
+++ b/template/en/default/bug/new_bug.html.tmpl
@@ -155,7 +155,14 @@
edit_only = 1
editable = 1
%]
-
+ [%# keywords %]
+ [% INCLUDE bug_modal/field.html.tmpl
+ field = bug_fields.keywords
+ field_type = constants.FIELD_TYPE_MULTI_SELECT
+ edit_only = 1
+ editable = 1
+ help = "describekeywords.cgi"
+ %]
[% END %]
[% END %]