Show More
@@ -1,285 +1,291 b'' | |||||
1 | // summary.less |
|
1 | // summary.less | |
2 | // For use in RhodeCode applications; |
|
2 | // For use in RhodeCode applications; | |
3 | // Used for headers and file detail summary screens. |
|
3 | // Used for headers and file detail summary screens. | |
4 |
|
4 | |||
5 | .summary { |
|
5 | .summary { | |
6 | float: left; |
|
6 | float: left; | |
7 | position: relative; |
|
7 | position: relative; | |
8 | width: 100%; |
|
8 | width: 100%; | |
9 | margin: 0; |
|
9 | margin: 0; | |
10 | padding: 0; |
|
10 | padding: 0; | |
11 |
|
11 | |||
12 | .summary-detail-header { |
|
12 | .summary-detail-header { | |
13 | float: left; |
|
13 | float: left; | |
14 | display: block; |
|
14 | display: block; | |
15 | width: 100%; |
|
15 | width: 100%; | |
16 | margin-bottom: @textmargin; |
|
16 | margin-bottom: @textmargin; | |
17 | padding: 0 0 .5em 0; |
|
17 | padding: 0 0 .5em 0; | |
18 | border-bottom: @border-thickness solid @border-default-color; |
|
18 | border-bottom: @border-thickness solid @border-default-color; | |
19 |
|
19 | |||
20 | .breadcrumbs { |
|
20 | .breadcrumbs { | |
21 | float: left; |
|
21 | float: left; | |
22 | display: inline; |
|
22 | display: inline; | |
23 | margin: 0; |
|
23 | margin: 0; | |
24 | padding: 0; |
|
24 | padding: 0; | |
25 | } |
|
25 | } | |
26 | h4 { |
|
26 | h4 { | |
27 | float: left; |
|
27 | float: left; | |
28 | margin: 0 1em 0 0; |
|
28 | margin: 0 1em 0 0; | |
29 | padding: 0; |
|
29 | padding: 0; | |
30 | line-height: 1.2em; |
|
30 | line-height: 1.2em; | |
31 | font-size: @basefontsize; |
|
31 | font-size: @basefontsize; | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | .action_link { |
|
34 | .action_link { | |
35 | float: right; |
|
35 | float: right; | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | .new-file { |
|
38 | .new-file { | |
39 | float: right; |
|
39 | float: right; | |
40 | margin-top: -1.5em; |
|
40 | margin-top: -1.5em; | |
41 | } |
|
41 | } | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | .summary-detail { |
|
44 | .summary-detail { | |
45 | float: left; |
|
45 | float: left; | |
46 | position: relative; |
|
46 | position: relative; | |
47 | width: 73%; |
|
47 | width: 73%; | |
48 | margin: 0 3% @space 0; |
|
48 | margin: 0 3% @space 0; | |
49 | padding: 0; |
|
49 | padding: 0; | |
50 |
|
50 | |||
51 | .file_diff_buttons { |
|
51 | .file_diff_buttons { | |
52 | margin-top: @space; |
|
52 | margin-top: @space; | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | // commit message |
|
55 | // commit message | |
56 | .commit { |
|
56 | .commit { | |
57 | white-space: pre-wrap; |
|
57 | white-space: pre-wrap; | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | .left-clone { |
|
60 | .left-clone { | |
61 | float: left; |
|
61 | float: left; | |
62 | height: 30px; |
|
62 | height: 30px; | |
63 | margin: 0; |
|
63 | margin: 0; | |
64 | padding: 0; |
|
64 | padding: 0; | |
65 | font-weight: @text-semibold-weight; |
|
65 | font-weight: @text-semibold-weight; | |
66 | font-family: @text-semibold; |
|
66 | font-family: @text-semibold; | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | .right-clone { |
|
69 | .right-clone { | |
70 | float: right; |
|
70 | float: right; | |
71 | width: 83%; |
|
71 | width: 83%; | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | .clone_url_input { |
|
74 | .clone_url_input { | |
75 | width: ~"calc(100% - 35px)"; |
|
75 | width: ~"calc(100% - 35px)"; | |
76 | padding: 5px; |
|
76 | padding: 5px; | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | &.directory { |
|
79 | &.directory { | |
80 | margin-bottom: 0; |
|
80 | margin-bottom: 0; | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | .desc { |
|
83 | .desc { | |
84 | white-space: pre-wrap; |
|
84 | white-space: pre-wrap; | |
85 | } |
|
85 | } | |
86 | .disabled { |
|
86 | .disabled { | |
87 | opacity: .5; |
|
87 | opacity: .5; | |
88 | cursor: inherit; |
|
88 | cursor: inherit; | |
89 | } |
|
89 | } | |
90 | .help-block { |
|
90 | .help-block { | |
91 | color: inherit; |
|
91 | color: inherit; | |
92 | margin: 0; |
|
92 | margin: 0; | |
93 | } |
|
93 | } | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | .sidebar-right { |
|
96 | .sidebar-right { | |
97 | float: left; |
|
97 | float: left; | |
98 | width: 24%; |
|
98 | width: 24%; | |
99 | margin: 0; |
|
99 | margin: 0; | |
100 | padding: 0; |
|
100 | padding: 0; | |
101 |
|
101 | |||
102 | ul { |
|
102 | ul { | |
103 | margin-left: 0; |
|
103 | margin-left: 0; | |
104 | padding-left: 0; |
|
104 | padding-left: 0; | |
105 |
|
105 | |||
106 | li { |
|
106 | li { | |
107 | list-style-type: none; |
|
107 | list-style-type: none; | |
108 | } |
|
108 | } | |
109 | } |
|
109 | } | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | #clone_by_name, #clone_by_id{ |
|
112 | #clone_by_name, #clone_by_id{ | |
113 | display: inline-block; |
|
113 | display: inline-block; | |
114 | margin-left: 0px; |
|
114 | margin-left: 0px; | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | .codeblock { |
|
117 | .codeblock { | |
118 | border: none; |
|
118 | border: none; | |
119 | background-color: transparent; |
|
119 | background-color: transparent; | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | .code-body { |
|
122 | .code-body { | |
123 | border: @border-thickness solid @border-default-color; |
|
123 | border: @border-thickness solid @border-default-color; | |
124 | .border-radius(@border-radius); |
|
124 | .border-radius(@border-radius); | |
125 | } |
|
125 | } | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
128 | // this is used outside of just the summary |
|
128 | // this is used outside of just the summary | |
129 | .fieldset, // similar to form fieldset |
|
129 | .fieldset, // similar to form fieldset | |
130 | .summary .sidebar-right-content { // these have to match |
|
130 | .summary .sidebar-right-content { // these have to match | |
131 | clear: both; |
|
131 | clear: both; | |
132 | float: left; |
|
132 | float: left; | |
133 | position: relative; |
|
133 | position: relative; | |
134 | display:block; |
|
134 | display:block; | |
135 | width: 100%; |
|
135 | width: 100%; | |
136 | min-height: 1em; |
|
136 | min-height: 1em; | |
137 | margin-bottom: @textmargin; |
|
137 | margin-bottom: @textmargin; | |
138 | padding: 0; |
|
138 | padding: 0; | |
139 | line-height: 1.2em; |
|
139 | line-height: 1.2em; | |
140 |
|
140 | |||
141 | &:after { // clearfix |
|
141 | &:after { // clearfix | |
142 | content: ""; |
|
142 | content: ""; | |
143 | clear: both; |
|
143 | clear: both; | |
144 | width: 100%; |
|
144 | width: 100%; | |
145 | height: 1em; |
|
145 | height: 1em; | |
146 | } |
|
146 | } | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | .summary .sidebar-right-content { |
|
149 | .summary .sidebar-right-content { | |
150 | margin-bottom: @space; |
|
150 | margin-bottom: @space; | |
151 |
|
151 | |||
152 | .rc-user { |
|
152 | .rc-user { | |
153 | min-width: 0; |
|
153 | min-width: 0; | |
154 | } |
|
154 | } | |
155 | } |
|
155 | } | |
156 |
|
156 | |||
157 | .fieldset { |
|
157 | .fieldset { | |
158 |
|
158 | |||
159 | .left-label { // similar to form legend |
|
159 | .left-label { // similar to form legend | |
160 | float: left; |
|
160 | float: left; | |
161 | display: block; |
|
161 | display: block; | |
162 | width: 25%; |
|
162 | width: 25%; | |
163 | margin: 0; |
|
163 | margin: 0; | |
164 | padding: 0; |
|
164 | padding: 0; | |
165 | font-weight: @text-semibold-weight; |
|
165 | font-weight: @text-semibold-weight; | |
166 | font-family: @text-semibold; |
|
166 | font-family: @text-semibold; | |
167 | } |
|
167 | } | |
168 |
|
168 | |||
169 | .left-label-summary { |
|
169 | .left-label-summary { | |
170 | .left-label; |
|
170 | .left-label; | |
171 | width: 150px; |
|
171 | width: 150px; | |
172 | } |
|
172 | } | |
173 |
|
173 | |||
174 | .right-content { // similar to form fields |
|
174 | .right-content { // similar to form fields | |
175 | float: left; |
|
175 | float: left; | |
176 | display: block; |
|
176 | display: block; | |
177 | width: 75%; |
|
177 | width: 75%; | |
178 | margin: 0 0 0 -15%; |
|
178 | margin: 0 0 0 -15%; | |
179 | padding: 0 0 0 15%; |
|
179 | padding: 0 0 0 15%; | |
180 |
|
180 | |||
181 | .truncate-wrap, |
|
181 | .truncate-wrap, | |
182 | .truncate { |
|
182 | .truncate { | |
183 | max-width: 100%; |
|
183 | max-width: 100%; | |
184 | width: 100%; |
|
184 | width: 100%; | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | .commit-long { |
|
187 | .commit-long { | |
188 | overflow-x: auto; |
|
188 | overflow-x: auto; | |
189 | } |
|
189 | } | |
190 | } |
|
190 | } | |
191 | .commit.truncate-wrap { |
|
191 | .commit.truncate-wrap { | |
192 | overflow:hidden; |
|
192 | overflow:hidden; | |
193 | text-overflow: ellipsis; |
|
193 | text-overflow: ellipsis; | |
194 | } |
|
194 | } | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 | // expand commit message |
|
197 | // expand commit message | |
198 | #message_expand { |
|
198 | #message_expand { | |
199 | clear: both; |
|
199 | clear: both; | |
200 | display: block; |
|
200 | display: block; | |
201 | color: @rcblue; |
|
201 | color: @rcblue; | |
202 | cursor: pointer; |
|
202 | cursor: pointer; | |
203 | } |
|
203 | } | |
204 |
|
204 | |||
205 | #trimmed_message_box { |
|
205 | #trimmed_message_box { | |
206 | max-height: floor(2 * @basefontsize * 1.2); // 2 lines * line-height |
|
206 | max-height: floor(2 * @basefontsize * 1.2); // 2 lines * line-height | |
207 | overflow: hidden; |
|
207 | overflow: hidden; | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | // show/hide comments button |
|
210 | // show/hide comments button | |
211 | .show-inline-comments { |
|
211 | .show-inline-comments { | |
212 | display: inline; |
|
212 | display: inline; | |
213 | cursor: pointer; |
|
213 | cursor: pointer; | |
214 |
|
214 | |||
215 | .comments-show { display: inline; } |
|
215 | .comments-show { display: inline; } | |
216 | .comments-hide { display: none; } |
|
216 | .comments-hide { display: none; } | |
217 |
|
217 | |||
218 | &.comments-visible { |
|
218 | &.comments-visible { | |
219 | .comments-show { display: none; } |
|
219 | .comments-show { display: none; } | |
220 | .comments-hide { display: inline; } |
|
220 | .comments-hide { display: inline; } | |
221 | } |
|
221 | } | |
222 | } |
|
222 | } | |
223 |
|
223 | |||
224 | // Quick Start section |
|
224 | // Quick Start section | |
225 | .quick_start { |
|
225 | .quick_start { | |
226 | float: left; |
|
226 | float: left; | |
227 | display: block; |
|
227 | display: block; | |
228 | position: relative; |
|
228 | position: relative; | |
229 | width: 100%; |
|
229 | width: 100%; | |
230 |
|
230 | |||
231 | // adds some space to make copy and paste easier |
|
231 | // adds some space to make copy and paste easier | |
232 | .left-label, |
|
232 | .left-label, | |
233 | .right-content { |
|
233 | .right-content { | |
234 | line-height: 1.6em; |
|
234 | line-height: 1.6em; | |
235 | } |
|
235 | } | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | .submodule { |
|
238 | .submodule { | |
239 | .summary-detail { |
|
239 | .summary-detail { | |
240 | width: 100%; |
|
240 | width: 100%; | |
241 |
|
241 | |||
242 | .btn-collapse { |
|
242 | .btn-collapse { | |
243 | display: none; |
|
243 | display: none; | |
244 | } |
|
244 | } | |
245 | } |
|
245 | } | |
246 | } |
|
246 | } | |
247 |
|
247 | |||
248 | .codeblock-header { |
|
248 | .codeblock-header { | |
249 | float: left; |
|
249 | float: left; | |
250 | display: block; |
|
250 | display: block; | |
251 | width: 100%; |
|
251 | width: 100%; | |
252 | margin: 0; |
|
252 | margin: 0; | |
253 | padding: @space 0 10px 0; |
|
253 | padding: @space 0 10px 0; | |
254 | border-top: @border-thickness solid @border-default-color; |
|
254 | border-top: @border-thickness solid @border-default-color; | |
255 |
|
255 | |||
256 | .stats { |
|
256 | .stats { | |
257 | float: left; |
|
257 | float: left; | |
258 | } |
|
258 | } | |
259 | .stats-filename { |
|
259 | .stats-filename { | |
260 | font-size: 120%; |
|
260 | font-size: 120%; | |
261 | } |
|
261 | } | |
262 | .stats-first-item { |
|
262 | .stats-first-item { | |
263 | padding: 0px 0px 0px 3px; |
|
263 | padding: 0px 0px 0px 3px; | |
264 | } |
|
264 | } | |
265 |
|
265 | |||
266 | .buttons { |
|
266 | .buttons { | |
267 | float: right; |
|
267 | float: right; | |
268 | text-align: right; |
|
268 | text-align: right; | |
269 | color: @grey4; |
|
269 | color: @grey4; | |
270 | } |
|
270 | } | |
|
271 | ||||
|
272 | .file-container { | |||
|
273 | display: inline-block; | |||
|
274 | width: 100%; | |||
|
275 | } | |||
|
276 | ||||
271 | } |
|
277 | } | |
272 |
|
278 | |||
273 | #summary-menu-stats { |
|
279 | #summary-menu-stats { | |
274 |
|
280 | |||
275 | .stats-bullet { |
|
281 | .stats-bullet { | |
276 | color: @grey3; |
|
282 | color: @grey3; | |
277 | min-width: 3em; |
|
283 | min-width: 3em; | |
278 | } |
|
284 | } | |
279 |
|
285 | |||
280 | .repo-size { |
|
286 | .repo-size { | |
281 | margin-bottom: .5em; |
|
287 | margin-bottom: .5em; | |
282 | } |
|
288 | } | |
283 |
|
289 | |||
284 | } |
|
290 | } | |
285 |
|
291 |
@@ -1,214 +1,222 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="/base/base.mako"/> |
|
2 | <%inherit file="/base/base.mako"/> | |
3 |
|
3 | |||
4 | <%def name="title()"> |
|
4 | <%def name="title()"> | |
5 | %if c.repo_name: |
|
5 | %if c.repo_name: | |
6 | ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)} |
|
6 | ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)} | |
7 | %elif c.repo_group_name: |
|
7 | %elif c.repo_group_name: | |
8 | ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)} |
|
8 | ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)} | |
9 | %else: |
|
9 | %else: | |
10 | ${_('Search inside all accessible repositories')} |
|
10 | ${_('Search inside all accessible repositories')} | |
11 | %endif |
|
11 | %endif | |
12 | %if c.rhodecode_name: |
|
12 | %if c.rhodecode_name: | |
13 | · ${h.branding(c.rhodecode_name)} |
|
13 | · ${h.branding(c.rhodecode_name)} | |
14 | %endif |
|
14 | %endif | |
15 | </%def> |
|
15 | </%def> | |
16 |
|
16 | |||
17 | <%def name="breadcrumbs_links()"> |
|
17 | <%def name="breadcrumbs_links()"> | |
18 | %if c.repo_name: |
|
18 | %if c.repo_name: | |
19 | ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)} |
|
19 | ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)} | |
20 | %elif c.repo_group_name: |
|
20 | %elif c.repo_group_name: | |
21 | ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)} |
|
21 | ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)} | |
22 | %else: |
|
22 | %else: | |
23 | ${_('Search inside all accessible repositories')} |
|
23 | ${_('Search inside all accessible repositories')} | |
24 | %endif |
|
24 | %endif | |
25 |
|
25 | |||
26 | </%def> |
|
26 | </%def> | |
27 |
|
27 | |||
28 | <%def name="menu_bar_nav()"> |
|
28 | <%def name="menu_bar_nav()"> | |
29 | %if c.repo_name: |
|
29 | %if c.repo_name: | |
30 | ${self.menu_items(active='search')} |
|
30 | ${self.menu_items(active='search')} | |
31 | %elif c.repo_group_name: |
|
31 | %elif c.repo_group_name: | |
32 | ${self.menu_items(active='search')} |
|
32 | ${self.menu_items(active='search')} | |
33 | %else: |
|
33 | %else: | |
34 | ${self.menu_items(active='search')} |
|
34 | ${self.menu_items(active='search')} | |
35 | %endif |
|
35 | %endif | |
36 | </%def> |
|
36 | </%def> | |
37 |
|
37 | |||
38 | <%def name="menu_bar_subnav()"> |
|
38 | <%def name="menu_bar_subnav()"> | |
39 | %if c.repo_name: |
|
39 | %if c.repo_name: | |
40 | ${self.repo_menu(active='search')} |
|
40 | ${self.repo_menu(active='search')} | |
41 | %elif c.repo_group_name: |
|
41 | %elif c.repo_group_name: | |
42 | ${self.repo_group_menu(active='search')} |
|
42 | ${self.repo_group_menu(active='search')} | |
43 | %endif |
|
43 | %endif | |
44 | </%def> |
|
44 | </%def> | |
45 |
|
45 | |||
|
46 | <%def name="repo_icon(db_repo)"> | |||
|
47 | %if h.is_hg(db_repo): | |||
|
48 | <i class="icon-hg"></i> | |||
|
49 | %endif | |||
|
50 | %if h.is_git(db_repo): | |||
|
51 | <i class="icon-git"></i> | |||
|
52 | %endif | |||
|
53 | %if h.is_svn(db_repo): | |||
|
54 | <i class="icon-svn"></i> | |||
|
55 | %endif | |||
|
56 | </%def> | |||
|
57 | ||||
|
58 | <%def name="repo_group_icon()"> | |||
|
59 | <i class="icon-folder-close"></i> | |||
|
60 | </%def> | |||
|
61 | ||||
46 | <%def name="main()"> |
|
62 | <%def name="main()"> | |
47 | <div class="box"> |
|
63 | <div class="box"> | |
48 | %if c.repo_name: |
|
64 | %if c.repo_name: | |
49 | <!-- box / title --> |
|
65 | <!-- box / title --> | |
50 | <div class="title"> |
|
66 | <div class="title"> | |
51 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
67 | ${self.repo_page_title(c.rhodecode_db_repo)} | |
52 | </div> |
|
68 | </div> | |
53 | ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')} |
|
69 | ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')} | |
54 | %elif c.repo_group_name: |
|
70 | %elif c.repo_group_name: | |
55 | <!-- box / title --> |
|
71 | <!-- box / title --> | |
56 | <div class="title"> |
|
72 | <div class="title"> | |
57 | ${self.repo_group_page_title(c.repo_group)} |
|
73 | ${self.repo_group_page_title(c.repo_group)} | |
58 | </div> |
|
74 | </div> | |
59 | ${h.form(h.route_path('search_repo_group',repo_group_name=c.repo_group_name),method='get')} |
|
75 | ${h.form(h.route_path('search_repo_group',repo_group_name=c.repo_group_name),method='get')} | |
60 | %else: |
|
76 | %else: | |
61 | <!-- box / title --> |
|
77 | <!-- box / title --> | |
62 | <div class="title"> |
|
78 | <div class="title"> | |
63 | ${self.breadcrumbs()} |
|
79 | ${self.breadcrumbs()} | |
64 | <ul class="links"> </ul> |
|
80 | <ul class="links"> </ul> | |
65 | </div> |
|
81 | </div> | |
66 | <!-- end box / title --> |
|
82 | <!-- end box / title --> | |
67 | ${h.form(h.route_path('search'), method='get')} |
|
83 | ${h.form(h.route_path('search'), method='get')} | |
68 | %endif |
|
84 | %endif | |
69 | <div class="form search-form"> |
|
85 | <div class="form search-form"> | |
70 | <div class="fields"> |
|
86 | <div class="fields"> | |
71 |
|
87 | |||
72 | ${h.text('q', c.cur_query, placeholder="Enter query...")} |
|
88 | ${h.text('q', c.cur_query, placeholder="Enter query...")} | |
73 |
|
89 | |||
74 | ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')} |
|
90 | ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')} | |
75 | ${h.hidden('max_lines', '10')} |
|
91 | ${h.hidden('max_lines', '10')} | |
76 |
|
92 | |||
77 | <input type="submit" value="${_('Search')}" class="btn"/> |
|
93 | <input type="submit" value="${_('Search')}" class="btn"/> | |
78 | <br/> |
|
94 | <br/> | |
79 |
|
95 | |||
80 | <div class="search-tags"> |
|
96 | <div class="search-tags"> | |
81 | <span class="tag tag8"> |
|
97 | <span class="tag tag8"> | |
82 | %if c.repo_name: |
|
98 | %if c.repo_name: | |
83 | <a href="${h.route_path('search', _query={'q': c.cur_query})}">${_('Global Search')}</a> |
|
99 | <a href="${h.route_path('search', _query={'q': c.cur_query, 'type': request.GET.get('type', 'content')})}">${_('Global Search')}</a> | |
84 | %elif c.repo_group_name: |
|
100 | %elif c.repo_group_name: | |
85 | <a href="${h.route_path('search', _query={'q': c.cur_query})}">${_('Global Search')}</a> |
|
101 | <a href="${h.route_path('search', _query={'q': c.cur_query, 'type': request.GET.get('type', 'content')})}">${_('Global Search')}</a> | |
86 | % else: |
|
102 | % else: | |
87 | ${_('Global Search')} |
|
103 | ${_('Global Search')} | |
88 | %endif |
|
104 | %endif | |
89 | </span> |
|
105 | </span> | |
90 |
|
106 | |||
91 | %if c.repo_name: |
|
107 | %if c.repo_name: | |
92 | Β» |
|
108 | Β» | |
93 | <span class="tag tag8"> |
|
109 | <span class="tag tag8"> | |
94 |
|
|
110 | ${repo_icon(c.rhodecode_db_repo)} | |
95 | <i class="icon-hg"></i> |
|
|||
96 | %endif |
|
|||
97 | %if h.is_git(c.rhodecode_db_repo): |
|
|||
98 | <i class="icon-git"></i> |
|
|||
99 | %endif |
|
|||
100 | %if h.is_svn(c.rhodecode_db_repo): |
|
|||
101 | <i class="icon-svn"></i> |
|
|||
102 | %endif |
|
|||
103 | ${c.repo_name} |
|
111 | ${c.repo_name} | |
104 | </span> |
|
112 | </span> | |
105 |
|
113 | |||
106 | %elif c.repo_group_name: |
|
114 | %elif c.repo_group_name: | |
107 | Β» |
|
115 | Β» | |
108 | <span class="tag tag8"> |
|
116 | <span class="tag tag8"> | |
109 | <i class="icon-folder-close"></i> |
|
117 | ${repo_group_icon()} | |
110 | ${c.repo_group_name} |
|
118 | ${c.repo_group_name} | |
111 | </span> |
|
119 | </span> | |
112 | %endif |
|
120 | %endif | |
113 |
|
121 | |||
114 |
|
122 | |||
115 | % for search_tag in c.search_tags: |
|
123 | % for search_tag in c.search_tags: | |
116 | <br/><span class="tag disabled" style="margin-top: 3px">${search_tag}</span> |
|
124 | <br/><span class="tag disabled" style="margin-top: 3px">${search_tag}</span> | |
117 | % endfor |
|
125 | % endfor | |
118 |
|
126 | |||
119 | </div> |
|
127 | </div> | |
120 |
|
128 | |||
121 | <div class="search-feedback-items"> |
|
129 | <div class="search-feedback-items"> | |
122 | % for error in c.errors: |
|
130 | % for error in c.errors: | |
123 | <span class="error-message"> |
|
131 | <span class="error-message"> | |
124 | % for k,v in error.asdict().items(): |
|
132 | % for k,v in error.asdict().items(): | |
125 | ${k} - ${v} |
|
133 | ${k} - ${v} | |
126 | % endfor |
|
134 | % endfor | |
127 | </span> |
|
135 | </span> | |
128 | % endfor |
|
136 | % endfor | |
129 | <div class="field"> |
|
137 | <div class="field"> | |
130 | <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Langague examples')}</p> |
|
138 | <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Langague examples')}</p> | |
131 | <pre id="search-help" style="display: none">\ |
|
139 | <pre id="search-help" style="display: none">\ | |
132 |
|
140 | |||
133 | % if c.searcher.name == 'whoosh': |
|
141 | % if c.searcher.name == 'whoosh': | |
134 | Example filter terms for `Whoosh` search: |
|
142 | Example filter terms for `Whoosh` search: | |
135 | query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a> |
|
143 | query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a> | |
136 | Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition. |
|
144 | Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition. | |
137 |
|
145 | |||
138 | Generate wildcards using '*' character: |
|
146 | Generate wildcards using '*' character: | |
139 | "repo_name:vcs*" - search everything starting with 'vcs' |
|
147 | "repo_name:vcs*" - search everything starting with 'vcs' | |
140 | "repo_name:*vcs*" - search for repository containing 'vcs' |
|
148 | "repo_name:*vcs*" - search for repository containing 'vcs' | |
141 |
|
149 | |||
142 | Optional AND / OR operators in queries |
|
150 | Optional AND / OR operators in queries | |
143 | "repo_name:vcs OR repo_name:test" |
|
151 | "repo_name:vcs OR repo_name:test" | |
144 | "owner:test AND repo_name:test*" AND extension:py |
|
152 | "owner:test AND repo_name:test*" AND extension:py | |
145 |
|
153 | |||
146 | Move advanced search is available via ElasticSearch6 backend in EE edition. |
|
154 | Move advanced search is available via ElasticSearch6 backend in EE edition. | |
147 | % elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2': |
|
155 | % elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2': | |
148 | Example filter terms for `ElasticSearch-${c.searcher.es_version}`search: |
|
156 | Example filter terms for `ElasticSearch-${c.searcher.es_version}`search: | |
149 | ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition. |
|
157 | ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition. | |
150 |
|
158 | |||
151 | search type: content (File Content) |
|
159 | search type: content (File Content) | |
152 | indexed fields: content |
|
160 | indexed fields: content | |
153 |
|
161 | |||
154 | # search for `fix` string in all files |
|
162 | # search for `fix` string in all files | |
155 | fix |
|
163 | fix | |
156 |
|
164 | |||
157 | search type: commit (Commit message) |
|
165 | search type: commit (Commit message) | |
158 | indexed fields: message |
|
166 | indexed fields: message | |
159 |
|
167 | |||
160 | search type: path (File name) |
|
168 | search type: path (File name) | |
161 | indexed fields: path |
|
169 | indexed fields: path | |
162 |
|
170 | |||
163 | % else: |
|
171 | % else: | |
164 | Example filter terms for `ElasticSearch-${c.searcher.es_version}`search: |
|
172 | Example filter terms for `ElasticSearch-${c.searcher.es_version}`search: | |
165 | query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a> |
|
173 | query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a> | |
166 | The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ / |
|
174 | The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ / | |
167 | % for handler in c.searcher.get_handlers().values(): |
|
175 | % for handler in c.searcher.get_handlers().values(): | |
168 |
|
176 | |||
169 | search type: ${handler.search_type_label} |
|
177 | search type: ${handler.search_type_label} | |
170 | *indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])} |
|
178 | *indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])} | |
171 | % for entry in handler.es_6_example_queries: |
|
179 | % for entry in handler.es_6_example_queries: | |
172 | ${entry.rstrip()} |
|
180 | ${entry.rstrip()} | |
173 | % endfor |
|
181 | % endfor | |
174 | % endfor |
|
182 | % endfor | |
175 |
|
183 | |||
176 | % endif |
|
184 | % endif | |
177 | </pre> |
|
185 | </pre> | |
178 | </div> |
|
186 | </div> | |
179 |
|
187 | |||
180 | <div class="field">${c.runtime}</div> |
|
188 | <div class="field">${c.runtime}</div> | |
181 | </div> |
|
189 | </div> | |
182 | </div> |
|
190 | </div> | |
183 | </div> |
|
191 | </div> | |
184 |
|
192 | |||
185 | ${h.end_form()} |
|
193 | ${h.end_form()} | |
186 | <div class="search"> |
|
194 | <div class="search"> | |
187 | % if c.search_type == 'content': |
|
195 | % if c.search_type == 'content': | |
188 | <%include file='search_content.mako'/> |
|
196 | <%include file='search_content.mako'/> | |
189 | % elif c.search_type == 'path': |
|
197 | % elif c.search_type == 'path': | |
190 | <%include file='search_path.mako'/> |
|
198 | <%include file='search_path.mako'/> | |
191 | % elif c.search_type == 'commit': |
|
199 | % elif c.search_type == 'commit': | |
192 | <%include file='search_commit.mako'/> |
|
200 | <%include file='search_commit.mako'/> | |
193 | % elif c.search_type == 'repository': |
|
201 | % elif c.search_type == 'repository': | |
194 | <%include file='search_repository.mako'/> |
|
202 | <%include file='search_repository.mako'/> | |
195 | % endif |
|
203 | % endif | |
196 | </div> |
|
204 | </div> | |
197 | </div> |
|
205 | </div> | |
198 | <script> |
|
206 | <script> | |
199 | $(document).ready(function(){ |
|
207 | $(document).ready(function(){ | |
200 | $("#id_search_type").select2({ |
|
208 | $("#id_search_type").select2({ | |
201 | 'containerCssClass': "drop-menu", |
|
209 | 'containerCssClass': "drop-menu", | |
202 | 'dropdownCssClass': "drop-menu-dropdown", |
|
210 | 'dropdownCssClass': "drop-menu-dropdown", | |
203 | 'dropdownAutoWidth': true, |
|
211 | 'dropdownAutoWidth': true, | |
204 | 'minimumResultsForSearch': -1 |
|
212 | 'minimumResultsForSearch': -1 | |
205 | }); |
|
213 | }); | |
206 |
|
214 | |||
207 | $('#q').autoGrowInput({maxWidth: 920}); |
|
215 | $('#q').autoGrowInput({maxWidth: 920}); | |
208 |
|
216 | |||
209 | setTimeout(function() { |
|
217 | setTimeout(function() { | |
210 | $('#q').keyup() |
|
218 | $('#q').keyup() | |
211 | }, 1); |
|
219 | }, 1); | |
212 | }) |
|
220 | }) | |
213 | </script> |
|
221 | </script> | |
214 | </%def> |
|
222 | </%def> |
@@ -1,103 +1,98 b'' | |||||
1 | <%namespace name="base" file="/base/base.mako"/> |
|
1 | <%namespace name="base" file="/base/base.mako"/> | |
|
2 | <%namespace name="search" file="/search/search.mako"/> | |||
2 |
|
3 | |||
3 | % if c.formatted_results: |
|
4 | % if c.formatted_results: | |
4 |
|
5 | |||
5 | <table class="rctable search-results"> |
|
6 | <table class="rctable search-results"> | |
6 | <tr> |
|
7 | <tr> | |
7 | <th>${_('Repository')}</th> |
|
8 | <th>${_('Repository')}</th> | |
8 | <th>${_('Commit')}</th> |
|
9 | <th>${_('Commit')}</th> | |
9 | <th></th> |
|
10 | <th></th> | |
10 | <th>${_('Commit message')}</th> |
|
11 | <th>${_('Commit message')}</th> | |
11 | <th> |
|
12 | <th> | |
12 | %if c.sort == 'newfirst': |
|
13 | %if c.sort == 'newfirst': | |
13 | <a href="${c.url_generator(sort='oldfirst')}">${_('Age (new first)')}</a> |
|
14 | <a href="${c.url_generator(sort='oldfirst')}">${_('Age (new first)')}</a> | |
14 | %else: |
|
15 | %else: | |
15 | <a href="${c.url_generator(sort='newfirst')}">${_('Age (old first)')}</a> |
|
16 | <a href="${c.url_generator(sort='newfirst')}">${_('Age (old first)')}</a> | |
16 | %endif |
|
17 | %endif | |
17 | </th> |
|
18 | </th> | |
18 | <th>${_('Author')}</th> |
|
19 | <th>${_('Author')}</th> | |
19 | </tr> |
|
20 | </tr> | |
20 | %for entry in c.formatted_results: |
|
21 | %for entry in c.formatted_results: | |
21 | ## search results are additionally filtered, and this check is just a safe gate |
|
22 | ## search results are additionally filtered, and this check is just a safe gate | |
22 | % if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results commit check'): |
|
23 | % if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results commit check'): | |
23 | <tr class="body"> |
|
24 | <tr class="body"> | |
24 | <td class="td-componentname"> |
|
25 | <td class="td-componentname"> | |
25 | <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> |
|
26 | <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> | |
26 |
|
|
27 | ${search.repo_icon(repo_type)} | |
27 | <i class="icon-hg"></i> |
|
|||
28 | %elif repo_type == 'git': |
|
|||
29 | <i class="icon-git"></i> |
|
|||
30 | %elif repo_type == 'svn': |
|
|||
31 | <i class="icon-svn"></i> |
|
|||
32 | %endif |
|
|||
33 | ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} |
|
28 | ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} | |
34 | </td> |
|
29 | </td> | |
35 | <td class="td-commit"> |
|
30 | <td class="td-commit"> | |
36 | ${h.link_to(h._shorten_commit_id(entry['commit_id']), |
|
31 | ${h.link_to(h._shorten_commit_id(entry['commit_id']), | |
37 | h.route_path('repo_commit',repo_name=entry['repository'],commit_id=entry['commit_id']))} |
|
32 | h.route_path('repo_commit',repo_name=entry['repository'],commit_id=entry['commit_id']))} | |
38 | </td> |
|
33 | </td> | |
39 | <td class="td-message expand_commit search open" data-commit-id="${h.md5_safe(entry['repository'])+entry['commit_id']}" id="t-${h.md5_safe(entry['repository'])+entry['commit_id']}" title="${_('Expand commit message')}"> |
|
34 | <td class="td-message expand_commit search open" data-commit-id="${h.md5_safe(entry['repository'])+entry['commit_id']}" id="t-${h.md5_safe(entry['repository'])+entry['commit_id']}" title="${_('Expand commit message')}"> | |
40 | <div> |
|
35 | <div> | |
41 | <i class="icon-expand-linked"></i> |
|
36 | <i class="icon-expand-linked"></i> | |
42 | </div> |
|
37 | </div> | |
43 | </td> |
|
38 | </td> | |
44 | <td data-commit-id="${h.md5_safe(entry['repository'])+entry['commit_id']}" id="c-${h.md5_safe(entry['repository'])+entry['commit_id']}" class="message td-description open"> |
|
39 | <td data-commit-id="${h.md5_safe(entry['repository'])+entry['commit_id']}" id="c-${h.md5_safe(entry['repository'])+entry['commit_id']}" class="message td-description open"> | |
45 | %if entry.get('message_hl'): |
|
40 | %if entry.get('message_hl'): | |
46 | ${h.literal(entry['message_hl'])} |
|
41 | ${h.literal(entry['message_hl'])} | |
47 | %else: |
|
42 | %else: | |
48 | ${h.urlify_commit_message(entry['message'], entry['repository'])} |
|
43 | ${h.urlify_commit_message(entry['message'], entry['repository'])} | |
49 | %endif |
|
44 | %endif | |
50 | </td> |
|
45 | </td> | |
51 | <td class="td-time"> |
|
46 | <td class="td-time"> | |
52 | ${h.age_component(h.time_to_utcdatetime(entry['date']))} |
|
47 | ${h.age_component(h.time_to_utcdatetime(entry['date']))} | |
53 | </td> |
|
48 | </td> | |
54 |
|
49 | |||
55 | <td class="td-user author"> |
|
50 | <td class="td-user author"> | |
56 | <% |
|
51 | <% | |
57 | ## es6 stores this as object |
|
52 | ## es6 stores this as object | |
58 | author = entry['author'] |
|
53 | author = entry['author'] | |
59 | if isinstance(author, dict): |
|
54 | if isinstance(author, dict): | |
60 | author = author['email'] |
|
55 | author = author['email'] | |
61 | %> |
|
56 | %> | |
62 | ${base.gravatar_with_user(author)} |
|
57 | ${base.gravatar_with_user(author)} | |
63 | </td> |
|
58 | </td> | |
64 | </tr> |
|
59 | </tr> | |
65 | % endif |
|
60 | % endif | |
66 | %endfor |
|
61 | %endfor | |
67 | </table> |
|
62 | </table> | |
68 |
|
63 | |||
69 | %if c.cur_query: |
|
64 | %if c.cur_query: | |
70 | <div class="pagination-wh pagination-left"> |
|
65 | <div class="pagination-wh pagination-left"> | |
71 | ${c.formatted_results.pager('$link_previous ~2~ $link_next')} |
|
66 | ${c.formatted_results.pager('$link_previous ~2~ $link_next')} | |
72 | </div> |
|
67 | </div> | |
73 | %endif |
|
68 | %endif | |
74 |
|
69 | |||
75 | <script> |
|
70 | <script> | |
76 | $('.expand_commit').on('click',function(e){ |
|
71 | $('.expand_commit').on('click',function(e){ | |
77 | var target_expand = $(this); |
|
72 | var target_expand = $(this); | |
78 | var cid = target_expand.data('commit-id'); |
|
73 | var cid = target_expand.data('commit-id'); | |
79 |
|
74 | |||
80 | if (target_expand.hasClass('open')){ |
|
75 | if (target_expand.hasClass('open')){ | |
81 | $('#c-'+cid).css({'height': '1.5em', 'white-space': 'nowrap', 'text-overflow': 'ellipsis', 'overflow':'hidden'}); |
|
76 | $('#c-'+cid).css({'height': '1.5em', 'white-space': 'nowrap', 'text-overflow': 'ellipsis', 'overflow':'hidden'}); | |
82 | $('#t-'+cid).css({'height': 'auto', 'line-height': '.9em', 'text-overflow': 'ellipsis', 'overflow':'hidden'}); |
|
77 | $('#t-'+cid).css({'height': 'auto', 'line-height': '.9em', 'text-overflow': 'ellipsis', 'overflow':'hidden'}); | |
83 | target_expand.removeClass('open'); |
|
78 | target_expand.removeClass('open'); | |
84 | } |
|
79 | } | |
85 | else { |
|
80 | else { | |
86 | $('#c-'+cid).css({'height': 'auto', 'white-space': 'normal', 'text-overflow': 'initial', 'overflow':'visible'}); |
|
81 | $('#c-'+cid).css({'height': 'auto', 'white-space': 'normal', 'text-overflow': 'initial', 'overflow':'visible'}); | |
87 | $('#t-'+cid).css({'height': 'auto', 'max-height': 'none', 'text-overflow': 'initial', 'overflow':'visible'}); |
|
82 | $('#t-'+cid).css({'height': 'auto', 'max-height': 'none', 'text-overflow': 'initial', 'overflow':'visible'}); | |
88 | target_expand.addClass('open'); |
|
83 | target_expand.addClass('open'); | |
89 | } |
|
84 | } | |
90 | }); |
|
85 | }); | |
91 |
|
86 | |||
92 | $(".message.td-description").mark( |
|
87 | $(".message.td-description").mark( | |
93 | "${c.searcher.query_to_mark(c.cur_query, 'message')}", |
|
88 | "${c.searcher.query_to_mark(c.cur_query, 'message')}", | |
94 | { |
|
89 | { | |
95 | "className": 'match', |
|
90 | "className": 'match', | |
96 | "accuracy": "complementary", |
|
91 | "accuracy": "complementary", | |
97 | "ignorePunctuation": ":._(){}[]!'+=".split("") |
|
92 | "ignorePunctuation": ":._(){}[]!'+=".split("") | |
98 | } |
|
93 | } | |
99 | ); |
|
94 | ); | |
100 |
|
95 | |||
101 | </script> |
|
96 | </script> | |
102 |
|
97 | |||
103 | % endif |
|
98 | % endif |
@@ -1,152 +1,180 b'' | |||||
|
1 | <%namespace name="search" file="/search/search.mako"/> | |||
1 |
|
2 | |||
2 | <%def name="highlight_text_file(has_matched_content, file_content, lexer, html_formatter, matching_lines, shown_matching_lines, url, use_hl_filter)"> |
|
3 | <%def name="highlight_text_file(has_matched_content, file_content, lexer, html_formatter, matching_lines, shown_matching_lines, url, use_hl_filter)"> | |
3 | % if has_matched_content: |
|
4 | % if has_matched_content: | |
4 | ${h.code_highlight(file_content, lexer, html_formatter, use_hl_filter=use_hl_filter)|n} |
|
5 | ${h.code_highlight(file_content, lexer, html_formatter, use_hl_filter=use_hl_filter)|n} | |
5 | % else: |
|
6 | % else: | |
6 | ${_('No content matched')} <br/> |
|
7 | ${_('No content matched')} <br/> | |
7 | % endif |
|
8 | % endif | |
8 |
|
9 | |||
9 | %if len(matching_lines) > shown_matching_lines: |
|
10 | %if len(matching_lines) > shown_matching_lines: | |
10 | <a href="${url}"> |
|
11 | <a href="${url}"> | |
11 | ${len(matching_lines) - shown_matching_lines} ${_('more matches in this file')} |
|
12 | ${len(matching_lines) - shown_matching_lines} ${_('more matches in this file')} | |
12 | </a> |
|
13 | </a> | |
13 | %endif |
|
14 | %endif | |
14 | </%def> |
|
15 | </%def> | |
15 |
|
16 | |||
16 | <div class="search-results"> |
|
17 | <div class="search-results"> | |
17 | <% query_mark = c.searcher.query_to_mark(c.cur_query, 'content') %> |
|
18 | <% query_mark = c.searcher.query_to_mark(c.cur_query, 'content') %> | |
18 |
|
19 | |||
19 | %for entry in c.formatted_results: |
|
20 | %for entry in c.formatted_results: | |
20 |
|
21 | |||
21 | <% |
|
22 | <% | |
22 | file_content = entry['content_highlight'] or entry['content'] |
|
23 | file_content = entry['content_highlight'] or entry['content'] | |
23 | mimetype = entry.get('mimetype') |
|
24 | mimetype = entry.get('mimetype') | |
24 | filepath = entry.get('path') |
|
25 | filepath = entry.get('path') | |
25 | max_lines = h.safe_int(request.GET.get('max_lines', '10')) |
|
26 | max_lines = h.safe_int(request.GET.get('max_lines', '10')) | |
26 | line_context = h.safe_int(request.GET.get('line_contenxt', '3')) |
|
27 | line_context = h.safe_int(request.GET.get('line_contenxt', '3')) | |
27 |
|
28 | |||
28 | match_file_url=h.route_path('repo_files',repo_name=entry['repository'], commit_id=entry.get('commit_id', 'tip'),f_path=entry['f_path'], _query={"mark": query_mark}) |
|
29 | match_file_url=h.route_path('repo_files',repo_name=entry['repository'], commit_id=entry.get('commit_id', 'tip'),f_path=entry['f_path'], _query={"mark": query_mark}) | |
29 | terms = c.cur_query |
|
30 | terms = c.cur_query | |
30 |
|
31 | |||
31 | if c.searcher.is_es_6: |
|
32 | if c.searcher.is_es_6: | |
32 | # use empty terms so we default to markers usage |
|
33 | # use empty terms so we default to markers usage | |
33 | total_lines, matching_lines = h.get_matching_line_offsets(file_content, terms=None) |
|
34 | total_lines, matching_lines = h.get_matching_line_offsets(file_content, terms=None) | |
34 | else: |
|
35 | else: | |
35 | total_lines, matching_lines = h.get_matching_line_offsets(file_content, terms) |
|
36 | total_lines, matching_lines = h.get_matching_line_offsets(file_content, terms) | |
36 |
|
37 | |||
37 | shown_matching_lines = 0 |
|
38 | shown_matching_lines = 0 | |
38 | lines_of_interest = set() |
|
39 | lines_of_interest = set() | |
39 | for line_number in matching_lines: |
|
40 | for line_number in matching_lines: | |
40 | if len(lines_of_interest) < max_lines: |
|
41 | if len(lines_of_interest) < max_lines: | |
41 | lines_of_interest |= set(range( |
|
42 | lines_of_interest |= set(range( | |
42 | max(line_number - line_context, 0), |
|
43 | max(line_number - line_context, 0), | |
43 | min(line_number + line_context, total_lines + 1))) |
|
44 | min(line_number + line_context, total_lines + 1))) | |
44 | shown_matching_lines += 1 |
|
45 | shown_matching_lines += 1 | |
45 | lexer = h.get_lexer_safe(mimetype=mimetype, filepath=filepath) |
|
46 | lexer = h.get_lexer_safe(mimetype=mimetype, filepath=filepath) | |
46 |
|
47 | |||
47 | html_formatter = h.SearchContentCodeHtmlFormatter( |
|
48 | html_formatter = h.SearchContentCodeHtmlFormatter( | |
48 | linenos=True, |
|
49 | linenos=True, | |
49 | cssclass="code-highlight", |
|
50 | cssclass="code-highlight", | |
50 | url=match_file_url, |
|
51 | url=match_file_url, | |
51 | query_terms=terms, |
|
52 | query_terms=terms, | |
52 | only_line_numbers=lines_of_interest |
|
53 | only_line_numbers=lines_of_interest | |
53 | ) |
|
54 | ) | |
54 |
|
55 | |||
55 | has_matched_content = len(lines_of_interest) >= 1 |
|
56 | has_matched_content = len(lines_of_interest) >= 1 | |
56 |
|
57 | |||
57 | %> |
|
58 | %> | |
58 | ## search results are additionally filtered, and this check is just a safe gate |
|
59 | ## search results are additionally filtered, and this check is just a safe gate | |
59 | % if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results content check'): |
|
60 | % if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results content check'): | |
60 | <div id="codeblock" class="codeblock"> |
|
61 | <div id="codeblock" class="codeblock"> | |
61 | <div class="codeblock-header"> |
|
62 | <div class="codeblock-header"> | |
62 | <h1> |
|
63 | <h1> | |
63 | <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> |
|
64 | <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> | |
64 | %if repo_type == 'hg': |
|
65 | ${search.repo_icon(repo_type)} | |
65 | <i class="icon-hg"></i> |
|
|||
66 | %elif repo_type == 'git': |
|
|||
67 | <i class="icon-git"></i> |
|
|||
68 | %elif repo_type == 'svn': |
|
|||
69 | <i class="icon-svn"></i> |
|
|||
70 | %endif |
|
|||
71 | ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} |
|
66 | ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} | |
72 | </h1> |
|
67 | </h1> | |
73 |
|
68 | ## level 1 | ||
74 |
<div class=" |
|
69 | <div class="file-container"> | |
75 | <span class="stats-filename"> |
|
|||
76 | <strong> |
|
|||
77 | <i class="icon-file-text"></i> |
|
|||
78 | ${h.link_to(h.literal(entry['f_path']), h.route_path('repo_files',repo_name=entry['repository'],commit_id=entry.get('commit_id', 'tip'),f_path=entry['f_path']))} |
|
|||
79 | </strong> |
|
|||
80 | </span> |
|
|||
81 | <span class="item last"><i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${entry['f_path']}" title="${_('Copy the full path')}"></i></span> |
|
|||
82 | <br/> |
|
|||
83 | <span class="stats-first-item"> |
|
|||
84 | ${len(matching_lines)} ${_ungettext('search match', 'search matches', len(matching_lines))} |
|
|||
85 | </span> |
|
|||
86 |
|
70 | |||
87 | <span > |
|
71 | <div class="pull-left"> | |
88 | %if entry.get('lines'): |
|
72 | <span class="stats-filename"> | |
89 | | ${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))} |
|
73 | <strong> | |
90 | %endif |
|
74 | <i class="icon-file-text"></i> | |
91 | </span> |
|
75 | ${h.link_to(h.literal(entry['f_path']), h.route_path('repo_files',repo_name=entry['repository'],commit_id=entry.get('commit_id', 'tip'),f_path=entry['f_path']))} | |
|
76 | </strong> | |||
|
77 | </span> | |||
|
78 | <span class="item last"> | |||
|
79 | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${entry['f_path']}" title="${_('Copy the full path')}"></i> | |||
|
80 | </span> | |||
|
81 | </div> | |||
92 |
|
82 | |||
93 | <span> |
|
83 | <div class="pull-right"> | |
94 | %if entry.get('size'): |
|
84 | <div class="buttons"> | |
95 | | ${h.format_byte_size_binary(entry['size'])} |
|
85 | <a id="file_history_overview_full" href="${h.route_path('repo_changelog_file',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path',''))}"> | |
96 | %endif |
|
86 | ${_('Show Full History')} | |
97 |
</ |
|
87 | </a> | |
98 |
|
88 | | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} | ||
99 | <span> |
|
89 | | ${h.link_to(_('Raw'), h.route_path('repo_file_raw', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} | |
100 | %if entry.get('mimetype'): |
|
90 | | ${h.link_to(_('Download'), h.route_path('repo_file_download',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} | |
101 | | ${entry.get('mimetype', "unknown mimetype")} |
|
91 | </div> | |
102 |
|
|
92 | </div> | |
103 | </span> |
|
|||
104 |
|
93 | |||
105 | </div> |
|
94 | </div> | |
106 | <div class="buttons"> |
|
95 | ## level 2 | |
107 | <a id="file_history_overview_full" href="${h.route_path('repo_changelog_file',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path',''))}"> |
|
96 | <div class="file-container"> | |
108 | ${_('Show Full History')} |
|
97 | ||
109 | </a> |
|
98 | <div class="pull-left"> | |
110 | | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} |
|
99 | <span class="stats-first-item"> | |
111 | | ${h.link_to(_('Raw'), h.route_path('repo_file_raw', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} |
|
100 | %if entry.get('lines'): | |
112 | | ${h.link_to(_('Download'), h.route_path('repo_file_download',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))} |
|
101 | ${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))} | |
|
102 | (${len(matching_lines)} ${_ungettext('matched', 'matched', len(matching_lines))}) | |||
|
103 | %endif | |||
|
104 | </span> | |||
|
105 | ||||
|
106 | <span> | |||
|
107 | %if entry.get('size'): | |||
|
108 | | ${h.format_byte_size_binary(entry['size'])} | |||
|
109 | %endif | |||
|
110 | </span> | |||
|
111 | ||||
|
112 | <span> | |||
|
113 | %if entry.get('mimetype'): | |||
|
114 | | ${entry.get('mimetype', "unknown mimetype")} | |||
|
115 | %endif | |||
|
116 | </span> | |||
|
117 | </div> | |||
|
118 | ||||
|
119 | <div class="pull-right"> | |||
|
120 | <div class="search-tags"> | |||
|
121 | ||||
|
122 | <% repo_group = entry.get('repository_group')%> | |||
|
123 | ## hiden if in repo group view | |||
|
124 | % if repo_group and not c.repo_group_name: | |||
|
125 | <span class="tag tag8"> | |||
|
126 | ${search.repo_group_icon()} | |||
|
127 | <a href="${h.route_path('search_repo_group', repo_group_name=repo_group, _query={'q': c.cur_query})}">${_('Narrow to this repository group')}</a> | |||
|
128 | </span> | |||
|
129 | % endif | |||
|
130 | ## hiden if in repo view | |||
|
131 | % if not c.repo_name: | |||
|
132 | <span class="tag tag8"> | |||
|
133 | ${search.repo_icon(repo_type)} | |||
|
134 | <a href="${h.route_path('search_repo', repo_name=entry.get('repo_name'), _query={'q': c.cur_query})}">${_('Narrow to this repository')}</a> | |||
|
135 | </span> | |||
|
136 | % endif | |||
|
137 | </div> | |||
|
138 | </div> | |||
|
139 | ||||
113 | </div> |
|
140 | </div> | |
|
141 | ||||
114 | </div> |
|
142 | </div> | |
115 | <div class="code-body search-code-body"> |
|
143 | <div class="code-body search-code-body"> | |
116 |
|
144 | |||
117 | ${highlight_text_file( |
|
145 | ${highlight_text_file( | |
118 | has_matched_content=has_matched_content, |
|
146 | has_matched_content=has_matched_content, | |
119 | file_content=file_content, |
|
147 | file_content=file_content, | |
120 | lexer=lexer, |
|
148 | lexer=lexer, | |
121 | html_formatter=html_formatter, |
|
149 | html_formatter=html_formatter, | |
122 | matching_lines=matching_lines, |
|
150 | matching_lines=matching_lines, | |
123 | shown_matching_lines=shown_matching_lines, |
|
151 | shown_matching_lines=shown_matching_lines, | |
124 | url=match_file_url, |
|
152 | url=match_file_url, | |
125 | use_hl_filter=c.searcher.is_es_6 |
|
153 | use_hl_filter=c.searcher.is_es_6 | |
126 | )} |
|
154 | )} | |
127 | </div> |
|
155 | </div> | |
128 |
|
156 | |||
129 | </div> |
|
157 | </div> | |
130 | % endif |
|
158 | % endif | |
131 | %endfor |
|
159 | %endfor | |
132 | </div> |
|
160 | </div> | |
133 | %if c.cur_query and c.formatted_results: |
|
161 | %if c.cur_query and c.formatted_results: | |
134 | <div class="pagination-wh pagination-left" > |
|
162 | <div class="pagination-wh pagination-left" > | |
135 | ${c.formatted_results.pager('$link_previous ~2~ $link_next')} |
|
163 | ${c.formatted_results.pager('$link_previous ~2~ $link_next')} | |
136 | </div> |
|
164 | </div> | |
137 | %endif |
|
165 | %endif | |
138 |
|
166 | |||
139 | %if c.cur_query: |
|
167 | %if c.cur_query: | |
140 | <script type="text/javascript"> |
|
168 | <script type="text/javascript"> | |
141 | $(function(){ |
|
169 | $(function(){ | |
142 | $(".search-code-body").mark( |
|
170 | $(".search-code-body").mark( | |
143 | "${query_mark}", |
|
171 | "${query_mark}", | |
144 | { |
|
172 | { | |
145 | "className": 'match', |
|
173 | "className": 'match', | |
146 | "accuracy": "complementary", |
|
174 | "accuracy": "complementary", | |
147 | "ignorePunctuation": ":._(){}[]!'+=".split("") |
|
175 | "ignorePunctuation": ":._(){}[]!'+=".split("") | |
148 | } |
|
176 | } | |
149 | ); |
|
177 | ); | |
150 | }) |
|
178 | }) | |
151 | </script> |
|
179 | </script> | |
152 | %endif |
|
180 | %endif |
@@ -1,50 +1,46 b'' | |||||
|
1 | <%namespace name="search" file="/search/search.mako"/> | |||
|
2 | ||||
1 | % if c.formatted_results: |
|
3 | % if c.formatted_results: | |
2 |
|
4 | |||
3 | <table class="rctable search-results"> |
|
5 | <table class="rctable search-results"> | |
4 | <tr> |
|
6 | <tr> | |
5 | <th>${_('Repository')}</th> |
|
7 | <th>${_('Repository')}</th> | |
6 | <th>${_('File')}</th> |
|
8 | <th>${_('File')}</th> | |
7 | <th>${_('Size')}</th> |
|
9 | <th>${_('Size')}</th> | |
8 | <th>${_('Lines')}</th> |
|
10 | <th>${_('Lines')}</th> | |
9 | </tr> |
|
11 | </tr> | |
10 | %for entry in c.formatted_results: |
|
12 | %for entry in c.formatted_results: | |
11 | ## search results are additionally filtered, and this check is just a safe gate |
|
13 | ## search results are additionally filtered, and this check is just a safe gate | |
12 | % if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results path check'): |
|
14 | % if c.rhodecode_user.is_admin or h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(entry['repository'], 'search results path check'): | |
13 | <tr class="body"> |
|
15 | <tr class="body"> | |
14 | <td class="td-componentname"> |
|
16 | <td class="td-componentname"> | |
15 | <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> |
|
17 | <% repo_type = entry.get('repo_type') or h.get_repo_type_by_name(entry.get('repository')) %> | |
16 |
|
|
18 | ${search.repo_icon(repo_type)} | |
17 | <i class="icon-hg"></i> |
|
|||
18 | %elif repo_type == 'git': |
|
|||
19 | <i class="icon-git"></i> |
|
|||
20 | %elif repo_type == 'svn': |
|
|||
21 | <i class="icon-svn"></i> |
|
|||
22 | %endif |
|
|||
23 | ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} |
|
19 | ${h.link_to(entry['repository'], h.route_path('repo_summary',repo_name=entry['repository']))} | |
24 | </td> |
|
20 | </td> | |
25 | <td class="td-componentname"> |
|
21 | <td class="td-componentname"> | |
26 | ${h.link_to(h.literal(entry['f_path']), |
|
22 | ${h.link_to(h.literal(entry['f_path']), | |
27 | h.route_path('repo_files',repo_name=entry['repository'],commit_id='tip',f_path=entry['f_path']))} |
|
23 | h.route_path('repo_files',repo_name=entry['repository'],commit_id='tip',f_path=entry['f_path']))} | |
28 | </td> |
|
24 | </td> | |
29 | <td> |
|
25 | <td> | |
30 | %if entry.get('size'): |
|
26 | %if entry.get('size'): | |
31 | ${h.format_byte_size_binary(entry['size'])} |
|
27 | ${h.format_byte_size_binary(entry['size'])} | |
32 | %endif |
|
28 | %endif | |
33 | </td> |
|
29 | </td> | |
34 | <td> |
|
30 | <td> | |
35 | %if entry.get('lines'): |
|
31 | %if entry.get('lines'): | |
36 | ${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))} |
|
32 | ${entry.get('lines', 0.)} ${_ungettext('line', 'lines', entry.get('lines', 0.))} | |
37 | %endif |
|
33 | %endif | |
38 | </td> |
|
34 | </td> | |
39 | </tr> |
|
35 | </tr> | |
40 | % endif |
|
36 | % endif | |
41 | %endfor |
|
37 | %endfor | |
42 | </table> |
|
38 | </table> | |
43 |
|
39 | |||
44 | %if c.cur_query: |
|
40 | %if c.cur_query: | |
45 | <div class="pagination-wh pagination-left"> |
|
41 | <div class="pagination-wh pagination-left"> | |
46 | ${c.formatted_results.pager('$link_previous ~2~ $link_next')} |
|
42 | ${c.formatted_results.pager('$link_previous ~2~ $link_next')} | |
47 | </div> |
|
43 | </div> | |
48 | %endif |
|
44 | %endif | |
49 |
|
45 | |||
50 | % endif |
|
46 | % endif |
General Comments 0
You need to be logged in to leave comments.
Login now