Skip to content

Commit

Permalink
Update events tied to panel apps when they are updated
Browse files Browse the repository at this point in the history
Requested via Slack. Also fixes a really annoying bug where if you had "None" for granular rating selected, the box would always be unchecked when you loaded and application.
  • Loading branch information
kitsuta committed Nov 18, 2023
1 parent cbc85a3 commit 63db6e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions uber/models/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from sqlalchemy.ext.hybrid import hybrid_property

from uber.config import c
from uber.decorators import presave_adjustment
from uber.models import MagModel
from uber.models.types import default_relationship as relationship, utcnow, Choice, DefaultColumn as Column, \
MultiChoice, SocialMediaMixin
Expand Down Expand Up @@ -136,6 +137,12 @@ class PanelApplication(MagModel):

email_model_name = 'app'

@presave_adjustment
def update_event_info(self):
if self.event:
self.event.name = self.name
self.event.description = self.description

@property
def email(self):
return self.submitter and self.submitter.email
Expand Down
7 changes: 3 additions & 4 deletions uber/templates/panel_app_form_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
showOrHideLengthReason();
showOrHideModHelp();
showOrHideLoud();
controlGranularRatingCheckboxes();
$.field('presentation').on('change', showOrHideOtherPresentation);
$.field('presentation').on('change', showOrHideModHelp);
$.field('presentation').on('change', showOrHideLoud);
Expand Down Expand Up @@ -160,10 +159,10 @@
$(function () {
if ($.field('granular_rating')) {
$.field('magscouts_opt_in').parents('.form-group').insertAfter($.field('granular_rating').parents('.form-group'));
$.field('granular_rating').on('change', showOrHideOtherMAGScouts);
setVisible($.field('magscouts_opt_in').parents('.form-group'),
$(':checkbox[name=granular_rating][value={{ c.NONE }}]').prop('checked'))
}

showOrHideOtherMAGScouts();
$.field('granular_rating').on('change', showOrHideOtherMAGScouts);
});
</script>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/panels_admin/form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}{% set admin_area=True %}
{% block title %}Edit Panel Application{% endblock %}}
{% block title %}Edit Panel Application{% endblock %}
{% block content %}
{% include "panels_common.html" %}

Expand Down

0 comments on commit 63db6e0

Please sign in to comment.