pmylund/haveabit — pull request #1 by gusennan (2013-07-13 18:32:54+00:00)
Title: Genericize

Patrick:

I really like the visual design of the site. Great job putting it together.

I built my own site based off of the code and changed a few things to make the code more generic, like adding a setting for whether or not to include Google Analytics and, if so, then what the GAQ account was. Additionally, I created some methods to be able to generate source urls for the images on the fly.

In the first commit I removed FB connect, as I hadn't setup a FB application for it. When deciding I wanted to push back to you I decided to re-add it so the changes wouldn't break your code. My next planned iteration through the code will be to genericize the FB-connect feature and add bulk-uploading of authors and images. If there are any changes you have questions about or you think need to be tweaked, let me know and I can see what I can do.

Nate Guerin

====================================================================

__File-by-File Changes__
_README_ - Added building prerequisites and overview of the different types of models and where they were used.

_admin.py_ - Added dynamic generation of image urls based on request URL and Google Analytics to the template values passed into the Base Page for conditional GAQ loading.

_app.py_ - Removed unused import `escape', added Google Analytics variables into templates, removed unused `Author' predeclaration in QuotePage, added a few comments and reformatted file.

_app.yaml_ - Made a few changes, such as specifying which version of Python and Django app uses, as requested by GAE. Should be selectively merged into master.

_bit.py_ - Modified the code to pull images from directory specified in settings.py so that only relative path of image is stored in the database.

_settings.py_ - Added Google Analytics Account and base image directory into settings file.

_style/gaq.js_ - Moved Google Analytics javascript bootstrapper into a separate file that is conditionally loaded and parameterized in view/base.html

_utils.py_ - Added two methods to generate an image url; one based on the request url and the other based on the settings file.

_view/admin/base.html_ - Removed GAQ code from here and put it into style/gaq.js and only load it if use_gaq is set to TRUE in the settings file.