opportunity: accept meetup without date or location
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 29 Oct 2014 20:10:43 +0000 (16:10 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 29 Oct 2014 22:10:43 +0000 (18:10 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/opportunity/src/opportunity_controller.nit
contrib/opportunity/src/templates/meetup.nit

index 42df348..73e1d2e 100644 (file)
@@ -60,16 +60,16 @@ class OpportunityWelcome
                        var mname = request.string_arg("meetup_name")
                        var mdate = request.string_arg("meetup_date")
                        var mplace = request.string_arg("meetup_place")
-                       if mname == null or mdate == null or mplace == null then
-                               if mname == null then mname = ""
-                               if mdate == null then mdate = ""
-                               if mplace == null then mplace = ""
+                       if mdate == null then mdate = ""
+                       if mplace == null then mplace = ""
+                       if mname == null then
+                               mname = ""
                                var rsp = new HttpResponse(200)
                                var meetpage = new MeetupCreationPage
                                var meet = new Meetup(mname, mdate, mplace)
                                meetpage.ans = ansset
                                meetpage.meet = meet
-                               meetpage.error = "Name, Date and Place are mandatory fields."
+                               meetpage.error = "'Meetup name' is a mandatory fields."
                                rsp.body = meetpage.write_to_string
                                return rsp
 
index 139ba93..a06a072 100644 (file)
@@ -141,8 +141,14 @@ redef class Meetup
                t.add """
 <div class="page-header">
        <center><h1>{{{name}}}</h1></center>
-       <center><h4>When : {{{date}}}</h4></center>
-       <center><h4>Where : {{{place}}}</h4></center>
+"""
+               if not date.is_empty then t.add """
+       <center><h4>When: {{{date}}}</h4></center>"""
+
+               if not place.is_empty then t.add """
+       <center><h4>Where: {{{place}}}</h4></center>"""
+
+               t.add """
 </div>
 <table class="table">
 """