aboutsummaryrefslogtreecommitdiffstats
path: root/templates/layerindex/recipes.html
blob: 6a4cbe373ca9f5e2aab52d82d6f2f5a9516ae7ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{% extends "base_toplevel.html" %}
{% load i18n %}

{% comment %}

  layerindex-web - recipe index page template

  Copyright (C) 2013 Intel Corporation
  Licensed under the MIT license, see COPYING.MIT for details

{% endcomment %}


<!--
{% block title_append %} - recipes{% endblock %}
-->

{% block navs %}
{% autoescape on %}
                            <li><a href="{% url 'layer_list' url_branch %}">Layers</a></li>
                            <li class="active"><a href="{% url 'recipe_search' url_branch %}">Recipes</a></li>
                            <li><a href="{% url 'machine_search' url_branch %}">Machines</a></li>
                            <li><a href="{% url 'class_search' url_branch %}">Classes</a></li>
                            <li><a href="{% url 'distro_search' url_branch %}">Distros</a></li>
{% endautoescape %}
{% endblock %}


{% block content_inner %}
{% autoescape on %}


                <div class="bottom-margin">
                    <form id="filter-form" action="{% url 'recipe_search' url_branch %}" method="get" onsubmit="return validate()">
                        <div class="form-group" id="searchfield">
                            <div class="controls">
                                <div class="input-group col-md-6">
                                    <input type="text" class="form-control" id="id_search_text" placeholder="Search recipes" name="q" value="{{ search_keyword }}" />
                                    <div class="input-group-btn">
                                        <button class="btn btn-default" type="submit">search</button>
                                    </div>
                                </div>
                                <span class="help-block" id="errortext"></span>
                            </div>
                        </div>
                    </form>
                </div>

                <div id="error"> </div>
{% if recipe_list %}
                <table class="table table-striped table-bordered recipestable">
                    <thead>
                        <tr>
                            <th>Recipe name</th>
                            <th>Version</th>
                            <th class="col-md-9">Description</th>
                            <th>Layer</th>
                        </tr>
                    </thead>

                    <tbody>
                        {% for recipe in recipe_list %}
                            <tr {% if recipe.preferred_count > 0 %}class="text-muted"{% endif %}>
                                <td><a href="{% url 'recipe' recipe.id %}">{{ recipe.name }}</a>{% if 'image' in recipe.inherits.split %} <i class="glyphicon glyphicon-hdd" aria-hidden="true"></i>{% endif %}{% if recipe.blacklisted %}<span class="label label-inverse" title="{{ recipe.blacklisted }}">blacklisted</span>{% endif %}</td>
                                <td>{{ recipe.pv }}</td>
                                <td>{{ recipe.short_desc }}</td>
                                <td><a href="{% url 'layer_item' url_branch recipe.layerbranch.layer.name %}">{{ recipe.layerbranch.layer.name }}</a></td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>

    {% if is_paginated %}
        {% load bootstrap_pagination %}
        <div class="text-center">
        {% bootstrap_paginate page_obj range=10 show_prev_next="false" show_first_last="true" %}
        </div>
    {% endif %}
{% else %}
    {% if search_keyword %}
    <p>No matching recipes in database.</p>
    {% endif %}
{% endif %}

{% endautoescape %}

{% endblock %}


{% block scripts %}
<script>
    $(document).ready(function() {
        firstfield = $("#filter-form input:text").first()
        if( ! firstfield.val() )
            firstfield.focus()

        $('.glyphicon-hdd').tooltip({title:"Inherits image"});
        $('.label-inverse').tooltip();
    });

    function validate(){
        if (!$("#id_search_text").val()){
            $("#errortext").html("<p>Please specify search text</p>");
            $("#searchfield").addClass("has-error");
            return false;
        }
    }

</script>
{% endblock %}