Skip to content

AJAX user interface

dtrce edited this page Jul 10, 2011 · 8 revisions

There is an on-going work on implementing drag-and-drop AJAX-based user interface, using one or more of available libraries.

Check out the code

To see how it goes, check out ajax_ui branch

Basic assumptions

Basic assumptions are as follows:

  • the “schedule” app should still provide the “old”, static interface
  • “schedule” should provide generic views (methods) for AJAX implementations (getting objects in JSON format, creating, editing and deleting events and occurrences)
  • “schedule” should also provide a generic JS library for use by UI implementations
  • "schedule"’s site media should contain all JS libraries required by specific UI implementations
  • “schedule” should also provide views returning JS scripts which require dynamic processing
  • templates for various AJAX clients overriding stock templates should be provided as separate apps (e.g. “schedule_weekcal”)

This way, developers will be able to port various JS UI libraries to a standard API; the user (meaning a site developer using django-schedule) will choose which UIs he is going to use by configuring TEMPLATE_DIRS in his settings.py.

Implementation status

As of November 13th, the status is:

  • server-side API

schedule/views contain methods “calendar_by_periods_json”, “ajax_edit_occurrence_by_code” and “ajax_edit_event”. Occurrences returned by “calendar_by_periods_json” are given a unique id which is then used in the other method to figure out which occurrence it is, and whether it is persisted or not.

Another view “event_json” is for getting an event for editing.

Missing: permission control in ajax views.

  • generic JS library

The is a view “schedulelibjs” which returns a dynamically generated library which defines methods for formatting dates and some global variables (urls of server-side API etc).

  • specific UI implementation

The “schedule_weekcal” app provides a working implementation of JQuery-weekcalendar. TODO file lists some cleanups which are due.

Plans

  • implement FullCalendar as a month view (with no editing) – it looks good and displays multi-day events very nicely
  • (maybe) implement FullCalendar with complete functionality as an alternative UI
  • (maybe) implement any other front-end – if you have your own beloved front-end, feel free to port it