diff options
-rw-r--r-- | settings.py | 55 | ||||
-rw-r--r-- | static/saclay/css/styles.css | 98 | ||||
-rw-r--r-- | static/saclay/images/button-cat-three-off.png | bin | 0 -> 4039 bytes | |||
-rw-r--r-- | static/saclay/images/button-cat-three-on.png | bin | 0 -> 3957 bytes | |||
-rw-r--r-- | static/saclay/images/button-route-three-off.png | bin | 0 -> 3604 bytes | |||
-rw-r--r-- | static/saclay/images/button-route-three-on.png | bin | 0 -> 3499 bytes | |||
-rw-r--r-- | static/saclay/images/button-search-off.png | bin | 0 -> 3736 bytes | |||
-rw-r--r-- | static/saclay/images/button-search-on.png | bin | 0 -> 3556 bytes | |||
-rw-r--r-- | static/saclay/images/search.png | bin | 0 -> 686 bytes | |||
-rw-r--r-- | templates/chimere/blocks/map.html | 80 | ||||
-rw-r--r-- | templates/chimere/blocks/share_bar.html | 2 | ||||
-rw-r--r-- | templates/chimere/detail.html | 2 | ||||
-rw-r--r-- | templates/chimere/main_map.html | 19 |
13 files changed, 200 insertions, 56 deletions
diff --git a/settings.py b/settings.py index 190a0b4..0a9ba06 100644 --- a/settings.py +++ b/settings.py @@ -30,11 +30,11 @@ JQUERY_CSS_URLS = [] OSM_CSS_URLS = ["http://www.openlayers.org/api/theme/default/style.css"] GPSBABEL = '/usr/bin/gpsbabel' -# simplify with an error of 5 meters +# simplify with an error of 5 meters GPSBABEL_OPTIONS = 'simplify,crosstrack,error=0.005k' # GPSBABEL_OPTIONS = 'simplify,count=100' -# chimere specific ## +# # chimere specific ## CHIMERE_DEFAULT_ZOOM = 10 # center of the map CHIMERE_DEFAULT_CENTER = (-1.679444, 48.114722) @@ -58,6 +58,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 @@ -91,17 +93,18 @@ CHIMERE_ENABLE_CLUSTERING = False # enable routing in Chimère CHIMERE_ENABLE_ROUTING = False -CHIMERE_ROUTING_TRANSPORT = (('foot', _(u"Foot")), - ('bicycle', _(u"Bicycle")), - ('motorcar', _(u"Motorcar")), - ) +CHIMERE_ROUTING_TRANSPORT = ( + ('foot', _(u"Foot")), + ('bicycle', _(u"Bicycle")), + ('motorcar', _(u"Motorcar")), +) -CHIMERE_ROUTING_SPEEDS = {'foot': ((3, _(u"You are walking slowly")), - (6, _(u"You are walking pretty quickly")),), - 'bicycle': ((16, _(u"You are riding pretty slowly")), - (22, _(u"You are riding pretty quickly")) - ) - } +CHIMERE_ROUTING_SPEEDS = { + 'foot': ((3, _(u"You are walking slowly")), + (6, _(u"You are walking pretty quickly")),), + 'bicycle': ((16, _(u"You are riding pretty slowly")), + (22, _(u"You are riding pretty quickly")),) +} # available routing engine: 'routino' CHIMERE_ROUTING_ENGINE = { @@ -121,6 +124,18 @@ 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 @@ -188,7 +203,6 @@ MEDIA_URL = '/media/' TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', - # 'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( @@ -287,11 +301,25 @@ LOGGING = { }, } +CHIMERE_SEARCH_ENGINE = False +# default haystack parameters when search engine is activated +HAYSTACK_CONNECTIONS = { + 'default': { + 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', + 'URL': 'http://127.0.0.1:8080/solr' + }, +} +HAYSTACK_SEARCH_RESULTS_PER_PAGE = 12 +HAYSTACK_AUTOCOMPLETE = False + try: from local_settings import * 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') @@ -303,7 +331,6 @@ if not JQUERY_CSS_URLS: JQUERY_CSS_URLS = (STATIC_URL + 'jquery-ui/smoothness/jquery-ui.css', STATIC_URL + 'jquery-ui/base/jquery.ui.all.css') - LOGGING['handlers']['logfile']['filename'] = LOGFILENAME if 'CHIMERE_SHARE_NETWORKS' not in globals(): diff --git a/static/saclay/css/styles.css b/static/saclay/css/styles.css index 683d7ee..6046bb2 100644 --- a/static/saclay/css/styles.css +++ b/static/saclay/css/styles.css @@ -72,6 +72,10 @@ caption{ font-size:0.9em; } +#detail_footer a { + display: inline-block; +} + /* * Background colors */ @@ -441,6 +445,50 @@ a#ui-active-menuitem.ui-state-hover{ background-image:none; } +#search-box{ + display:none; + left:7px; + top:10px; + width: 281px; +} + +#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; + width:100%; +} + +ul.pager .next{ + text-align:right; +} + + #logos{ width:340px; margin-left:auto; @@ -751,6 +799,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{ @@ -897,9 +951,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; } @@ -1058,11 +1137,12 @@ div#action-panel{ background-image:url(../images/background-small.png) ; background-repeat:repeat; background-position:center; + border-right:1px solid; } div#panel{ position:absolute; - width:281px; + width:282px; z-index:10; max-height:none; padding:0; @@ -1074,6 +1154,7 @@ div#panel{ background-repeat:repeat-x; background-position:left bottom; overflow-x:hidden; + border-right:1px solid; } /* share toolbar */ @@ -1089,12 +1170,19 @@ a.share_id_email_single{ font-size:0; } +ul.share { + display: inline; + text-align: center; + font-style: normal; + padding: 2px 0; +} + #footer-panel{ text-align:center; padding:3px; bottom:0; position:absolute; - width:275px; + width:276px; height:22px; border-right:1px solid #999; border-left:1px solid #999; diff --git a/static/saclay/images/button-cat-three-off.png b/static/saclay/images/button-cat-three-off.png Binary files differnew file mode 100644 index 0000000..9d728de --- /dev/null +++ b/static/saclay/images/button-cat-three-off.png diff --git a/static/saclay/images/button-cat-three-on.png b/static/saclay/images/button-cat-three-on.png Binary files differnew file mode 100644 index 0000000..d9bcc7e --- /dev/null +++ b/static/saclay/images/button-cat-three-on.png diff --git a/static/saclay/images/button-route-three-off.png b/static/saclay/images/button-route-three-off.png Binary files differnew file mode 100644 index 0000000..388fd9d --- /dev/null +++ b/static/saclay/images/button-route-three-off.png diff --git a/static/saclay/images/button-route-three-on.png b/static/saclay/images/button-route-three-on.png Binary files differnew file mode 100644 index 0000000..9581525 --- /dev/null +++ b/static/saclay/images/button-route-three-on.png diff --git a/static/saclay/images/button-search-off.png b/static/saclay/images/button-search-off.png Binary files differnew file mode 100644 index 0000000..9188039 --- /dev/null +++ b/static/saclay/images/button-search-off.png diff --git a/static/saclay/images/button-search-on.png b/static/saclay/images/button-search-on.png Binary files differnew file mode 100644 index 0000000..b7ed487 --- /dev/null +++ b/static/saclay/images/button-search-on.png diff --git a/static/saclay/images/search.png b/static/saclay/images/search.png Binary files differnew file mode 100644 index 0000000..0eff19b --- /dev/null +++ b/static/saclay/images/search.png diff --git a/templates/chimere/blocks/map.html b/templates/chimere/blocks/map.html index 6273576..037d5a8 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/blocks/share_bar.html b/templates/chimere/blocks/share_bar.html index aaa9fc4..b23c9e2 100644 --- a/templates/chimere/blocks/share_bar.html +++ b/templates/chimere/blocks/share_bar.html @@ -8,7 +8,7 @@ {% if not email_only %}<li class='share-icon'><a href="#">{% trans "Share" %}</a></li>{% for share_network in share_networks %} <li class='shared'><a class='share_link share_id_{{share_network.0}}' href='{{share_network.1}}'><img src="{{share_network.2}}" alt="{{share_network.0}}"/></a></li> {% endfor %} - <li class='shared'><a href='{% url chimere:feeds-global %}'><img src='{{STATIC_URL}}chimere/img/feed.png' alt='Feeds'/></a></li>{%endif%} + {% if rss %}<li class='shared'><a href='{% url chimere:feeds-global %}'><img src='{{STATIC_URL}}chimere/img/feed.png' alt='Feeds'/></a></li>{% endif %}{%endif%} </ul>{% endif %} <script type='text/javascript'> <!-- diff --git a/templates/chimere/detail.html b/templates/chimere/detail.html index c0f9d64..65e9600 100644 --- a/templates/chimere/detail.html +++ b/templates/chimere/detail.html @@ -42,7 +42,7 @@ <li><a href="{{modif_by_email}}">{% trans "Propose a modification" %}</a></li> <li class='sep'>–</li> </ul> - {% share_bar marker.name %} + {% share_bar marker.name '' '' %} {% comment %} <a href='{% if marker.route %}{% url chimere:editroute-item area_name_slash|default_if_none:"" marker.route.pk "" %}{%else%}{% url chimere:edit-item area_name_slash|default_if_none:"" marker.pk "" %}{%endif%}'> {% trans "Submit a modification" %} 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 %} |