-all: tags
+###
+all:
+ @echo no default target
force:
+#################### compute emacs tags
# in general it's right to rely on the contents as reported by git
tags: force
git ls-files | xargs etags
ftags: force
find . -type f | fgrep -v '/.git/' | xargs etags
+#################### manage static contents (extract from all the modules into the single all-static location)
static: force
./manage.py collectstatic --noinput
clean-static: force
rm -rf ./all-static/
+
+#################### sync : push current code on a (devel) box running myslice
+SSHURL:=root@$(MYSLICEBOX):/
+SSHCOMMAND:=ssh root@$(MYSLICEBOX)
+
+### rsync options
+# the config file should probably not be overridden
+LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude settings.py --exclude devel
+# usual excludes
+RSYNC_EXCLUDES := --exclude .git --exclude '*~' --exclude TAGS --exclude .DS_Store $(LOCAL_RSYNC_EXCLUDES)
+# make -n will propagate as rsync -n
+RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
+# putting it together
+RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
+
+# xxx until we come up with a packaging this is going to be a wild guess
+INSTALLED=/usr/share/myslice
+
+sync:
+ifeq (,$(MYSLICEBOX))
+ @echo "you need to set MYSLICEBOX, like in e.g."
+ @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
+ @exit 1
+else
+ +$(RSYNC) ./ $(SSHURL)/$(INSTALLED)/
+endif
+
+# xxx likewise until we run this under apache it's probably hard to restart from here
+restart:
+ifeq (,$(MYSLICEBOX))
+ @echo "you need to set MYSLICEBOX, like in e.g."
+ @echo " $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
+ @exit 1
+else
+ @echo "$@" target not yet implemented; exit; @$(SSHCOMMAND) /etc/init.d/apache2 restart
+endif
+
--- /dev/null
+The contents of this module:
+
+==================== 1st level subdirs
+* myslice:
+ this is the sjango project', where to look for
+ . settings
+ . urls
+ . common static files
+
+* insert_above:
+ a third-party django app for adding on-the-fly mentions to css or js files that need to go in the header
+ much like our past drupal_set_html_head()
+
+* auth:
+ a django 'app' that deals with authentication
+
+* slice:
+ a django app for dealing with slice views
+
+* devel:
+ only for various notes and other utiliy scripts
+
+* all-static: (generated, no need to source-control)
+ this is where 'manage.py collectstatic' will gather all your static contents if you run a local server
+ make has convenience targets to refresh this area
+ $ make clean-static
+ $ make static
+==================== conventions
+
+* templates:
+ we store this under templates/ within the corresponding app, e.g.
+ auth/templates/login.html
+ for now this is only about html, but the engine can be used for rendering anything including json or whatever..
+
+* static files:
+ we chose to have all static files (images, but also javascript and stylesheets) in the various
+ proj or app where they belong, under a static/ subdir that has this structure:
+ where-it-belongs/
+ static/
+ img/
+ css/
+ js/
+ the stuff I have so far is in myslice/ because it looks common to all apps..
+
+
+
else:
state = "Your username and/or password were incorrect."
- return render_to_response('auth.html',{'state':state, 'username': username},
+ return render_to_response('login.html',{'state':state, 'username': username},
context_instance=RequestContext(request))
-ul#mymenu {
+ul#mymenu { display: block; }
+ul#mymenu>li { display: block;
+ float: left;
+ padding: 5px;
+}
+
+/*
+div.mymenu {
position: fixed;
display: block;
padding:0;
margin:0;
- bottom: 10px;
+ top: 10px;
right: 10px;
+ background-color: #abc;
+}
+
+ul.mymenu {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
}
+*/
--- /dev/null
+#header {
+ position: fixed;
+ display: block;
+ margin:0;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ height: 60px;
+ background-color: #fc9;
+}
+
+#column-wrap {
+ margin-top: 60px;
+ display: table;
+ table-layout: fixed;
+ border-collapse: collapse;
+}
+#content-main, #content-related {
+ display: table-cell;
+ position: static;
+ padding: 10px;
+}
+#content-main {
+ width: 100%;
+}
+#content-related {
+ width: 200px;
+}
{% insert_str prelude "js/mymenu.js" %}
{% insert_str prelude "css/mymenu.css" %}
{# this shows how to add raw js code #}
-{% insert raw_js %} "some script useful for mymenu" {% endinsert %}
+{# {% insert raw_js %} "some script useful for mymenu" {% endinsert %} #}
{# use the raw_css container for css style #}
-<img class="logo" src="{{ STATIC_URL }}img/myslice-logo.png" alt="MySlice" />
+<div id='mymenu'>
<ul id='mymenu'>
+<li>
+ <a href="/"><img class="logo mymenu" src="{{ STATIC_URL }}img/myslice-logo.png" alt="MySlice" /></a>
+</li>
{% for d in menu_items %}
+ {% if d.current %}
+ <li class='current'> <a href="{{ d.href }}"> {{ d.label }} </a> </li>
+ {% else %}
<li class='other'> <a href="{{ d.href }}"> {{ d.label }} </a> </li>
-{% endfor %}
+ {% endif %}
+ {% endfor %}
</ul>
+</div>
+++ /dev/null
-{# This is required by insert_above #}
-{% insert_handler %}
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html> <head>
-<title> MySlice - slice page with python var foo = {{ foo }} </title>
-{# This is where insert_str will end up #}
-{% media_container prelude %}
-<script>
-{% container raw_js %}
-</script>
-<style>
-{% container raw_css %}
-</style>
-</head>
-
-{# let's add this one no matter what #}
-{% insert_str prelude "css/miscell.css" %}
-
-<body>
-{% block menu %} <div class='menu'> {{ menu }} </div> {% endblock %}
-
-{% block left %}
-<div class='left'>
- {{ left|default:"The left area" }}
-</div>
-{% endblock %}
-
-{% block main %}
-<div class='main'> <h1>Again, python var foo = {{ foo }} </h1>
- {{ main }}
-</div>
-<hr>
-{% block content %} and more stuff if needed {% endblock %}
-{% endblock %}
-
-</body>
-</html>
--- /dev/null
+{# This is required by insert_above #}
+{% insert_handler %}
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html> <head>
+<title> MySlice - slice page with python var foo = {{ foo|default:"foo is undefined"}} </title>
+{# This is where insert_str will end up #}
+{% media_container prelude %}
+<script type="text/javascript">
+{# In case we need to add raw js code #}
+{% container raw_js %}
+</script>
+<style type="text/css">
+{# In case we need to add raw css code #}
+{% container raw_css %}
+</style>
+</head>
+
+{# let's add this one no matter what #}
+{% insert_str prelude "css/myslice.css" %}
+{% insert_str prelude "css/miscell.css" %}
+
+<body>
+
+{% block container %}
+<div id='container'>
+
+ <div id='header'>
+ {% block header %}
+ {% include 'mymenu.html' %}
+ {% endblock header %}
+ </div>
+
+ {% block column_wrap %}
+ <div id='column-wrap'>
+ <div id='content-main'>
+ {% block content_main %}
+ "The main content area (set block 'content_main')"
+ {% endblock content_main %}
+ </div>
+
+ <div id='content-related'>
+ {% block content_related %}
+ "The related content area (set block 'related_main')"
+ {% endblock content_related %}
+ </div>
+ </div>
+ {% endblock column_wrap %}
+
+</div>
+{% endblock container %}
+
+</body>
+</html>
(r'^login/?$', 'auth.views.login_user'),
(r'^slice/?$', 'slice.views.fake_view'),
(r'^slice/(?P<name>\w+)/?$', 'slice.views.fake_view'),
+ (r'^sample/?$', 'slice.views.sample'),
)
-{% extends 'myslice-base.html' %}
+{% extends 'myslice.html' %}
{% block content %}
<p>The URL variable name= {{ name }} </p>
{{ content_string|safe }}
{% endblock content %}
-{% block menu %}
-{% include 'mymenu.html' %}
-{% endblock menu %}
context_instance=RequestContext(request))
return result
+
+def sample (request):
+ return render_to_response ('sample.html',
+ { 'menu_items':
+ [ { 'label':'Some label', 'href': '/url1/','current':True, },
+ { 'label':'Another topic ', 'href': '/other/'},
+ ]},
+ context_instance=RequestContext(request))
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html> <head>
-<title> {{ title }} </title>
-{{
-</head>
-
-<body>
-<div class='wrapper'>
-
- <div class='top'>
- {% block top %}
- <div class="header">
- <a href="/" alt="Home"><img class="logo" src="{{ STATIC_URL }}myslice-logo.png" alt="MySlice" /></a>
- </div>
- {% endblock top %}
- </div>
- <div class='menubar'>
- {% block menubar %}
- <h1> Empty menubar for now </h1>
- {% endblock menubar %}
- </div>
- <div class='centered content'>
- {% block content %}
- Welcome...
- {% endblock content %}
- </div>
-</div>
-</body> </html>