- Make it possible to rename subgroups and testgroups and to enable and disable them (the state of the form controls were previously being ignored).

- When clicking the "edit testcase" link, make the edit form automatically display in manage_testcases.cgi

- Display markdown formatted text for testcase data in manage_testcases.cgi
This commit is contained in:
zach%zachlipton.com 2006-06-30 18:37:29 +00:00
Родитель b4064f2273
Коммит ef2fa8a12c
7 изменённых файлов: 29 добавлений и 6 удалений

Просмотреть файл

@ -32,6 +32,7 @@ use strict;
use Litmus;
use Litmus::Auth;
use Litmus::Error;
use Text::Markdown;
use JSON;
use CGI;
@ -48,6 +49,11 @@ if ($c->param("testcase_id")) {
$testcase->{'testgroups'} = \@testgroups;
$testcase->{'subgroups'} = \@subgroups;
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
# apply markdown formatting to the steps and expected results:
$testcase->{'steps_formatted'} = Text::Markdown::markdown($testcase->steps());
$testcase->{'expected_results_formatted'} = Text::Markdown::markdown($testcase->expected_results());
my $js = $json->objToJson($testcase);
print $js;
} elsif ($c->param("subgroup_id")) {

Просмотреть файл

@ -116,8 +116,9 @@ if ($c->param("delete_subgroup_button")) {
$subgroup_id = $c->param("editform_subgroup_id");
my $subgroup = Litmus::DB::Subgroup->retrieve($subgroup_id);
if ($subgroup) {
$subgroup->product_id($c->param('product'));
$subgroup->product_id($c->param('editform_product'));
$subgroup->enabled($enabled);
$subgroup->name($c->param('editform_name'));
$rv = $subgroup->update();
if ($rv) {
my @selected_testgroups = $c->param("testgroup");

Просмотреть файл

@ -47,11 +47,15 @@ Litmus::Auth::requireAdmin('manage_testcases.cgi');
my $vars;
my $testcase_id;
my $edit;
my $message;
my $status;
my $rv;
if ($c->param("testcase_id")) {
$testcase_id = $c->param("testcase_id");
if ($c->param("edit")) {
$edit = $testcase_id;
}
}
my $rebuild_cache = 0;
@ -177,6 +181,7 @@ $vars->{'testcases'} = $testcases;
$vars->{'products'} = $products;
$vars->{'authors'} = $authors;
$vars->{'user'} = Litmus::Auth::getCurrentUser();
$vars->{'edit'} = $edit;
my $cookie = Litmus::Auth::getCookie();
$vars->{"defaultemail"} = $cookie;

Просмотреть файл

@ -113,8 +113,9 @@ if ($c->param("delete_testgroup_button")) {
$testgroup_id = $c->param("editform_testgroup_id");
my $testgroup = Litmus::DB::Testgroup->retrieve($testgroup_id);
if ($testgroup) {
$testgroup->product_id($c->param('product'));
$testgroup->product_id($c->param('editform_product'));
$testgroup->enabled($enabled);
$testgroup->name($c->param('editform_name'));
$rv = $testgroup->update();
if ($rv) {
my @selected_subgroups = $c->param("editform_testgroup_subgroups");

Просмотреть файл

@ -116,7 +116,7 @@ function checkFormContents(f) {
value="1" disabled
onChange="if (this.checked == true) {document.getElementById('editform_enabled').checked =true;}">
</td>
<td>&lArr;&nbsp;Uncheck this to disable this testcase for the community-at-large.<br/>Note: trusted testers will stlil be able to see and run this testcase.</td>
<td>&lArr;&nbsp;Uncheck this to disable this testcase for the community-at-large.<br/>Note: trusted testers will still be able to see and run this testcase.</td>
</tr>
<tr>
<td class="headerleft">Regression Bug ID#:</td>

Просмотреть файл

@ -96,8 +96,8 @@ function populateTestcase(data) {
document.getElementById('editform_results').value = testcase.expected_results;
document.getElementById('testcase_id_display').innerHTML = testcase.testcase_id;
document.getElementById('summary_text').innerHTML = testcase.summary;
document.getElementById('steps_text').innerHTML = testcase.steps;
document.getElementById('results_text').innerHTML = testcase.expected_results;
document.getElementById('steps_text').innerHTML = testcase.steps_formatted;
document.getElementById('results_text').innerHTML = testcase.expected_results_formatted;
var product_box = document.getElementById('product');
var options = product_box.getElementsByTagName('option');
@ -201,6 +201,16 @@ function populateTestcase(data) {
document.getElementById('editform_div').style.display = 'none';
document.getElementById('testcase_display_div').style.display = 'block';
enableModeButtons();
[% IF edit %]
// user clicked an "edit testcase" button for a test, so switch to edit
// right away
if (testcase.testcase_id == [% edit | js | html %]) {
switchToEdit();
}
[% END %]
}
function blankForm(formid) {

Просмотреть файл

@ -41,7 +41,7 @@
<td>
<div id="product_text[% IF ! show_edit %]_[% testcase.testcase_id | html %][% END %]">[% testcase.product.name | html %]</div>
</td>
[% IF ! show_edit %]<td align="right" valign="top" colspan="5"><a href="manage_testcases.cgi?testcase_id=[%testcase.testcase_id | html%]"> Edit Testcase</a></td>[% END %]
[% IF ! show_edit %]<td align="right" valign="top" colspan="5"><a href="manage_testcases.cgi?testcase_id=[%testcase.testcase_id | html%]&edit=1"> Edit Testcase</a></td>[% END %]
</tr>
<tr>
<td><b>Test Group(s):</b></td>