home and ticket style
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 20 Feb 2014 18:03:10 +0000 (19:03 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 20 Feb 2014 18:03:10 +0000 (19:03 +0100)
portal/contactview.py
portal/homeview.py
portal/static/css/onelab.css
portal/templates/contact.html
portal/templates/onelab/_widget-login-user.html
portal/templates/onelab/home-view.html
ui/static/img/icon_support_small.png [new file with mode: 0644]

index a97d697..63b4bb0 100644 (file)
@@ -33,7 +33,11 @@ class ContactView (FreeAccessView, ThemeView):
 
             msg = render_to_string('contact-support-email.txt', form.cleaned_data)
             send_mail("Onelab user %s submitted a query "%email, msg, email, recipients)
-            return render(request,'contact_sent.html', { 'theme' : self.theme}) # Redirect after POST
+            if request.user.is_authenticated() :
+                username = request.user.email
+            else :
+                username = None
+            return render(request,'contact_sent.html', { 'theme' : self.theme,  'username': username}) # Redirect after POST
         else:
             return self._display (request, form)
 
@@ -41,9 +45,13 @@ class ContactView (FreeAccessView, ThemeView):
         return self._display (request, ContactForm()) # A fresh unbound form
         
     def _display (self, request, form):
+        if request.user.is_authenticated() :
+            username = request.user.email
+        else :
+            username = None
         return render(request, 'contact.html', {
                 'form': form,
                 'topmenu_items': topmenu_items('Contact', request),
-                'username': the_user (request),
-                'theme' : self.theme
+                'theme' : self.theme,
+                'username': username,
                 })
index 5704164..395cd96 100644 (file)
@@ -44,6 +44,7 @@ class HomeView (FreeAccessView, ThemeView):
             # let's use ManifoldResult.__repr__
             env['state']="%s"%manifoldresult
             env['layout_1_or_2']="layout-unfold2.html"
+            
             return render_to_response(self.template,env, context_instance=RequestContext(request))
         # user was authenticated at the backend
         elif auth_result is not None:
@@ -51,18 +52,24 @@ class HomeView (FreeAccessView, ThemeView):
             if user.is_active:
                 print "LOGGING IN"
                 login(request, user)
-                return HttpResponseRedirect ('/login-ok')
+                
+                if request.user.is_authenticated(): 
+                    env['person'] = self.request.user
+                else: 
+                    env['person'] = None
+                return render_to_response(self.template,env, context_instance=RequestContext(request))
             else:
                 env['state'] = "Your account is not active, please contact the site admin."
                 env['layout_1_or_2']="layout-unfold2.html"
+                
                 return render_to_response(self.template,env, context_instance=RequestContext(request))
         # otherwise
         else:
             env['state'] = "Your username and/or password were incorrect."
             env['layout_1_or_2']="layout-unfold2.html"
+            
             return render_to_response(self.template, env, context_instance=RequestContext(request))
 
-    # login-ok sets state="Welcome to MySlice" in urls.py
     def get (self, request, state=None):
         env = self.default_env()
 
index 59364b4..e2f6216 100644 (file)
@@ -16,19 +16,14 @@ body {
 a, a:active, a:focus {
     outline: 0;
 }
-input {
-    margin:0;
-}
+
 h1 {
-    color:#0B0042;
     border-bottom:1px solid #DDDDDD;
     padding:0 0 15px 0;
     margin:0 0 15px 0;
 }
 h1 img {
     vertical-align:top;
-    margin:0;
-    padding:0;
 }
 div.wrapper {
     width:980px;
@@ -143,20 +138,33 @@ div#home-dashboard table tr:first-child td {
     color:#270A5A;
 }
 div#home-dashboard table tr:last-child td {
-    font-size:12pt;
     vertical-align:top;
+    padding:25px 0;
+}
+div#home-dashboard table tr:last-child td.logged-in {
     border-right:1px solid #DDDDDD;
     padding:25px;
 }
+div#home-dashboard table tr:last-child td.support {
+    border-left:1px solid #DDDDDD;
+    padding:25px;
+}
 div#home-dashboard table tr:last-child td:first-child {
 }
 div#home-dashboard table tr:last-child td:last-child {
     border-right:0;
 }
