... | ... |
@@ -119,22 +119,8 @@ |
119 | 119 |
|
120 | 120 |
<div class="container"> |
121 | 121 |
%= include '/include/project_header'; |
122 |
- %= include '/include/code_menu', display => 'commits'; |
|
123 |
- |
|
124 |
- <div style="margin-top:20px;margin-bottom:15px"> |
|
125 |
- % if (defined $file && length $file) { |
|
126 |
- %= include '/include/page_path', type => 'blob', Path => $file, operation => 'commits', prefix => 'History for'; |
|
127 |
- % } else { |
|
128 |
- <div style="font-size:18px"> |
|
129 |
- <a class="ubar" href="<%= url_for("/$user/$project") %>"> |
|
130 |
- <%= $project %> |
|
131 |
- </a> |
|
132 |
- / |
|
133 |
- <span class="muted">Commit History</span> |
|
134 |
- </div> |
|
135 |
- % } |
|
136 |
- </div> |
|
137 |
- |
|
122 |
+ %= include '/include/branch_select', display => 'commits'; |
|
123 |
+ |
|
138 | 124 |
% for my $date (reverse sort keys %$commits_date) { |
139 | 125 |
<div style="margin-bottom:20px"> |
140 | 126 |
% my $commits = $commits_date->{$date}; |
... | ... |
@@ -0,0 +1,168 @@ |
1 |
+<% |
|
2 |
+ my $display = stash('display') || ''; |
|
3 |
+ my $rev = stash('rev'); |
|
4 |
+ $rev = '' unless defined $rev; |
|
5 |
+ my $branches = stash('branches'); |
|
6 |
+%> |
|
7 |
+ |
|
8 |
+%= javascript begin |
|
9 |
+ $(document).ready(function () { |
|
10 |
+ |
|
11 |
+ % if ($display eq 'files' || $display eq 'commits') { |
|
12 |
+ % my $type = $display eq 'files' ? 'tree' : 'commits'; |
|
13 |
+ |
|
14 |
+ // Switch branches and tags |
|
15 |
+ var revs_init = false; |
|
16 |
+ $('#rev-btn').on('click', function () { |
|
17 |
+ |
|
18 |
+ if (!revs_init) { |
|
19 |
+ $.get('<%= url_for("/$user/$project/api/revs") %>', function (result) { |
|
20 |
+ var branch_names = result.branch_names; |
|
21 |
+ var tag_names = result.tag_names; |
|
22 |
+ var style = 'style="border-top-left-radius:0px;border-top-right-radius:0px;"'; |
|
23 |
+ |
|
24 |
+ if (branch_names.length === 0) { |
|
25 |
+ $('#branch-names-list').append( |
|
26 |
+ '<li><a ' + style + ' href="#">No branches</a></li>' |
|
27 |
+ ); |
|
28 |
+ } |
|
29 |
+ else { |
|
30 |
+ for (var i = 0; i < branch_names.length; i++) { |
|
31 |
+ var branch_name = branch_names[i]; |
|
32 |
+ $('#branch-names-list').append( |
|
33 |
+ '<li><a ' + style + ' href="<%= url_for("/$user/$project/$type/") %>' + branch_name + '">' + branch_name + '</a></li>' |
|
34 |
+ ); |
|
35 |
+ } |
|
36 |
+ } |
|
37 |
+ |
|
38 |
+ if (tag_names.length === 0) { |
|
39 |
+ $('#tag-names-list').append( |
|
40 |
+ '<li><a ' + style + ' href="#">No tags</a></li>' |
|
41 |
+ ); |
|
42 |
+ } |
|
43 |
+ else { |
|
44 |
+ for (var i = 0; i < tag_names.length; i++) { |
|
45 |
+ var tag_name = tag_names[i]; |
|
46 |
+ $('#tag-names-list').append( |
|
47 |
+ '<li><a ' + style + ' href="<%= url_for("/$user/$project/$type/") %>' + tag_name + '">' + tag_name + '</a></li>' |
|
48 |
+ ); |
|
49 |
+ } |
|
50 |
+ } |
|
51 |
+ $('#rev-popup') |
|
52 |
+ .css('display', 'block') |
|
53 |
+ .css('top', '40px') |
|
54 |
+ .css('left', '0px') |
|
55 |
+ ; |
|
56 |
+ }); |
|
57 |
+ revs_init = true; |
|
58 |
+ } |
|
59 |
+ else { |
|
60 |
+ $('#rev-popup') |
|
61 |
+ .css('display', 'block') |
|
62 |
+ .css('top', '40px') |
|
63 |
+ .css('left', '0px') |
|
64 |
+ ; |
|
65 |
+ } |
|
66 |
+ }); |
|
67 |
+ |
|
68 |
+ $('#revs-tab a').click(function (e) { |
|
69 |
+ e.preventDefault(); |
|
70 |
+ $(this).tab('show'); |
|
71 |
+ }) |
|
72 |
+ |
|
73 |
+ $('#rev-close').on('click', function () { |
|
74 |
+ $('#rev-popup').css('display', 'none'); |
|
75 |
+ }); |
|
76 |
+ % } elsif ($display eq 'branches') { |
|
77 |
+ $('#rev-btn').on('click', function () { |
|
78 |
+ $('#rev-popup') |
|
79 |
+ .css('display', 'block') |
|
80 |
+ .css('top', '40px') |
|
81 |
+ .css('left', '0px') |
|
82 |
+ ; |
|
83 |
+ $('#rev-close').on('click', function () { |
|
84 |
+ $('#rev-popup').css('display', 'none'); |
|
85 |
+ }); |
|
86 |
+ }); |
|
87 |
+ % } |
|
88 |
+ }); |
|
89 |
+% end |
|
90 |
+ |
|
91 |
+ |
|
92 |
+ |
|
93 |
+<div style="position:relative"> |
|
94 |
+ <div style="margin-bottom:20px"> |
|
95 |
+ % if ($display eq 'files' || $display eq 'commits' || $display eq 'branches') { |
|
96 |
+ <% |
|
97 |
+ my $title; |
|
98 |
+ my $rev_short; |
|
99 |
+ if (defined $rev && length $rev == 40) { |
|
100 |
+ $title = 'tree'; |
|
101 |
+ $rev_short = substr($rev, 0, 10); |
|
102 |
+ } |
|
103 |
+ else { |
|
104 |
+ $title = 'branch'; |
|
105 |
+ $rev_short = $rev; |
|
106 |
+ } |
|
107 |
+ %> |
|
108 |
+ <button id="rev-btn" class="btn" style="font-size:13px;padding:2px 10px;margin-top:5px;margin-right:6px"> |
|
109 |
+ <i class="icon-share-alt"></i><span class="muted"><%= $title %>:</span> <b><%= $rev_short %></b> |
|
110 |
+ </button> |
|
111 |
+ % } |
|
112 |
+ </div> |
|
113 |
+ |
|
114 |
+ % if ($display eq 'files' || $display eq 'commits') { |
|
115 |
+ <div id="rev-popup" style="display:none;width:330px;position:absolute"> |
|
116 |
+ <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
117 |
+ <div class="row"> |
|
118 |
+ <div class="span3"> |
|
119 |
+ <b>Switch branches/tags</b> |
|
120 |
+ </div> |
|
121 |
+ <div class="text-right"> |
|
122 |
+ <i id="rev-close" class="icon-remove-circle"></i> |
|
123 |
+ </div> |
|
124 |
+ </div> |
|
125 |
+ </div> |
|
126 |
+ <ul class="nav nav-tabs" id="revs-tab" style="background:#F5F5F5;margin-bottom:0"> |
|
127 |
+ <li class="active"><a href="#branches">Branches</a></li> |
|
128 |
+ <li><a href="#tags">Tags</a></li> |
|
129 |
+ </ul> |
|
130 |
+ <div class="tab-content"> |
|
131 |
+ <div class="tab-pane active" id="branches" style="background:white;max-height:300px;overflow:auto;margin-top:0"> |
|
132 |
+ <ul id="branch-names-list" class="nav nav-tabs nav-stacked"> |
|
133 |
+ </ul> |
|
134 |
+ </div> |
|
135 |
+ <div class="tab-pane" id="tags" style="background:white;max-height:300px;overflow:auto;margin-top:0"> |
|
136 |
+ <ul id="tag-names-list" class="nav nav-tabs nav-stacked"> |
|
137 |
+ </ul> |
|
138 |
+ </div> |
|
139 |
+ </div> |
|
140 |
+ </div> |
|
141 |
+ % } else { |
|
142 |
+ <div id="rev-popup" style="display:none;width:330px;position:absolute"> |
|
143 |
+ <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
144 |
+ <div class="row"> |
|
145 |
+ <div class="span3"> |
|
146 |
+ <b>Switch branches</b> |
|
147 |
+ </div> |
|
148 |
+ <div class="text-right"> |
|
149 |
+ <i id="rev-close" class="icon-remove-circle"></i> |
|
150 |
+ </div> |
|
151 |
+ </div> |
|
152 |
+ </div> |
|
153 |
+ <ul class="nav nav-tabs" style="background:#F5F5F5;margin-bottom:0"> |
|
154 |
+ <li class="active"><a href="#branches">Branches</a></li> |
|
155 |
+ </ul> |
|
156 |
+ <ul id="rev-names-list" class="nav nav-tabs nav-stacked" style="background:white"> |
|
157 |
+ % for my $branch (@$branches) { |
|
158 |
+ <li> |
|
159 |
+ <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= url_for("/$user/$project/branches/$branch->{name}") %>"> |
|
160 |
+ <%= $branch->{name} %> |
|
161 |
+ </a> |
|
162 |
+ </li> |
|
163 |
+ % } |
|
164 |
+ </ul> |
|
165 |
+ </div> |
|
166 |
+ % } |
|
167 |
+ |
|
168 |
+</div> |