show.html.ep 8.28 KB
Newer Older
Luc Didry's avatar
Luc Didry committed
1
2
3
4
5
6
% # vim:set sts=4 sw=4 ts=4 ft=html.epl expandtab:
% layout 'default';
% title $self->l('Dolos').' · Dolomon';

%= include 'partial/modModal'
%= include 'partial/rmModal'
7
% my @tags;
Luc Didry's avatar
Luc Didry committed
8
% my $i = 0;
Luc Didry's avatar
Luc Didry committed
9
% if (defined stash('dolo')) {
Luc Didry's avatar
Fix #13    
Luc Didry committed
10
<div class="show-dolo">
11
    % if ($dolo->name) {
Luc Didry's avatar
Luc Didry committed
12
13
14
    <h1><span class="glyphicon glyphicon-link" aria-hidden="true"></span> <%= $dolo->name %></h1>
    % } else {
    <h1><span class="glyphicon glyphicon-link" aria-hidden="true"></span> <%= l('Unnamed dolo') %></h1>
15
    % }
Luc Didry's avatar
Fix #13    
Luc Didry committed
16
17
18
19
    <p>
        <span class="glyphicon glyphicon-folder-open" aria-hidden="true" title="<%= l('Category') %>"></span>
            <span class="sr-only"><%= l('Category') %></span>
            <a href="<%= url_for('show_cat', id => $dolo->category_id) %>"><%= $dolo->category_name %></a>
20
    % if (scalar @{$dolo->tags}) {
Luc Didry's avatar
Fix #13    
Luc Didry committed
21
22
23
        <span class="glyphicon glyphicon-tags" aria-hidden="true" title="<%= l('Tags') %>"></span>
            <span class="sr-only"><%= l('Tags') %></span>
        % for my $tag (@{$dolo->tags}) {
Luc Didry's avatar
Luc Didry committed
24
25
        %     $i++;
            <a href="<%= url_for('show_tag', id => $tag->{id}) %>"><%= $tag->{name} %></a><%= ($i != scalar(@{$dolo->tags})) ? ', ' : '' %>
Luc Didry's avatar
Fix #13    
Luc Didry committed
26
27
28
29
30
        %     push @tags, $tag->{id};
        % }
    % }
    </p>
    <p>
Luc Didry's avatar
Luc Didry committed
31
32
        <span class="glyphicon glyphicon-screenshot" aria-hidden="true" title="<%= l('Target URL') %>"></span>
            <span class="sr-only"><%= l('Target URL') %></span>
Luc Didry's avatar
Fix #13    
Luc Didry committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
            <a href="<%= $dolo->url %>"><%= $dolo->url %></a>
        <span class="glyphicon glyphicon-link" aria-hidden="true" title="<%= l('Dolomon URL') %>"></span>
            <span class="sr-only"><%= l('Dolomon URL') %></span>
            <a href="<%= url_for('hit', short => $dolo->short)->to_abs %>"><%= url_for('hit', short => $dolo->short)->to_abs %></a>
    </p>
    <p>
        <span class="glyphicon glyphicon-calendar" aria-hidden="true" title="<%= l('Created at') %>"></span>
            <span class="sr-only"><%= l('Created at') %></span>
            <span class="date-to-format"><%= $dolo->created_at %></span>
    </p>
    <p>
        <strong><%= l('Expired?') %></strong> <%= ($dolo->expired) ? l('Yes') : l('No') %>
    % if ($dolo->extra) {
        <span class="glyphicon glyphicon-pencil" aria-hidden="true" title="<%= l('Free field') %>"></span>
            <span class="sr-only"><%= l('Free field') %></span>
            <%= $dolo->extra %>
49
    % }
Luc Didry's avatar
Fix #13    
Luc Didry committed
50
51
52
53
54
55
56
    </p>
    <p>
        <span class="glyphicon glyphicon-info-sign" aria-hidden="true" title="<%= l('Total hits') %>"></span>
            <span class="sr-only"><%= l('Total hits') %></span>
            <%= l('%1 hits', $dolo->count) %>
    </p>
    <dl>
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    % if ($dolo->children->size) {
        <dt><%= l('Children') %></dt>
        <dd>
            <ul>
            % $dolo->children->each(sub {
            %   my ($e, $num) = @_;
                <li><a href="<%== url_for('show_dolo', {id => $e->id}) %>"><%= $e->url %></a></li>
            % });
            </ul>
        <dd>
    % }
    % if ($dolo->parent_id) {
        <dt><%= l('Parent') %></dt>
        <dd><a href="<%== url_for('show_dolo', {id => $dolo->parent_id}) %>"><%= l('See parent') %></a></dd>
    % }
Luc Didry's avatar
Luc Didry committed
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
    </dl>
    <a class="action-modify btn btn-info" href="#" data-id="<%= $dolo->id %>" data-action="<%= url_for('mod_dolo') %>" data-mod="dolo" data-name="<%= $dolo->name %>" data-url="<%= $dolo->url %>" data-short="<%= $dolo->short %>" data-cat="<%= $dolo->category_id %>" data-tags="<%= join(',', @tags) %>">
        <%= l('Modify dolo') %>
    </a>
    <a class="action-remove btn btn-danger" href="#" data-id="<%= $dolo->id %>" data-action="<%= url_for('del_dolo') %>" data-rm="dolo" data-name="<%= $dolo->name %>" data-url="<%= $dolo->url %>" data-short="<%= $dolo->short %>">
        <%= l('Delete dolo') %>
    </a>

% if ($dolo->count) {
    <div style="position:relative;">
        <ul class="nav nav-tabs" role="tablist" id="tablist">
            <li role="presentation" class="disabled">
                <a href="#uber" aria-controls="uber" role="tab" data-toggle="tab" data-targetid="uber">
                    <%= l('Last %1 days', config('keep_hits')->{uber_precision}) %>
                </a>
            </li>
            <li role="presentation" class="disabled">
                <a href="#days" aria-controls="days" role="tab" data-targetid="days">
                    <%= l('Last %1 days', config('keep_hits')->{day_precision}) %>
                </a>
            </li>
            <li role="presentation" class="disabled">
                <a href="#weeks" aria-controls="weeks" role="tab" data-targetid="weeks">
                    <%= l('Last %1 weeks', config('keep_hits')->{week_precision}) %>
                </a>
            </li>
            <li role="presentation" class="disabled">
                <a href="#months" aria-controls="months" role="tab" data-targetid="months">
                    <%= l('Last %1 months', config('keep_hits')->{month_precision}) %>
                </a>
            </li>
            <li role="presentation" class="active">
                <a href="#years" aria-controls="years" role="tab" data-targetid="years">
                    <%= l('Per year') %>
                </a>
            </li>
        </ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade in active" id="uber">
                <div class="alert alert-info">
                    <p><%= l('Please wait') %><p>
                </div>
                <form class="form-inline">
                % for my $id (qw(uber days weeks months years)) {
                    <span class="<%= $id %> datepicker hidden">
                    % if ($id eq 'uber') {
                        <div class="form-group" id="aggregate-group">
                            <label for="aggregate_by"><%= l('Aggregate data per') %></label>
                            <select id="aggregate_by" class="form-control" name="aggregate_by">
                                <option value="180"><%= l('%1 hours', '3') %></option>
                                <option value="120"><%= l('%1 hours', 2) %></option>
                                <option value="60" selected="selected"><%= l('hour') %></option>
                                <option value="30"><%= l('%1 minutes', '30') %></option>
                                <option value="15"><%= l('%1 minutes', '15') %></option>
                                <option value="10"><%= l('%1 minutes', '10') %></option>
                                <option value="5"><%= l('%1 minutes', '5') %></option>
                                <option value="1"><%= l('1 minute') %></option>
                            </select>
                        </div>
                    % }
                        <div class="form-group">
                            <label for="<%= $id %>-graph-start"><%= l('Start graph at') %></label>
                            <input id="<%= $id %>-graph-start" class="form-control" name="<%= $id %>-graph-start" type="text"></input>
                        </div>
                        <div class="form-group">
                            <label for="<%= $id %>-graph-stop"><%= l('Stop graph at') %></label>
                            <input id="<%= $id %>-graph-stop" class="form-control" name="<%= $id %>-graph-stop" type="text"></input>
                        </div>
                    </span>
                % }
                </form>
                <div class="mo-graph" id="graph"></div>
                <div>
                    <a href="<%= url_for('get_dolo_zip', id => $dolo->id) %>" class="btn btn-default" id="download"><%= l('Download datas in CSV format') %></a>
                </div>
            </div>
        </div>
    </div>
Luc Didry's avatar
Luc Didry committed
150
    <div class="table">
Luc Didry's avatar
Luc Didry committed
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
        <table class="table table-striped table-condensed">
            <thead>
                <tr>
                    <th><%= l('Referrer') %></th>
                    <th><%= l('Count (on last %1 days)', config('keep_hits')->{uber_precision}) %></th>
                </tr>
            </thead>
            <tbody>
                % for my $key (sort keys %{$referrers}) {
                <tr>
                    <td><%= $key %></td>
                    <td><%= $referrers->{$key} %></td>
                </tr>
                % }
            </tbody>
        </table>
    </div>
% }
</div>
    %= javascript begin
        var dataUrl = '<%= url_for('get_dolo_data', id => $dolo->id) %>';
    % end
% }