% # vim:set sts=4 sw=4 ts=4 ft=html.epl expandtab:
% my %d = (
%   delay_0   => l('no time limit'),
%   delay_1   => l('24 hours'),
%   delay_365 => l('1 year')
% );
<h4><%= l('My images') %></h4>
<hr>

<p>
    <%= l('Only the images sent with this browser will be listed here. The details are stored in localStorage: if you delete your localStorage data, you\'ll loose these details.') %>
</p>
<div class="modal fade" id="modModal" tabindex="-1" role="dialog" aria-labelledby="modModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h1 id="mod-name" class="ellips"></h1>
            </div>
            <div class="modal-body">
                <div class="form-group form-inline">
                    <select id="mod-delete-day" name="delete-day" class="form-control">
% my @delays = split(',', $self->config('proposed_delays'));
% for my $delay (@delays) {
%   my $text = (defined($d{'delay_'.$delay})) ? $d{'delay_'.$delay} : l('%1 days', $delay);
%   if (config('max_delay')) {
%       if ($delay) {
%           if ($delay < config('max_delay')) {
                                <option value="<%= $delay %>" <%== is_selected($delay) %>><%= $text %></option>
%           } elsif ($delay == config('max_delay')) {
                                <option value="<%= $delay %>" <%== is_selected($delay) %>><%= $text %></option>
%               last;
%           } else {
%               my $text = ($delay == 1) ? l('24 hours') : l('%1 days', $delay);
                                <option value="<%= config('max_delay') %>" <%== is_selected(config('max_delay')) %>><%= l('%1 days', config('max_delay')) %></option>
%               last;
%           }
%       }
%   } else {
                                <option value="<%= $delay %>" <%== is_selected($delay) %>><%= $text %></option>
%   }
% }
                    </select>&nbsp;
                    <div class="checkbox">
                        <label>
                            <input id="mod-first-view" type="checkbox" name="first-view"> <%= l('Delete at first view?') %>
                        </label>
                    </div>&nbsp;
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><%= l('Close') %></button>
                <button type="button" class="btn btn-primary" id="mod-delay"><%= l('Save changes') %></button>
            </div>
        </div>
    </div>
</div>
<div id="gallery-url" class="hidden row">
    <form class="form col-sm-12">
        <div class="form-group">
            <label for="gallery-url-input"><%= l('Gallery link') %></label>
            <div class="input-group">
                <a class="input-group-addon" id="gallery-url-link" href="#" target="_blank" title="<%= l('Gallery link') %>">
                    <span class="icon icon-picture"></span>
                </a>
                <input class="form-control" name="gallery-url-input" type="text" id="gallery-url-input" readonly></input>
                <a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
                    <span class="icon icon-clipboard"></span>
                </a>
            </div>
        </div>
    </form>
</div>
<div id="zip-url" class="hidden row">
    <form class="form col-sm-12">
        <div class="form-group">
            <label for="zip-url-input"><%= l('Download zip link') %></label>
            <div class="input-group">
                <a class="input-group-addon" id="zip-url-link" href="#" target="_blank" title="<%= l('Download zip link') %>">
                    <span class="icon icon-file-archive"></span>
                </a>
                <input class="form-control" name="zip-url-input" type="text" id="zip-url-input" readonly></input>
                <a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
                    <span class="icon icon-clipboard"></span>
                </a>
            </div>
        </div>
    </form>
</div>
<div id="random-url" class="hidden row">
    <form class="form col-sm-12">
        <div class="form-group">
            <label for="random-url-input"><%= l('Random image link') %></label>
            <div class="input-group">
                <a class="input-group-addon" id="random-url-link" href="#" target="_blank" title="<%= l('Random image link') %>">
                    <span class="icon icon-shuffle"></span>
                </a>
                <input class="form-control" name="random-url-input" type="text" id="random-url-input" readonly></input>
                <a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
                    <span class="icon icon-clipboard"></span>
                </a>
            </div>
        </div>
    </form>
</div>
<div class="files-buttons">
    <a href="#" id="json-export" class="btn btn-info"><%= l('Export localStorage data') %></a>
    <a href="#" id="json-import" class="btn btn-info"><%= l('Import localStorage data') %></a>
    <input type="file" class="hidden" id="import">
</div>
<div class="table-responsive">
    <table class="table table-hover">
        <thead>
            <tr>
                <th class="text-center"><span class="checkbox"><label><input type="checkbox" id="check-all"><label></span></th>
                <th class="text-center"><%= l('File name') %></th>
                <th class="text-center"><%= l('View link') %></th>
                <th class="text-center"><%= l('Counter') %></th>
                <th class="text-center"><%= l('Delete at first view?') %></th>
                <th class="text-center"><%= l('Uploaded at') %></th>
                <th class="text-center"><%= l('Expires at') %></th>
                <th class="text-center"><%= l('Deletion link') %></th>
            </tr>
        </thead>
        <tbody id="myfiles">
        </tbody>
    </table>
</div>

<%= link_to url_for('/') => ( class => "btn btn-primary btn-lg" ) => begin %><%= l('Back to homepage') %><% end%>
