Skip to content

Commit

Permalink
add demo site
Browse files Browse the repository at this point in the history
  • Loading branch information
gawel committed Jan 15, 2011
1 parent 577502f commit db96af4
Show file tree
Hide file tree
Showing 24 changed files with 459 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0.0
---

- Initial version
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
CURDIR=$(PWD)
TEST=$(PWD)/bin/nosetests

all: git clean test html

develop:
python2.6 bootstrap.py --distribute
bin/buildout

git:
git submodule foreach git pull origin master

doc:
html:
cd pyramid_formalchemy/docs; $(MAKE) html
cd formalchemy/docs; $(MAKE) html
cd fa.jquery/docs; $(MAKE) html
cd docs; $(MAKE) html

test:
cd pyramid_formalchemy; $(TEST)
cd formalchemy; bin/test
cd fa.jquery; $(TEST)

clean:
rm -Rf pyramid_formalchemy/docs/_build
rm -Rf formalchemy/docs/_build
rm -Rf fa.jquery/docs/_build
rm -Rf docs/_build


4 changes: 4 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
formalchemy_project README



3 changes: 3 additions & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ eggs =
Pygments
formalchemy
fa.jquery
Pylons
pyramid_formalchemy
pyramidapp
ipython
Expand All @@ -22,5 +23,7 @@ eggs =
genshi
RDFAlchemy
BeautifulSoup
rstctl
nose
Sphinx

25 changes: 19 additions & 6 deletions development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use = egg:Paste#urlmap
/formalchemy = formalchemy
/fa.jquery = fa.jquery
/jquery = jquery
/demo = pyramid
/demo = demo
/ = docs

[app:pyramid_formalchemy]
Expand All @@ -16,10 +16,15 @@ document_root = %(here)s/pyramid_formalchemy/docs/_build/html
use = egg:Paste#static
document_root = %(here)s/formalchemy/docs/_build/html

[app:fa.jquery]
[app:fa.jquery_docs]
use = egg:Paste#static
document_root = %(here)s/fa.jquery/docs/_build/html

[pipeline:fa.jquery]
pipeline =
egg:fa.jquery#demo
fa.jquery_docs

[app:jquery]
use = egg:Paste#static
document_root = %(here)s/fa.jquery/fa/jquery/jquery-ui
Expand All @@ -28,14 +33,22 @@ document_root = %(here)s/fa.jquery/fa/jquery/jquery-ui
use = egg:Paste#static
document_root = %(here)s/docs/_build/html

[app:pyramidapp]
use = config:%(here)s/pyramid_formalchemy/pyramidapp/development.ini
[app:pyramid]
use = egg:formalchemy_project
reload_templates = false
debug_authorization = false
debug_notfound = false
debug_routematch = false
debug_templates = true
default_locale_name = en
sqlalchemy.url = sqlite:///%(here)s/demo.db


[pipeline:pyramid]
[pipeline:demo]
pipeline =
egg:WebError#evalerror
egg:repoze.tm2#tm
pyramidapp
pyramid

[server:main]
use = egg:Paste#http
Expand Down
20 changes: 14 additions & 6 deletions docs/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ The FormAlchemy Project is a set of packages related to ref:`FormAlchemy`
You can read more about each project by browsing this documentation and each
project's documentation.

Projects are hosted on `GitHub <https://github.com/FormAlchemy>`_. Any issue related to FormAlchemy should be report here.
Projects are hosted on `GitHub <https://github.com/FormAlchemy>`_. Any issue
related to FormAlchemy should be report here.

There is also a live `demo </demo/admin/>`_ of what you can do with all those
We also have a `Google Group <http://groups.google.com/group/formalchemy>`_ and
an irc channel: ``/join #formalchemy`` on `Freenode <http://freenode.net>`_.

There is also a live `demo <./demo/admin/>`_ of what you can do with all those
packages.


About FormAlchemy
==========================

