|
2 | 2 | gist: gitbucket.gist.model.Gist, |
3 | 3 | repositoryUrl: gitbucket.gist.util.GistUtils.GistRepositoryURL)(implicit context: gitbucket.core.controller.Context) |
4 | 4 | @import gitbucket.core.view.helpers |
5 | | - |
| 5 | +@embedScript=@{"<script>"+repositoryUrl.embedUrl+"</script>"} |
6 | 6 | @menuitem(name: String, path: String, label: String, count: Int = 0) = { |
7 | 7 | <li @if(active == name){class="active"}> |
8 | 8 | <a href="@context.path/gist/@path"> |
|
32 | 32 | "Forks") |
33 | 33 | } |
34 | 34 | </ul> |
35 | | - <div class="small"> |
36 | | - <strong id="repository-url-proto">HTTP</strong> <span class="mute">clone URL</span> |
37 | | - </div> |
| 35 | + <div class="pull-right pc"> |
| 36 | + <div class="input-group" style="margin-bottom: 0px;"> |
| 37 | + <div class="btn-group input-group-btn"> |
| 38 | + <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
| 39 | + <span id="repository-url-proto">HTTP</span> <span class="caret"></span> |
| 40 | + </button> |
| 41 | + <ul class="dropdown-menu"> |
| 42 | + <li> |
| 43 | + <a href="javascript:void(0);" id="repository-url-embed"> |
| 44 | + <strong>Embed</strong><br> |
| 45 | + Embed this snippet in your website. |
| 46 | + </a> |
| 47 | + </li> |
| 48 | + <li> |
| 49 | + <a href="javascript:void(0);" id="repository-url-http"> |
| 50 | + <strong>HTTP</strong><br> |
| 51 | + Clone with Git using the repository's web address. |
| 52 | + </a> |
| 53 | + </li> |
| 54 | + @if(context.settings.ssh && context.loginAccount.isDefined){ |
| 55 | + <li> |
| 56 | + <a href="javascript:void(0);" id="repository-url-ssh"> |
| 57 | + <strong>SSH</strong><br> |
| 58 | + Clone with an SSH key and passphrase from your GitBucket Settings. |
| 59 | + </a> |
| 60 | + </li> |
| 61 | + } |
| 62 | + </ul> |
| 63 | + </div> |
38 | 64 | @gitbucket.core.helper.html.copy("repository-url", "repository-url-copy", repositoryUrl.httpUrl){ |
39 | 65 | <input type="text" value="@repositoryUrl.httpUrl" id="repository-url" class="form-control input-sm" readonly> |
40 | 66 | } |
41 | | - @if(context.settings.ssh && context.loginAccount.isDefined){ |
42 | | - <div class="small"> |
43 | | - <span class="mute">You can clone <a href="javascript:void(0);" id="repository-url-http">HTTP</a> or <a href="javascript:void(0);" id="repository-url-ssh">SSH</a>.</span> |
44 | | - </div> |
45 | | - } |
| 67 | + </div> |
46 | 68 | <div style="margin-top: 10px;"> |
47 | 69 | <a href="@context.path/gist/@{gist.userName}/@{gist.repositoryName}/download/@{gist.repositoryName}.zip" |
48 | | - class="btn btn-default btn-block"><i class="icon-download-alt"></i>Download ZIP</a> |
| 70 | + class="btn btn-default btn-block"><i class="octicon octicon-cloud-download"></i>Download ZIP</a> |
49 | 71 | </div> |
50 | 72 | </div> |
51 | | -@if(context.settings.ssh && context.loginAccount.isDefined){ |
| 73 | +</div> |
52 | 74 | <script> |
53 | 75 | $(function(){ |
| 76 | + $('#repository-url-embed').click(function(){ |
| 77 | + $('#repository-url').val('@embedScript'.replace(/</g,"<").replace(/>/g,">")); |
| 78 | + $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); |
| 79 | + }); |
54 | 80 | $('#repository-url-http').click(function(){ |
55 | 81 | $('#repository-url').val('@repositoryUrl.httpUrl'); |
56 | 82 | $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); |
57 | 83 | }); |
| 84 | +@if(context.settings.ssh && context.loginAccount.isDefined){ |
58 | 85 | $('#repository-url-ssh').click(function(){ |
59 | 86 | $('#repository-url').val('@repositoryUrl.sshUrl(context.loginAccount.get.userName)'); |
60 | 87 | $('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val()); |
61 | 88 | }); |
| 89 | +} |
62 | 90 | }); |
63 | 91 | </script> |
64 | | -} |
|
0 commit comments