##// END OF EJS Templates
templates: add copy to clipboard for repository clone.
marcink -
r1942:f50c2856 default
parent child Browse files
Show More
@@ -1,270 +1,270 b''
1 1 // summary.less
2 2 // For use in RhodeCode applications;
3 3 // Used for headers and file detail summary screens.
4 4
5 5 .summary {
6 6 float: left;
7 7 position: relative;
8 8 width: 100%;
9 9 margin: 0;
10 10 padding: 0;
11 11
12 12 .summary-detail-header {
13 13 float: left;
14 14 display: block;
15 15 width: 100%;
16 16 margin-bottom: @textmargin;
17 17 padding: 0 0 .5em 0;
18 18 border-bottom: @border-thickness solid @border-default-color;
19 19
20 20 .breadcrumbs {
21 21 float: left;
22 22 display: inline;
23 23 margin: 0;
24 24 padding: 0;
25 25 }
26 26 h4 {
27 27 float: left;
28 28 margin: 0 1em 0 0;
29 29 padding: 0;
30 30 line-height: 1.2em;
31 31 font-size: @basefontsize;
32 32 }
33 33
34 34 .action_link {
35 35 float: right;
36 36 }
37 37
38 38 .new-file {
39 39 float: right;
40 40 margin-top: -1.5em;
41 41 }
42 42 }
43 43
44 44 .summary-detail {
45 45 float: left;
46 46 position: relative;
47 47 width: 73%;
48 48 margin: 0 3% @space 0;
49 49 padding: 0;
50 50
51 51 .file_diff_buttons {
52 52 margin-top: @space;
53 53 }
54 54
55 55 // commit message
56 56 .commit {
57 57 white-space: pre-wrap;
58 58 }
59 59
60 60 #clone_url {
61 width: ~"calc(100% - 96px)";
61 width: ~"calc(100% - 103px)";
62 62 padding: @padding/4;
63 63 }
64 64
65 65 #clone_url_id {
66 width: ~"calc(100% - 118px)";
66 width: ~"calc(100% - 125px)";
67 67 padding: @padding/4;
68 68 }
69 69
70 70 &.directory {
71 71 margin-bottom: 0;
72 72 }
73 73
74 74 .desc {
75 75 white-space: pre-wrap;
76 76 }
77 77 .disabled {
78 78 opacity: .5;
79 79 cursor: inherit;
80 80 }
81 81 .help-block {
82 82 color: inherit;
83 83 margin: 0;
84 84 }
85 85 }
86 86
87 87 .sidebar-right {
88 88 float: left;
89 89 width: 24%;
90 90 margin: 0;
91 91 padding: 0;
92 92
93 93 ul {
94 94 margin-left: 0;
95 95 padding-left: 0;
96 96
97 97 li {
98 98
99 99 &:before {
100 100 content: none;
101 101 width: 0;
102 102 }
103 103 }
104 104 }
105 105 }
106 106
107 107 #clone_by_name, #clone_by_id{
108 108 display: inline-block;
109 margin-left: @padding;
109 margin-left: 0px;
110 110 }
111 111
112 112 .codeblock {
113 113 border: none;
114 114 background-color: transparent;
115 115 }
116 116
117 117 .code-body {
118 118 border: @border-thickness solid @border-default-color;
119 119 .border-radius(@border-radius);
120 120 }
121 121 }
122 122
123 123 // this is used outside of just the summary
124 124 .fieldset, // similar to form fieldset
125 125 .summary .sidebar-right-content { // these have to match
126 126 clear: both;
127 127 float: left;
128 128 position: relative;
129 129 display:block;
130 130 width: 100%;
131 131 min-height: 1em;
132 132 margin-bottom: @textmargin;
133 133 padding: 0;
134 134 line-height: 1.2em;
135 135
136 136 &:after { // clearfix
137 137 content: "";
138 138 clear: both;
139 139 width: 100%;
140 140 height: 1em;
141 141 }
142 142 }
143 143
144 144 .summary .sidebar-right-content {
145 145 margin-bottom: @space;
146 146
147 147 .rc-user {
148 148 min-width: 0;
149 149 }
150 150 }
151 151
152 152 .fieldset {
153 153
154 154 .left-label { // similar to form legend
155 155 float: left;
156 156 display: block;
157 157 width: 25%;
158 158 margin: 0;
159 159 padding: 0;
160 160 font-family: @text-semibold;
161 161 }
162 162
163 163 .right-content { // similar to form fields
164 164 float: left;
165 165 display: block;
166 166 width: 75%;
167 167 margin: 0 0 0 -15%;
168 168 padding: 0 0 0 15%;
169 169
170 170 .truncate-wrap,
171 171 .truncate {
172 172 max-width: 100%;
173 173 width: 100%;
174 174 }
175 175
176 176 .commit-long {
177 177 overflow-x: auto;
178 178 }
179 179 }
180 180 .commit.truncate-wrap {
181 181 overflow:hidden;
182 182 text-overflow: ellipsis;
183 183 }
184 184 }
185 185
186 186 // expand commit message
187 187 #message_expand {
188 188 clear: both;
189 189 display: block;
190 190 color: @rcblue;
191 191 cursor: pointer;
192 192 }
193 193
194 194 #trimmed_message_box {
195 195 max-height: floor(2 * @basefontsize * 1.2); // 2 lines * line-height
196 196 overflow: hidden;
197 197 }
198 198
199 199 // show/hide comments button
200 200 .show-inline-comments {
201 201 display: inline;
202 202 cursor: pointer;
203 203
204 204 .comments-show { display: inline; }
205 205 .comments-hide { display: none; }
206 206
207 207 &.comments-visible {
208 208 .comments-show { display: none; }
209 209 .comments-hide { display: inline; }
210 210 }
211 211 }
212 212
213 213 // Quick Start section
214 214 .quick_start {
215 215 float: left;
216 216 display: block;
217 217 position: relative;
218 218 width: 100%;
219 219
220 220 // adds some space to make copy and paste easier
221 221 .left-label,
222 222 .right-content {
223 223 line-height: 1.6em;
224 224 }
225 225 }
226 226
227 227 .submodule {
228 228 .summary-detail {
229 229 width: 100%;
230 230
231 231 .btn-collapse {
232 232 display: none;
233 233 }
234 234 }
235 235 }
236 236
237 237 .codeblock-header {
238 238 float: left;
239 239 display: block;
240 240 width: 100%;
241 241 margin: 0;
242 242 padding: @space 0 @padding 0;
243 243 border-top: @border-thickness solid @border-default-color;
244 244
245 245 .stats {
246 246 float: left;
247 247 width: 50%;
248 248 }
249 249
250 250 .buttons {
251 251 float: right;
252 252 width: 50%;
253 253 text-align: right;
254 254 color: @grey4;
255 255 }
256 256 }
257 257
258 258 #summary-menu-stats {
259 259
260 260 .stats-bullet {
261 261 color: @grey3;
262 262 min-width: 3em;
263 263 }
264 264
265 265 .repo-size {
266 266 margin-bottom: .5em;
267 267 }
268 268
269 269 }
270 270
@@ -1,202 +1,211 b''
1 1 <%def name="refs_counters(branches, closed_branches, tags, bookmarks)">
2 2 <span class="branchtag tag">
3 3 <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs">
4 4 <i class="icon-branch"></i>${_ungettext(
5 5 '%(num)s Branch','%(num)s Branches', len(branches)) % {'num': len(branches)}}</a>
6 6 </span>
7 7
8 8 %if closed_branches:
9 9 <span class="branchtag tag">
10 10 <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs">
11 11 <i class="icon-branch"></i>${_ungettext(
12 12 '%(num)s Closed Branch', '%(num)s Closed Branches', len(closed_branches)) % {'num': len(closed_branches)}}</a>
13 13 </span>
14 14 %endif
15 15
16 16 <span class="tagtag tag">
17 17 <a href="${h.route_path('tags_home',repo_name=c.repo_name)}" class="childs">
18 18 <i class="icon-tag"></i>${_ungettext(
19 19 '%(num)s Tag', '%(num)s Tags', len(tags)) % {'num': len(tags)}}</a>
20 20 </span>
21 21
22 22 %if bookmarks:
23 23 <span class="booktag tag">
24 24 <a href="${h.route_path('bookmarks_home',repo_name=c.repo_name)}" class="childs">
25 25 <i class="icon-bookmark"></i>${_ungettext(
26 26 '%(num)s Bookmark', '%(num)s Bookmarks', len(bookmarks)) % {'num': len(bookmarks)}}</a>
27 27 </span>
28 28 %endif
29 29 </%def>
30 30
31 31 <%def name="summary_detail(breadcrumbs_links, show_downloads=True)">
32 32 <% summary = lambda n:{False:'summary-short'}.get(n) %>
33 33
34 34 <div id="summary-menu-stats" class="summary-detail">
35 35 <div class="summary-detail-header">
36 36 <div class="breadcrumbs files_location">
37 37 <h4>
38 38 ${breadcrumbs_links}
39 39 </h4>
40 40 </div>
41 41 <div id="summary_details_expand" class="btn-collapse" data-toggle="summary-details">
42 42 ${_('Show More')}
43 43 </div>
44 44 </div>
45 45
46 46 <div class="fieldset">
47 47 %if h.is_svn_without_proxy(c.rhodecode_db_repo):
48 48 <div class="left-label disabled">
49 49 ${_('Read-only url')}:
50 50 </div>
51 51 <div class="right-content disabled">
52 52 <input type="text" class="input-monospace" id="clone_url" disabled value="${c.clone_repo_url}"/>
53 <i id="clone_by_name_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i>
54
53 55 <input type="text" class="input-monospace" id="clone_url_id" disabled value="${c.clone_repo_url_id}" style="display: none;"/>
56 <i id="clone_by_id_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}" style="display: none"></i>
57
54 58 <a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a>
55 59 <a id="clone_by_id" class="clone">${_('Show by ID')}</a>
60
56 61 <p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p>
57 62 </div>
58 63 %else:
59 64 <div class="left-label">
60 65 ${_('Clone url')}:
61 66 </div>
62 67 <div class="right-content">
63 68 <input type="text" class="input-monospace" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
69 <i id="clone_by_name_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i>
70
64 71 <input type="text" class="input-monospace" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}" style="display: none;"/>
72 <i id="clone_by_id_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}" style="display: none"></i>
73
65 74 <a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a>
66 75 <a id="clone_by_id" class="clone">${_('Show by ID')}</a>
67 76 </div>
68 77 %endif
69 78 </div>
70 79
71 80 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
72 81 <div class="left-label">
73 82 ${_('Description')}:
74 83 </div>
75 84 <div class="right-content">
76 85 %if c.visual.stylify_metatags:
77 86 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.escaped_stylize(c.rhodecode_db_repo.description))}</div>
78 87 %else:
79 88 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.html_escape(c.rhodecode_db_repo.description))}</div>
80 89 %endif
81 90 </div>
82 91 </div>
83 92
84 93 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
85 94 <div class="left-label">
86 95 ${_('Information')}:
87 96 </div>
88 97 <div class="right-content">
89 98
90 99 <div class="repo-size">
91 100 <% commit_rev = c.rhodecode_db_repo.changeset_cache.get('revision') %>
92 101
93 102 ## commits
94 103 % if commit_rev == -1:
95 104 ${_ungettext('%(num)s Commit', '%(num)s Commits', 0) % {'num': 0}},
96 105 % else:
97 106 <a href="${h.route_path('repo_changelog', repo_name=c.repo_name)}">
98 107 ${_ungettext('%(num)s Commit', '%(num)s Commits', commit_rev) % {'num': commit_rev}}</a>,
99 108 % endif
100 109
101 110 ## forks
102 111 <a title="${_('Number of Repository Forks')}" href="${h.url('repo_forks_home', repo_name=c.repo_name)}">
103 112 ${c.repository_forks} ${_ungettext('Fork', 'Forks', c.repository_forks)}</a>,
104 113
105 114 ## repo size
106 115 % if commit_rev == -1:
107 116 <span class="stats-bullet">0 B</span>
108 117 % else:
109 118 <span class="stats-bullet" id="repo_size_container">
110 119 ${_('Calculating Repository Size...')}
111 120 </span>
112 121 % endif
113 122 </div>
114 123
115 124 <div class="commit-info">
116 125 <div class="tags">
117 126 % if c.rhodecode_repo:
118 127 ${refs_counters(
119 128 c.rhodecode_repo.branches,
120 129 c.rhodecode_repo.branches_closed,
121 130 c.rhodecode_repo.tags,
122 131 c.rhodecode_repo.bookmarks)}
123 132 % else:
124 133 ## missing requirements can make c.rhodecode_repo None
125 134 ${refs_counters([], [], [], [])}
126 135 % endif
127 136 </div>
128 137 </div>
129 138
130 139 </div>
131 140 </div>
132 141
133 142 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
134 143 <div class="left-label">
135 144 ${_('Statistics')}:
136 145 </div>
137 146 <div class="right-content">
138 147 <div class="input ${summary(c.show_stats)} statistics">
139 148 % if c.show_stats:
140 149 <div id="lang_stats" class="enabled">
141 150 ${_('Calculating Code Statistics...')}
142 151 </div>
143 152 % else:
144 153 <span class="disabled">
145 154 ${_('Statistics are disabled for this repository')}
146 155 </span>
147 156 % if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
148 157 , ${h.link_to(_('enable statistics'),h.route_path('edit_repo',repo_name=c.repo_name, anchor='repo_enable_statistics'))}
149 158 % endif
150 159 % endif
151 160 </div>
152 161
153 162 </div>
154 163 </div>
155 164
156 165 % if show_downloads:
157 166 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
158 167 <div class="left-label">
159 168 ${_('Downloads')}:
160 169 </div>
161 170 <div class="right-content">
162 171 <div class="input ${summary(c.show_stats)} downloads">
163 172 % if c.rhodecode_repo and len(c.rhodecode_repo.revisions) == 0:
164 173 <span class="disabled">
165 174 ${_('There are no downloads yet')}
166 175 </span>
167 176 % elif not c.enable_downloads:
168 177 <span class="disabled">
169 178 ${_('Downloads are disabled for this repository')}
170 179 </span>
171 180 % if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
172 181 , ${h.link_to(_('enable downloads'),h.route_path('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'))}
173 182 % endif
174 183 % else:
175 184 <span class="enabled">
176 185 <a id="archive_link" class="btn btn-small" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name,fname='tip.zip')}">
177 186 <i class="icon-archive"></i> tip.zip
178 187 ## replaced by some JS on select
179 188 </a>
180 189 </span>
181 190 ${h.hidden('download_options')}
182 191 % endif
183 192 </div>
184 193 </div>
185 194 </div>
186 195 % endif
187 196
188 197 </div><!--end summary-detail-->
189 198 </%def>
190 199
191 200 <%def name="summary_stats(gravatar_function)">
192 201 <div class="sidebar-right">
193 202 <div class="summary-detail-header">
194 203 <h4 class="item">
195 204 ${_('Owner')}
196 205 </h4>
197 206 </div>
198 207 <div class="sidebar-right-content">
199 208 ${gravatar_function(c.rhodecode_db_repo.user.email, 16)}
200 209 </div>
201 210 </div><!--end sidebar-right-->
202 211 </%def>
@@ -1,128 +1,136 b''
1 1 <%inherit file="/summary/base.mako"/>
2 2
3 3 <%namespace name="components" file="/summary/components.mako"/>
4 4
5 5
6 6 <%def name="menu_bar_subnav()">
7 7 ${self.repo_menu(active='summary')}
8 8 </%def>
9 9
10 10 <%def name="main()">
11 11
12 12 <div class="title">
13 13 ${self.repo_page_title(c.rhodecode_db_repo)}
14 14 <ul class="links icon-only-links block-right">
15 15 <li>
16 16 %if c.rhodecode_user.username != h.DEFAULT_USER:
17 17 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}"><i class="icon-rss-sign"></i></a>
18 18 %else:
19 19 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}"><i class="icon-rss-sign"></i></a>
20 20 %endif
21 21 </li>
22 22 </ul>
23 23 </div>
24 24
25 25 <div id="repo-summary" class="summary">
26 26 ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=True)}
27 27 ${components.summary_stats(gravatar_function=self.gravatar_with_user)}
28 28 </div><!--end repo-summary-->
29 29
30 30
31 31 <div class="box" >
32 32 %if not c.repo_commits:
33 33 <div class="title">
34 34 <h3>${_('Quick start')}</h3>
35 35 </div>
36 36 %endif
37 37 <div class="table">
38 38 <div id="shortlog_data">
39 39 <%include file='summary_commits.mako'/>
40 40 </div>
41 41 </div>
42 42 </div>
43 43
44 44 %if c.readme_data:
45 45 <div id="readme" class="anchor">
46 46 <div class="box" >
47 47 <div class="title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_rev[0], c.rhodecode_db_repo.landing_rev[1]))}">
48 48 <h3 class="breadcrumbs">
49 49 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_rev[1],f_path=c.readme_file)}">${c.readme_file}</a>
50 50 </h3>
51 51 </div>
52 52 <div class="readme codeblock">
53 53 <div class="readme_box">
54 54 ${c.readme_data|n}
55 55 </div>
56 56 </div>
57 57 </div>
58 58 </div>
59 59 %endif
60 60
61 61 <script type="text/javascript">
62 62 $(document).ready(function(){
63 63 $('#clone_by_name').on('click',function(e){
64 64 // show url by name and hide name button
65 65 $('#clone_url').show();
66 66 $('#clone_by_name').hide();
67 67
68 68 // hide url by id and show name button
69 69 $('#clone_by_id').show();
70 70 $('#clone_url_id').hide();
71 71
72 // hide copy by id
73 $('#clone_by_name_copy').show();
74 $('#clone_by_id_copy').hide();
75
72 76 });
73 77 $('#clone_by_id').on('click',function(e){
74 78
75 79 // show url by id and hide id button
76 80 $('#clone_by_id').hide();
77 81 $('#clone_url_id').show();
78 82
79 83 // hide url by name and show id button
80 84 $('#clone_by_name').show();
81 85 $('#clone_url').hide();
86
87 // hide copy by id
88 $('#clone_by_id_copy').show();
89 $('#clone_by_name_copy').hide();
82 90 });
83 91
84 92 var initialCommitData = {
85 93 id: null,
86 94 text: 'tip',
87 95 type: 'tag',
88 96 raw_id: null,
89 97 files_url: null
90 98 };
91 99
92 100 select2RefSwitcher('#download_options', initialCommitData);
93 101
94 102 // on change of download options
95 103 $('#download_options').on('change', function(e) {
96 104 // format of Object {text: "v0.0.3", type: "tag", id: "rev"}
97 105 var selected_cs = e.added;
98 106 var fname= e.added.raw_id + ".zip";
99 107 var href = pyroutes.url('repo_archivefile', {'repo_name': templateContext.repo_name, 'fname':fname});
100 108 // set new label
101 109 $('#archive_link').html('<i class="icon-archive"></i> '+ e.added.text+".zip");
102 110
103 111 // set new url to button,
104 112 $('#archive_link').attr('href', href)
105 113 });
106 114
107 115
108 116 // load details on summary page expand
109 117 $('#summary_details_expand').on('click', function() {
110 118
111 119 var callback = function (data) {
112 120 % if c.show_stats:
113 121 showRepoStats('lang_stats', data);
114 122 % endif
115 123 };
116 124
117 125 showRepoSize(
118 126 'repo_size_container',
119 127 templateContext.repo_name,
120 128 templateContext.repo_landing_commit,
121 129 callback);
122 130
123 131 })
124 132
125 133 })
126 134 </script>
127 135
128 136 </%def>
General Comments 0
You need to be logged in to leave comments. Login now