summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-06-16 19:49:26 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-06-16 19:49:26 +0200
commite0d1b71fce2f62a81df082e28aa3430ba76cb07f (patch)
treeef4d23635c460c95352d971565ff66fb975893c4
parent5c805cfe9351664485862d0811ea940d988eef8e (diff)
parent72905a236226e28cb0f33918d85790141952f22b (diff)
downloadChimère - projet Saclay-e0d1b71fce2f62a81df082e28aa3430ba76cb07f.tar.bz2
Chimère - projet Saclay-e0d1b71fce2f62a81df082e28aa3430ba76cb07f.zip
Merge branch 'master-v2.2' into saclay-v2.2
Conflicts: templates/chimere/blocks/map.html
-rw-r--r--settings.py21
-rw-r--r--static/saclay/css/styles.css82
-rw-r--r--static/saclay/images/button-cat-three-off.pngbin0 -> 805 bytes
-rw-r--r--static/saclay/images/button-cat-three-on.pngbin0 -> 1232 bytes
-rw-r--r--static/saclay/images/button-route-three-off.pngbin0 -> 900 bytes
-rw-r--r--static/saclay/images/button-route-three-on.pngbin0 -> 806 bytes
-rw-r--r--static/saclay/images/button-search-off.pngbin0 -> 805 bytes
-rw-r--r--static/saclay/images/button-search-on.pngbin0 -> 640 bytes
-rw-r--r--templates/chimere/blocks/map.html80
-rw-r--r--templates/chimere/main_map.html19
10 files changed, 162 insertions, 40 deletions
diff --git a/settings.py b/settings.py
index f84e7db..99117a6 100644
--- a/settings.py
+++ b/settings.py
@@ -57,6 +57,8 @@ CHIMERE_DAYS_BEFORE_EVENT = 30
CHIMERE_ALL_DATED_ARE_FRONT = True
# allow feeds
CHIMERE_FEEDS = True
+# display a directory of items
+CHIMERE_DIRECTORY = False
CHIMERE_ICON_WIDTH = 36
CHIMERE_ICON_HEIGHT = 42
@@ -107,7 +109,7 @@ CHIMERE_ROUTING_ENGINE = {
}
CHIMERE_ROUTING_FAIL_MESSAGE = u"""<h3 class='warn'>Attention</h3>
-<p>Le moteur de routage a échoué dans sa recherche de trajet. Les points de
+<p>Le moteur de routage a échoué dans sa recherche de trajet. Les points de
départ ou d'arrivée sont peut-être trop loin d'une voie existante ou le trajet
est trop dangereux.</p>"""
@@ -117,13 +119,25 @@ NOMINATIM_URL = 'http://nominatim.openstreetmap.org/search'
CHIMERE_THUMBS_SCALE_HEIGHT=250
CHIMERE_THUMBS_SCALE_WIDTH=None
+# search engine
+CHIMERE_SEARCH_ENGINE = False
+HAYSTACK_CONNECTIONS = {
+ 'default': {
+ 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
+ 'URL': 'http://127.0.0.1:8080/solr',
+ 'INCLUDE_SPELLING': True,
+ },
+}
+HAYSTACK_SEARCH_RESULTS_PER_PAGE = 12
+HAYSTACK_AUTOCOMPLETE = False
+
# length of short description
CHIMERE_SHORT_DESC_LENGTH = 400
CHIMERE_MODIF_EMAIL = _(u"""Hello, I would like to propose you a modification about this item: """)
CHIMERE_ROUTING_WARN_MESSAGE = u"""<h3 class='warn'>Attention</h3>
-<p>Cet itinéraire comporte des passages dangereux, nous vous conseillons de
+<p>Cet itinéraire comporte des passages dangereux, nous vous conseillons de
modifier votre recherche.</p>
"""
@@ -288,6 +302,9 @@ try:
except ImportError, e:
print 'Unable to load local_settings.py:', e
+if CHIMERE_SEARCH_ENGINE:
+ INSTALLED_APPS.insert(INSTALLED_APPS.index('south'), 'haystack')
+
if DJANGO_EXTENSIONS:
INSTALLED_APPS.append('django_extensions')
diff --git a/static/saclay/css/styles.css b/static/saclay/css/styles.css
index c3b92ac..80d3396 100644
--- a/static/saclay/css/styles.css
+++ b/static/saclay/css/styles.css
@@ -447,6 +447,51 @@ a#ui-active-menuitem.ui-state-hover{
background-image:none;
}
+#search-box{
+ display:none;
+ left:7px;
+ top:10px;
+}
+
+#haystack-search{
+ width:35px;
+ height:28px;
+ background-image:url(../images/search.png);
+ background-repeat:no-repeat;
+ background-position:center;
+ background-color: #fff;
+ border: 1px solid #ddd;
+ vertical-align:top;
+}
+
+#search-listing img{
+ vertical-align:middle;
+}
+
+#search-listing ul{
+ padding:4px;
+}
+
+#search-listing ul li {
+ padding: 0;
+}
+
+ul.pager{
+ list-style:none;
+}
+
+ul.pager li{
+ display:block;
+}
+
+ul.pager.next{
+ float:right;
+}
+
+ul.pager.right{
+ float:right;
+}
+
#logos{
width:340px;
margin-left:auto;
@@ -757,6 +802,12 @@ ul#action{
margin-top:22px;
}
+#action-panel.three .action li {
+ padding: 0px;
+ height: 38px;
+ width: 92px;
+}
+
.action li,
.action li a,
.action li label{
@@ -903,9 +954,34 @@ ul#action{
background-repeat:no-repeat;
}
-#action-routing.state-active,
-#action-routing:hover{
- background-image:url(../images/button-route-on.png) ;
+.three #action-categories{
+ background-image:url(../images/button-cat-three-off.png) ;
+ margin-right:3px;
+}
+
+.three #action-categories.state-active,
+.three #action-categories:hover{
+ background-image:url(../images/button-cat-three-on.png) ;
+}
+
+.three #action-routing{
+ background-image:url(../images/button-route-three-off.png) ;
+}
+
+.three #action-routing.state-active,
+.three #action-routing:hover{
+ background-image:url(../images/button-route-three-on.png) ;
+}
+
+#action-search{
+ background-image:url(../images/button-search-off.png) ;
+ background-repeat:no-repeat;
+ margin-right:3px;
+}
+
+#action-search.state-active,
+#action-search:hover{
+ background-image:url(../images/button-search-on.png) ;
background-repeat:no-repeat;
}
diff --git a/static/saclay/images/button-cat-three-off.png b/static/saclay/images/button-cat-three-off.png
new file mode 100644
index 0000000..a581a6b
--- /dev/null
+++ b/static/saclay/images/button-cat-three-off.png
Binary files differ
diff --git a/static/saclay/images/button-cat-three-on.png b/static/saclay/images/button-cat-three-on.png
new file mode 100644
index 0000000..1c90751
--- /dev/null
+++ b/static/saclay/images/button-cat-three-on.png
Binary files differ
diff --git a/static/saclay/images/button-route-three-off.png b/static/saclay/images/button-route-three-off.png
new file mode 100644
index 0000000..ad65794
--- /dev/null
+++ b/static/saclay/images/button-route-three-off.png
Binary files differ
diff --git a/static/saclay/images/button-route-three-on.png b/static/saclay/images/button-route-three-on.png
new file mode 100644
index 0000000..ea096b3
--- /dev/null
+++ b/static/saclay/images/button-route-three-on.png
Binary files differ
diff --git a/static/saclay/images/button-search-off.png b/static/saclay/images/button-search-off.png
new file mode 100644
index 0000000..8aa6f96
--- /dev/null
+++ b/static/saclay/images/button-search-off.png
Binary files differ
diff --git a/static/saclay/images/button-search-on.png b/static/saclay/images/button-search-on.png
new file mode 100644
index 0000000..27f6d69
--- /dev/null
+++ b/static/saclay/images/button-search-on.png
Binary files differ
diff --git a/templates/chimere/blocks/map.html b/templates/chimere/blocks/map.html
index bc27287..133050a 100644
--- a/templates/chimere/blocks/map.html
+++ b/templates/chimere/blocks/map.html
@@ -35,11 +35,46 @@ $(function(){
}, false);
}
};
+ $('#sidebar-handler-hide').click(function(){
+ $('#sidebar').hide();
+ // Added for mobile - START //
+ //iOS
+ connectWebViewJavascriptBridge(
+ function(bridge) {
+ if(!bridge){
+ bridge.init(function(message, responseCallback) {
+ if (responseCallback) {
+ responseCallback("Right back atcha");
+ }
+ });
+ }
+ bridge.send('sidebarHide');
+ });
+ });
+ $('#sidebar-handler-show').click(function(){
+ $('#sidebar').show();
+ // Added for mobile - START //
+ //iOS
+ connectWebViewJavascriptBridge(
+ function(bridge) {
+ if(!bridge){
+ bridge.init(function(message, responseCallback) {
+ if (responseCallback) {
+ responseCallback("Right back atcha");
+ }
+ });
+ }
+ bridge.send('sidebarShow');
+ });
+
+ });
//fin lib ios
var routing_panel_open = function(){
$('#frm_categories').hide();
+ $('#search-box').hide();
$('#chimere_itinerary_panel').show();
$('#action-categories').removeClass('state-active');
+ $('#action-search').removeClass('state-active');
$('#action-routing').addClass('state-active');
};
@@ -47,46 +82,25 @@ $(function(){
var category_panel_open = function(){
$('#chimere_itinerary_panel').hide();
+ $('#search-box').hide();
$('#frm_categories').show();
$('#action-routing').removeClass('state-active');
+ $('#action-search').removeClass('state-active');
$('#action-categories').addClass('state-active');
};
$('#action-categories').click(category_panel_open);
- $('#sidebar-handler-hide').click(function(){
- $('#sidebar').hide();
- // Added for mobile - START //
- //iOS
- connectWebViewJavascriptBridge(
- function(bridge) {
- if(!bridge){
- bridge.init(function(message, responseCallback) {
- if (responseCallback) {
- responseCallback("Right back atcha");
- }
- });
- }
- bridge.send('sidebarHide');
- });
- });
- $('#sidebar-handler-show').click(function(){
- $('#sidebar').show();
- // Added for mobile - START //
- //iOS
- connectWebViewJavascriptBridge(
- function(bridge) {
- if(!bridge){
- bridge.init(function(message, responseCallback) {
- if (responseCallback) {
- responseCallback("Right back atcha");
- }
- });
- }
- bridge.send('sidebarShow');
- });
-
- });
+ var search_panel_open = function(){
+ $('#chimere_itinerary_panel').hide();
+ $('#frm_categories').hide();
+ $('#search-box').show();
+ $('#action-routing').removeClass('state-active');
+ $('#action-categories').removeClass('state-active');
+ $('#action-search').addClass('state-active');
+ };
+
+ $('#action-search').click(search_panel_open);
{% if single_category %}
$(function() {$('#panel').hide()});{% endif %}
diff --git a/templates/chimere/main_map.html b/templates/chimere/main_map.html
index a14ea3f..2acbba5 100644
--- a/templates/chimere/main_map.html
+++ b/templates/chimere/main_map.html
@@ -8,6 +8,9 @@
<script src="{{ STATIC_URL }}chimere/js/jquery.chimere.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}saclay/js/SaclayCloud.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}saclay/js/jquery.form.js" type="text/javascript"></script>
+{% if has_search %}
+<script src="{{ STATIC_URL }}chimere/js/search.js" type="text/javascript"></script>
+<script src="{{ STATIC_URL }}chimere/js/search-autocomplete.js" type="text/javascript"></script>{% endif %}
<script type='text/javascript' language='javascript'>
<!--
@@ -24,11 +27,13 @@
{% block sidebar %}
<div class='sidebar-handler' id='sidebar-handler-hide'>
</div>
- <div id='action-panel'>
+ <div id='action-panel'{% if has_search %} class='three'{% endif %}>
<ul id='map-actions' class='action'>
<li id='action-categories' class='state-active'>
<label>{% trans "Categories" %}</label>
- </li>{% if itinerary_form %}
+ </li>{% if has_search %}<li id='action-search'>
+ <label>{% trans "Search" %}</label>
+ </li>{% endif %}{% if itinerary_form %}
<li id='action-routing'>
<label>{% trans "Routing" %}</label>
</li>{% endif %}
@@ -51,6 +56,7 @@
<div id='categories'>{# dynamic content #}
</div>
</form>
+ <div id='search-box'></div>
{% routing %}
</div>
<div id='edit-panel'>
@@ -100,6 +106,15 @@
<script type="text/javascript">
<!--
$("#main-map").show();
+ var has_search = {% if has_search %}true{% else %}false{% endif %};
+ // array to keep trace of already displayed items
+ var search_result = new Array();
+ var search_url = "/search/";
+ $(function(){
+ if (has_search){
+ load_search_box();
+ }
+ });
// -->
</script>
{% map_menu %}