vkaravir/a-plus — pull request #88 by Rubinous (2013-02-12 15:04:00+00:00)
Title: Apps

This would be my take on improving the app architecture of A+.

- First of all, BasePlugin now has the field "views" which should contain a whitespace-separated list of strings. These strings tell in which views that plugins should be rendered. Currently the possibilities are "course_instance", "exercise" and "submission".
- The correct plugins of a CourseInstance should filtered out using the contains filter on the "views" field, in the views.
- After a view that wishes to render plugins has filtered out those plugins, plugin renderers should be built by calling the build_app_renderers in app.app_renderers. These renderers have the render method which can then be called in the template code to render the plugin.
- The renderers should be put under the "plugins" variable of the template context.

- The ExternalIFramePlugin and its renderer end up rendering an iframe on the page which has data related to that view in url parameters of the iframe's src. The word "external" means that the iframe points to an external resource instead of A+.
- The url-parameters are database identifiers for models such as UserProfile, Submission, Exercise and CourseInstance. The idea is that the service can use the api to get more data from the database now that it knows for example which user is viewing which submission, before sending a response to the iframe.
- The ids should be encoded both in the src and in the api but the encoding and decoding methods are not implemented yet so they are just plain id's of the model objects.