##// END OF EJS Templates
datagrids: save permanently the state if sorting for pull-request grids.
milka -
r4558:c3119a6d default
parent child Browse files
Show More
@@ -702,7 +702,9 b' class MyAccountView(BaseAppView, DataGri'
702 **valid_data)
702 **valid_data)
703 if old_email != valid_data['email']:
703 if old_email != valid_data['email']:
704 old = UserEmailMap.query() \
704 old = UserEmailMap.query() \
705 .filter(UserEmailMap.user == c.user).filter(UserEmailMap.email == valid_data['email']).first()
705 .filter(UserEmailMap.user == c.user)\
706 .filter(UserEmailMap.email == valid_data['email'])\
707 .first()
706 old.email = old_email
708 old.email = old_email
707 h.flash(_('Your account was updated successfully'), category='success')
709 h.flash(_('Your account was updated successfully'), category='success')
708 Session().commit()
710 Session().commit()
@@ -718,6 +720,7 b' class MyAccountView(BaseAppView, DataGri'
718 def _get_pull_requests_list(self, statuses):
720 def _get_pull_requests_list(self, statuses):
719 draw, start, limit = self._extract_chunk(self.request)
721 draw, start, limit = self._extract_chunk(self.request)
720 search_q, order_by, order_dir = self._extract_ordering(self.request)
722 search_q, order_by, order_dir = self._extract_ordering(self.request)
723
721 _render = self.request.get_partial_renderer(
724 _render = self.request.get_partial_renderer(
722 'rhodecode:templates/data_table/_dt_elements.mako')
725 'rhodecode:templates/data_table/_dt_elements.mako')
723
726
@@ -704,3 +704,13 b' var storeUserSessionAttr = function (key'
704 ajaxPOST(pyroutes.url('store_user_session_value'), postData, success);
704 ajaxPOST(pyroutes.url('store_user_session_value'), postData, success);
705 return false;
705 return false;
706 };
706 };
707
708
709 var getUserSessionAttr = function(key) {
710 var storeKey = templateContext.session_attrs;
711 var val = storeKey[key]
712 if (val !== undefined) {
713 return JSON.parse(val)
714 }
715 return null
716 }
@@ -46,6 +46,8 b''
46 $pullRequestListTable.DataTable({
46 $pullRequestListTable.DataTable({
47 processing: true,
47 processing: true,
48 serverSide: true,
48 serverSide: true,
49 stateSave: true,
50 stateDuration: -1,
49 ajax: {
51 ajax: {
50 "url": "${h.route_path('my_account_pullrequests_data')}",
52 "url": "${h.route_path('my_account_pullrequests_data')}",
51 "data": function (d) {
53 "data": function (d) {
@@ -119,6 +121,10 b''
119 if (data['owned']) {
121 if (data['owned']) {
120 $(row).addClass('owned');
122 $(row).addClass('owned');
121 }
123 }
124 },
125 "stateSaveParams": function (settings, data) {
126 data.search.search = ""; // Don't save search
127 data.start = 0; // don't save pagination
122 }
128 }
123 });
129 });
124 $pullRequestListTable.on('xhr.dt', function (e, settings, json, xhr) {
130 $pullRequestListTable.on('xhr.dt', function (e, settings, json, xhr) {
@@ -129,6 +135,7 b''
129 $pullRequestListTable.css('opacity', 0.3);
135 $pullRequestListTable.css('opacity', 0.3);
130 });
136 });
131
137
138
132 // filter
139 // filter
133 $('#q_filter').on('keyup',
140 $('#q_filter').on('keyup',
134 $.debounce(250, function () {
141 $.debounce(250, function () {
@@ -74,6 +74,8 b''
74 $pullRequestListTable.DataTable({
74 $pullRequestListTable.DataTable({
75 processing: true,
75 processing: true,
76 serverSide: true,
76 serverSide: true,
77 stateSave: true,
78 stateDuration: -1,
77 ajax: {
79 ajax: {
78 "url": "${h.route_path('pullrequest_show_all_data', repo_name=c.repo_name)}",
80 "url": "${h.route_path('pullrequest_show_all_data', repo_name=c.repo_name)}",
79 "data": function (d) {
81 "data": function (d) {
@@ -114,6 +116,10 b''
114 if (data['closed']) {
116 if (data['closed']) {
115 $(row).addClass('closed');
117 $(row).addClass('closed');
116 }
118 }
119 },
120 "stateSaveParams": function (settings, data) {
121 data.search.search = ""; // Don't save search
122 data.start = 0; // don't save pagination
117 }
123 }
118 });
124 });
119
125
General Comments 0
You need to be logged in to leave comments. Login now