Show More
@@ -723,12 +723,12 b' class MyAccountView(BaseAppView, DataGri' | |||
|
723 | 723 | |
|
724 | 724 | pull_requests = PullRequestModel().get_im_participating_in( |
|
725 | 725 | user_id=self._rhodecode_user.user_id, |
|
726 | statuses=statuses, | |
|
726 | statuses=statuses, query=search_q, | |
|
727 | 727 | offset=start, length=limit, order_by=order_by, |
|
728 | 728 | order_dir=order_dir) |
|
729 | 729 | |
|
730 | 730 | pull_requests_total_count = PullRequestModel().count_im_participating_in( |
|
731 | user_id=self._rhodecode_user.user_id, statuses=statuses) | |
|
731 | user_id=self._rhodecode_user.user_id, statuses=statuses, query=search_q) | |
|
732 | 732 | |
|
733 | 733 | data = [] |
|
734 | 734 | comments_model = CommentsModel() |
@@ -355,7 +355,7 b' class PullRequestModel(BaseModel):' | |||
|
355 | 355 | PullRequestReviewers.user_id == user_id).all() |
|
356 | 356 | ] |
|
357 | 357 | |
|
358 | def _prepare_participating_query(self, user_id=None, statuses=None, | |
|
358 | def _prepare_participating_query(self, user_id=None, statuses=None, query='', | |
|
359 | 359 | order_by=None, order_dir='desc'): |
|
360 | 360 | q = PullRequest.query() |
|
361 | 361 | if user_id: |
@@ -372,6 +372,13 b' class PullRequestModel(BaseModel):' | |||
|
372 | 372 | if statuses: |
|
373 | 373 | q = q.filter(PullRequest.status.in_(statuses)) |
|
374 | 374 | |
|
375 | if query: | |
|
376 | like_expression = u'%{}%'.format(safe_unicode(query)) | |
|
377 | q = q.filter(or_( | |
|
378 | cast(PullRequest.pull_request_id, String).ilike(like_expression), | |
|
379 | PullRequest.title.ilike(like_expression), | |
|
380 | PullRequest.description.ilike(like_expression), | |
|
381 | )) | |
|
375 | 382 | if order_by: |
|
376 | 383 | order_map = { |
|
377 | 384 | 'name_raw': PullRequest.pull_request_id, |
@@ -386,19 +393,19 b' class PullRequestModel(BaseModel):' | |||
|
386 | 393 | |
|
387 | 394 | return q |
|
388 | 395 | |
|
389 | def count_im_participating_in(self, user_id=None, statuses=None): | |
|
390 | q = self._prepare_participating_query(user_id, statuses=statuses) | |
|
396 | def count_im_participating_in(self, user_id=None, statuses=None, query=''): | |
|
397 | q = self._prepare_participating_query(user_id, statuses=statuses, query=query) | |
|
391 | 398 | return q.count() |
|
392 | 399 | |
|
393 | 400 | def get_im_participating_in( |
|
394 | self, user_id=None, statuses=None, offset=0, | |
|
401 | self, user_id=None, statuses=None, query='', offset=0, | |
|
395 | 402 | length=None, order_by=None, order_dir='desc'): |
|
396 | 403 | """ |
|
397 | 404 | Get all Pull requests that i'm participating in, or i have opened |
|
398 | 405 | """ |
|
399 | 406 | |
|
400 | 407 | q = self._prepare_participating_query( |
|
401 | user_id, statuses=statuses, order_by=order_by, | |
|
408 | user_id, statuses=statuses, query=query, order_by=order_by, | |
|
402 | 409 | order_dir=order_dir) |
|
403 | 410 | |
|
404 | 411 | if length: |
@@ -2,11 +2,29 b'' | |||
|
2 | 2 | |
|
3 | 3 | <div class="panel panel-default"> |
|
4 | 4 | <div class="panel-body"> |
|
5 | %if c.closed: | |
|
6 | ${h.checkbox('show_closed',checked="checked", label=_('Show Closed Pull Requests'))} | |
|
7 | %else: | |
|
8 | ${h.checkbox('show_closed',label=_('Show Closed Pull Requests'))} | |
|
9 | %endif | |
|
5 | <div style="height: 35px"> | |
|
6 | <% | |
|
7 | selected_filter = 'all' | |
|
8 | if c.closed: | |
|
9 | selected_filter = 'all_closed' | |
|
10 | %> | |
|
11 | ||
|
12 | <ul class="button-links"> | |
|
13 | <li class="btn ${h.is_active('all', selected_filter)}"><a href="${h.route_path('my_account_pullrequests')}">${_('All')}</a></li> | |
|
14 | <li class="btn ${h.is_active('all_closed', selected_filter)}"><a href="${h.route_path('my_account_pullrequests', _query={'pr_show_closed':1})}">${_('All + Closed')}</a></li> | |
|
15 | </ul> | |
|
16 | ||
|
17 | <div class="grid-quick-filter"> | |
|
18 | <ul class="grid-filter-box"> | |
|
19 | <li class="grid-filter-box-icon"> | |
|
20 | <i class="icon-search"></i> | |
|
21 | </li> | |
|
22 | <li class="grid-filter-box-input"> | |
|
23 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | |
|
24 | </li> | |
|
25 | </ul> | |
|
26 | </div> | |
|
27 | </div> | |
|
10 | 28 | </div> |
|
11 | 29 | </div> |
|
12 | 30 | |
@@ -22,15 +40,6 b'' | |||
|
22 | 40 | <script type="text/javascript"> |
|
23 | 41 | $(document).ready(function() { |
|
24 | 42 | |
|
25 | $('#show_closed').on('click', function(e){ | |
|
26 | if($(this).is(":checked")){ | |
|
27 | window.location = "${h.route_path('my_account_pullrequests', _query={'pr_show_closed':1})}"; | |
|
28 | } | |
|
29 | else{ | |
|
30 | window.location = "${h.route_path('my_account_pullrequests')}"; | |
|
31 | } | |
|
32 | }); | |
|
33 | ||
|
34 | 43 | var $pullRequestListTable = $('#pull_request_list_table'); |
|
35 | 44 | |
|
36 | 45 | // participating object list |
@@ -41,26 +50,58 b'' | |||
|
41 | 50 | "url": "${h.route_path('my_account_pullrequests_data')}", |
|
42 | 51 | "data": function (d) { |
|
43 | 52 | d.closed = "${c.closed}"; |
|
53 | }, | |
|
54 | "dataSrc": function (json) { | |
|
55 | return json.data; | |
|
44 | 56 | } |
|
45 | 57 | }, |
|
58 | ||
|
46 | 59 | dom: 'rtp', |
|
47 | 60 | pageLength: ${c.visual.dashboard_items}, |
|
48 | 61 |
order: [[ |
|
49 | 62 | columns: [ |
|
50 | { data: {"_": "target_repo", | |
|
51 | "sort": "target_repo"}, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false}, | |
|
52 |
|
|
|
53 | "sort": "status"}, title: "", className: "td-status", orderable: false}, | |
|
54 | { data: {"_": "name", | |
|
55 | "sort": "name_raw"}, title: "${_('Id')}", className: "td-componentname", "type": "num" }, | |
|
56 | { data: {"_": "title", | |
|
57 | "sort": "title"}, title: "${_('Title')}", className: "td-description" }, | |
|
58 |
|
|
|
59 | "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false }, | |
|
60 | { data: {"_": "comments", | |
|
61 | "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false}, | |
|
62 | { data: {"_": "updated_on", | |
|
63 | "sort": "updated_on_raw"}, title: "${_('Last Update')}", className: "td-time" } | |
|
63 | { | |
|
64 | data: { | |
|
65 | "_": "target_repo", | |
|
66 | "sort": "target_repo" | |
|
67 | }, title: "${_('Target Repo')}", className: "td-targetrepo", orderable: false | |
|
68 | }, | |
|
69 | { | |
|
70 | data: { | |
|
71 | "_": "status", | |
|
72 | "sort": "status" | |
|
73 | }, title: "", className: "td-status", orderable: false | |
|
74 | }, | |
|
75 | { | |
|
76 | data: { | |
|
77 | "_": "name", | |
|
78 | "sort": "name_raw" | |
|
79 | }, title: "${_('Id')}", className: "td-componentname", "type": "num" | |
|
80 | }, | |
|
81 | { | |
|
82 | data: { | |
|
83 | "_": "title", | |
|
84 | "sort": "title" | |
|
85 | }, title: "${_('Title')}", className: "td-description" | |
|
86 | }, | |
|
87 | { | |
|
88 | data: { | |
|
89 | "_": "author", | |
|
90 | "sort": "author_raw" | |
|
91 | }, title: "${_('Author')}", className: "td-user", orderable: false | |
|
92 | }, | |
|
93 | { | |
|
94 | data: { | |
|
95 | "_": "comments", | |
|
96 | "sort": "comments_raw" | |
|
97 | }, title: "", className: "td-comments", orderable: false | |
|
98 | }, | |
|
99 | { | |
|
100 | data: { | |
|
101 | "_": "updated_on", | |
|
102 | "sort": "updated_on_raw" | |
|
103 | }, title: "${_('Last Update')}", className: "td-time" | |
|
104 | } | |
|
64 | 105 | ], |
|
65 | 106 | language: { |
|
66 | 107 | paginate: DEFAULT_GRID_PAGINATION, |
@@ -87,5 +128,17 b'' | |||
|
87 | 128 | $pullRequestListTable.on('preXhr.dt', function(e, settings, data){ |
|
88 | 129 | $pullRequestListTable.css('opacity', 0.3); |
|
89 | 130 | }); |
|
131 | ||
|
132 | // filter | |
|
133 | $('#q_filter').on('keyup', | |
|
134 | $.debounce(250, function () { | |
|
135 | $pullRequestListTable.DataTable().search( | |
|
136 | $('#q_filter').val() | |
|
137 | ).draw(); | |
|
138 | }) | |
|
139 | ); | |
|
140 | ||
|
90 | 141 | }); |
|
142 | ||
|
143 | ||
|
91 | 144 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now