Commits

Shu Zong Chen  committed 5b9b9f1

initial web presence work

  • Participants
  • Parent commits 0ffca4a

Comments (0)

Files changed (15)

File cjh/content/__init__.py

Empty file added.

File cjh/content/admin.py

+from django.contrib import admin
+from cjh.content.models import ContentPage
+
+class ContentPageAdmin(admin.ModelAdmin):
+	readonly_fields = ('created_on', 'modified_on')
+	#exclude = ('engine',)
+	#def save_model(self, request, obj, form, change):
+	#	obj.engine = 'markdown'
+	#	obj.save()
+
+admin.site.register(ContentPage, ContentPageAdmin)

File cjh/content/models.py

+from sasaba.models import SasabaPage
+
+class ContentPage(SasabaPage):
+	class Meta:
+		verbose_name = "Page"
+		verbose_name_plural = "Pages"
+

File cjh/content/tests.py

+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+

File cjh/content/views.py

+# Create your views here.
+from cjh.content.models import ContentPage
+from sasaba.views import SasabaView
+
+view = SasabaView(ContentPage, default_template = "content.html")
+
+class ContentView(object):
+
+	@classmethod
+	def home(cls, request):
+		return cls.page(request, page='homepage')
+
+	@classmethod
+	def page(cls, request, page=None):
+		v = view.page(request, page)
+		v.context['page'] = v.page
+		return v.HttpResponse
+

File cjh/gis_io/management/commands/gis_convert_to_kml.py

-from django.core.management.base import BaseCommand, CommandError
+from django.core.management.base import BaseCommand
 from cjh.gis_io.models import GIS_IO
 import glob
 import os

File cjh/settings.py

 
 DATABASES = {
     'default': {
-        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': '',                      # Or path to database file if using sqlite3.
+        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': os.path.join(BASE_PATH, 'data.sqlite3'),                      # Or path to database file if using sqlite3.
         'USER': '',                      # Not used with sqlite3.
         'PASSWORD': '',                  # Not used with sqlite3.
         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
     # Put strings here, like "/home/html/static" or "C:/www/django/static".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
+		os.path.join(BASE_PATH, 'static'),
 )
 
 # List of finder classes that know how to find static files in
     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
+		os.path.join(BASE_PATH, 'templates'),
 )
 
 INSTALLED_APPS = (
     'django.contrib.staticfiles',
     'django.contrib.admin',
 		'cjh.gis_io',
+		'cjh.content',
+		'sasaba',
 )
 
 # A sample logging configuration. The only tangible logging

File cjh/static/js/base.js

Empty file added.

File cjh/static/less/ninesixty.less

+@ninesixty_width: 960px;
+@ninesixty_padding: 10px;
+
+.ninesixty_clearfix{
+	content: '.';
+	display: block;
+	overflow: hidden;
+	visiblity: hidden;
+	font-size: 0;
+	line-height: 0;
+	width: 0;
+	height: 0;
+}
+
+body{
+	min-width: 960px;
+}
+
+.container(@size){
+	margin-left: auto;
+	margin-right: auto;
+	width: @ninesixty_width;
+	&:before, &:after{
+		.ninesixty_clearfix;
+	}
+	&:after{
+		clear: both;
+	}
+}
+
+.block(@grid, @container){
+	@c_width: @ninesixty_width/@container;
+	display: inline;
+	float: left;
+	width: @c_width * @grid;
+}
+
+.grid(@grid, @container){
+	@c_width: @ninesixty_width/@container;
+	display: inline;
+	float: left;
+	margin-left: @ninesixty_padding;
+	margin-right: @ninesixty_padding;
+	width: @c_width * @grid - 2 * @ninesixty_padding;
+}
+
+.prefix(@prefix, @container){
+	@c_width: @ninesixty_width/@container;
+	padding-left: @c_width * @prefix;
+}
+
+.suffix(@suffix, @container){
+	@c_width: @ninesixty_width/@container;
+	padding-right: @c_width * @suffix;
+}
+
+.push(@push, @container){
+	@c_width: @ninesixty_width/@container;
+	position: relative;
+	left: @c_width * @push;
+}
+
+.pull(@pull, @container){
+	@c_width: @ninesixty_width/@container;
+	position: relative;
+	right: @c_width * @pull;
+}
+
+.alpha(){
+	margin-left: 0;
+}
+
+.omega(){
+	margin-right: 0;
+}
+
+.clear(){
+	clear: both;
+	display: block;
+	overflow: hidden;
+	visiblity: hidden;
+	width: 0;
+	height: 0;
+}
+
+.clearfix(){
+	&:before, &:after{
+		.ninesixty_clearfix;
+	}
+	&:after{
+		clear: both;
+	}
+}

File cjh/static/less/style.less

+@import "ninesixty";
+
+header{
+	.container(12);
+	h1{
+		.grid(12, 12);
+	}
+}
+#page{
+	.container(12);
+	.lhs{
+		.block(8, 12);
+	}
+	.rhs{
+		.block(4, 12);
+	}
+	.nhs{
+		.block(12, 12);
+	}
+}
+footer{
+	.container(12);
+}

File cjh/templates/base.html

+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<title>ChiriJyouHou</title>
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"></script> 
+	<script type="text/javascript" src="/static/js/base.js"></script>
+	<link href='http://fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT' rel='stylesheet' type='text/css'>
+	<link href="/static/less/style.less" rel="stylesheet/less" type="text/css">
+	<script type="text/javascript" src="http://lesscss.googlecode.com/files/less-1.1.3.min.js"></script>
+</head>
+<body>
+	<div id="overlord">
+		<header>
+			<h1>Hawaii GIS+</h1>
+		</header>
+{% block body %}
+{% endblock %}
+		<footer>
+			<p>&copy;2011 FreelanceDreams LLC</p>
+		</footer>
+	</div>
+</body>

File cjh/templates/content.html

+{% extends "base.html" %}
+{% block body %}
+	<div id="page">
+		<div class="nhs">
+			<article>
+			{{ page.rendered_content }}
+			<div class="spacer"><!--IE SUX--></div>
+			</article>
+		</div>
+	</div>
+{% endblock %}

File cjh/templates/homepage.html

+{% extends "base.html" %}
+{% block body %}
+<div id="page" class="homepage_splash">
+	<div class="lhs">
+		<article>
+		{{ page.rendered_content }}
+		</article>
+	</div>
+	<div class="rhs">
+		<article>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+			<p>Blah</p>
+		</article>
+	</div>
+</div>
+{% endblock %}
 from django.conf.urls.defaults import patterns, include, url
+from cjh.content.views import ContentView
 
 # Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
+from django.contrib import admin
+admin.autodiscover()
 
 urlpatterns = patterns('',
+		url(r'^$', ContentView.home, name="homepage"),
+		url(r'^admin/', include(admin.site.urls)),
+		url(r'^(?P<page>.*)\.html$', ContentView.page),
     # Examples:
     # url(r'^$', 'cjh.views.home', name='home'),
     # url(r'^cjh/', include('cjh.foo.urls')),

File requirements.txt

 PyYAML
 hg+https://bitbucket.org/michael_kirk/python-fusion-tables-client
 pykml
+hg+https://bitbucket.org/sirpengi/django-snippet
+hg+https://bitbucket.org/sirpengi/django-sasaba