From 6633e95b89c1d1eba9b7b0e612becaf11b085d69 Mon Sep 17 00:00:00 2001 From: arno Date: Sat, 26 Mar 2011 09:31:45 +0100 Subject: [PATCH] better mobile support --- application/controllers/IdxController.php | 1 + application/views/scripts/idx/index.phtml | 3 ++- public/css/syj.css | 8 ++++++++ public/js/syj.js | 14 ++++++++++++-- public/js/utils.js | 16 +++++++++++----- public/modifiablepath | 2 +- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/application/controllers/IdxController.php b/application/controllers/IdxController.php index d24b71c..c049809 100644 --- a/application/controllers/IdxController.php +++ b/application/controllers/IdxController.php @@ -11,6 +11,7 @@ class IdxController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet('css/generic.css', "screen"); $this->view->headLink()->appendStylesheet('css/syj.css', "screen"); $this->view->headLink()->appendStylesheet('css/syjprint.css', "print"); + $this->view->headMeta()->appendName('viewport', 'width=640px'); } public function rawmode(Syj_Model_Path $path) { diff --git a/application/views/scripts/idx/index.phtml b/application/views/scripts/idx/index.phtml index ac7e9dd..455f90b 100644 --- a/application/views/scripts/idx/index.phtml +++ b/application/views/scripts/idx/index.phtml @@ -13,7 +13,7 @@ errorMsg) { $message .= $this->errorMsg; $msgclass = "error"; @@ -23,6 +23,7 @@ if ($this->errorMsg) { $message .= $this->translate('To create a journey, just press "start a route" button, then click on the map to add points to your route. You can zoom and move the map with the controls in the top left corner'); $message .= "
"; $message .= $this->translate('When you have finished a path, press "create", button.'); + $msgclass = "info optional"; } ?> diff --git a/public/css/syj.css b/public/css/syj.css index d6ce283..9dc2a69 100644 --- a/public/css/syj.css +++ b/public/css/syj.css @@ -46,6 +46,11 @@ body, html { -webkit-border-radius: 5px; border-radius: 5px; } +@media screen and (max-width: 640px) { + #message.optional { + display: none; + } +} /* * menu rules @@ -78,6 +83,7 @@ body, html { -webkit-border-radius: 5px; border-radius: 5px; background-color: white; + cursor: pointer; } .menu-item:hover { background-color: #E0E0FF; @@ -117,6 +123,7 @@ body, html { #data_controls { position: absolute; + z-index: 11; /* to be over login-controls */ right: 0.5em; bottom: 3em; text-align: center; @@ -175,6 +182,7 @@ body, html { background-color: white; padding: 5px 1px 5px 1px; position: relative; /* otherwise, under #map in ie */ + margin-bottom: 10px; } /* nominatim-suggestions */ diff --git a/public/js/syj.js b/public/js/syj.js index a72dbb7..78d7606 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -100,7 +100,12 @@ var SYJDataUi = (function() { if (!infotoggler) { infotoggler = new Toggler('path-infos-content'); $("path-infos-toggler").insert({bottom: infotoggler.element}); - $("path-infos-anchor").observe('click', function(evt) { + var anchor = $("path-infos-anchor"); + var parent = anchor.up('.menu-item'); + if (parent) { + anchor = parent; + } + anchor.observe('click', function(evt) { evt.stop(); infotoggler.toggle(evt); }); @@ -658,7 +663,12 @@ var SYJModalClass = Class.create({ closeMethods: ["onescapekey", "onouterclick", "onbutton"] }); - $(this.type + "_control_anchor").observe("click", function(evt) { + var anchor = $(this.type + '_control_anchor'); + var parent = anchor.up('.menu-item'); + if (parent) { + anchor = parent; + } + anchor.observe("click", function(evt) { this.modalbox.show(); evt.stop(); }.bindAsEventListener(this)); diff --git a/public/js/utils.js b/public/js/utils.js index 447ea34..8936797 100644 --- a/public/js/utils.js +++ b/public/js/utils.js @@ -438,10 +438,16 @@ Element.addMethods('div', { }, setMessageStatus: function(div, status) { - return div.removeClassName('error'). - removeClassName('warn'). - removeClassName('info'). - removeClassName('success'). - addClassName(status); + $A(["error", "warn", "info", "success", "optional"]).each(function(clname) { + div.removeClassName(clname); + }); + if (typeof status === "string") { + div.addClassName(status); + } else { + $A(status).each(function(clname) { + div.addClassName(clname); + }); + } + return div; } }); diff --git a/public/modifiablepath b/public/modifiablepath index e0ddb08..f92ab9b 160000 --- a/public/modifiablepath +++ b/public/modifiablepath @@ -1 +1 @@ -Subproject commit e0ddb083172efd0ac1af0436e695ac180d3d7b74 +Subproject commit f92ab9b8184be61241eec13d8dd470f35c10fc4b -- 2.39.2