-div#home-dashboard table tr:last-child td div {
+div#home-dashboard table tr:last-child td.logged-in div {
+    text-align:left;
+    padding:25px 0;
+}
+div#home-dashboard table tr:last-child td.support div {
     text-align:left;
     padding:25px 0;
 }
+div#home-dashboard div.login-widget {
+    padding:20px;
+}
 div#home-dashboard table td.support {
 }
 div#home-dashboard table td.support a {
@@ -224,11 +232,24 @@ div#slice-request {
     color:black;
     margin:25px auto;
 }
-div#slice-request div {
+.form-hint {
+    font-size:11pt;
+    font-style:italic;
+    color:gray;
+}
+
+
 
+/* TICKET REQUEST */
+div#ticket-request {
+    color:black;
+    margin:25px auto;
 }
 .form-hint {
     font-size:11pt;
     font-style:italic;
     color:gray;
 }
+div#ticket-request p {
+    margin:20px 0;
+}
index 12f76c3..4bc8218 100644 (file)
@@ -6,16 +6,16 @@
 
 {% block unfold_main %}
 
-<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/onelab.css" />
-<div class="onelab-title well-lg">
-  <h2>Onelab Support</h2>
-  <h4>If you have any diffculties using the portal, please contact us by filling this form below.</h4>
-  <h4>You can also <a href="mailto:support@myslice.info">e-mail</a> us directly or consult to our <a href="http://trac.myslice.info/" >documentation</a></h4>
-</div>
 
-<!-- no hint for this form, moreover we need more space to write stuff down
-     so we use a 3-6-3 layout -->
-<div class='well'>
+<div class="wrapper" id="ticket-request">
+<h1><img src="{{ STATIC_URL }}img/icon_support_small.png" alt="Open a Ticket" /> Onelab Support</h1>
+
+<p>
+       If you have any diffculties using the portal, please contact us by filling this form below.<br />
+       You can also <a href="mailto:support@myslice.info">e-mail</a> us directly or consult to our <a href="http://trac.myslice.info/" >documentation</a>
+</p>
+
+<div>
   <form class="cmxform form-horizontal" id="commentForm" action="#" method="post" role="form">{% csrf_token %}
   <fieldset>
     {% for field in form %}
@@ -24,7 +24,9 @@
       <div class="col-xs-6"> {{ field.errors }} {{ field }} <p class="form-hint">{{ field.help_text }}</p> </div>
     </div>
     {% endfor %}
-    <button class="submit btn btn-default col-xs-12" type="submit">Submit to OneLab Support</button>
+    <div class="col-xs-5">
+    </div>
+    <button class="submit btn btn-default col-xs-2" type="submit">Create Ticket</button>
   </fieldset>
   </form>
 </div>
index db7245c..9e24887 100644 (file)
@@ -1,4 +1,4 @@
-<div class="well">
+<div class="well login-widget">
        {% if state %}
        <span class="help-block">{{ state }}</span>
        {% endif %}
index a6430ea..1566181 100644 (file)
@@ -19,8 +19,8 @@
                                <td><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></td>
                        </tr>
                        <tr>
-                               <td>
                                {% if person %}
+                               <td class="logged-in">
                                        <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
                                        <div>
                                        {% if person.last_name %}
                                        <span class="label">Email:</span> <a href='mailto:{{person.email}}'>{{person.email}}</a>
                                </div>
                                {% else %}
+                               <td>
                                        {% include 'onelab/_widget-login-user.html' %}
                                {% endif %}
                                </td>
                                <td>
+                               {% if person %}
                                        <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request a Slice</button>
+                               {% else %}
+                               {% endif %}
                                </td>
                                <td class="support">
                                        <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
                                <td><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></td>
                        </tr>
                        <tr>
-                               <td>
                                {% if person %}
+                               <td class="logged-in">
                                        {% if person.last_name %}
                                        <div><span id='username'>{{person.first_name}} {{person.last_name}}</span></div> {% endif %}
                                <div><b>Email: </b><a href='mailto:{{person.email}}'>{{person.email}}</a></div>
                                {% else %}
+                               <td>
                                        {% include 'onelab/_widget-login-manager.html' %}
                                {% endif %}
                                </td>
diff --git a/ui/static/img/icon_support_small.png b/ui/static/img/icon_support_small.png
new file mode 100644 (file)
index 0000000..f157281
Binary files /dev/null and b/ui/static/img/icon_support_small.png differ