Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only flash about the meeting deletion if the meeting has been deleted an... #63

Merged
merged 5 commits into from Dec 17, 2013
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions fedocal/__init__.py
Expand Up @@ -706,6 +706,11 @@ def delete_meeting(meeting_id):
return flask.redirect(flask.url_for('index'))
meeting = Meeting.by_id(SESSION, meeting_id)

if not meeting:
flask.flash(
'No meeting with this identifier could be found.', 'errors')
return flask.redirect(flask.url_for('index'))

if meeting.calendar.calendar_status != 'Enabled':
flask.flash('This calendar is "%s", you are not allowed to delete '
'its meetings anymore.' % (
Expand Down Expand Up @@ -739,8 +744,9 @@ def delete_meeting(meeting_id):
except SQLAlchemyError, err:
SESSION.rollback()
print 'edit_meeting:', err
flask.flash('Could not update this meeting.', 'error')
flask.flash('Meeting deleted')
flask.flash('Could not delete this meeting.', 'error')
flask.flash('Meeting deleted')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems incorrect. Will both flash messages appear?


fedmsg.publish(topic="meeting.delete", msg=dict(
agent=flask.g.fas_user.username,
meeting=meeting.to_json(),
Expand Down
21 changes: 20 additions & 1 deletion fedocal/templates/default/delete_meeting.html
Expand Up @@ -32,10 +32,29 @@ <h4> Meeting: {{ meeting.meeting_name}}</h4>
{{ render_field_invert(form.confirm_futher_delete) }}
{% endif %}
<p class="buttons indent">
<input type="submit" class="submit positive button" value="Delete">
<input id="confirm_button" type="submit" class="submit positive button"
value="Delete" disabled="disabled">
<input type="button" value="Cancel" class="button" onclick="history.back();">
</p>
{{ form.csrf_token }}
</form>

{% endblock %}

{% block jscripts %}
{{ super() }}
<script type="text/javascript">
$(document).ready(function() {
$('#confirm_delete').click(function() {
var cb = $('#confirm_button');
if(this.checked == true) {
cb.removeAttr('disabled');
cb.removeClass('ui-state-disabled')
} else {
cb.attr('disabled', true);
cb.addClass('ui-state-disabled')
}
});
});
</script>
{% endblock %}