changeset 2041:e1cf79737e15

rework issue 329 fix to eliminate redundant code in foobar theme by using (modernized) macro
author Roger Haase <crosseyedpenguin@yahoo.com>
date Fri, 08 Mar 2013 11:56:10 -0700
parents 4307c3e76076
children e02cf4c80881
files MoinMoin/templates/base.html MoinMoin/templates/blog/utils.html MoinMoin/templates/layout.html MoinMoin/templates/utils.html MoinMoin/themes/foobar/static/css/common.css MoinMoin/themes/foobar/static/css/stylus/main.styl MoinMoin/themes/foobar/templates/blog/layout.html MoinMoin/themes/foobar/templates/layout.html MoinMoin/themes/modernized/static/css/common.css MoinMoin/themes/modernized/static/css/stylus/main.styl
diffstat 10 files changed, 41 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/base.html	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/templates/base.html	Fri Mar 08 11:56:10 2013 -0700
@@ -3,6 +3,13 @@
 {%- set head = snippets.head() %}
 {%- set scripts = snippets.scripts() %}
 {%- set stylesheets = snippets.stylesheets() %}
+
+{# This allows child templates passing their header_search macro to the common layout (eg blog).
+   If there is no header_search macro defined in child templates use the default one. #}
+{% if not header_search %}
+    {% from "utils.html" import header_search %}
+{% endif %}
+
 <html>
 <head>
 {% block head %}
--- a/MoinMoin/templates/blog/utils.html	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/templates/blog/utils.html	Fri Mar 08 11:56:10 2013 -0700
@@ -59,7 +59,6 @@
 
 {% macro header_search(blog_name, form) %}
     {{ gen.form.open(form, id='moin-searchform', method='get', action=url_for('frontend.search')) }}
-        <div>
             {{ forms.render(form['q']) }}
             {{ forms.render_submit(form, id='moin-search-submit') }}
             {{ forms.render_errors(form) }}
@@ -67,6 +66,5 @@
             <input type="checkbox" id="moin-blog-search-this"
             onclick="$('#moin-searchform').attr('action', this.checked ? '{{ url_for('frontend.search', item_name=blog_name) }}' : '{{ url_for('frontend.search') }}' );" />
             {{ _("only this blog") }}
-        </div>
     {{ gen.form.close() }}
 {% endmacro %}
--- a/MoinMoin/templates/layout.html	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/templates/layout.html	Fri Mar 08 11:56:10 2013 -0700
@@ -10,13 +10,6 @@
 {% set creditlogos = snippets.creditlogos() %}
 {% set credits = snippets.credits() %}
 
-
-{# This allows child templates passing their header_search macro to the common layout.
-   If there is no header_search macro defined in child templates use the default one. #}
-{% if not header_search %}
-    {% from "utils.html" import header_search %}
-{% endif %}
-
 {% block layout %}
 
 <div id="moin-main-wrapper">
--- a/MoinMoin/templates/utils.html	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/templates/utils.html	Fri Mar 08 11:56:10 2013 -0700
@@ -97,10 +97,8 @@
 
 {% macro header_search(form) %}
     {{ gen.form.open(form, id='moin-searchform', method='get', action=url_for('frontend.search')) }}
-        <div>
             {{ forms.render(form['q']) }}
             {{ forms.render_submit(form, id='moin-search-submit') }}
             {{ forms.render_errors(form) }}
-        </div>
     {{ gen.form.close() }}
 {% endmacro %}
--- a/MoinMoin/themes/foobar/static/css/common.css	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/themes/foobar/static/css/common.css	Fri Mar 08 11:56:10 2013 -0700
@@ -179,7 +179,7 @@
 #moin-global-tray{float:left;width:16.666666666666668%;padding:.5%;overflow:hidden}
 #moin-main-container{float:left;width:81.13333333333333%;padding:.5%}
 #moin-main-box{background-color:#f4f4f4;border:1px solid #ccc;border-radius:6px;box-shadow:2px 2px 4px #9d9d9b;overflow:hidden}
-#moin-header{background-color:#2d2d2d;color:#fff;border-bottom:1px solid #ccc;padding:.2% .5%;overflow:auto;}
+#moin-header{background-color:#2d2d2d;color:#fff;border-bottom:1px solid #ccc;padding:0;overflow:auto;}
 #moin-header a{color:#fff}
 #moin-content-no-panel{float:left;width:98.56746096959736%;padding:.6162695152013148%;border-right:1px solid #ccc}
 #moin-content{float:left;width:76.79260476581759%;padding:.6162695152013148%;border-right:1px solid #ccc}
@@ -190,8 +190,6 @@
 #moin-interwiki a{vertical-align:middle}
 #moin-pagelocation{vertical-align:middle}
 .moin-pagepath{vertical-align:middle}
-#moin-search{float:right;padding:.3em .5em .2em .5em}
-#moin-search-submit{vertical-align:middle}
 #moin-logo{width:100%;padding:0 0 1em 0;}
 #moin-logo a{display:block;width:100%;height:70px;background-repeat:no-repeat;background-position:center center}
 #moin-global-panel ul,#moin-local-panel ul{list-style-type:none;margin:0;}
@@ -336,16 +334,13 @@
 .moin-flash-warning{background-image:url("../img/smileys/alert.png");color:#ff2727}
 .moin-flash-error{background-image:url("../img/smileys/icon-error.png");color:#ff2727}
 .moin-error{color:#ff2727;background:#d6d5d0;padding:4px;margin:1em;text-align:center;list-style-type:none;border-radius:5px}
-#moin-searchform{padding:0;font-size:.82em;float:right;text-align:right;}
-#moin-searchform input{font-size:1em;vertical-align:middle;background-color:#f4f4f4;border:1px solid #ccc}
-#moin-searchform button{box-shadow:none}
-#moin-searchform #moin-search-submit{text-indent:-9000%;margin-left:-24px;padding:0;width:20px;height:16px;background:url("../img/moin-search.png") center center no-repeat;background-size:16px 16px;border:none;overflow:hidden;vertical-align:middle;cursor:pointer}
-#moin-searchform #moin-search-query{padding-right:20px}
-#moin-searchform div{margin:0}
+#moin-searchform{margin:7px 12px 0 0;font-size:.82em;text-align:right;float:right;padding:0;width:15em;}
+#moin-searchform input{font-size:1em;vertical-align:middle;background-color:#f4f4f4;border:0;box-shadow:none}
+#moin-search-submit{text-indent:-9000%;margin-left:-24px;padding:0;width:20px;height:16px;background:url("../img/moin-search.png") center center no-repeat;background-size:16px 16px;border:none;overflow:hidden;vertical-align:middle;cursor:pointer}
+#moin-search-query{padding-right:20px}
 #moin-long-searchform{padding:0;font-size:.82em;text-align:left;}
 #moin-long-searchform div{margin:0}
 #moin-long-searchform label{display:inline}
-#moin-search-query{width:50%}
 .searchresults dt{margin-top:1em;font-weight:normal}
 .searchresults dd,.searchresults p{font-size:.85em}
 .searchresults td{border-width:0}
@@ -445,5 +440,5 @@
 .moin-big{font-size:1.17em}
 .moin-small{font-size:.83em}
 .moin-integer{text-align:right;padding-right:1em;width:2%}
-@media print{#moin-global-tray,#moin-local-panel,#moin-footer,#moin-search{display:none}
+@media print{#moin-global-tray,#moin-local-panel,#moin-footer,#moin-searchform{display:none}
 }
--- a/MoinMoin/themes/foobar/static/css/stylus/main.styl	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/themes/foobar/static/css/stylus/main.styl	Fri Mar 08 11:56:10 2013 -0700
@@ -83,7 +83,7 @@
     background-color header_bg_color
     color heading_color
     border-bottom border_style
-    padding 0.2% 0.5%
+    padding 0
     overflow auto
     a
         color heading_color
@@ -135,13 +135,6 @@
 .moin-pagepath
     vertical-align middle
 
-#moin-search
-    float opposite-position(dir)
-    padding 0.3em 0.5em 0.2em 0.5em
-
-#moin-search-submit
-    vertical-align middle
-
 // panels, footer
 #moin-logo
     width 100%
@@ -759,19 +752,20 @@
 
 // search
 #moin-searchform
-    padding 0
+    margin 7px 12px 0px 0px
     font-size 0.82em
-    float right
     text-align right
+    float opposite-position(dir)
+    padding 0
+    width 15em
     input
         font-size 1em
         vertical-align middle
         background-color page_color
-        border border_style
-    button
+        border 0
         box-shadow none
 
-#moin-searchform #moin-search-submit
+#moin-search-submit
     text-indent -9000%
     margin-left -24px
     padding 0px
@@ -784,11 +778,9 @@
     vertical-align middle
     cursor pointer
 
-#moin-searchform #moin-search-query
+#moin-search-query
     padding-right 20px
 
-#moin-searchform div
-    margin 0
 
 #moin-long-searchform
     padding 0
@@ -799,9 +791,6 @@
     label
         display inline
 
-#moin-search-query
-    width 50%
-
 .searchresults
     dt
         margin-top 1em
@@ -1172,5 +1161,5 @@
     #moin-global-tray
     #moin-local-panel
     #moin-footer
-    #moin-search
+    #moin-searchform
         display none
--- a/MoinMoin/themes/foobar/templates/blog/layout.html	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/themes/foobar/templates/blog/layout.html	Fri Mar 08 11:56:10 2013 -0700
@@ -7,6 +7,12 @@
     {% set supertags = blog_item.meta['supertags'] %}
 {% endif %}
 
+{% if blog_name %}
+    {% macro header_search(form) %}
+        {{ blog_utils.header_search(blog_name, form) }}
+    {% endmacro %}
+{% endif %}
+
 {% block theme_stylesheets %}
     {{ super() }}
     <link media="all" rel="stylesheet" href="{{ theme_static('css/blog.css') }}" />
--- a/MoinMoin/themes/foobar/templates/layout.html	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/themes/foobar/templates/layout.html	Fri Mar 08 11:56:10 2013 -0700
@@ -11,7 +11,6 @@
 {% set footer_items = '' %}
 {% set credits = snippets.credits() %}
 
-
 {% block layout %}
 
 <div id="moin-global-tray">
@@ -103,15 +102,11 @@
 <div id="moin-main-container">
 <div id="moin-main-box">
 <div id="moin-header">
+
     {% if search_form %}
-    <div id="moin-search">
-    {{ gen.form.open(search_form, id='moin-searchform', method='get', action=url_for('frontend.search')) }}
-        {{ gen.input(search_form['q'], type='search', id='moin-search-query', size='40') }}
-        {{ forms.render_submit(search_form, id='moin-search-submit') }}
-        {{ forms.render_errors(search_form) }}
-    {{ gen.form.close() }}
-    </div>
+        {{ header_search(search_form) }}
     {% endif %}
+
     <div id="moin-breadcrumbs-location">
         {% if cfg.show_interwiki -%}
         <span id="moin-interwiki">
--- a/MoinMoin/themes/modernized/static/css/common.css	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/themes/modernized/static/css/common.css	Fri Mar 08 11:56:10 2013 -0700
@@ -442,11 +442,9 @@
 a.moin-nonexistent:hover{color:#1f9ae0;text-decoration:underline}
 .current-link{color:inherit !important}
 #moin-header{margin:0;padding:7px 0 10px 0;background:#708090;color:#fff;line-height:1.12em;border-bottom-left-radius:9px;border-bottom-right-radius:9px}
-#moin-searchform{margin:8px .5em;padding:0;font-size:.82em;float:right;text-align:right;width:15em}
-#moin-searchform input{font-size:100%;vertical-align:middle;background-color:#fff;border:1px solid #4e7da9}
-#moin-searchform #moin-search-submit{text-indent:-9000%;margin-left:-26px;width:20px;height:16px;background:url("../img/moin-search.png") center center no-repeat;background-size:16px 16px;border:none;overflow:hidden;vertical-align:middle;cursor:pointer;padding:0;box-shadow:none}
-#moin-searchform #moin-search-query{padding-right:20px}
-#moin-searchform div{margin:-6px 5px 0 0}
+#moin-searchform{margin:2px 12px 0 0;padding:0;font-size:.82em;float:right;text-align:right;width:15em}
+#moin-search-submit{text-indent:-9000%;margin-left:-26px;width:20px;height:16px;background:url("../img/moin-search.png") center center no-repeat;background-size:16px 16px;border:none;overflow:hidden;vertical-align:middle;cursor:pointer;padding:0;box-shadow:none}
+#moin-search-query{padding-right:20px;font-size:100%;vertical-align:middle;background-color:#fff;border:1px solid #4e7da9}
 #moin-long-searchform{padding:0;font-size:.82em;text-align:left}
 #moin-long-searchform div{margin:0}
 #moin-search-query{width:50%}
--- a/MoinMoin/themes/modernized/static/css/stylus/main.styl	Sun Mar 03 12:58:29 2013 -0700
+++ b/MoinMoin/themes/modernized/static/css/stylus/main.styl	Fri Mar 08 11:56:10 2013 -0700
@@ -1186,20 +1186,14 @@
     border-bottom-right-radius 9px
 
 #moin-searchform
-    margin 8px .5em
+    margin 2px 12px 0px 0px
     padding 0
     font-size 0.82em
     float right
     text-align right
     width 15em
 
-#moin-searchform input
-    font-size 100%
-    vertical-align middle
-    background-color page_color
-    border border_style
-
-#moin-searchform #moin-search-submit
+#moin-search-submit
     text-indent -9000%
     margin-left -26px
     width 20px
@@ -1213,11 +1207,13 @@
     padding 0px
     box-shadow none
 
-#moin-searchform #moin-search-query
+#moin-search-query
     padding-right 20px
+    font-size 100%
+    vertical-align middle
+    background-color page_color
+    border border_style
 
-#moin-searchform div
-    margin -6px 5px 0px 0px
 
 #moin-long-searchform
     padding 0