FormAlchemy got his own About page since it's the main project.
The full documentation can be found at `/formalchemy </formalchemy>`_.

Content:

Expand All @@ -31,18 +34,23 @@ Content:

formalchemy

Full documentation
--------------------

The full documentation can be found at `/formalchemy <./formalchemy>`_.

About fa.jquery
==========================

Description
--------------------

fa.jquery is a set of renderer based on jQuery.ui
fa.jquery is a set of renderer for FormAlchemy based on `jQuery.ui <http://jqueryui.com/>`_

Full documentation
--------------------

The full documentation is available at `/fa.jquery </fa.jquery>`_
The full documentation is available at `/fa.jquery <./fa.jquery>`_

About pyramid_formalchemy
==========================
Expand All @@ -55,5 +63,5 @@ pyramid_formalchemy is a set of view and model designed to help you to build an
Full documentation
--------------------

The full documentation is available at `/pyramid_formalchemy </pyramid_formalchemy>`_
The full documentation is available at `/pyramid_formalchemy <./pyramid_formalchemy>`_

2 changes: 1 addition & 1 deletion fa.jquery
Submodule fa.jquery updated 35 files
+1 −1 docs/configuration.txt
+2 −0 fa/jquery/app.py
+ fa/jquery/jquery-ui/css/.DS_Store
+ fa/jquery/jquery-ui/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-icons_6da8d5_256x240.png
+ fa/jquery/jquery-ui/css/redmond/images/ui-icons_f9bd01_256x240.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-icons_2e83ff_256x240.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-icons_454545_256x240.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-icons_888888_256x240.png
+ fa/jquery/jquery-ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png
+172 −80 fa/jquery/jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css
+18 −18 fa/jquery/jquery-ui/fa.jquery.min.js
+1 −1 fa/jquery/jquery-ui/fa/jquery.formalchemy.css
+0 −154 fa/jquery/jquery-ui/js/jquery-1.4.2.min.js
+167 −0 fa/jquery/jquery-ui/js/jquery-1.4.4.min.js
+781 −0 fa/jquery/jquery-ui/js/jquery-ui-1.8.8.custom.min.js
+0 −374 fa/jquery/jquery-ui/js/jquery-ui-1.8.custom.min.js
+1 −1 fa/jquery/templates/admin/master.pt
+33 −157 fa/jquery/templates/admin/master.pt.py
+2 −2 fa/jquery/templates/head.mako
+1 −1 setup.py
18 changes: 17 additions & 1 deletion formalchemy_project/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
#
from pyramid.config import Configurator
from sqlalchemy import engine_from_config

from formalchemy_project.models import initialize_sql
import pyramid_formalchemy

def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
engine = engine_from_config(settings, 'sqlalchemy.')
initialize_sql(engine)
config = Configurator(settings=settings)
pyramid_formalchemy.include_jquery(config)
pyramid_formalchemy.configure(config, package='formalchemy_project', use_jquery=True)
return config.make_wsgi_app()


33 changes: 33 additions & 0 deletions formalchemy_project/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from formalchemy_project import models
from formalchemy import config as fa_config
from formalchemy import templates
from formalchemy import validators
from formalchemy import fields
from formalchemy import forms
from formalchemy import tables
from formalchemy.ext.fsblob import FileFieldRenderer
from formalchemy.ext.fsblob import ImageFieldRenderer
import fa.jquery as jq

fa_config.encoding = 'utf-8'
fa_config.engine = jq.TemplateEngine()

## Use jquery renderers
forms.FieldSet.default_renderers.update(jq.default_renderers)
#forms.FieldSet.default_renderers['dropdown'] = jq.relations()

class FieldSet(forms.FieldSet):
pass

class Grid(tables.Grid):
pass

## Initialize fieldsets

Widgets = FieldSet(models.Widgets)
Widgets.configure()
Widgets.autocomplete.set(renderer=jq.autocomplete(['%sanux' % s for s in 'BCDFGHJKLMNP']))

