forked from yuki-kimoto/gitprep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
network.html.ep
98 lines (87 loc) · 3.66 KB
/
network.html.ep
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
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
<%
# API
my $api = gitprep_api;
# Branches
my $branches = [map { $_->{name} } @{app->git->branches($user, $project)}];
# Members
my $members = app->manager->members($user, $project);
# Members branches
for my $member (@$members) {
my $branches = [
map { $_->{name} } @{app->git->branches($member->{id}, $member->{project})}
];
$member->{branches} = $branches;
}
# Default branch
my $default_branch = app->manager->default_branch($user, $project);
%>
% layout 'common', title => "Network \x{30fb} $user/$project";
%= javascript begin
$(document).ready(function () {
// Click compare button
$('[name=compare-btn]').on('click', function () {
var branch = $('[name=branch]').val();
var remote = $(this).closest('[name=remote]');
var remote_member = remote.find('[name=remote-member]').text();
var remote_project = remote.find('[name=remote-project]').text();
var remote_branch = remote.find('[name=remote-branch]').val();
location.href = '<%= url_for("/$user/$project/network/graph/") %>' + branch + '...'
+ remote_member + '/' + remote_project + '/' + remote_branch;
});
// Click import button
$('[name=import-btn]').on('click', function () {
var branch = $('[name=branch]').val();
var remote = $(this).closest('[name=remote]');
var remote_member = remote.find('[name=remote-member]').text();
var remote_project = remote.find('[name=remote-project]').text();
var remote_branch = remote.find('[name=remote-branch]').val();
location.href = '<%= url_for("/$user/$project/import-branch/") %>'
+ remote_member + '/' + remote_project + '?remote-branch=' + remote_branch;
});
});
% end
%= include '/include/header';
<div class="container" style="min-heigth:500px">
%= include '/include/project_header';
<h3>Members of the <%= $project %> Network</h3>
<div class="well" style="padding:5px 10px 0 10px;margin-bottom:20px">
<span class="label label-info">My branch</span>
<a href="<%= url_for("/$user") %>"><%= $user %></a>
<span>/</span>
<a href="<%= url_for("/$user/$project") %>"><%= $project %></a>
<span>/</span>
% param('branch', $default_branch);
%= select_field 'branch' => $branches, style => 'margin-top:5px;width:150px';
</div>
<div style="margin-bottom:30px">
% if (@$members) {
% for my $member (@$members) {
<div class="row" name="remote" style="font-size:18px;">
% my $mid = $member->{id};
% my $mproject = $member->{project};
% my $mbranches = $member->{branches};
<div class="span8" style="padding-left:5px">
<span class="label label-success">Member branch</span>
<a name="remote-member" href="<%= url_for("/$mid") %>"><%= $mid %></a>
<span>/</span>
<a name="remote-project" href="<%= url_for("/$mid/$mproject") %>"><%= $mproject %></a>
<span>/</span>
%= select_field 'remote-branch' => $mbranches, style => 'margin-top:5px;margin-bottom:7px;width:150px';
</div>
<div class="text-right">
<button name="compare-btn" class="btn" style="margin-top:5px">Compare</button>
% if ($api->logined($user)) {
<button name="import-btn" class="btn" style="margin-top:5px">Import</button>
% }
</div>
</div>
<hr style="margin:0">
% }
% } else {
<div class="well">
No Members.
</div>
% }
</div>
</div>
%= include '/include/footer';