Source

lfs-carousel / lfs_carousel / templates / lfs_carousel / items.html

{% load i18n %}
<div id="carousel-items">
<h2 class="heading-first">{% trans 'Carousel items' %}</h2>

{% if items %}
    <form id="carousel-items-update-form"
          action="{% url lfs_carousel_update_items ct.pk obj.pk %}"
          method="post">

        <table class="lfs-manage-table carousel-items">
            <tr>
                <th class="tiny">
                    <input type="checkbox"
                           class="select-all"
                           value="delete-images" />
                </th>
                <th class="tiny" style="padding: 0 10px">
                    {% trans 'Image' %}
                </th>
                <th class="small">
                    {% trans 'Title' %}
                </th>
                <th class="small">
                    {% trans 'URL' %}
                </th>
                <th class="small">
                    {% trans 'Text' %}
                </th>
                <th class="right-padding">
                    {% trans 'Position' %}
                </th>
                <th class="small right-padding">
                    {% trans 'Manage' %}
                </th>
            </tr>
            {% for item in items %}
                <tr>
                    <td>
                        <input type="checkbox"
                               class="select-delete-images"
                               name="delete-{{ item.id }}"
                               style="float:left" />
                    </td>
                    <td style="padding: 3px 10px">
                        <img src="{{ item.image.url_60x60 }}"
                             alt="{{ item.title }}"
                             title="{{ item.title }}"
                             style="float:left"/>
                    </td>
                    <td class="small">
                        <input type="text" name="title-{{ item.id }}" value="{{ item.title }}" style="width:300px" />
                    </td>
                    <td class="small">
                        <input type="text" name="link-{{ item.id }}" value="{{ item.link }}" style="width:300px" />
                    </td>
                    <td class="small">
                        <input type="text" name="text-{{ item.id }}" value="{{ item.text }}" style="width:300px" />
                    </td>
                    <td class="right-padding">
                        <input type="text" name="position-{{ item.id }}" value="{{ item.position }}" size="3" />
                    </td>
                    <td class="right-padding">
                        {% if not forloop.first %}
                            <a class="up ajax-link"
                               href="{% url lfs_carousel_move_item item.id %}?direction=0"
                               title='{% trans "Move Up" %}'></a>
                        {% endif %}
                        {% if not forloop.last %}
                            <a class="down ajax-link"
                               href="{% url lfs_carousel_move_item item.id %}?direction=1"
                               title='{% trans "Move Down" %}'></a>
                        {% else %}
                            <span class="blank"></span>
                        {% endif %}
                    </td>

                </tr>
            {% endfor %}
        </table>
        <div class="buttons">
            <input class="ajax-save-button button"
                   type="submit" name="update" value="{% trans 'Update items' %}" />
            <input class="ajax-save-button button"
                   type="submit" name="delete" value="{% trans 'Delete items' %}" />
        </div>
    </form>
{% else %}
    <span>{% trans 'There are no items' %}</span>
{% endif %}

<h2 class="heading-middle">{% trans 'Add items' %}</h2>

<div id="carousel-content">
    <form id="file_upload" action="{% url lfs_carousel_add_item ct.pk obj.pk %}" method="POST" enctype="multipart/form-data">
        {% csrf_token %}
        <input class="button" type="file" name="file" multiple>
    </form>
    <table id="files" data="{% url lfs_carousel_manage_items ct.pk obj.pk %}" msg='{% trans "Uploading images:" %}'></table>
</div>
<script>
    $(function () {
        $('#file_upload').fileUploadUI({
            uploadTable: $('#files'),
            multiFileRequest : true,
            buildUploadRow: function (files) {
                var fileNames = '';
                for (i = 0; i < files.length; i += 1) {
                    fileNames = fileNames + files[i].name + '<br>';
                }
                var msg = $("#files").attr("msg");
                return $(
                    '<tr>' +
                    '<td><div style="font-weight:bold; padding-bottom:10px">' + msg + '<img src="{{ STATIC_URL }}img/ajax-loader.gif" style="padding:8px 0 0 10px" /></div>' + fileNames + '<\/td>' +
                    '<\/tr>'
                );
            },
            onLoadAll: function(files) {
                var url = $("#files").attr("data");
                $.get(url, function(data) {
                    data = $.parseJSON(data);
                    $("#carousel-items").html(data["items"]);
                    $.jGrowl(data["message"]);
                });
            }
        });
    });
</script>
</div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.