## Initialize grids

103 changes: 103 additions & 0 deletions formalchemy_project/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
"""The application's model objects"""
import transaction
import logging

from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import Unicode
from sqlalchemy import Date
from sqlalchemy import DateTime

from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base

from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker

from zope.sqlalchemy import ZopeTransactionExtension

DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()

from fa.jquery.utils import HTML, Color, Slider
from datetime import datetime

class Article(Base):
__tablename__ = 'articles'

id = Column(Integer, primary_key=True)
title = Column(Unicode)
text = Column(HTML)
publication_date = Column(Date, default=datetime.now)


class Widgets(Base):
__tablename__ = 'widgets'

id = Column(Integer, primary_key=True)
autocomplete = Column(Unicode)
slider = Column(Slider, default=0)
color = Column(Color)
date = Column(Date)
date_time = Column(DateTime, default=datetime.now)

def populate():
import random
session = DBSession()
for i in range(50):
article = Article(
title='Article %s' % i,
text='''Heading
=====================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent consectetur
imperdiet porta. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. Proin sollicitudin, mi sit amet blandit
dignissim, lacus ante sagittis est, in congue lectus nulla non urna. Nunc a
justo ut lacus laoreet facilisis. Nullam blandit posuere mauris semper
pellentesque. Sed leo neque, vulputate sed pharetra vel, rhoncus at nisl.
Aenean eget nibh turpis. Quisque semper lacus sodales libero dictum pretium.
Phasellus euismod, odio sit amet vehicula pharetra, nunc diam imperdiet dui,
non malesuada neque erat ac augue. Sed elit ipsum, placerat vitae accumsan
quis, tempor in tellus. Vestibulum tempus consequat libero, sit amet
pellentesque lacus interdum in. Vestibulum in nunc at nulla ultrices laoreet.
* Morbi id orci augue, porta malesuada mi.
* Proin rhoncus tellus non orci iaculis pretium.
* Praesent aliquet commodo urna, vitae laoreet arcu porttitor ut.
* Nullam sollicitudin blandit risus, eu luctus nisl scelerisque eget.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent consectetur
imperdiet porta. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. Proin sollicitudin, mi sit amet blandit
dignissim, lacus ante sagittis est, in congue lectus nulla non urna. Nunc a
justo ut lacus laoreet facilisis. Nullam blandit posuere mauris semper
pellentesque. Sed leo neque, vulputate sed pharetra vel, rhoncus at nisl.
Aenean eget nibh turpis. Quisque semper lacus sodales libero dictum pretium.
Phasellus euismod, odio sit amet vehicula pharetra, nunc diam imperdiet dui,
non malesuada neque erat ac augue. Sed elit ipsum, placerat vitae accumsan
quis, tempor in tellus. Vestibulum tempus consequat libero, sit amet
pellentesque lacus interdum in. Vestibulum in nunc at nulla ultrices laoreet.
''',
publication_date = datetime.utcnow())
session.add(article)

for i in range(100):
widgets = Widgets(
autocomplete=random.choice(['%sanux' % s for s in 'BCDFGHJKLMNP']+['']),
color = random.choice(["#EEEEEE", "#FFFF88", "#FF7400", "#CDEB8B", "#6BBA70"]),
slider = random.choice(range(0, 100, 10)),
)
session.add(widgets)
transaction.commit()


def initialize_sql(engine):
DBSession.configure(bind=engine)
Base.metadata.bind = engine
Base.metadata.create_all(engine)
try:
populate()
except IntegrityError, e:
DBSession.rollback()
Binary file added formalchemy_project/static/favicon.ico
Binary file not shown.
Binary file added formalchemy_project/static/footerbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added formalchemy_project/static/headerbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions formalchemy_project/static/ie6.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* html img,
* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')",
this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
);}
#wrap{display:table;height:100%}
Binary file added formalchemy_project/static/middlebg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit db96af4

Please sign in to comment.