Tell the user what to do if no topics are defined.
authorRobert Haas <robertmhaas@gmail.com>
Wed, 27 May 2009 00:34:12 +0000 (20:34 -0400)
committerRobert Haas <robertmhaas@gmail.com>
Wed, 27 May 2009 00:34:12 +0000 (20:34 -0400)
Per suggestion from Josh Tolley.

perl-lib/PgCommitFest/Patch.pm
template/patch_form.tt2

index 3cf1e2ac5a293be46523a3a7eab00bf4f48c0123..eda67d7b797e1d2955ea5b837d927c62df0646f8 100644 (file)
@@ -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(<<EOM,
+       my $commitfest_topic = $r->db->select(<<EOM, $d->{'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(<<EOM));
 SELECT id, name FROM patch_status ORDER BY id
@@ -119,7 +119,8 @@ EOM
        }
 
        # Display template.
-       $r->render_template('patch_form', { 'id' => $id, 'd' => $d });
+       $r->render_template('patch_form', { 'id' => $id, 'd' => $d,
+               'commitfest_topic_warning' => !@$commitfest_topic });
 }
 
 sub view {
index cb0377745eb3dde4401830a11ceae3c68fe7d02a..6505fe9f41b00404d64eaee6481956a8aa28636a 100644 (file)
@@ -1,4 +1,11 @@
+[% IF commitfest_topic_warning %]
+<p class='error'>Note: No topics have been defined for this CommitFest.
+Before you can add patches to this CommitFest, you will need to visit the
+<a href='/action/commitfest_topic_search?id=[% d.commitfest_id %]'>CommitFest
+Topics</a> page and add one or more topics.
+[% ELSE %]
 <p></p>
+[% END %]
 
 <div class='tblBasic'>
 <table cellspacing='0' class='tblBasicGrey'>