Browse Source

Reusable project form templates

Gu1 11 years ago
parent
commit
92eaf7be32

+ 2 - 0
ffdnispdb/templates/add_project_form.html

@@ -0,0 +1,2 @@
+{% set page_title = _("Add a new project") %}
+{% include 'project_form_generic.html' with context %}

+ 2 - 0
ffdnispdb/templates/add_project_json_form.html

@@ -0,0 +1,2 @@
+{% set page_title = _("Add a new project from a JSON URL") %}
+{% include 'project_json_form_generic.html' with context %}

+ 1 - 1
ffdnispdb/templates/project_form.html

@@ -6,7 +6,7 @@
     <form method="post" class="form-horizontal">
       {{ form.csrf_token }}
       <fieldset>
-        <legend>{{ _("Add a new project") }}</legend>
+        <legend>{{ page_title }}</legend>
         {{ fm.render_field(form.tech_email) }}
         <hr />
         {{ fm.render_field(form.name) }}

+ 3 - 2
ffdnispdb/templates/project_json_form.html

@@ -6,14 +6,15 @@
     <form method="post" class="form-horizontal">
       {{ form.csrf_token }}
       <fieldset>
-        <legend>{{ _("Add a new project from a JSON URL") }}</legend>
-        {{ fm.render_field(form.url) }}
+        <legend>{{ page_title }}</legend>
+        {{ fm.render_field(form.json_url) }}
         {{ fm.render_field(form.tech_email) }}
         <div class="form-actions">
           <input type="submit" class="btn btn-primary" value="{{ _("Next") }}" />
           <input type="reset" class="btn" value="{{ _("Cancel") }}" />
         </div>
       </fieldset>
+    </form>
   </div>
 </div>
 {% endblock %}

+ 2 - 2
ffdnispdb/views.py

@@ -102,7 +102,7 @@ def create_project_form():
         db.session.commit()
         flash(_(u'Project created'), 'info')
         return redirect(url_for('project', projectid=isp.id))
-    return render_template('project_form.html', form=form)
+    return render_template('add_project_form.html', form=form)
 
 
 @app.route('/isp/create/validator', methods=['GET'])
@@ -133,7 +133,7 @@ def create_project_json():
         url=urlunsplit(u)
         session['form_json'] = {'url': url, 'tech_email': form.tech_email.data}
         return render_template('project_json_validator.html')
-    return render_template('project_json_form.html', form=form)
+    return render_template('add_project_json_form.html', form=form)
 
 
 @app.route('/isp/create/confirm', methods=['POST'])