Skip to content

Commit

Permalink
Event fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Merlin Buczek committed Jun 7, 2019
1 parent c8d774e commit 35b5140
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions mpicms/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
from wagtail.search import index
from wagtail.images.blocks import ImageChooserBlock
from wagtail.snippets.edit_handlers import SnippetChooserPanel
from wagtail.snippets.models import register_snippet

from mpicms.news.mixins import NewsMixin
from mpicms.events.models import Event

from wagtail.snippets.models import register_snippet
from mpicms.events.models import Event, EventIndex


Page.show_in_menus_default = True
Expand Down Expand Up @@ -104,6 +103,7 @@ def get_context(self, request, *args, **kwargs):
events.append(event.get_dict(request))

context["events"] = json.dumps(events)
context['event_index'] = EventIndex.objects.get()

return context

Expand Down
7 changes: 6 additions & 1 deletion mpicms/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ def get_context(self, request, *args, **kwargs):

return context

def clean(self): # Prevent more than one event index
model = self.__class__
if (model.objects.count() > 0 and self.pk != model.objects.get().id):
raise ValidationError("Can only create 1 %s instance" % model.__name__)

class Meta: # noqa
verbose_name = _('event index')
verbose_name_plural = _('event indexes')
verbose_name_plural = _('event indexes')
6 changes: 3 additions & 3 deletions mpicms/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,16 @@ select, input {
border-radius: 0 !important;
}

.fc-scroller {
.calendar-list .fc-scroller {
max-height: 30rem;
height: fit-content !important;
}

.fc-toolbar.fc-header-toolbar {
.calendar-list .fc-toolbar.fc-header-toolbar {
margin-bottom: 0 !important;
}

.fc {
.calendar-list .fc {
padding: 1rem;
}

Expand Down
4 changes: 2 additions & 2 deletions mpicms/templates/base/home_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
<div class="column">
{% include 'news/components/news_preview.html' with news=page.news %}
</div>
<div class="column">
<div class="column calendar-list">
<h3 class="title is-3">{% trans 'Upcoming events' %}</h3>
{% include 'events/components/event_list.html' %}
<div class="section-button" >
<a href=""><button class="button">{% trans 'All events' %}&nbsp&nbsp<i class="fas fa-chevron-right"></i></button></a>
<a href="{% pageurl event_index %}"><button class="button">{% trans 'All events' %}&nbsp&nbsp<i class="fas fa-chevron-right"></i></button></a>
</div>
</div>
</div>
Expand Down

0 comments on commit 35b5140

Please sign in to comment.