aboutsummaryrefslogtreecommitdiffstats
path: root/templates/layerindex/bulkchangesearch.html
blob: 0cb83ff7e6ac9c5d77b440d44212df54f28c80ea (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
{% extends "base.html" %}
{% load i18n %}

{% comment %}

  layerindex-web - bulk change search page template

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

{% endcomment %}


<!--
{% block title_append %} - bulk change{% endblock %}
-->

{% block content %}
{% autoescape on %}

<h2>Add recipes to changeset</h2>

        <div class="row-fluid">

            <div class="span9">

                <div class="row-fluid">
                    <form id="search-form" class="form-inline" method="GET">
                        <table class="search-form-table">
                            <tbody>
                                <tr>
                                    <td></td>
                                    <td>
                                        {{ search_form.field.errors }}
                                        {{ search_form.match_type.errors }}
                                        {{ search_form.value.errors }}
                                    </td>
                                </tr>
                                <tr>
                                    <td>Field:</td>
                                    <td>
                                        {{ search_form.field }}
                                        {{ search_form.match_type }}
                                        {{ search_form.value }}
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        {{ search_form.layer.errors }}
                                    </td>
                                </tr>
                                <tr>
                                    <td>Layer:</td>
                                    <td>{{ search_form.layer }}</td>
                                </tr>
                            </tbody>
                        </table>
                        <button class="btn" type="submit">Search</button>
                    </form>
                </div>

{% if recipe_list %}
                <form id="recipe-select-form" method="POST">
                    {% csrf_token %}
                    <table class="table table-striped table-bordered recipestable">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Recipe name</th>
                                <th>Version</th>
                                <th class="span9">Description</th>
                                <th>Layer</th>
                            </tr>
                        </thead>

                        <tbody>
                            {% for recipe in recipe_list %}
                                <tr>
                                    <td><input type="checkbox" name="selecteditems" value="{{ recipe.id }}"></input></td>
                                    <td><a href="{% url 'recipe' recipe.id %}">{{ recipe.name }}</a></td>
                                    <td>{{ recipe.pv }}</td>
                                    <td>{{ recipe.short_desc }}</td>
                                    <td><a href="{% url 'layer_item' current_branch recipe.layerbranch.layer.name %}">{{ recipe.layerbranch.layer.name }}</a></td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                    <input type="submit" class="btn" name="add_selected" value="Add selected"></input>
                    <input type="submit" class="btn" name="add_all" value="Add all"></input>

    {% if is_paginated %}
        {% load pagination %}
        {% pagination page_obj %}
    {% endif %}
{% else %}
    {% if searched %}
    <p>No matching recipes in database.</p>
    {% endif %}
{% endif %}
            </div>

            <div class="span3">
                    {% if changeset %}
                    <div class="well">
                        <p>{{ changeset.name }}</p>
                        {% if changeset.recipechange_set.all %}
                        <small>
                            {% regroup changeset.recipechange_set.all by recipe.layerbranch.layer as changeset_recipes %}
                            <ul>
                            {% for layer in changeset_recipes %}
                                <li>{{ layer.grouper }}
                                <ul>
                                    {% for change in layer.list %}
                                    <li>{{ change.recipe.filename }}</li>
                                    {% endfor %}
                                </ul>
                                </li>
                            {% endfor %}
                            </ul>
                        </small>
                        <input type="submit" class="btn" name="remove_all" value="Remove all"></input>
                        <a href="{% url 'bulk_change_edit' changeset.id %}" class="btn">Edit</a>
                        {% endif %}
                        <a href="{% url 'bulk_change_delete' changeset.id %}?cancel=bulk_change_search" class="btn">Delete</a>
                    </div>
                    {% endif %}
                </form>


            </div>

        </div>

{% endautoescape %}

{% endblock %}

{% block scripts %}
<script>
    enable_value_field = function() {
        if($('#id_match_type').val() == 'B')
            $('#id_value').prop('disabled', true);
        else
            $('#id_value').prop('disabled', false);
    }

    $(document).ready(function() {
        $('#id_match_type').change(enable_value_field)
        enable_value_field()
    });
</script>
{% endblock %}