From 45273da0859095cd4e7565f7ea0fc1496ef2f2de Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 22 Mar 2013 12:14:36 +0100 Subject: [PATCH] added new layout with a single column - use this for the slice view in the mix renamed unfold1 into unfold2 (1 has 1 column and 2 has 2 columns) --- trash/dashboard.py | 6 ++-- trash/pluginview.py | 6 ++-- trash/sliceview.py | 8 +++-- trash/templates/view-plugin.html | 14 ++++---- trash/templates/view-scroll.html | 10 +++--- trash/templates/view-slice.html | 5 +++ trash/templates/view-tab.html | 10 +++--- unfold/prelude.py | 2 +- ...{layout-unfold1.css => layout-unfold2.css} | 4 +-- views/templates/layout-unfold1.html | 14 +++----- views/templates/layout-unfold2.html | 35 +++++++++++++++++++ views/templates/view-login.html | 10 +++--- 12 files changed, 80 insertions(+), 44 deletions(-) create mode 100644 trash/templates/view-slice.html rename views/css/{layout-unfold1.css => layout-unfold2.css} (75%) create mode 100644 views/templates/layout-unfold2.html diff --git a/trash/dashboard.py b/trash/dashboard.py index cbe8bd4e..cd1ba3d6 100644 --- a/trash/dashboard.py +++ b/trash/dashboard.py @@ -68,8 +68,8 @@ def dashboard_view (request): # variables that will get passed to the view-plugin.html template template_env = {} - # define 'unfold1_main' to the template engine - template_env [ 'unfold1_main' ] = main_plugin.render(request) + # define 'unfold2_main' to the template engine + template_env [ 'unfold2_main' ] = main_plugin.render(request) # more general variables expected in the template template_env [ 'title' ] = 'Test view for a full request cycle' @@ -90,7 +90,7 @@ def dashboard_view (request): query=slices_query, ) # likewise but on the side view - template_env [ 'unfold1_margin' ] = related_plugin.render (request) + template_env [ 'unfold2_margin' ] = related_plugin.render (request) # add our own css in the mix page.add_css_files ( 'css/dashboard.css') diff --git a/trash/pluginview.py b/trash/pluginview.py index c836c764..c2939e1c 100644 --- a/trash/pluginview.py +++ b/trash/pluginview.py @@ -67,8 +67,8 @@ def test_plugin_view (request): title='QuickFilter in main content', criterias=quickfilter_criterias, ) ] ) - # define 'unfold1_main' to the template engine - template_env [ 'unfold1_main' ] = main_plugin.render(request) + # define 'unfold2_main' to the template engine + template_env [ 'unfold2_main' ] = main_plugin.render(request) ########## related_plugin = StaticList (page=page, @@ -77,7 +77,7 @@ def test_plugin_view (request): list=hard_wired_slice_names, header='Slices') # likewise but on the side view - template_env [ 'unfold1_margin' ] = related_plugin.render (request) + template_env [ 'unfold2_margin' ] = related_plugin.render (request) # more general variables expected in the template template_env [ 'title' ] = 'Test Plugin View' diff --git a/trash/sliceview.py b/trash/sliceview.py index 4f4202df..a1048bd0 100644 --- a/trash/sliceview.py +++ b/trash/sliceview.py @@ -76,7 +76,7 @@ def slice_view (request, slicename=tmp_default_slice): # variables that will get passed to the view-plugin.html template template_env = {} - # define 'unfold1_main' to the template engine + # define 'unfold2_main' to the template engine template_env [ 'unfold1_main' ] = main_plugin.render(request) # more general variables expected in the template @@ -98,7 +98,7 @@ def slice_view (request, slicename=tmp_default_slice): ### query=main_query, ### ) ### # likewise but on the side view -### template_env [ 'unfold1_margin' ] = related_plugin.render (request) +### template_env [ 'unfold2_margin' ] = related_plugin.render (request) ### ### # add our own css in the mix ### page.add_css_files ( 'css/hazelnut.css') @@ -113,5 +113,7 @@ def slice_view (request, slicename=tmp_default_slice): # define {js,css}_{files,chunks} prelude_env = page.prelude_env() template_env.update(prelude_env) - return render_to_response ('view-plugin.html',template_env, + result=render_to_response ('view-slice.html',template_env, context_instance=RequestContext(request)) + print 'result=',result + return result diff --git a/trash/templates/view-plugin.html b/trash/templates/view-plugin.html index 33610b82..7626ab1e 100644 --- a/trash/templates/view-plugin.html +++ b/trash/templates/view-plugin.html @@ -1,9 +1,9 @@ -{% extends 'layout-unfold1.html' %} +{% extends 'layout-unfold2.html' %} -{% block unfold1_main %} -{{ unfold1_main|safe }} -{% endblock unfold1_main %} +{% block unfold2_main %} +{{ unfold2_main|safe }} +{% endblock unfold2_main %} -{% block unfold1_margin %} -{{ unfold1_margin|safe }} -{% endblock unfold1_margin %} +{% block unfold2_margin %} +{{ unfold2_margin|safe }} +{% endblock unfold2_margin %} diff --git a/trash/templates/view-scroll.html b/trash/templates/view-scroll.html index 0755e81c..5fa9400b 100644 --- a/trash/templates/view-scroll.html +++ b/trash/templates/view-scroll.html @@ -1,6 +1,6 @@ -{% extends 'layout-unfold1.html' %} +{% extends 'layout-unfold2.html' %} -{% block unfold1_main %} +{% block unfold2_main %} {% insert_str prelude "css/sample.css" %} @@ -11,9 +11,9 @@
scroll3 area {{ lorem }}
scroll4 area {{ lorem }} {{ lorem }} {{ lorem }}
-{% endblock unfold1_main %} +{% endblock unfold2_main %} -{% block unfold1_margin %} +{% block unfold2_margin %}
-{% endblock unfold1_margin %} +{% endblock unfold2_margin %} diff --git a/trash/templates/view-slice.html b/trash/templates/view-slice.html new file mode 100644 index 00000000..75a10096 --- /dev/null +++ b/trash/templates/view-slice.html @@ -0,0 +1,5 @@ +{% extends 'layout-unfold1.html' %} + +{% block unfold1_main %} +{{ unfold1_main|safe }} +{% endblock unfold1_main %} diff --git a/trash/templates/view-tab.html b/trash/templates/view-tab.html index 2cc6817a..c3ba335c 100644 --- a/trash/templates/view-tab.html +++ b/trash/templates/view-tab.html @@ -1,6 +1,6 @@ -{% extends 'layout-unfold1.html' %} +{% extends 'layout-unfold2.html' %} -{% block unfold1_main %} +{% block unfold2_main %} {% insert_str prelude "css/sample.css" %} {% insert prelude_js %} @@ -58,13 +58,13 @@ $(function() {$('#mylougout').click(foo);}) decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum. -{% endblock unfold1_main %} +{% endblock unfold2_main %} -{% block unfold1_margin %} +{% block unfold2_margin %} This text is shorter on purpose Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. -{% endblock unfold1_margin %} +{% endblock unfold2_margin %} diff --git a/unfold/prelude.py b/unfold/prelude.py index 0d93822f..f576ed3d 100644 --- a/unfold/prelude.py +++ b/unfold/prelude.py @@ -48,7 +48,7 @@ class Prelude: # env['js_chunks']= '\n'.join(self.js_chunks) # env['css_chunks']='\n'.join(self.css_chunks) # return env - # together with this in layout-unfold1.html + # together with this in layout-unfold2.html # {% for js_file in js_files %} {% insert_str prelude js_file %} {% endfor %} # {% for css_file in css_files %} {% insert_str prelude css_file %} {% endfor %} # somehow however this would not work too well, diff --git a/views/css/layout-unfold1.css b/views/css/layout-unfold2.css similarity index 75% rename from views/css/layout-unfold1.css rename to views/css/layout-unfold2.css index ab6af8af..d91775c4 100644 --- a/views/css/layout-unfold1.css +++ b/views/css/layout-unfold2.css @@ -1,7 +1,7 @@ /* this relates to the unfold-layout1 template */ -#unfold1-main { +#unfold2-main { } -#unfold1-margin { +#unfold2-margin { padding: 10; background-color: #fff2ff; } diff --git a/views/templates/layout-unfold1.html b/views/templates/layout-unfold1.html index 9f7de2c3..8ce6cdc1 100644 --- a/views/templates/layout-unfold1.html +++ b/views/templates/layout-unfold1.html @@ -1,5 +1,4 @@ -{# This is required by insert_above #}{% insert_handler %} - +{# This is required by insert_above #}{% insert_handler %} MySlice - {{ title }} @@ -8,7 +7,7 @@ {{ header_prelude }} {# let's add these ones no matter what #} -{% insert_str prelude "css/layout-unfold1.css" %} +{# not yet needed {% insert_str prelude "css/layout-unfold1.css" %} #} {% insert_str prelude "js/jquery.js" %} {% insert_str prelude "js/init-all-plugins.js" %} @@ -19,16 +18,11 @@ {% endblock topmenu %}
-
+
{% block unfold1_main %} "The main content area (define block 'unfold1_main')" {% endblock unfold1_main %} -
-
- {% block unfold1_margin %} - "The related content area (define block 'related_main')" - {% endblock unfold1_margin %} -
+
{% endblock container %} diff --git a/views/templates/layout-unfold2.html b/views/templates/layout-unfold2.html new file mode 100644 index 00000000..75c30876 --- /dev/null +++ b/views/templates/layout-unfold2.html @@ -0,0 +1,35 @@ +{# This is required by insert_above #}{% insert_handler %} + + MySlice - {{ title }} + +{# This is where insert_str will end up #}{% media_container prelude %} + + +{{ header_prelude }} +{# let's add these ones no matter what #} +{% insert_str prelude "css/layout-unfold2.css" %} +{% insert_str prelude "js/jquery.js" %} +{% insert_str prelude "js/init-all-plugins.js" %} + +{% block container %} +
+ {% block topmenu %} + {% include 'widget-topmenu.html' %} + {% endblock topmenu %} +
+
+
+ {% block unfold2_main %} + "The main content area (define block 'unfold2_main')" + {% endblock unfold2_main %} +
+
+ {% block unfold2_margin %} + "The related content area (define block 'related_main')" + {% endblock unfold2_margin %} +
+
+
+{% endblock container %} + + diff --git a/views/templates/view-login.html b/views/templates/view-login.html index c17ae5d7..6cd126e4 100644 --- a/views/templates/view-login.html +++ b/views/templates/view-login.html @@ -1,10 +1,10 @@ -{% extends 'layout-unfold1.html' %} +{% extends 'layout-unfold2.html' %} -{% block unfold1_margin %} +{% block unfold2_margin %} {% include 'widget-login.html' %} -{% endblock unfold1_margin %} +{% endblock unfold2_margin %} -{% block unfold1_main %} +{% block unfold2_main %} This page is currently connected to two authentication systems: -{% endblock unfold1_main %} +{% endblock unfold2_main %} -- 2.43.0