Commit 97186e7490b0d349e821973008ab335124b4fe84

Authored by Sergio Oliveira
1 parent c1b92d9a

Only start conversejs if not in a mobile device

requirements.txt
... ... @@ -7,6 +7,7 @@ pytz==2011n
7 7 chardet==1.0.1
8 8 python-dateutil==1.5
9 9 django-cliauth==0.9
  10 +django-mobile==0.3.0
10 11  
11 12 gunicorn
12 13 gevent
... ...
src/colab/custom_settings.py
... ... @@ -21,6 +21,7 @@ INSTALLED_APPS = INSTALLED_APPS + (
21 21 'raven.contrib.django.raven_compat',
22 22 'south',
23 23 'cliauth',
  24 + 'django_mobile',
24 25 'django_browserid',
25 26 'conversejs',
26 27  
... ... @@ -118,6 +119,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
118 119 'django.contrib.messages.context_processors.messages',
119 120 'django.core.context_processors.request',
120 121 'django_browserid.context_processors.browserid',
  122 + 'django_mobile.context_processors.is_mobile',
121 123 )
122 124  
123 125 MIDDLEWARE_CLASSES = (
... ... @@ -128,6 +130,8 @@ MIDDLEWARE_CLASSES = (
128 130 'django.contrib.auth.middleware.AuthenticationMiddleware',
129 131 'django.contrib.messages.middleware.MessageMiddleware',
130 132 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  133 + 'django_mobile.middleware.MobileDetectionMiddleware',
  134 + 'django_mobile.middleware.SetFlavourMiddleware',
131 135 )
132 136  
133 137 # Add the django_browserid authentication backend.
... ...
src/templates/base.html
... ... @@ -10,7 +10,9 @@
10 10 href="{{ STATIC_URL }}third-party/font-awesome/css/font-awesome.min.css"
11 11 type="text/css" media="screen" charset="utf-8"/>
12 12  
13   - {% conversejs_static %}
  13 + {% if not is_mobile %}
  14 + {% conversejs_static %}
  15 + {% endif %}
14 16  
15 17 <link rel="stylesheet" href="{{ STATIC_URL }}css/screen.css"
16 18 type="text/css" media="screen" charset="utf-8"/>
... ... @@ -156,10 +158,11 @@
156 158 {% endblock %}
157 159 </div>
158 160  
159   - <div class="visible-lg">
  161 +
  162 + {% if not is_mobile %}
160 163 {% conversejs_chatpanel %}
161   - </div>
162   - {% conversejs_initialize %}
  164 + {% conversejs_initialize %}
  165 + {% endif %}
163 166  
164 167 {% browserid_js %}
165 168 </body>
... ...