Changes between Version 8 and Version 9 of KSSInDjango
- Timestamp:
- Oct 16, 2007, 2:18:47 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
KSSInDjango
v8 v9 51 51 }}} 52 52 53 The lines above mean that if the user clicks on a link element like ``<span class="page-link"><a href="wiki/view?title=WikiWord">WikiWord</a></span>``, KSS will execute the previous fragment (like CSS selector does) and will:53 The lines above mean that if the user clicks on a link element like {{{<span class="page-link"><a href="wiki/view?title=WikiWord">WikiWord</a></span>}}}, KSS will execute the previous fragment (like CSS selector does) and will: 54 54 1. Override ``href`` argument, and send an AJAX request to URL defined in ``action-server`` KSS attribute. In this case the link goes to ``ajax/view``, but without refreshing the page. 55 1. Pass a HTTP parameter (``POST`` by default) named ``title`` (as defined in ``ajax/view-title``) with the value taken from the content of the node (`` WikiWord`` in this case). In this case it is like ``ajax/view?title=WikiWord``request, but in a ``POST`` method.55 1. Pass a HTTP parameter (``POST`` by default) named ``title`` (as defined in ``ajax/view-title``) with the value taken from the content of the node (``!WikiWord`` in this case). In this case it is like {{{ajax/view?title=WikiWord}}} request, but in a ``POST`` method. 56 56 1. The server action takes the AJAX request and returns KSS commands to the browser. Commands are XML fragments that do things like (I explain better later): 57 57 * ''replace breadcrumbs with ``Home / News / Foo News item``'' … … 59 59 * ''replace main content with the new content i am seeing'' 60 60 61 The first step is very important for accesibility. If you have javascript disabled and the users clicks he would go to ``wiki/view?title=WikiWord``, and it works perfectly both with or without javascript.61 The first step is very important for accesibility. If you have javascript disabled and the users clicks he would go to {{{wiki/view?title=WikiWord}}}, and it works perfectly both with or without javascript. 62 62 63 63 The last thing to explain is how to send KSS commands from '''server side'''. Normal code at server side (i.e. a django view) could be something like this: