Show More
@@ -1,112 +1,112 b'' | |||
|
1 | 1 | <%inherit file="/base/base.mako"/> |
|
2 | 2 | <%namespace name="dt" file="/data_table/_dt_elements.mako"/> |
|
3 | 3 | |
|
4 | 4 | <%def name="robots()"> |
|
5 | 5 | %if c.gist.gist_type != 'public': |
|
6 | 6 | <meta name="robots" content="noindex, nofollow"> |
|
7 | 7 | %else: |
|
8 | 8 | ${parent.robots()} |
|
9 | 9 | %endif |
|
10 | 10 | </%def> |
|
11 | 11 | |
|
12 | 12 | <%def name="title()"> |
|
13 | 13 | ${_('Gist')} · ${c.gist.gist_access_id} |
|
14 | 14 | %if c.rhodecode_name: |
|
15 | 15 | · ${h.branding(c.rhodecode_name)} |
|
16 | 16 | %endif |
|
17 | 17 | </%def> |
|
18 | 18 | |
|
19 | 19 | <%def name="breadcrumbs_links()"> |
|
20 | 20 | ${_('Gist')} · ${c.gist.gist_access_id} |
|
21 | 21 | </%def> |
|
22 | 22 | |
|
23 | 23 | <%def name="menu_bar_nav()"> |
|
24 | 24 | ${self.menu_items(active='gists')} |
|
25 | 25 | </%def> |
|
26 | 26 | |
|
27 | 27 | <%def name="main()"> |
|
28 | 28 | <div class="box"> |
|
29 | 29 | <!-- box / title --> |
|
30 | 30 | |
|
31 | 31 | <div class="table"> |
|
32 | 32 | <div id="files_data"> |
|
33 | 33 | <div id="codeblock" class="codeblock"> |
|
34 | 34 | <div class="code-header"> |
|
35 | 35 | <div class="gist_url"> |
|
36 | 36 | <div class="pull-left"> |
|
37 | 37 | <code> |
|
38 | 38 | ${dt.gist_type(c.gist.gist_type)} |
|
39 | 39 | <span class="tag disabled">${c.gist.gist_access_id}</span> |
|
40 | 40 | ${c.gist.gist_url()} <span class="icon-clipboard clipboard-action" data-clipboard-text="${c.gist.gist_url()}" title="${_('Copy the url')}"></span> |
|
41 | 41 | </code> |
|
42 | 42 | </div> |
|
43 | 43 | |
|
44 | 44 | <div class="pull-right buttons"> |
|
45 | 45 | ## only owner should see that |
|
46 | 46 | <a href="#copySource" onclick="return false;" class="btn btn-mini icon-clipboard no-grey clipboard-action" data-clipboard-text="${c.files[0].content}">${_('Copy content')}</a> |
|
47 | 47 | |
|
48 | 48 | %if c.is_super_admin or c.gist.gist_owner == c.rhodecode_user.user_id: |
|
49 | 49 | ${h.link_to(_('Edit'), h.route_path('gist_edit', gist_id=c.gist.gist_access_id), class_="btn btn-mini")} |
|
50 | 50 | %endif |
|
51 | 51 | ${h.link_to(_('Show as Raw'), h.route_path('gist_show_formatted', gist_id=c.gist.gist_access_id, revision='tip', format='raw'), class_="btn btn-mini")} |
|
52 | 52 | |
|
53 | 53 | %if c.is_super_admin or c.gist.gist_owner == c.rhodecode_user.user_id: |
|
54 | 54 | <div class="pull-right remove_gist"> |
|
55 | 55 | ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), request=request)} |
|
56 | 56 | <input class="btn btn-mini btn-danger" id="remove_gist" name="remove_gist" |
|
57 | 57 | onclick="submitConfirm(event, this, _gettext('Confirm to delete this gist'), _gettext('Delete'), '${c.gist.gist_access_id}')" |
|
58 | 58 | type="submit" value="${_('Delete')}" |
|
59 | 59 | > |
|
60 | 60 | ${h.end_form()} |
|
61 | 61 | </div> |
|
62 | 62 | %endif |
|
63 | 63 | </div> |
|
64 | 64 | </div> |
|
65 | 65 | |
|
66 | 66 | <div class="gist-desc"> |
|
67 | 67 | <code>${c.gist.gist_description}</code> |
|
68 | 68 | </div> |
|
69 | 69 | |
|
70 | 70 | <div class="author"> |
|
71 | 71 | <div title="${h.tooltip(c.file_last_commit.author)}"> |
|
72 | 72 | ${self.gravatar_with_user(c.file_last_commit.author, 16, tooltip=True)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}, |
|
73 | 73 | ${_('expires')}: |
|
74 | 74 | %if c.gist.gist_expires == -1: |
|
75 | 75 | ${_('never')} |
|
76 | 76 | %else: |
|
77 | 77 | ${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))} |
|
78 | 78 | %endif |
|
79 | 79 | </span> |
|
80 | 80 | </div> |
|
81 | 81 | |
|
82 | 82 | </div> |
|
83 | 83 | <div class="commit">${h.urlify_commit_message(c.file_last_commit.message, None)}</div> |
|
84 | 84 | </div> |
|
85 | 85 | |
|
86 | 86 | ## iterate over the files |
|
87 | 87 | % for gist_file in c.files: |
|
88 | 88 | <% renderer = c.render and h.renderer_from_filename(gist_file.path, exclude=['.txt', '.TXT'])%> |
|
89 | 89 | <!-- |
|
90 | 90 | <div id="${h.FID('G', gist_file.path)}" class="stats" > |
|
91 | 91 | <a href="${c.gist.gist_url()}">ΒΆ</a> |
|
92 | 92 | <b >${gist_file.path}</b> |
|
93 | 93 | <div> |
|
94 | 94 | ${h.link_to(_('Show as raw'), h.route_path('gist_show_formatted_path', gist_id=c.gist.gist_access_id, revision=gist_file.commit.raw_id, format='raw', f_path=gist_file.path), class_="btn btn-mini")} |
|
95 | 95 | </div> |
|
96 | 96 | </div> |
|
97 | 97 | --> |
|
98 | 98 | <div class="code-body textarea text-area editor"> |
|
99 | 99 | %if renderer: |
|
100 | ${h.render(gist_file.content, renderer=renderer)} | |
|
100 | ${h.render(gist_file.str_content, renderer=renderer)} | |
|
101 | 101 | %else: |
|
102 | 102 | ${h.pygmentize(gist_file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
|
103 | 103 | %endif |
|
104 | 104 | </div> |
|
105 | 105 | %endfor |
|
106 | 106 | </div> |
|
107 | 107 | </div> |
|
108 | 108 | </div> |
|
109 | 109 | |
|
110 | 110 | |
|
111 | 111 | </div> |
|
112 | 112 | </%def> |
@@ -1,64 +1,63 b'' | |||
|
1 | ## -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | ## <%namespace name="diff_block" file="/changeset/diff_block.mako"/> |
|
4 | 3 | ## ${diff_block.diff_block_changeset_table(change)} |
|
5 | 4 | ## |
|
6 | 5 | <%def name="changeset_message()"> |
|
7 | 6 | <h5>${_('The requested commit is too big and content was truncated.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5> |
|
8 | 7 | </%def> |
|
9 | 8 | <%def name="file_message()"> |
|
10 | 9 | <h5>${_('The requested file is too big and its content is not shown.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5> |
|
11 | 10 | </%def> |
|
12 | 11 | |
|
13 | 12 | <%def name="diff_block_changeset_table(change)"> |
|
14 | 13 | <div class="diff-container" id="${'diff-container-%s' % (id(change))}"> |
|
15 | 14 | %for FID,(cs1, cs2, change, filenode_path, diff, stats, file_data) in change.items(): |
|
16 | 15 | <div id="${h.FID('',filenode_path)}_target" ></div> |
|
17 | 16 | <div id="${h.FID('',filenode_path)}" class="diffblock margined comm"> |
|
18 | 17 | <div class="code-body"> |
|
19 |
<div class="full_f_path" path="${h.safe_ |
|
|
18 | <div class="full_f_path" path="${h.safe_str(filenode_path)}" style="display: none"></div> | |
|
20 | 19 | ${diff|n} |
|
21 | 20 | % if file_data["is_limited_diff"]: |
|
22 | 21 | % if file_data["exceeds_limit"]: |
|
23 | 22 | ${self.file_message()} |
|
24 | 23 | % else: |
|
25 | 24 | <h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5> |
|
26 | 25 | % endif |
|
27 | 26 | % endif |
|
28 | 27 | </div> |
|
29 | 28 | </div> |
|
30 | 29 | %endfor |
|
31 | 30 | </div> |
|
32 | 31 | </%def> |
|
33 | 32 | |
|
34 | 33 | <%def name="diff_block_simple(change)"> |
|
35 | 34 | <div class="diff-container" id="${'diff-container-%s' % (id(change))}"> |
|
36 | 35 | %for op,filenode_path,diff,file_data in change: |
|
37 | 36 | <div id="${h.FID('',filenode_path)}_target" ></div> |
|
38 | 37 | <div id="${h.FID('',filenode_path)}" class="diffblock margined comm" > |
|
39 | 38 | <div class="code-body"> |
|
40 |
<div class="full_f_path" path="${h.safe_ |
|
|
39 | <div class="full_f_path" path="${h.safe_str(filenode_path)}" style="display: none;"></div> | |
|
41 | 40 | ${diff|n} |
|
42 | 41 | % if file_data["is_limited_diff"]: |
|
43 | 42 | % if file_data["exceeds_limit"]: |
|
44 | 43 | ${self.file_message()} |
|
45 | 44 | % else: |
|
46 | 45 | <h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5> |
|
47 | 46 | % endif |
|
48 | 47 | % endif |
|
49 | 48 | </div> |
|
50 | 49 | </div> |
|
51 | 50 | %endfor |
|
52 | 51 | </div> |
|
53 | 52 | </%def> |
|
54 | 53 | |
|
55 | 54 | |
|
56 | 55 | <%def name="diff_summary_text(changed_files, lines_added, lines_deleted, limited_diff=False)"> |
|
57 | 56 | % if limited_diff: |
|
58 | 57 | ${_ungettext('%(num)s file changed', '%(num)s files changed', changed_files) % {'num': changed_files}} |
|
59 | 58 | % else: |
|
60 | 59 | ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted', |
|
61 | 60 | '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', changed_files) % {'num': changed_files, 'linesadd': lines_added, 'linesdel': lines_deleted}} |
|
62 | 61 | %endif |
|
63 | 62 | </%def> |
|
64 | 63 |
@@ -1,128 +1,128 b'' | |||
|
1 | 1 | <%inherit file="/base/base.mako"/> |
|
2 | 2 | |
|
3 | 3 | <%def name="title()"> |
|
4 | 4 | ${_('{} Files Edit').format(c.repo_name)} |
|
5 | 5 | %if c.rhodecode_name: |
|
6 | 6 | · ${h.branding(c.rhodecode_name)} |
|
7 | 7 | %endif |
|
8 | 8 | </%def> |
|
9 | 9 | |
|
10 | 10 | <%def name="menu_bar_nav()"> |
|
11 | 11 | ${self.menu_items(active='repositories')} |
|
12 | 12 | </%def> |
|
13 | 13 | |
|
14 | 14 | <%def name="breadcrumbs_links()"></%def> |
|
15 | 15 | |
|
16 | 16 | <%def name="menu_bar_subnav()"> |
|
17 | 17 | ${self.repo_menu(active='files')} |
|
18 | 18 | </%def> |
|
19 | 19 | |
|
20 | 20 | <%def name="main()"> |
|
21 | 21 | |
|
22 | 22 | <div class="box"> |
|
23 | 23 | |
|
24 | 24 | <div class="edit-file-title"> |
|
25 | 25 | <span class="title-heading">${_('Edit file')} @ <code>${h.show_id(c.commit)}</code></span> |
|
26 | 26 | % if c.commit.branch: |
|
27 | 27 | <span class="tag branchtag"> |
|
28 | 28 | <i class="icon-branch"></i> ${c.commit.branch} |
|
29 | 29 | </span> |
|
30 | 30 | % endif |
|
31 | 31 | </div> |
|
32 | 32 | |
|
33 | 33 | ${h.secure_form(h.route_path('repo_files_update_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', request=request)} |
|
34 | 34 | <div class="edit-file-fieldset"> |
|
35 | 35 | <div class="path-items"> |
|
36 | 36 | <ul> |
|
37 | 37 | <li class="breadcrumb-path"> |
|
38 | 38 | <div> |
|
39 | 39 | ${h.files_breadcrumbs(c.repo_name, c.rhodecode_db_repo.repo_type, c.commit.raw_id, c.file.path, c.rhodecode_db_repo.landing_ref_name, request.GET.get('at'), limit_items=True, hide_last_item=True, copy_path_icon=False)} / |
|
40 | 40 | </div> |
|
41 | 41 | </li> |
|
42 | 42 | <li class="location-path"> |
|
43 | 43 | <input type="hidden" value="${c.f_path}" name="root_path"> |
|
44 | 44 | <input class="file-name-input input-small" type="text" value="${c.file.name}" name="filename" id="filename" placeholder="${_('Filename e.g example.py, or docs/readme.md')}"> |
|
45 | 45 | </li> |
|
46 | 46 | </ul> |
|
47 | 47 | </div> |
|
48 | 48 | |
|
49 | 49 | </div> |
|
50 | 50 | |
|
51 | 51 | <div class="table"> |
|
52 | 52 | <div> |
|
53 | 53 | |
|
54 | 54 | <div id="codeblock" class="codeblock"> |
|
55 | 55 | <div class="editor-items"> |
|
56 | 56 | <div class="editor-action active show-editor pull-left" onclick="fileEditor.showEditor(); return false"> |
|
57 | 57 | ${_('Edit')} |
|
58 | 58 | </div> |
|
59 | 59 | |
|
60 | 60 | <div class="editor-action show-preview pull-left" onclick="fileEditor.showPreview(); return false"> |
|
61 | 61 | ${_('Preview')} |
|
62 | 62 | </div> |
|
63 | 63 | |
|
64 | 64 | <div class="pull-right"> |
|
65 | 65 | ${h.dropdownmenu('line_wrap', 'off', [('on', _('Line wraps on')), ('off', _('line wraps off')),])} |
|
66 | 66 | </div> |
|
67 | 67 | <div class="pull-right"> |
|
68 | 68 | ${h.dropdownmenu('set_mode','plain',[('plain', _('plain'))],enable_filter=True)} |
|
69 | 69 | </div> |
|
70 | 70 | </div> |
|
71 | 71 | |
|
72 | 72 | <div id="editor_container"> |
|
73 | 73 | <pre id="editor_pre"></pre> |
|
74 | <textarea id="editor" name="content" >${h.escape(c.file.content)|n}</textarea> | |
|
74 | <textarea id="editor" name="content" >${h.escape(c.file.str_content)|n}</textarea> | |
|
75 | 75 | <div id="editor_preview" ></div> |
|
76 | 76 | </div> |
|
77 | 77 | </div> |
|
78 | 78 | </div> |
|
79 | 79 | </div> |
|
80 | 80 | |
|
81 | 81 | <div class="edit-file-fieldset"> |
|
82 | 82 | <div class="fieldset"> |
|
83 | 83 | <div class="message"> |
|
84 | 84 | <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea> |
|
85 | 85 | </div> |
|
86 | 86 | </div> |
|
87 | 87 | <div class="pull-left"> |
|
88 | 88 | ${h.submit('commit_btn',_('Commit changes'), class_="btn btn-small btn-success")} |
|
89 | 89 | </div> |
|
90 | 90 | </div> |
|
91 | 91 | ${h.end_form()} |
|
92 | 92 | </div> |
|
93 | 93 | |
|
94 | 94 | <script type="text/javascript"> |
|
95 | 95 | |
|
96 | 96 | $(document).ready(function() { |
|
97 | 97 | var modes_select = $('#set_mode'); |
|
98 | 98 | var filename_selector = '#filename'; |
|
99 | 99 | fillCodeMirrorOptions(modes_select); |
|
100 | 100 | |
|
101 | 101 | fileEditor = new FileEditor('#editor'); |
|
102 | 102 | |
|
103 | 103 | // try to detect the mode based on the file we edit |
|
104 | 104 | var detected_mode = detectCodeMirrorMode("${c.file.name}", "${c.file.mimetype}"); |
|
105 | 105 | |
|
106 | 106 | if (detected_mode) { |
|
107 | 107 | setCodeMirrorMode(fileEditor.cm, detected_mode); |
|
108 | 108 | |
|
109 | 109 | var mimetype = $(modes_select).find("option[mode={0}]".format(detected_mode)).val(); |
|
110 | 110 | $(modes_select).select2("val", mimetype).trigger('change'); |
|
111 | 111 | } |
|
112 | 112 | |
|
113 | 113 | // on change of select field set mode |
|
114 | 114 | setCodeMirrorModeFromSelect(modes_select, filename_selector, fileEditor.cm, null); |
|
115 | 115 | |
|
116 | 116 | // on entering the new filename set mode, from given extension |
|
117 | 117 | setCodeMirrorModeFromInput(modes_select, filename_selector, fileEditor.cm, null); |
|
118 | 118 | |
|
119 | 119 | var commit_id = "${c.commit.raw_id}"; |
|
120 | 120 | var f_path = "${c.f_path}"; |
|
121 | 121 | |
|
122 | 122 | checkFileHead($('#eform'), commit_id, f_path, 'edit') |
|
123 | 123 | |
|
124 | 124 | }); |
|
125 | 125 | |
|
126 | 126 | |
|
127 | 127 | </script> |
|
128 | 128 | </%def> |
@@ -1,189 +1,189 b'' | |||
|
1 | 1 | <%namespace name="sourceblock" file="/codeblocks/source.mako"/> |
|
2 | 2 | |
|
3 | 3 | <% |
|
4 | 4 | at_ref = request.GET.get('at') |
|
5 | 5 | if at_ref: |
|
6 | 6 | query={'at': at_ref} |
|
7 | 7 | default_commit_id = at_ref or c.rhodecode_db_repo.landing_ref_name |
|
8 | 8 | else: |
|
9 | 9 | query=None |
|
10 | 10 | default_commit_id = c.commit.raw_id |
|
11 | 11 | %> |
|
12 | 12 | |
|
13 | 13 | <div id="codeblock" class="browserblock"> |
|
14 | 14 | <div class="browser-header"> |
|
15 | 15 | <div class="browser-nav"> |
|
16 | 16 | <div class="pull-left"> |
|
17 | 17 | ## loads the history for a file |
|
18 | 18 | ${h.hidden('file_refs_filter')} |
|
19 | 19 | </div> |
|
20 | 20 | |
|
21 | 21 | <div class="pull-right"> |
|
22 | 22 | |
|
23 | 23 | ## Download |
|
24 | 24 | % if c.lf_node: |
|
25 | 25 | <a class="btn btn-default" href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}"> |
|
26 | 26 | ${_('Download largefile')} |
|
27 | 27 | </a> |
|
28 | 28 | % else: |
|
29 | 29 | <a class="btn btn-default" href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}"> |
|
30 | 30 | ${_('Download file')} |
|
31 | 31 | </a> |
|
32 | 32 | % endif |
|
33 | 33 | |
|
34 | 34 | %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
|
35 | 35 | ## on branch head, can edit files |
|
36 | 36 | %if c.on_branch_head and c.branch_or_raw_id: |
|
37 | 37 | ## binary files are delete only |
|
38 | 38 | % if c.file.is_binary: |
|
39 | 39 | ${h.link_to(_('Edit'), '#Edit', class_="btn btn-default disabled tooltip", title=_('Editing binary files not allowed'))} |
|
40 | 40 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _query=query),class_="btn btn-danger")} |
|
41 | 41 | % else: |
|
42 | 42 | <a class="btn btn-default" href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _query=query)}"> |
|
43 | 43 | ${_('Edit on branch: ')}<code>${c.branch_name}</code> |
|
44 | 44 | </a> |
|
45 | 45 | |
|
46 | 46 | <a class="btn btn-danger" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _query=query)}"> |
|
47 | 47 | ${_('Delete')} |
|
48 | 48 | </a> |
|
49 | 49 | % endif |
|
50 | 50 | ## not on head, forbid all |
|
51 | 51 | % else: |
|
52 | 52 | ${h.link_to(_('Edit'), '#Edit', class_="btn btn-default disabled tooltip", title=_('Editing files allowed only when on branch head commit'))} |
|
53 | 53 | ${h.link_to(_('Delete'), '#Delete', class_="btn btn-default btn-danger disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))} |
|
54 | 54 | % endif |
|
55 | 55 | %endif |
|
56 | 56 | |
|
57 | 57 | </div> |
|
58 | 58 | </div> |
|
59 | 59 | <div id="file_history_container"></div> |
|
60 | 60 | |
|
61 | 61 | </div> |
|
62 | 62 | </div> |
|
63 | 63 | |
|
64 | 64 | <div class="codeblock"> |
|
65 | 65 | <div class=" codeblock-header"> |
|
66 | 66 | <div class="file-filename"> |
|
67 | 67 | <i class="icon-file"></i> ${c.file.name} |
|
68 | 68 | </div> |
|
69 | 69 | |
|
70 | 70 | <div class="file-stats"> |
|
71 | 71 | |
|
72 | 72 | <div class="stats-info"> |
|
73 | 73 | <span class="stats-first-item"> |
|
74 | 74 | % if c.file_size_too_big: |
|
75 | 75 | 0 ${(_('lines'))} |
|
76 | 76 | % else: |
|
77 | 77 | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])} |
|
78 | 78 | % endif |
|
79 | 79 | </span> |
|
80 | 80 | |
|
81 | 81 | <span> | ${h.format_byte_size_binary(c.file.size)}</span> |
|
82 | 82 | % if c.lf_node: |
|
83 | 83 | <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span> |
|
84 | 84 | % endif |
|
85 | 85 | <span> |
|
86 | 86 | | ${c.file.mimetype} |
|
87 | 87 | </span> |
|
88 | 88 | |
|
89 | 89 | % if not c.file_size_too_big: |
|
90 | 90 | <span> | |
|
91 | 91 | ${h.get_lexer_for_filenode(c.file).__class__.__name__} |
|
92 | 92 | </span> |
|
93 | 93 | % endif |
|
94 | 94 | |
|
95 | 95 | </div> |
|
96 | 96 | </div> |
|
97 | 97 | </div> |
|
98 | 98 | |
|
99 | 99 | <div class="path clear-fix"> |
|
100 | 100 | <div class="pull-left"> |
|
101 | 101 | ${h.files_breadcrumbs(c.repo_name, c.rhodecode_db_repo.repo_type, c.commit.raw_id, c.file.path, c.rhodecode_db_repo.landing_ref_name, request.GET.get('at'))} |
|
102 | 102 | </div> |
|
103 | 103 | |
|
104 | 104 | <div class="pull-right stats"> |
|
105 | 105 | <a id="file_history_overview" href="#loadHistory"> |
|
106 | 106 | ${_('History')} |
|
107 | 107 | </a> |
|
108 | 108 | | |
|
109 | 109 | %if c.annotate: |
|
110 | 110 | ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
111 | 111 | %else: |
|
112 | 112 | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
113 | 113 | %endif |
|
114 | 114 | | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
115 | 115 | % if not c.file.is_binary: |
|
116 | 116 | |<a href="#copySource" onclick="return false;" class="no-grey clipboard-action" data-clipboard-text="${c.file.content}">${_('Copy content')}</a> |
|
117 | 117 | |<a href="#copyPermaLink" onclick="return false;" class="no-grey clipboard-action" data-clipboard-text="${h.route_url('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">${_('Copy permalink')}</a> |
|
118 | 118 | % endif |
|
119 | 119 | |
|
120 | 120 | </div> |
|
121 | 121 | <div class="clear-fix"></div> |
|
122 | 122 | </div> |
|
123 | 123 | |
|
124 | 124 | <div class="code-body clear-fix "> |
|
125 | 125 | %if c.file.is_binary: |
|
126 | 126 | <% rendered_binary = h.render_binary(c.repo_name, c.file)%> |
|
127 | 127 | % if rendered_binary: |
|
128 | 128 | <div class="text-center"> |
|
129 | 129 | ${rendered_binary} |
|
130 | 130 | </div> |
|
131 | 131 | % else: |
|
132 | 132 | <div> |
|
133 | 133 | ${_('Binary file ({})').format(c.file.mimetype)} |
|
134 | 134 | </div> |
|
135 | 135 | % endif |
|
136 | 136 | %else: |
|
137 | 137 | % if c.file_size_too_big: |
|
138 | 138 | ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'), |
|
139 | 139 | h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
140 | 140 | % else: |
|
141 | 141 | %if c.renderer and not c.annotate: |
|
142 | 142 | ## pick relative url based on renderer |
|
143 | 143 | <% |
|
144 | 144 | relative_urls = { |
|
145 | 145 | 'raw': h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path), |
|
146 | 146 | 'standard': h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path), |
|
147 | 147 | } |
|
148 | 148 | %> |
|
149 | ${h.render(c.file.content, renderer=c.renderer, relative_urls=relative_urls)} | |
|
149 | ${h.render(c.file.str_content, renderer=c.renderer, relative_urls=relative_urls)} | |
|
150 | 150 | %else: |
|
151 | 151 | <table class="cb codehilite"> |
|
152 | 152 | %if c.annotate: |
|
153 | 153 | <% color_hasher = h.color_hasher() %> |
|
154 | 154 | %for annotation, lines in c.annotated_lines: |
|
155 | 155 | ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)} |
|
156 | 156 | %endfor |
|
157 | 157 | %else: |
|
158 | 158 | %for line_num, tokens in enumerate(c.lines, 1): |
|
159 | 159 | ${sourceblock.render_line(line_num, tokens)} |
|
160 | 160 | %endfor |
|
161 | 161 | %endif |
|
162 | 162 | </table> |
|
163 | 163 | %endif |
|
164 | 164 | % endif |
|
165 | 165 | %endif |
|
166 | 166 | </div> |
|
167 | 167 | |
|
168 | 168 | </div> |
|
169 | 169 | |
|
170 | 170 | <script type="text/javascript"> |
|
171 | 171 | % if request.GET.get('mark'): |
|
172 | 172 | |
|
173 | 173 | $(function(){ |
|
174 | 174 | $(".codehilite").mark( |
|
175 | 175 | "${request.GET.get('mark')}", |
|
176 | 176 | { |
|
177 | 177 | "className": 'match', |
|
178 | 178 | "accuracy": "complementary", |
|
179 | 179 | "ignorePunctuation": ":._(){}[]!'+=".split(""), |
|
180 | 180 | "each": function(el) { |
|
181 | 181 | // and also highlight lines ! |
|
182 | 182 | $($(el).closest('tr')).find('td.cb-lineno').addClass('cb-line-selected'); |
|
183 | 183 | } |
|
184 | 184 | } |
|
185 | 185 | ); |
|
186 | 186 | |
|
187 | 187 | }); |
|
188 | 188 | % endif |
|
189 | 189 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now