This repository holds the code for Open Knesset templates, sample data and code to run as development server. You are invited to fork the code, improve the design and send a pull request
Fork the repo: ok-templates.git
by using the Fork button on github and:
$ git clone git@github.com:yourusername/ok-templates.git $ cd ok-webfront $ sudo ./install/install.sh $ node app.js
and point your broser at http://localhost:3000
the templates themselves are located at the views
folder and written in
Mustache logicless templating language. The templates have a .html
file suffix.
The repository includes a agenda_detail.mustache
file that is based on a
1.0 template and all the required template tags and include files. To see
the template, point your browser at http://locahost:8000/agenda/1;s and you
will see a page rendered based on the template and a context file from
fixtures/agenda/1.json
.
Behind the scenes, when the server identify a url that ends with ;s
it
eaves most of the rendering to the client and uses
template/small_base.mustache
to render a page with basic html and the
javascript needed to render the page on the client. Without the ;s
rendering is done on the server, using pystache. This mode is not tested
and is less usuable as pystache does not return meaningfull errors (yet?).
The templates support i18n through gnu's gettext. You can test if you have it
installed by running gettext --version
. If you don't, the easiest way is to
run apt-get install gettext
on Linux or brew install gettext
for the
OSX, and for the less fortunate ones, try the setup file
here.
To use static text in the the template, use natural language and wrap it in
{{#_}}Natural Language{{/_}}
. Once you've added strings to be translated
you need to update the .po
file. First run python makemsgs.py
to update
the file locale/he/LC_MESSAGES/mustache.po
with the new strings. Next, edit
the file using a text editor or poedit and translate the strings. Fianlly, you
need to compile the file using ./compilemsgs
.
Once stasified with your changes, commit your changes to your fork with a meaningful commit message and send a pull request to hasadna's fork