From: Sebastin Santy Date: Wed, 21 Jun 2017 20:01:16 +0000 (+0530) Subject: Bug 1365344 - Extract the "status" and "null" modules (#101) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cff02a403a608775b3d7d93c4d1276c4b33631e;p=thirdparty%2Fbugzilla.git Bug 1365344 - Extract the "status" and "null" modules (#101) * Added comp_desc, ajax loading, modified rest * Make summary field long * Fixed indentations --- diff --git a/extensions/BugModal/lib/WebService.pm b/extensions/BugModal/lib/WebService.pm index a7026288c..556a2d7cc 100644 --- a/extensions/BugModal/lib/WebService.pm +++ b/extensions/BugModal/lib/WebService.pm @@ -96,9 +96,10 @@ sub components { ThrowCodeError( 'params_required', { function => 'BugModal.components', params => ['product'] } ); } - my $product = Bugzilla::Product->check( { name => $params->{product_name}, cache => 1 } ); - $product = Bugzilla->user->can_enter_product( $product, 1 ); - return { components => _name( $product->components ) }; + my $product = Bugzilla::Product->check({ name => $params->{product_name}, cache => 1 }); + $product = Bugzilla->user->can_enter_product($product, 1); + my @components = map { { name => $_->name, description => Bugzilla::Component->check({ product => $product, name => $_->name })->description} } @{ $product->components }; + return { components => \@components } } # everything we need for edit mode in a single call, returning just the fields diff --git a/extensions/BugModal/web/common_bug_modal.js b/extensions/BugModal/web/common_bug_modal.js index 3a5a149fb..1a2d309bb 100644 --- a/extensions/BugModal/web/common_bug_modal.js +++ b/extensions/BugModal/web/common_bug_modal.js @@ -1079,88 +1079,6 @@ $(function() { $('#component, #version, #target_milestone').each(function() { $(this).data('default', $(this).val()); }); - $('#product') - .change(function(event) { - $('#product-throbber').show(); - $('#component, #version, #target_milestone').attr('disabled', true); - - slide_module($('#module-tracking'), 'show'); - - $.each($('input[name=groups]'), function() { - if (this.checked) { - slide_module($('#module-security'), 'show'); - return false; - } - }); - - bugzilla_ajax( - { - url: 'rest/bug_modal/new_product/' + BUGZILLA.bug_id + '?product=' + encodeURIComponent($('#product').val()) - }, - function(data) { - $('#product-throbber').hide(); - $('#component, #version, #target_milestone').attr('disabled', false); - var is_default = $('#product').val() == $('#product').data('default'); - - // populate selects - $.each(data, function(key, value) { - if (key == 'groups') return; - var el = $('#' + key); - if (!el) return; - el.empty(); - var selected = el.data('preselect'); - $(value).each(function(i, v) { - el.append($(''); + }); + }, + function() {} + ); + }); + $('#component') + .change(function(event) { + $("#component option[value='Select Product']").remove(); + $('#comp_desc').text($('#component').find(":selected").attr('desc').split('_').join(' ')); + }); + +}); diff --git a/template/en/default/bug/new_bug.html.tmpl b/template/en/default/bug/new_bug.html.tmpl index 96ec7d8d3..dc64a9678 100644 --- a/template/en/default/bug/new_bug.html.tmpl +++ b/template/en/default/bug/new_bug.html.tmpl @@ -8,11 +8,137 @@ [% PROCESS global/variables.none.tmpl %] [% title = BLOCK %]Enter [% terms.Bug %] [% END %] [% PROCESS bug_modal/common_header.html.tmpl -title = title + title = title + javascript_urls = ['extensions/BugModal/web/new_bug.js'] %] [% PROCESS global/header.html.tmpl %]

Coming Soon!

This is a demonstration of a reusable comment component

+ +[% WRAPPER bug_modal/module.html.tmpl + title = "" +%] +
+ [%# summary %] + [% INCLUDE bug_modal/field.html.tmpl + field = bug_fields.short_desc + field_type = constants.FIELD_TYPE_FREETEXT + edit_only = 1 + editable = 1 + help = "https://wiki.mozilla.org/BMO/UserGuide/BugFields#short_desc" + %] + +
+
+ +
+[%END%] + + +[%# === status === %] + +[% WRAPPER bug_modal/module.html.tmpl + title = "Status" +%] + [% WRAPPER fields_lhs %] + + [%# product %] + [% can_edit_product = bug.check_can_change_field("product", 0, 1) %] + [% filtered_product = bug.product_obj.name FILTER uri %] + [% filtered_component = bug.component_obj.name FILTER uri %] + [% WRAPPER bug_modal/field.html.tmpl + field = bug_fields.product + field_type = constants.FIELD_TYPE_SINGLE_SELECT + edit_only = 1 + editable = 1 + help = "describecomponents.cgi?product=$filtered_product" + %] + + +
+ [% bug.product FILTER html %] +
+ +
+ [% END %] + [% WRAPPER bug_modal/field.html.tmpl + field = bug_fields.product + field_type = constants.FIELD_TYPE_SINGLE_SELECT + hide_on_view = 1 + hide_on_edit = !can_edit_product + append_content = 1 + help = "describecomponents.cgi?product=$filtered_product" + %] + + [% INCLUDE prodcompsearch/form.html.tmpl + id = "pcs" + custom_select = 1 + hidden = 1 + throbber = "product-throbber" + %] + + + + + + [% END %] + + [%# component %] + [% WRAPPER bug_modal/field.html.tmpl + field = bug_fields.component + field_type = constants.FIELD_TYPE_SINGLE_SELECT + help = "describecomponents.cgi?product=$filtered_product&component=$filtered_component#$filtered_component" + edit_only = 1 + editable = 1 + %] + + +
+ [% bug.component FILTER html %] +
+ +
+ [% END %] + [% END %] + [% WRAPPER fields_rhs %] + + + + + +
+
+ Component Description +
Select a component to read its description.
+
+
+ + [% END %] +[% END %] + +[% BLOCK fields_lhs %] +
[% content FILTER none %]
+[% END %] + +[% BLOCK fields_rhs %] +
[% content FILTER none %]
+[% END %] + [% IF user.id; INCLUDE bug_modal/common_new_comment.html.tmpl;