Skip to content

Commit

Permalink
testing modal for proposal admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibhas committed Mar 28, 2018
1 parent 82386a6 commit 307078e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 29 deletions.
10 changes: 6 additions & 4 deletions funnel/forms/proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import baseframe.forms as forms
from flask import g
from baseframe.forms.sqlalchemy import QuerySelectField
from ..models import ProposalSpace, Profile, Proposal
from ..models import ProposalSpace, Profile, Proposal, User
from .. import lastuser

__all__ = ['TransferProposal', 'ProposalForm', 'ProposalTransitionForm', 'ProposalMoveForm']
__all__ = ['ProposalTransferForm', 'ProposalForm', 'ProposalTransitionForm', 'ProposalMoveForm']


class TransferProposal(forms.Form):
userid = forms.UserSelectField(__("Transfer to"), validators=[forms.validators.DataRequired()])
class ProposalTransferForm(forms.Form):
userid = forms.UserSelectField(__("Transfer to"), validators=[forms.validators.DataRequired()],
usermodel=User, lastuser=lastuser)


class ProposalForm(forms.Form):
Expand Down
74 changes: 51 additions & 23 deletions funnel/templates/proposal.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@
</div>
</div>
<div class="row">
{%- if proposal_move_form %}
<div class="col-xs-12 col-lg-12">
{{ renderform(proposal_move_form, 'proposal-move', action=proposal.url_for('move-to'), submit="Move") }}
</div>
{%- endif %}
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#adminModal">
Admin
</button>
</div>
</div>
<div class="section bar">
Expand Down Expand Up @@ -201,24 +199,6 @@
{% endfor %}
{% endif %}
{% endfor %}

<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12 pull-right">
<h3>Status:
{% if proposal.state.SCHEDULED %}
<mark><a class="" href="{{ proposal.session.url_for() }}">{{ proposal.state.SCHEDULED.label.title }}</a></mark>
{% else %}
{{ proposal.state.label.title }}
{% endif %}
</h3>
<form action="{{ proposal.url_for('transition') }}" method="post" class="form-inline">
{{ transitionform.hidden_tag() }}
<p>
{% for name, transition in transitionform.transition.choices %}
<button name="transition" value="{{ name }}" class="transition control-group btn btn-{{ transition.data['type'] }}">{{ transition.data['title'] }}</button>
{% endfor %}
</p>
</form>
</div>
</div>
{% endif %}
{% if proposal.preview_video or proposal.slides %}
Expand Down Expand Up @@ -339,6 +319,54 @@
</div>
</div>

<!-- Modal -->
<div class="modal fade" id="adminModal" tabindex="-1" role="dialog" aria-labelledby="adminModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Proposal Admin</h4>
</div>
<div class="modal-body">
<div class="row">
{%- if proposal_move_form %}
<div class="col-xs-12 col-lg-12">
{{ renderform(proposal_move_form, 'proposal-move', action=proposal.url_for('move-to'), submit="Move") }}
</div>
{%- endif %}
</div>
<div class="row">
<div class="col-sm-12 col-xs-12">
<h3>Status: {% if proposal.state.SCHEDULED %}
<mark>
<a class="" href="{{ proposal.session.url_for() }}">{{ proposal.state.SCHEDULED.label.title }}</a>
</mark>
{% else %} {{ proposal.state.label.title }} {% endif %}
</h3>
<form action="{{ proposal.url_for('transition') }}" method="post" class="form-inline">
{{ transitionform.hidden_tag() }}
<p>
{% for name, transition in transitionform.transition.choices %}
<button name="transition" value="{{ name }}" class="transition control-group btn btn-{{ transition.data['type'] }}">{{ transition.data['title'] }}</button>
{% endfor %}
</p>
</form>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-xs-12">
{{ renderform(proposal_transfer_form, 'proposal-transfer', action="#", submit="Transfer") }}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

{% endblock %}

{% block footerscripts %}
Expand Down
7 changes: 5 additions & 2 deletions funnel/views/proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from .. import app, mail, lastuser
from ..models import (db, Profile, ProposalSpace, ProposalSpaceRedirect, ProposalSpaceSection, Proposal,
ProposalRedirect, Comment, ProposalFeedback, FEEDBACK_AUTH_TYPE)
from ..forms import ProposalForm, CommentForm, DeleteCommentForm, ProposalTransitionForm, ProposalMoveForm
from ..forms import (ProposalForm, CommentForm, DeleteCommentForm, ProposalTransitionForm,
ProposalTransferForm, ProposalMoveForm)

proposal_headers = [
'id',
Expand Down Expand Up @@ -289,12 +290,14 @@ def proposal_view(profile, space, proposal):
transitionform = ProposalTransitionForm(obj=proposal)

proposal_move_form = None
proposal_transfer_form = None
if 'move_to' in proposal.current_access():
proposal_move_form = ProposalMoveForm()
proposal_transfer_form = ProposalTransferForm()

return render_template('proposal.html.jinja2', space=space, proposal=proposal,
comments=comments, commentform=commentform, delcommentform=delcommentform,
votes_groups=proposal.votes_by_group(),
votes_groups=proposal.votes_by_group(), proposal_transfer_form=proposal_transfer_form,
links=links, transitionform=transitionform, proposal_move_form=proposal_move_form,
part_a=space.proposal_part_a.get('title', 'Objective'),
part_b=space.proposal_part_b.get('title', 'Description'), csrf_form=Form())
Expand Down

0 comments on commit 307078e

Please sign in to comment.