McPringle/sportchef

View on GitHub
src/main/webapp/admin_components/admin-eventimage/admin-eventimage.html

Summary

Maintainability
Test Coverage
<!--
    SportChef – Sports Competition Management Software
    Copyright (C) 2015 Marcus Fihlon

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/ <http://www.gnu.org/licenses/>>.
-->
<link rel="import" href="../../bower_components/polymer/polymer.html" />
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html" />
<link rel="import" href="../../bower_components/paper-listbox/paper-listbox.html" />
<link rel="import" href="../../bower_components/paper-item/paper-item.html" />
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html" />
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html" />
<link rel="import" href="../../bower_components/file-upload/file-upload.html" />
<link rel="import" href="../../sportchef_components/sportchef-jquery/sportchef-jquery.html" />

<dom-module id="admin-eventimage">
    <template>
        <paper-card heading="Event Image Upload" data-i18n="admin-eventimage.heading" data-i18n-attribute="heading">
            <div class="card-content">
                <paper-listbox>
                    <iron-ajax auto url="/api/events" handle-as="json" last-response="{{ajaxResponse}}"></iron-ajax>
                    <template is="dom-repeat" items="[[ajaxResponse]]">
                        <paper-item id="paper-item-{{item.eventId}}">
                            {{item.title}}
                            <file-upload accept="image/png" raised="true" target="/api/events/{{item.eventId}}/image">PNG (350x200)</file-upload>
                        </paper-item>
                    </template>
                </paper-listbox>
            </div>
        </paper-card>
    </template>

    <script>
        // register a new element called sportchef-events
        Polymer({
            is: "admin-eventimage"
        });
    </script>
</dom-module>