From 1ebc05578d5550f80a16fce84124f9f55f8373d4 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 26 May 2009 20:34:12 -0400 Subject: [PATCH] Tell the user what to do if no topics are defined. Per suggestion from Josh Tolley. --- perl-lib/PgCommitFest/Patch.pm | 7 ++++--- template/patch_form.tt2 | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/perl-lib/PgCommitFest/Patch.pm b/perl-lib/PgCommitFest/Patch.pm index 3cf1e2a..eda67d7 100644 --- a/perl-lib/PgCommitFest/Patch.pm +++ b/perl-lib/PgCommitFest/Patch.pm @@ -64,10 +64,10 @@ EOM $r->add_control('name', 'text', 'Name', 'required' => 1); $r->add_control('commitfest_topic', 'select', 'CommitFest Topic', 'required' => 1); - $r->control('commitfest_topic')->choice($r->db->select(<db->select(<{'commitfest_id'}); SELECT id, name FROM commitfest_topic WHERE commitfest_id = ? ORDER BY name EOM - $d->{'commitfest_id'})); + $r->control('commitfest_topic')->choice($commitfest_topic); $r->add_control('patch_status', 'select', 'Patch Status', 'required' => 1); $r->control('patch_status')->choice($r->db->select(<render_template('patch_form', { 'id' => $id, 'd' => $d }); + $r->render_template('patch_form', { 'id' => $id, 'd' => $d, + 'commitfest_topic_warning' => !@$commitfest_topic }); } sub view { diff --git a/template/patch_form.tt2 b/template/patch_form.tt2 index cb03777..6505fe9 100644 --- a/template/patch_form.tt2 +++ b/template/patch_form.tt2 @@ -1,4 +1,11 @@ +[% IF commitfest_topic_warning %] +

Note: No topics have been defined for this CommitFest. +Before you can add patches to this CommitFest, you will need to visit the +CommitFest +Topics page and add one or more topics. +[% ELSE %]

+[% END %]
-- 2.39.5