dolos_list.html.ep 9.94 KB
Newer Older
Luc Didry's avatar
Luc Didry committed
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
% $dolos->each(sub {
    % my ($e, $num) = @_;
    % unless (defined $e->parent_id) {
        <tr id="dolo_id_<%= $e->id %>">
            <td class="url"><%= $e->url %></td>
            <td class="durl"><%= url_for('hit', short => $e->short)->to_abs %></td>
            <td class="name"><%= $e->name %></td>
            <td class="extra"><%= $e->extra %></td>
            <td class="hits"><%= $e->count %></td>
            <td class="expired"><%= ($e->expired) ? l('Yes') : l('No') %></td>
            <td class="will-expire"><%= (defined($e->expires_at) || defined($e->expires_after)) ? l('Yes') : l('No') %></td>
            <td>
        % if ($e->children->size) {
                <a class="pull-right" role="button" href="#" onclick="$('.collapse<%= $num %>').toggleClass('hidden');" aria-expanded="false" aria-controls="collapse<%= $num %>">
                    &nbsp;<%= l('Show children') %>
                    <span class="caret" aria-hidden="true"></span>
                </a>
        % }
                <div class="pull-right">
                    <div class="dropdown">
                        <a class="dropdown-toggle" id="dropdown-dolo-<%= $e->id %>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                            <span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span>
                            <span class="sr-only"><%= l('Actions') %></span>
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="dropdown-dolo-<%= $e->id %>">
                            <li>
                                <a class="action-view" class="action-view" href="<%= url_for('show_dolo', id => $e->id) %>">
                                    <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
                                    <%= l('Show dolo') %>
                                </a>
                                % my @tags;
                                % for my $tag (@{$e->tags}) {
                                %     push @tags, $tag->{id};
                                % }
                            </li>
                            <li>
                                <a class="action-modify" href="#"
                                    data-id="<%= $e->id %>"
                                    data-action="<%= url_for('mod_dolo') %>"
                                    data-mod="dolo"
                                    data-name="<%= $e->name %>"
                                    data-extra="<%= $e->extra %>"
                                    data-url="<%= $e->url %>"
                                    data-short="<%= $e->short %>"
                                    data-cat="<%= $e->category_id %>"
                                    data-tags="<%= join(',', @tags) %>"
                                    data-expired="<%= $e->expired %>"
                                    data-will-expire="<%= ($e->expired) ? l('Yes') : l('No') %>"
                                    data-expires_at="<%= $e->expires_at %>"
                                    data-expires_after="<%= $e->expires_after %>">
                                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                    <%= l('Modify dolo') %>
                                </a>
                            </li>
                            <li>
                                <a class="action-remove" href="#"
                                    data-id="<%= $e->id %>"
                                    data-action="<%= url_for('del_dolo') %>"
                                    data-rm="dolo"
                                    data-name="<%= $e->name %>"
                                    data-extra="<%= $e->extra %>"
                                    data-url="<%= $e->url %>"
                                    data-short="<%= $e->short %>">
                                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                                    <%= l('Delete dolo') %>
                                </a>
                            </li>
Luc Didry's avatar
Luc Didry committed
68
69
70
71
72
73
74
                            <li>
                                <a class="action-copy" href="#"
                                    data-text="<%= url_for('hit', short => $e->short)->to_abs %>">
                                    <span class="glyphicon glyphicon-copy" aria-hidden="true"></span>
                                    <%= l('Copy dolomon URL') %>
                                </a>
                            </li>
75
76
77
78
79
80
81
82
83
                        % if ($e->url eq url_for('/1px.gif')->to_abs) {
                            <li>
                                <a class="action-copy" href="#"
                                   data-text='<img src="<%= url_for('hit', short => $e->short)->to_abs %>" alt="">'>
                                    <span class="glyphicon glyphicon-copy" aria-hidden="true"></span>
                                    <%= l('Copy image code') %>
                                </a>
                            </li>
                        % }
Luc Didry's avatar
Luc Didry committed
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
                        </ul>
                    </div>
                </div>
            </td>
        </tr>
        % if ($e->children->size) {
            % $e->children->each(sub {
            % my ($f, $n) = @_;
            % my @tags;
            % for my $tag (@{$f->tags}) {
            %     push @tags, $tag->{id};
            % }
        <tr class="hidden collapse<%= $num %>" id="dolo_id_<%= $f->id %>">
            <td class="url">
                <%= ($n == $e->children->size) ? '└' : '├' %>
                <%= $f->url %>
            </td>
            <td class="durl"><%= url_for('hit', short => $f->short)->to_abs %></td>
            <td class="name"><%= $f->name %></td>
            <td class="extra"><%= $f->extra %></td>
            <td class="hits"><%= $f->count %></td>
            <td class="expired"><%= ($f->expired) ? l('Yes') : l('No') %></td>
            <td class="will-expire"><%= (defined($f->expires_at) || defined($f->expires_after)) ? l('Yes') : l('No') %></td>
            <td>
                <div class="pull-right">
                    <div class="dropdown">
                        <a class="dropdown-toggle" id="dropdown-dolo-<%= $f->id %>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                            <span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span>
                            <span class="sr-only"><%= l('Actions') %></span>
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="dropdown-dolo-<%= $f->id %>">
                            <li>
                                <a class="action-view" href="<%= url_for('show_dolo', id => $f->id) %>">
                                    <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
                                    <%= l('Show dolo') %>
                                </a>
                            </li>
                            <li>
                                <a class="action-modify" href="#"
                                    data-id="<%= $f->id %>"
                                    data-action="<%= url_for('mod_dolo') %>"
                                    data-mod="dolo"
                                    data-name="<%= $f->name %>"
                                    data-extra="<%= $f->extra %>"
                                    data-url="<%= $f->url %>"
                                    data-short="<%= $f->short %>"
                                    data-cat="<%= $f->category_id %>"
                                    data-tags="<%= join(',', @tags) %>"
                                    data-will-expire="<%= ($e->expired) ? l('Yes') : l('No') %>"
                                    data-expires_at="<%= $e->expires_at %>"
                                    data-expires_after="<%= $e->expires_after %>">
                                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                    <%= l('Modify dolo') %>
                                </a>
                            </li>
                            <li>
                                <a class="action-remove" href="#"
                                    data-id="<%= $f->id %>"
                                    data-action="<%= url_for('del_dolo') %>"
                                    data-rm="dolo"
                                    data-name="<%= $f->name %>"
                                    data-extra="<%= $f->extra %>"
                                    data-url="<%= $f->url %>"
                                    data-short="<%= $f->short %>">
                                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                                    <%= l('Delete dolo') %>
                                </a>
                            </li>
Luc Didry's avatar
Luc Didry committed
152
153
154
155
156
157
158
                            <li>
                                <a class="action-copy" href="#"
                                    data-text="<%= url_for('hit', short => $f->short)->to_abs %>">
                                    <span class="glyphicon glyphicon-copy" aria-hidden="true"></span>
                                    <%= l('Copy dolomon URL') %>
                                </a>
                            </li>
159
160
161
162
163
164
165
166
167
                        % if ($f->url eq url_for('/1px.gif')->to_abs) {
                            <li>
                                <a class="action-copy" href="#"
                                   data-text='<img src="<%= url_for('hit', short => $f->short)->to_abs %>" alt="">'>
                                    <span class="glyphicon glyphicon-copy" aria-hidden="true"></span>
                                    <%= l('Copy image code') %>
                                </a>
                            </li>
                        % }
Luc Didry's avatar
Luc Didry committed
168
169
170
171
172
173
174
175
176
                        </ul>
                    </div>
                </div>
            % });
        </tr>
        % }
    % }
% });