Skip to content

Commit

Permalink
Merge pull request #498 from SaptakS/gsoc2016
Browse files Browse the repository at this point in the history
Session display added
  • Loading branch information
rafalkowalski committed Jun 2, 2016
2 parents 4eb8544 + 59ad20e commit fa6d806
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
7 changes: 7 additions & 0 deletions open_event/helpers/data_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ def get_sessions_by_event_id():
"""
return Session.query.filter_by(event_id=get_event_id())

@staticmethod
def get_sessions_by_event_id(event_id):
"""
:return: All Sessions with correct event_id
"""
return Session.query.filter_by(event_id=event_id)

@staticmethod
def get_tracks(event_id):
"""
Expand Down
6 changes: 3 additions & 3 deletions open_event/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def send_email_invitation(email, username, event_name, link):
payload = {'to': email,
'from': 'open-event@googlegroups.com',
'subject': "Invitation to Submit Papers for " + event_name,
"html": ("Hi %s<br/>" + \
"You are invited to submit papers for event: %s" + \
"<br/> Visit this link to fill up details: %s" % (username, event_name, link))}
"html": ("Hi %s<br/>" % str(username) + \
"You are invited to submit papers for event: %s" % str(event_name) + \
"<br/> Visit this link to fill up details: %s" % link)}
requests.post("https://api.sendgrid.com/api/mail.send.json",
data=payload,
headers=HEADERS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</label>

<button class="btn btn-success " type="button" data-toggle="modal" data-target="#invite-speaker-modal">Invite Person</button>
<button class="btn btn-warning ">Accept/Reject Session</button>
<a href="{{ url_for('session.display_view', event_id=event.id) }}"><button class="btn btn-warning ">Accept/Reject Session</button></a>
</div>
<div class="row">
<div class="col-md-offset-10">
Expand Down
69 changes: 69 additions & 0 deletions open_event/templates/gentelella/admin/session/display.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% extends 'gentelella/admin/base.html' %}
{% block body %}
<div class="page-title">
<div class="title_left">
<h3>Sessions</h3>
</div>
</div>

<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<button class="btn btn-default" onclick="show_all();">All</button>
<button class="btn btn-default" onclick="show_pending();">Pending</button>
<button class="btn btn-default" onclick="show_accepted();">Accepted</button>
<button class="btn btn-default" onclick="show_rejected();">Rejected</button>

<div class="x_content">
<table class="table table-striped">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th>Abstract</th>
<th>Start Date</th>
<th>End Date</th>
<th>State</th>

</tr>
</thead>
<tbody>
{% for session in sessions %}
<tr class="session {{session.state}}">
<td>{{session.title}}</td>
<td>{{session.description}}</td>
<td>{{session.abstract}}</td>
<td>{{session.start_time}}</td>
<td>{{session.end_time}}</td>
<td>{{session.state}}</td>
</tr>
{%endfor%}
</tbody>
</table>
</div>

</div>
</div>
</div>
<script type="text/javascript">
function show_all() {
$('.session').show();
}

function show_pending() {
$('.session').hide();
$('.session.pending').show();
}

function show_accepted() {
$('.session').hide();
$('.session.accepted').show();
}

function show_rejected() {
$('.session').hide();
$('.session.rejected').show();
}
</script>
{% endblock %}
8 changes: 7 additions & 1 deletion open_event/views/admin/models_views/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ def create_view(self, event_id, user_id, hash):
if invite and invite.hash == hash:
if request.method == 'POST':
DataManager.add_session_to_event(request.form, event_id)
return redirect(url_for('event.details_view', event_id=event_id))
return redirect(url_for('session.display_view', event_id=event_id))
return self.render('/gentelella/admin/session/new.html')

@expose('/display/')
def display_view(self, event_id):
sessions = DataGetter.get_sessions_by_event_id(event_id)
return self.render('/gentelella/admin/session/display.html',
sessions=sessions)

0 comments on commit fa6d806

Please sign in to comment.