dolos_list_for_cat_and_tag_show.html.ep 7.77 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
% $dolos->each(sub {
    % my ($d, $n) = @_;
    % my @tags;
    % for my $tag (@{$d->tags}) {
    %     push @tags, $tag->{id};
    % }
    % unless (defined $d->parent_id) {
        % my $dhs = $d->get_raw_dhs;
        <tr id="dolo_id_<%= $d->id %>">
            <td class="url"><%= $d->url %></td>
            <td class="durl"><%= url_for('hit', short => $d->short)->to_abs %></td>
            <td class="name"><%= $d->name %></td>
            <td class="extra"><%= $d->extra %></td>
            <td class="hits"><%= $d->count %></td>
            <td>
            % if ($d->children->size) {
                <a class="pull-right" role="button" href="#" onclick="$('.collapse<%= $n %>').toggleClass('hidden');" aria-expanded="false" aria-controls="collapse<%= $n %>">
                    <%= 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-<%= $d->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-<%= $d->id %>">
                            <li>
                                <a class="action-view" href="<%= url_for('show_dolo', id => $d->id) %>">
                                    <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
                                    <%= l('Show dolo') %>
                                </a>
                            </li>
                            <li>
                                <a class="action-modify" href="#" data-id="<%= $d->id %>" data-action="<%= url_for('mod_dolo') %>" data-mod="dolo" data-name="<%= $d->name %>" data-extra="<%= $d->extra %>" data-url="<%= $d->url %>" data-short="<%= $d->short %>" data-cat="<%= $d->category_id %>" data-tags="<%= join(',', @tags) %>">
                                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                    <%= l('Modify dolo') %>
                                </a>
                            </li>
                            <li>
                                <a class="action-remove" href="#" data-id="<%= $d->id %>" data-action="<%= url_for('del_dolo') %>" data-rm="dolo" data-name="<%= $d->name %>" data-extra="<%= $d->extra %>" data-url="<%= $d->url %>" data-short="<%= $d->short %>">
                                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                                    <%= l('Delete dolo') %>
                                </a>
                            </li>
Luc Didry's avatar
Luc Didry committed
47
48
49
50
51
52
53
                            <li>
                                <a class="action-copy" href="#"
                                    data-text="<%= url_for('hit', short => $d->short)->to_abs %>">
                                    <span class="glyphicon glyphicon-copy" aria-hidden="true"></span>
                                    <%= l('Copy dolomon URL') %>
                                </a>
                            </li>
54
55
56
57
58
59
60
61
62
                        % if ($d->url eq url_for('/1px.gif')->to_abs) {
                            <li>
                                <a class="action-copy" href="#"
                                   data-text='<img src="<%= url_for('hit', short => $d->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
63
64
65
66
67
68
69
70
71
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
                        </ul>
                    </div>
                </div>
            </td>
        </tr>
        % if ($d->children->size) {
            % $d->children->each(sub {
            % my ($f, $m) = @_;
            % my @tags;
            % for my $tag (@{$f->tags}) {
            %     push @tags, $tag->{id};
            % }
        <tr class="hidden collapse<%= $n %>" id="dolo_id_<%= $f->id %>">
            <td class="url">
                <%= ($m == $d->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>
                <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) %>">
                                    <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
110
111
112
113
114
115
116
                            <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>
117
118
119
120
121
122
123
124
125
                        % 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
126
127
128
129
130
131
132
133
134
135
                        </ul>
                    </div>
                </div>
            </td>
            % });
        </tr>
        % }
    % }
% });