Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro committed Jan 27, 2018
1 parent 8324afc commit 26f6ca7
Show file tree
Hide file tree
Showing 45 changed files with 15,385 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ db.sqlite3
/gagawag/media
/gagawag/static
/gagawag/gagawag/settings/local.py
_dist
15 changes: 0 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,9 @@ A planning calendar for wagtail
.. image:: https://coveralls.io/repos/github/Gagaro/wagtail-calendar/badge.svg?branch=master
:target: https://coveralls.io/github/Gagaro/wagtail-calendar?branch=master


THIS IS STILL A WORK IN PROGRESS

TODO
----

- [X] Display published pages
- [X] Display planned pages
- [X] Use hook to get the events
- [X] Add popup on click/hover
- [X] Move planned pages to change the planning
- [X] Move unplanned pages from the side of the calendar to plan them
- [X] Move planned pages to the side of the calendar to unplan them
- [X] Check permissions in wagtail_calendar_register_events hooks
- [X] Add unit tests
- [ ] Docs
- [ ] Release!

- [ ] #3

Screenshots
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = WagtailCalendar
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_build/doctrees/customize.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/_build/doctrees/getting_started.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/index.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 94808024c223b34b95e53e7aca27e59a
tags: 645f666f9bcd5a90fca523b33c5a78b7
68 changes: 68 additions & 0 deletions docs/_build/html/_sources/customize.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Customize
=========

Changing the event data
-----------------------

You can add a `get_page_event_data` method to your page model to change the data used by the calendar.
The default data are:

.. code-block:: python
return {
'type': 'page',
'pk': page.pk,
'author': str(page.owner),
'description': page.search_description, # description can be HTML to allow more customization of the popup
}
Adding events
-------------

There are two wagtail hooks available to add events. `wagtail_calendar_register_events` is used to add events to the calendar.
The properties of the events are the one from `fullcalendar <https://fullcalendar.io/docs/event_data/Event_Object/>`_.
The hook take the request, a start date, a end date and a list of events already in the calendar.
You must return the whole list of events which will appear in the calendar.

.. code-block:: python
@hooks.register('wagtail_calendar_register_events')
def my_events(request, start, end, events):
if start is not None:
start = parse_datetime(start)
if end is not None:
end = parse_datetime(end)
my_events = []
for event in MyEvent.objects.filter(start__gte=start, end__lte=end):
my_events.append({
'id': event.pk,
'title': event.title,
'start': event.start.isoformat(),
'end': event.end.isoformat(),
'url': event.get_absolute_url(),
'editable': False,
'color': '#ff0000',
})
return events + my_events
`wagtail_calendar_register_side_events` is used to add events to the sidebar of the calendar. It is used for events which are not planned yet.
The properties of the events are the one from `fullcalendar <https://fullcalendar.io/docs/event_data/Event_Object/>`_.
The hook take the request and a list of events already in the sidebar.
You must return the whole list of events which will appear in the sidebar.

.. code-block:: python
@hooks.register('wagtail_calendar_register_side_events')
def my_events(request, start, end, events):
my_events = []
for event in MyEvent.objects.filter(start__isnull=True):
my_events.append({
'id': event.pk,
'title': event.title,
'url': event.get_absolute_url(),
'editable': True,
'color': '#ff0000',
})
return events + my_events
17 changes: 17 additions & 0 deletions docs/_build/html/_sources/getting_started.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Getting started
===============

It is as simple as installing it and adding it to the installed apps:

.. code-block:: bash
$ pip install wagtail-calendar
.. code-block:: python
INSTALLED_APPS = [
...
'wagtail_calendar',
...
]
22 changes: 22 additions & 0 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. Wagtail Calendar documentation master file, created by
sphinx-quickstart on Sat Jan 27 10:39:16 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Wagtail Calendar's documentation!
============================================

.. toctree::
:maxdepth: 2
:caption: Contents:

getting_started
customize


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Binary file added docs/_build/html/_static/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 26f6ca7

Please sign in to comment.