summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@0d.be>2011-12-09 10:04:13 (GMT)
committerFrédéric Péters <fpeters@0d.be>2011-12-09 10:04:13 (GMT)
commit29337beaa34c282d4783f5a203bcce53b3153072 (patch)
treec43a9ed07e958286e5c69d37222ea05f110d24bb
parent7ad01f704da4c311bc3308739fdb66c00a7f201a (diff)
downloadtabellio.searchform-29337beaa34c282d4783f5a203bcce53b3153072.zip
tabellio.searchform-29337beaa34c282d4783f5a203bcce53b3153072.tar.gz
tabellio.searchform-29337beaa34c282d4783f5a203bcce53b3153072.tar.bz2
add link to help page, and question marks to fields (#1101)
-rw-r--r--tabellio/searchform/docsearch.pt34
-rw-r--r--tabellio/searchform/form.py8
2 files changed, 39 insertions, 3 deletions
diff --git a/tabellio/searchform/docsearch.pt b/tabellio/searchform/docsearch.pt
index ead9ea1..13984f5 100644
--- a/tabellio/searchform/docsearch.pt
+++ b/tabellio/searchform/docsearch.pt
@@ -23,8 +23,9 @@
<dl class="enableFormTabbing" id="search-tabs">
<dt id="fieldsetlegend-documents">Documents parlementaires</dt>
<dd id="fieldset-documents">
- <form method="post" action="./#resultsbox">
<div class="newsearch"><a href="./#fieldsetlegend-documents">Nouvelle recherche</a></div>
+ <div class="help-page"><a href="./aide-en-ligne">Aide en ligne</a></div>
+ <form method="post" action="./#resultsbox">
<div tal:replace="structure view/document_search_form"/>
</form>
@@ -64,8 +65,9 @@
</dd>
<dt id="fieldsetlegend-dossiers">Dossiers parlementaires</dt>
<dd id="fieldset-dossiers">
- <form method="post" action="./#resultsbox">
<div class="newsearch"><a href="./#fieldsetlegend-dossiers">Nouvelle recherche</a></div>
+ <div class="help-page"><a href="./aide-en-ligne">Aide en ligne</a></div>
+ <form method="post" action="./#resultsbox">
<div tal:replace="structure view/dossier_search_form"/>
</form>
@@ -105,6 +107,7 @@
<dt id="fieldsetlegend-questions">Questions &amp; interpellations</dt>
<dd id="fieldset-questions">
<div class="newsearch"><a href="./#fieldsetlegend-questions">Nouvelle recherche</a></div>
+ <div class="help-page"><a href="./aide-en-ligne">Aide en ligne</a></div>
<form method="post" action="./#resultsbox">
<div tal:replace="structure view/question_search_form"/>
</form>
@@ -183,10 +186,37 @@
<div tal:replace="structure provider:plone.belowcontentbody" />
+<ul id="help-links" style="display: none;">
+<li tal:repeat="link view/get_help_links"><a
+ class="help-link"
+ tal:attributes="href link/absolute_url; id link/id; title link/Description"
+ tal:content="link/Title">help text</a></li>
+</ul>
+
<script type="text/javascript" tal:content="string: var PORTAL_URL='${view/portal_url}';"></script>
<script metal:use-macro="view/js_macros/macros/labelboxes"></script>
<script metal:use-macro="view/js_macros/macros/sorton"></script>
<script metal:use-macro="view/js_macros/macros/droppablecheckboxes"></script>
+<script type="text/javascript">
+function setup_help_link(index, elem)
+{
+ var parts = elem.id.split('-');
+ var fieldname = parts[parts.length-1];
+ var help_link = $('#aide-'+fieldname).clone();
+ console.log('help_link:', help_link);
+ if (help_link.length > 0) {
+ help_link.text('?');
+ $(elem).find('label.horizontal').append(help_link);
+ }
+}
+
+(function($) {
+ $().ready(function() {
+ $('div.field').each(setup_help_link);
+ });
+})(jQuery);
+
+</script>
</tal:block>
</tal:main-macro>
diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py
index d20bfd7..ebff639 100644
--- a/tabellio/searchform/form.py
+++ b/tabellio/searchform/form.py
@@ -1014,6 +1014,13 @@ class SearchView(BrowserView):
sort_on='dateDoc')
return rs
+ def get_help_links(self):
+ try:
+ help_dir = getattr(getattr(self.context, 'aide-en-ligne'), 'aide-contextuelle')
+ except AttributeError:
+ return []
+ return help_dir.objectValues()
+
class Reflex(BrowserView):
def __call__(self):
@@ -1035,4 +1042,3 @@ class Reflex(BrowserView):
if not rs:
return self.request.response.redirect('.')
return self.request.response.redirect(rs[0].getURL())
-