18
18
<a class="ui button" href="{{.RepoLink}}/src/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_permalink"}}</a>
19
19
{{end}}
20
20
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
21
+ {{/* Custom GIN code change from repo.file_raw to repo.file_dl */}}
21
22
<a class="ui button" href="{{EscapePound $.RawFileLink}}">{{.i18n.Tr "repo.file_dl"}}</a>
22
23
</div>
23
24
{{if .Repository.CanEnableEditor}}
45
46
<div id="{{if not (or .IsJSON .IsYAML)}}{{if .IsIPythonNotebook}}ipython-notebook{{end}}" class="file-view {{if .IsMarkdown}}markdown{{else if .IsIPythonNotebook}}ipython-notebook{{else if .IsIPythonNotebook}}ipython-notebook{{else if .ReadmeInList}}plain-text{{else if and .IsTextFile}}code-view{{end}} has-emoji{{end}}">
46
47
{{if .IsMarkdown}}
47
48
{{if .FileContent}}{{.FileContent | Str2HTML}}{{end}}
48
- {{else if .IsODML}}
49
- <div class="ui fluid input">
50
- <input class="search-input form-control" placeholder="Search"></input>
51
- </div>
52
- <div id="jstree"></div>
53
- <script>
54
- $(function() {
55
- $(".search-input").keyup(function(e) {
56
- if(e.keyCode==13) {
57
- var searchString = $(this).val();
58
- console.log(searchString);
59
- $('#jstree').jstree('search', searchString);
60
- }
61
- });
62
- $('#jstree').jstree({
63
- 'core': {
64
- 'data': [{{.ODML| Str2JS}}]
65
- },
66
- "search": {
67
- "case_insensitive": true,
68
- "show_only_matches" : true
69
- },
70
- "plugins": ["search"]
71
- });
49
+ {{else if .IsODML}}
50
+ <div class="ui fluid input">
51
+ <input class="search-input form-control" placeholder="Search"></input>
52
+ </div>
53
+ <div id="jstree"></div>
54
+ <script>
55
+ $(function() {
56
+ $(".search-input").keyup(function(e) {
57
+ if(e.keyCode==13) {
58
+ var searchString = $(this).val();
59
+ console.log(searchString);
60
+ $('#jstree').jstree('search', searchString);
61
+ }
62
+ });
63
+ $('#jstree').jstree({
64
+ 'core': {
65
+ 'data': [{{.ODML| Str2JS}}]
66
+ },
67
+ "search": {
68
+ "case_insensitive": true,
69
+ "show_only_matches" : true
70
+ },
71
+ "plugins": ["search"]
72
72
});
73
- </script>
73
+ });
74
+ </script>
75
+
76
+ {{else if .IsJSON}}
77
+ <div id="jsoneditor"></div>
78
+ <script>
79
+ // create the editor
80
+ var container = document.getElementById("jsoneditor");
81
+ var options = {mode:"view"};
82
+ var editor = new JSONEditor(container, options);
83
+
84
+ // set json
85
+ var json = {{.RawFileContent| Str2JS}}
86
+ editor.set(json);
74
87
75
- {{else if .IsJSON}}
76
- <div id="jsoneditor"></div>
77
- <script>
78
- // create the editor
79
- var container = document.getElementById("jsoneditor");
80
- var options = {mode:"view"};
81
- var editor = new JSONEditor(container, options);
88
+ // get json
89
+ var json = editor.get();
90
+ </script>
82
91
83
- // set json
84
- var json = {{.RawFileContent| Str2JS}}
85
- editor.set(json);
92
+ {{else if .IsYAML}}
93
+ <div id="jsoneditor"></div>
94
+ <script>
95
+ // create the editor
96
+ var container = document.getElementById("jsoneditor");
97
+ var options = {mode:"view"};
98
+ var editor = new JSONEditor(container, options);
99
+ // set json
100
+ var json = YAML.parse({{.RawFileContent}})
101
+ editor.set(json);
86
102
87
- // get json
88
- var json = editor.get();
89
- </script>
90
- {{else if .IsYAML}}
91
- <div id="jsoneditor"></div>
92
- <script>
93
- // create the editor
94
- var container = document.getElementById("jsoneditor");
95
- var options = {mode:"view"};
96
- var editor = new JSONEditor(container, options);
97
- // set json
98
- var json = YAML.parse({{.RawFileContent}})
99
- editor.set(json);
103
+ // get json
104
+ var json = editor.get();
105
+ </script>
100
106
101
- // get json
102
- var json = editor.get();
103
- </script>
104
- {{else if .IsIPythonNotebook}}
105
- <script>
106
- $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
107
- var notebook = nb.parse(notebook_json);
107
+ {{else if .IsIPythonNotebook}}
108
+ <script>
109
+ $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
110
+ var notebook = nb.parse(notebook_json);
108
111
var rendered = notebook.render();
109
112
$.ajax({
110
113
type: "POST",
@@ -131,47 +134,50 @@ $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
131
134
});
132
135
});
133
136
});
134
- </script>
135
- {{else if .ReadmeInList}}
136
- {{if .FileContent}}{{.FileContent | Str2HTML}}{{end}}
137
- {{else if not .IsTextFile}}
138
- <div class="view-raw ui center">
139
- {{if .IsImageFile}}
140
- <img src="{{EscapePound $.RawFileLink}}">
141
- {{else if .IsAnnexedFile}}
142
- <div class="ui yellow segment">
143
- <strong>File content is not available</strong>
144
- <p>
145
- This file is a reference to a large file that is not available.
146
- Find more information on what this means, how it can happen, and how to potentially resolve the issue see the <a href="/G-Node/Info/wiki/Annexed+Content">Help Page on Annexed Content</a>.
147
- </p>
148
- </div>
149
- {{else if .IsVideoFile}}
150
- <video controls src="{{EscapePound $.RawFileLink}}">
151
- <strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong>
152
- </video>
153
- {{else if .IsPDFFile}}
154
- <iframe width="100%" height="600px" src="{{AppSubURL}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
155
- {{else}}
156
- <a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_dl"}}</a>
157
- {{end}}
158
- </div>
159
- {{else if .FileSize}}
160
- <table>
161
- <tbody>
162
- <tr>
137
+ </script>
138
+ {{else if .ReadmeInList}}
139
+ {{if .FileContent}}{{.FileContent | Str2HTML}}{{end}}
140
+ {{else if not .IsTextFile}}
141
+ <div class="view-raw ui center">
142
+ {{if .IsImageFile}}
143
+ <img src="{{EscapePound $.RawFileLink}}">
144
+
145
+ {{else if .IsAnnexedFile}}
146
+ <div class="ui yellow segment">
147
+ <strong>File content is not available</strong>
148
+ <p>
149
+ This file is a reference to a large file that is not available.
150
+ Find more information on what this means, how it can happen, and how to potentially resolve the issue see the <a href="/G-Node/Info/wiki/Annexed+Content">Help Page on Annexed Content</a>.
151
+ </p>
152
+ </div>
153
+ {{else if .IsVideoFile}}
154
+ <video controls src="{{EscapePound $.RawFileLink}}">
155
+ <strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong>
156
+ </video>
157
+ {{else if .IsPDFFile}}
158
+ <iframe width="100%" height="600px" src="{{AppSubURL}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
159
+ {{else}}
160
+ {{/* Custom GIN code change from repo.file_raw to repo.file_dl */}}
161
+ <a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_dl"}}</a>
162
+ {{end}}
163
+ </div>
164
+ {{else if .FileSize}}
165
+ <table>
166
+ <tbody>
167
+ <tr>
163
168
{{if .IsFileTooLarge}}
164
169
<td><strong>{{.i18n.Tr "repo.file_too_large"}}</strong></td>
165
170
{{else}}
166
171
<td class="lines-num">{{.LineNums}}</td>
167
172
<td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
168
- {{end}}
169
- </tr>
170
- </tbody>
171
- </table>
172
- {{end}}
173
+ {{end}}
174
+ </tr>
175
+ </tbody>
176
+ </table>
177
+ {{end}}
173
178
</div>
174
179
</div>
180
+
175
181
{{if or .IsJSON (or .IsYAML .IsODML)}}
176
182
<div class="ui codetab bottom attached tab {{if not .IsODML}}active{{end}} segment" data-tab="code">
177
183
<div class="file-view code-view has-emoji">
@@ -183,7 +189,7 @@ $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
183
189
{{else}}
184
190
<td class="lines-num">{{.LineNums}}</td>
185
191
<td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
186
- {{end}}
192
+ {{end}}
187
193
</tr>
188
194
</tbody>
189
195
</table>
@@ -193,11 +199,11 @@ $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
193
199
</div>
194
200
195
201
<script>
196
- function submitDeleteForm() {
197
- var message = prompt("{{.i18n.Tr "repo.delete_confirm_message"}}\n\n{{.i18n.Tr "repo.delete_commit_summary"}}", "Delete '{{.TreeName}}'");
198
- if (message != null) {
199
- $("#delete-message").val(message);
200
- $("#delete-file-form").submit()
201
- }
202
- }
202
+ function submitDeleteForm() {
203
+ var message = prompt("{{.i18n.Tr "repo.delete_confirm_message"}}\n\n{{.i18n.Tr "repo.delete_commit_summary"}}", "Delete '{{.TreeName}}'");
204
+ if (message != null) {
205
+ $("#delete-message").val(message);
206
+ $("#delete-file-form").submit()
207
+ }
208
+ }
203
209
</script>
0 commit comments