Commit 5f44d607 authored by BERJON Matthieu's avatar BERJON Matthieu

Add of a common base template layout

I added a basic template layout based on the rails application. At the
moment the header and footer aren't completely ported from rails to
Django template engine.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 0b416733
<div class="container footer-space">
&nbsp;
</div>
<footer class="footer">
<div class="container">
<div class="col-md-4 credits">
<%#FIXME should have links too%>
<img class="img-responsive" src="<%= asset_path('credit.png') %>" alt="inria">
</div>
<div class="col-md-8">
<p class="credit pull-right">
<a href="https://wiki.inria.fr/sed_ren/">SED</a>
<a href="http://www.irisa.fr/">IRISA</a> /
<a href="http://www.inria.fr/centre/rennes">INRIA</a>,
<%= Time.now.year %><br />
</p>
</div>
</div>
</footer>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div>
{#
# function generating a button in the navigation bar, with:
# - a glyphicon and a tooltip (in devices given by 'hide')
# - a glyphicon and a text (in other configuration)
def nav_button (glyph, text, hide=[])
if hide.empty?
raw "<span class='glyphicon #{glyph}'></span> #{h text}</span>"
else
raw("
<span class='#{hide.map{|x| "visible-#{x}-inline"}.join " "} glyphicon #{glyph}'
data-toggle='tooltip' data-placement='bottom' #{raw "title='#{text}'"}></span>
<span class='#{hide.map{|x| "hidden-#{x}"}.join " "}'><span class='glyphicon #{glyph}'></span> #{h text}</span>
")
end
end
#}
<ul class="nav navbar-nav">
<li class="hidden-md hidden-sm hidden-xs">
<a class="navbar-brand brand" href="/">A||GO</a>
</li>
<li>
<%= link_to nav_button("glyphicon-cloud", "Apps", ["xs"]), apps_path %>
</li>
<% if user_signed_in? %>
<li>
<%= link_to nav_button("glyphicon-tasks", "My Jobs", ["xs"]), jobs_path %>
</li>
<% end %>
<% if user_signed_in? && User.valid_email(current_user.email) %> <!-- ajout d'app que pour inria/irisa -->
<li>
<%= link_to nav_button("glyphicon-cloud-upload", "Add an app", ["xs", "sm"]), new_webapp_path %>
</li>
<li>
<%= link_to nav_button("glyphicon-stats", "My apps", ["xs"]), show_apps_user_path %>
</li>
<li>
<%= link_to nav_button("glyphicon-save", "My datasets", ["xs", "sm", "md"]), new_dataset_path %>
</li>
<% if current_user.admin? %>
<li>
<%= link_to nav_button("glyphicon-eye-open", "Admin", ["xs", "sm", "md"]), admin_dashboard_path %>
</li>
<% end %>
<% end %>
<li>
<a href="/documentation/about"><%= nav_button "glyphicon-info-sign", "Doc", ["xs", "sm"] %></a>
</li>
<% if user_signed_in? %>
<li class="dropdown">
<%# the hepldesk is accessible only by inria users %>
<% if User.valid_email(current_user.email) %>
<a data-toggle="dropdown" role="button" aria-expanded="false">
<%= nav_button "glyphicon-question-sign", "Help", ["xs", "sm"] %>
</a>
<ul class="dropdown-menu">
<% Rails.configuration.helpdesk_links.each do|text, url| %>
<li> <a href="<%= url %>"><%= text %></a></li>
<%end%>
</ul>
<% end %>
</li>
<li>
<%= link_to image_tag(avatar_url(current_user.email), alt: '', title: '', size: "30x30", class: "avatar"), edit_user_registration_path, class: "link-avatar" %>
</li>
<li class="dropdown">
<a data-toggle="dropdown" role="button" aria-expanded="false"><i class="glyphicon glyphicon-menu-down"></i></a>
<ul class="dropdown-menu dropdown-menu-right" role="menu" id="user-options">
<li>
<%= link_to 'My account', edit_user_registration_path %>
</li>
<li>
<%= link_to 'Quotas of my apps', quotas_path %>
</li>
<li>
<%= link_to 'Logout', destroy_user_session_path, method: "delete" %>
</li>
</ul>
</li>
<% else %>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="glyphicon glyphicon-user"></i> Log In</a>
<ul class="dropdown-menu" role="menu" style="padding: 15px;">
<%= form_for("user", url: user_session_path) do |f| %>
<%= f.email_field :email, class: "form-control", placeholder: "Email address" %>
<%= f.password_field :password, class: "form-control", placeholder: "Password" %>
<%= f.submit "Login", class: "btn btn-success btn-block" %>
<% end %>
<span style="padding-left: 27px;"><%= link_to 'Forgot your password?', '/users/password/new' %></span>
</ul>
</li>
<li>
<%= link_to "<i class=\"glyphicon glyphicon-glyphicon glyphicon-pencil\"></i> Sign Up".html_safe, new_user_registration_path %>
</li>
<% end %>
</ul>
</div>
</div>
</nav>
{% load static %}
{% load compress %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{% block title %}A||GO | Home{% endblock %}</title>
<meta name="keywords" content="allgo, a||go, scientific applications as a service, science, inria, irisa, research, deploy app, platform, api" />
<meta name="description" content="allgo allow you to use console applications made by research team, online." />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
{% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static 'css/allgo.scss' %}" media="all" charset="utf-8">
{% endcompress %}
</head>
<body>
<header>{% include "_header.html" %}</header>
{% block content %}
{% endblock %}
<footer>{% include "_footer.html" %}</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment