Showing 3 changed files with 95 additions and 48 deletions
+57 -2
public/css/bootstrap.css
... ...
@@ -868,6 +868,55 @@ button.close {
868 868
   border-radius: 3px;
869 869
 }
870 870
 
871
+.btn-primary {
872
+  color: #ffffff;
873
+  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
874
+  background-color: #006dcc;
875
+  background-image: linear-gradient(to bottom, #0088cc, #0044cc);
876
+  background-repeat: repeat-x;
877
+  border-color: #0044cc #0044cc #002a80;
878
+  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
879
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
880
+  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
881
+}
882
+
883
+.btn-primary:hover,
884
+.btn-primary:focus,
885
+.btn-primary:active,
886
+.btn-primary.active,
887
+.btn-primary.disabled,
888
+.btn-primary[disabled] {
889
+  color: #ffffff;
890
+  background-color: #0044cc;
891
+}
892
+
893
+.btn-primary:active,
894
+.btn-primary.active {
895
+  background-color: #003399 \9;
896
+}
897
+
898
+.btn-info {
899
+  color: #ffffff;
900
+  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
901
+  background-color: #49afcd;
902
+  background-image: linear-gradient(to bottom, #5bc0de, #2f96b4);
903
+  background-repeat: repeat-x;
904
+  border-color: #2f96b4 #2f96b4 #1f6377;
905
+  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
906
+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0);
907
+  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
908
+}
909
+
910
+.btn-info:hover,
911
+.btn-info:focus,
912
+.btn-info:active,
913
+.btn-info.active,
914
+.btn-info.disabled,
915
+.btn-info[disabled] {
916
+  color: #ffffff;
917
+  background-color: #2f96b4;
918
+}
919
+
871 920
 /* alert */
872 921
 .alert {
873 922
   padding: 8px 35px 8px 14px;
... ...
@@ -1555,12 +1604,12 @@ button.close {
1555 1604
 
1556 1605
 .branch-select-left-container {
1557 1606
   float:left;
1558
-  width:30%;
1607
+  width:20%;
1559 1608
 }
1560 1609
 
1561 1610
 .branch-select-right-container {
1562 1611
   float:left;
1563
-  width:70%;
1612
+  width:80%;
1564 1613
 }
1565 1614
 
1566 1615
 .git-url-container {
... ...
@@ -1577,6 +1626,12 @@ button.close {
1577 1626
   border-radius:0;
1578 1627
 }
1579 1628
 
1629
+.git-url-container input {
1630
+  width:550px;
1631
+  padding:4px 0 5px 5px;
1632
+  border:1px solid #d8d8d8;
1633
+}
1634
+
1580 1635
 .page-path-container {
1581 1636
   float:left;
1582 1637
 }
+37 -4
templates/include/branch_select.html.ep
... ...
@@ -1,10 +1,13 @@
1 1
 <%
2 2
   my $api = gitprep_api;
3 3
   
4
+  my $user = param('user');
5
+  my $project = param('project');
4 6
   my $display = stash('display') || '';
5 7
   my $rev = stash('rev');
6 8
   $rev = '' unless defined $rev;
7 9
   my $branches = stash('branches');
10
+  my $ssh_rep_url = stash('ssh_rep_url');
8 11
 
9 12
   my $logined = $api->logined;
10 13
 
... ...
@@ -24,6 +27,7 @@
24 27
     $title = 'branch';
25 28
     $rev_short = $rev;
26 29
   }
30
+  
27 31
 %>
28 32
 
29 33
 %= javascript begin
... ...
@@ -91,6 +95,35 @@
91 95
     $('#rev-close').on('click', function () {
92 96
       $('#rev-popup').css('display', 'none');
93 97
     });
98
+    
99
+    
100
+    // Repository URL buttons
101
+    var http_rep_url = '<%= url_for("$user/$project.git")->to_abs %>';
102
+    
103
+    var logined = <%= $logined ? 'true' : 'false' %>;
104
+    var ssh_rep_url = '<%= $ssh_rep_url %>';
105
+    
106
+    // Click HTTP button
107
+    $('#btn_http').on('click', function () {
108
+      $('#rep_url').val(http_rep_url);
109
+      $('#btn_http').addClass('btn-info');
110
+      $('#btn_ssh').removeClass('btn-info');
111
+    });
112
+
113
+    // Click SSH button
114
+    $('#btn_ssh').on('click', function () {
115
+      $('#rep_url').val(ssh_rep_url);
116
+      $('#btn_http').removeClass('btn-info');
117
+      $('#btn_ssh').addClass('btn-info');
118
+    });
119
+
120
+    // Initialize
121
+    if (logined) {
122
+      $('#btn_ssh').trigger('click');
123
+    }
124
+    else {
125
+      $('#btn_http').trigger('click');
126
+    }
94 127
   });
95 128
 % end
96 129
 
... ...
@@ -103,14 +136,14 @@
103 136
   <div class="branch-select-right-container">
104 137
     % if ($display eq 'tree_top') {
105 138
       <ul class="git-url-container">
106
-        <li>
107
-          <button class="btn btn-small" id="btn_http"><%= $self->req->is_secure ? 'HTTPS' : 'HTTP' %></button>
108
-        </li>
109 139
         % if ($logined) {
110 140
           <li>
111
-            <button class="btn btn-small" id="btn_ssh">SSH</button>
141
+            <button class="btn btn-small btn-info" id="btn_ssh">SSH</button>
112 142
           </li>
113 143
         % }
144
+        <li>
145
+          <button class="btn btn-small <%= !$logined ? 'btn-info' : '' %>" id="btn_http"><%= $self->req->is_secure ? 'HTTPS' : 'HTTP' %></button>
146
+        </li>
114 147
         <li>
115 148
           <input id="rep_url" type="text">
116 149
         </li>
+1 -42
templates/tree.html.ep
... ...
@@ -79,47 +79,6 @@
79 79
   
80 80
   layout 'common', title => "$user/$project";
81 81
 %>
82
-
83
-  %= javascript begin
84
-    $(document).ready(function () {
85
-      var http_rep_url = '<%= url_for("$user/$project.git")->to_abs %>';
86
-      % my $rep = $git->rep($user, $project);
87
-      % my $ssh_port = config->{basic}{ssh_port} || '';
88
-      
89
-      var logined = <%= $logined ? 'true' : 'false' %>;
90
-      var ssh_rep_url = '';
91
-      if (logined) {
92
-        ssh_rep_url = '<%= $ssh_rep_url %>';
93
-      }
94
-      
95
-      // Click HTTP button
96
-      $('#btn_http').on('click', function () {
97
-        $('#rep_url').val(http_rep_url);
98
-        $('#access').text('Read-write');
99
-      });
100
-
101
-      // Click SSH(old) button
102
-      $('#btn_ssh').on('click', function () {
103
-        $('#rep_url').val(ssh_rep_url);
104
-        $('#access').text('Read-write');
105
-      });
106
-
107
-      // Initialize
108
-      $('#btn_http').trigger('click');
109
-      
110
-      // URL is automatically selected
111
-      var url_selected_count = 0;
112
-      $('#rep_url').on('mouseup', function () {
113
-        if (url_selected_count == 0) {
114
-          $(this).select();
115
-        }
116
-        url_selected_count += 1;
117
-      });
118
-      $('#rep_url').on('blur', function () {
119
-        url_selected_count = 0;
120
-      });
121
-    });
122
-  % end
123 82
   
124 83
   %= include '/include/header';
125 84
   
... ...
@@ -204,7 +163,7 @@
204 163
 
205 164
       <div style="margin-bottom:5px;">
206 165
         % my $display = defined $dir && length $dir ? 'tree' : 'tree_top';
207
-        %= include '/include/branch_select', display => $display, Path => $dir;
166
+        %= include '/include/branch_select', display => $display, Path => $dir, ssh_rep_url => $ssh_rep_url;
208 167
       </div>
209 168
       
210 169
       <div style="margin-bottom:30px">