Ver Fonte

Improve vote pages, rename main to index

JoostSijm há 6 anos atrás
pai
commit
2a3c31011a

+ 2 - 2
app/modules/backend/modules/vote/app.py

@@ -24,12 +24,12 @@ BLUEPRINT = Blueprint(
 @register_menu(BLUEPRINT, 'vote', 'Vote')
 @BLUEPRINT.route("/")
 @login_required
-def main():
+def index():
     """Ballots overview"""
     ballots = Ballot.query.all()
 
     return render_template(
-        'main.j2',
+        'backend_vote/index.j2',
         ballots=ballots,
     )
 

+ 1 - 0
app/modules/backend/modules/vote/templates/main.j2 → app/modules/backend/modules/vote/templates/backend_vote/index.j2

@@ -27,6 +27,7 @@
                         <tr>
                             <td>
                                 <a href="{{ url_for('backend_vote.view', ballot_id=ballot.id) }}"><button class="btn btn-secondary btn-sm">View</button></a>
+                                <a href="{{ url_for('vote.view', ballot_id=ballot.id) }}"><button class="btn btn-secondary btn-sm">Public</button></a>
                             </td>
                             <td>{{ ballot.name }}</td>
                             <td>{{ ballot.start_at }}</td>

+ 1 - 0
app/modules/backend/modules/vote/templates/backend_vote/view.j2

@@ -6,6 +6,7 @@
 	</div>
 	<div class="col-auto mb-3 text-right">
 		<a href="{{ url_for('backend_vote.add_question', ballot_id=ballot.id) }}"><button class="btn btn-secondary btn-sm">Add question</button></a>
+		<a href="{{ url_for('vote.view', ballot_id=ballot.id) }}"><button class="btn btn-secondary btn-sm">Public</button></a>
 	</div>
 </div>
 <table class="table table-sm">

+ 2 - 2
app/modules/vote/app.py

@@ -16,7 +16,7 @@ BLUEPRINT = Blueprint(
 
 
 @BLUEPRINT.route('/')
-def public_index():
+def index():
     """View list of votes"""
     ballots = Ballot.query.all()
 
@@ -27,7 +27,7 @@ def public_index():
 
 
 @BLUEPRINT.route('/<int:ballot_id>', methods=["GET", "POST"])
-def public_view(ballot_id):
+def view(ballot_id):
     """Vote and view results of ballot"""
     ballot = Ballot.query.get(ballot_id)
 

+ 1 - 1
app/modules/vote/templates/vote/index.j2

@@ -31,7 +31,7 @@
             {% for ballot in ballots %}
             <tr>
                 <td>
-                    <a href="{{ url_for('vote.public_view', ballot_id=ballot.id) }}"><button class="btn btn-secondary btn-sm">View</button></a>
+                    <a href="{{ url_for('vote.view', ballot_id=ballot.id) }}"><button class="btn btn-secondary btn-sm">View</button></a>
                 </td>
                 <td>{{ ballot.name }}</td>
                 <td>{{ ballot.start_at }}</td>