Parcourir la source

[search] Added no collections page for normal users

Enrico Berti il y a 12 ans
Parent
commit
422db36502

+ 54 - 0
apps/search/src/search/templates/no_collections.mako

@@ -0,0 +1,54 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+
+<%!
+from desktop.views import commonheader, commonfooter
+from django.utils.translation import ugettext as _
+import urllib
+%>
+
+<%namespace name="macros" file="macros.mako" />
+
+${ commonheader(_('Search'), "search", user, "120px") | n,unicode }
+
+<style type="text/css">
+
+  .waiting {
+    font-size: 196px;
+    color: #DDD;
+  }
+
+  h1 {
+    margin-top: 50px;
+    color: #BBB;
+    line-height: 60px;
+  }
+
+</style>
+
+<div class="container-fluid">
+  <div class="row-fluid">
+    <div class="span10 offset1 center">
+
+      <i class="icon-search waiting"></i>
+      <h1>${ _('Oh no! It seems there is nothing to search on...') }</h1>
+
+    </div>
+  </div>
+</div>
+
+
+${ commonfooter(messages) | n,unicode }

+ 4 - 1
apps/search/src/search/views.py

@@ -47,7 +47,7 @@ def index(request):
     if request.user.is_superuser:
       return admin_collections_wizard(request)
     else:
-      raise PopupException(_('No collections! If user message, if admin send to wizard.'))
+      return no_collections(request)
 
   search_form = QueryForm(request.GET)
   response = {}
@@ -94,6 +94,9 @@ def index(request):
     'json': json,
   })
 
+def no_collections(request):
+  return render('no_collections.mako', request, {})
+
 
 @allow_admin_only
 def admin_collections(request):