Show More
@@ -1,147 +1,145 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.show_private: |
|
5 | %if c.show_private: | |
6 |
${_('Private Gists for user |
|
6 | ${_('Private Gists for user {}').format(c.rhodecode_user.username)} | |
7 | %elif c.show_public: |
|
7 | %elif c.show_public: | |
8 |
${_('Public Gists for user |
|
8 | ${_('Public Gists for user {}').format(c.rhodecode_user.username)} | |
9 | %else: |
|
9 | %else: | |
10 | ${_('Public Gists')} |
|
10 | ${_('Public Gists')} | |
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()"></%def> |
|
17 | <%def name="breadcrumbs_links()"></%def> | |
18 |
|
18 | |||
19 | <%def name="menu_bar_nav()"> |
|
19 | <%def name="menu_bar_nav()"> | |
20 | ${self.menu_items(active='gists')} |
|
20 | ${self.menu_items(active='gists')} | |
21 | </%def> |
|
21 | </%def> | |
22 |
|
22 | |||
23 |
|
||||
24 |
|
||||
25 | <%def name="main()"> |
|
23 | <%def name="main()"> | |
26 |
|
24 | |||
27 | <div class="box"> |
|
25 | <div class="box"> | |
28 | <div class="title"> |
|
26 | <div class="title"> | |
29 |
|
27 | |||
30 | <ul class="button-links"> |
|
28 | <ul class="button-links"> | |
31 | % if c.is_super_admin: |
|
29 | % if c.is_super_admin: | |
32 | <li class="btn ${'active' if c.active=='all' else ''}"><a href="${h.route_path('gists_show', _query={'all': 1})}">${_('All gists')}</a></li> |
|
30 | <li class="btn ${('active' if c.active=='all' else '')}"><a href="${h.route_path('gists_show', _query={'all': 1})}">${_('All gists')}</a></li> | |
33 | %endif |
|
31 | %endif | |
34 | <li class="btn ${'active' if c.active=='public' else ''}"><a href="${h.route_path('gists_show')}">${_('All public')}</a></li> |
|
32 | <li class="btn ${('active' if c.active=='public' else '')}"><a href="${h.route_path('gists_show')}">${_('All public')}</a></li> | |
35 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
33 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
36 | <li class="btn ${'active' if c.active=='my_all' else ''}"><a href="${h.route_path('gists_show', _query={'public':1, 'private': 1})}">${_('My gists')}</a></li> |
|
34 | <li class="btn ${('active' if c.active=='my_all' else '')}"><a href="${h.route_path('gists_show', _query={'public':1, 'private': 1})}">${_('My gists')}</a></li> | |
37 | <li class="btn ${'active' if c.active=='my_private' else ''}"><a href="${h.route_path('gists_show', _query={'private': 1})}">${_('My private')}</a></li> |
|
35 | <li class="btn ${('active' if c.active=='my_private' else '')}"><a href="${h.route_path('gists_show', _query={'private': 1})}">${_('My private')}</a></li> | |
38 | <li class="btn ${'active' if c.active=='my_public' else ''}"><a href="${h.route_path('gists_show', _query={'public': 1})}">${_('My public')}</a></li> |
|
36 | <li class="btn ${('active' if c.active=='my_public' else '')}"><a href="${h.route_path('gists_show', _query={'public': 1})}">${_('My public')}</a></li> | |
39 | %endif |
|
37 | %endif | |
40 | </ul> |
|
38 | </ul> | |
41 |
|
39 | |||
42 | % if c.rhodecode_user.username != h.DEFAULT_USER: |
|
40 | % if c.rhodecode_user.username != h.DEFAULT_USER: | |
43 | <div class="pull-right"> |
|
41 | <div class="pull-right"> | |
44 | <a class="btn btn-primary" href="${h.route_path('gists_new')}" > |
|
42 | <a class="btn btn-primary" href="${h.route_path('gists_new')}" > | |
45 | ${_(u'Create New Gist')} |
|
43 | ${_(u'Create New Gist')} | |
46 | </a> |
|
44 | </a> | |
47 | </div> |
|
45 | </div> | |
48 | % endif |
|
46 | % endif | |
49 |
|
47 | |||
50 | <div class="grid-quick-filter"> |
|
48 | <div class="grid-quick-filter"> | |
51 | <ul class="grid-filter-box"> |
|
49 | <ul class="grid-filter-box"> | |
52 | <li class="grid-filter-box-icon"> |
|
50 | <li class="grid-filter-box-icon"> | |
53 | <i class="icon-search"></i> |
|
51 | <i class="icon-search"></i> | |
54 | </li> |
|
52 | </li> | |
55 | <li class="grid-filter-box-input"> |
|
53 | <li class="grid-filter-box-input"> | |
56 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> |
|
54 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | |
57 | </li> |
|
55 | </li> | |
58 | </ul> |
|
56 | </ul> | |
59 | </div> |
|
57 | </div> | |
60 |
|
58 | |||
61 | </div> |
|
59 | </div> | |
62 |
|
60 | |||
63 | <div class="main-content-full-width"> |
|
61 | <div class="main-content-full-width"> | |
64 | <div id="repos_list_wrap"> |
|
62 | <div id="repos_list_wrap"> | |
65 | <table id="gist_list_table" class="display"></table> |
|
63 | <table id="gist_list_table" class="display"></table> | |
66 | </div> |
|
64 | </div> | |
67 | </div> |
|
65 | </div> | |
68 |
|
66 | |||
69 | </div> |
|
67 | </div> | |
70 |
|
68 | |||
71 | <script type="text/javascript"> |
|
69 | <script type="text/javascript"> | |
72 | $(document).ready(function() { |
|
70 | $(document).ready(function() { | |
73 |
|
71 | |||
74 | var get_datatable_count = function(){ |
|
72 | var get_datatable_count = function(){ | |
75 | var api = $('#gist_list_table').dataTable().api(); |
|
73 | var api = $('#gist_list_table').dataTable().api(); | |
76 | $('#gists_count').text(api.page.info().recordsDisplay); |
|
74 | $('#gists_count').text(api.page.info().recordsDisplay); | |
77 | }; |
|
75 | }; | |
78 |
|
76 | |||
79 |
|
77 | |||
80 | // custom filter that filters by access_id, description or author |
|
78 | // custom filter that filters by access_id, description or author | |
81 | $.fn.dataTable.ext.search.push( |
|
79 | $.fn.dataTable.ext.search.push( | |
82 | function( settings, data, dataIndex ) { |
|
80 | function( settings, data, dataIndex ) { | |
83 | var query = $('#q_filter').val(); |
|
81 | var query = $('#q_filter').val(); | |
84 | var author = data[0].strip(); |
|
82 | var author = data[0].strip(); | |
85 | var access_id = data[2].strip(); |
|
83 | var access_id = data[2].strip(); | |
86 | var description = data[3].strip(); |
|
84 | var description = data[3].strip(); | |
87 |
|
85 | |||
88 | var query_str = (access_id + " " + author + " " + description).toLowerCase(); |
|
86 | var query_str = (access_id + " " + author + " " + description).toLowerCase(); | |
89 |
|
87 | |||
90 | if(query_str.indexOf(query.toLowerCase()) !== -1){ |
|
88 | if(query_str.indexOf(query.toLowerCase()) !== -1){ | |
91 | return true; |
|
89 | return true; | |
92 | } |
|
90 | } | |
93 | return false; |
|
91 | return false; | |
94 | } |
|
92 | } | |
95 | ); |
|
93 | ); | |
96 |
|
94 | |||
97 | // gists list |
|
95 | // gists list | |
98 | $('#gist_list_table').DataTable({ |
|
96 | $('#gist_list_table').DataTable({ | |
99 | data: ${c.data|n}, |
|
97 | data: ${c.data|n}, | |
100 | dom: 'rtp', |
|
98 | dom: 'rtp', | |
101 | pageLength: ${c.visual.dashboard_items}, |
|
99 | pageLength: ${c.visual.dashboard_items}, | |
102 | order: [[ 4, "desc" ]], |
|
100 | order: [[ 4, "desc" ]], | |
103 | columns: [ |
|
101 | columns: [ | |
104 | { data: {"_": "author", |
|
102 | { data: {"_": "author", | |
105 | "sort": "author_raw"}, title: "${_("Author")}", width: "250px", className: "td-user" }, |
|
103 | "sort": "author_raw"}, title: "${_("Author")}", width: "250px", className: "td-user" }, | |
106 | { data: {"_": "type", |
|
104 | { data: {"_": "type", | |
107 | "sort": "type"}, title: "${_("Type")}", width: "70px", className: "td-tags" }, |
|
105 | "sort": "type"}, title: "${_("Type")}", width: "70px", className: "td-tags" }, | |
108 | { data: {"_": "access_id", |
|
106 | { data: {"_": "access_id", | |
109 | "sort": "access_id"}, title: "${_("Name")}", width:"150px", className: "td-componentname" }, |
|
107 | "sort": "access_id"}, title: "${_("Name")}", width:"150px", className: "td-componentname" }, | |
110 | { data: {"_": "description", |
|
108 | { data: {"_": "description", | |
111 | "sort": "description"}, title: "${_("Description")}", width: "250px", className: "td-description" }, |
|
109 | "sort": "description"}, title: "${_("Description")}", width: "250px", className: "td-description" }, | |
112 | { data: {"_": "created_on", |
|
110 | { data: {"_": "created_on", | |
113 | "sort": "created_on_raw"}, title: "${_("Created on")}", className: "td-time" }, |
|
111 | "sort": "created_on_raw"}, title: "${_("Created on")}", className: "td-time" }, | |
114 | { data: {"_": "expires", |
|
112 | { data: {"_": "expires", | |
115 | "sort": "expires"}, title: "${_("Expires")}", className: "td-exp" } |
|
113 | "sort": "expires"}, title: "${_("Expires")}", className: "td-exp" } | |
116 | ], |
|
114 | ], | |
117 | language: { |
|
115 | language: { | |
118 | paginate: DEFAULT_GRID_PAGINATION, |
|
116 | paginate: DEFAULT_GRID_PAGINATION, | |
119 | emptyTable: _gettext("No gists available yet.") |
|
117 | emptyTable: _gettext("No gists available yet.") | |
120 | }, |
|
118 | }, | |
121 | "initComplete": function( settings, json ) { |
|
119 | "initComplete": function( settings, json ) { | |
122 | timeagoActivate(); |
|
120 | timeagoActivate(); | |
123 | get_datatable_count(); |
|
121 | get_datatable_count(); | |
124 | } |
|
122 | } | |
125 | }); |
|
123 | }); | |
126 |
|
124 | |||
127 | // update the counter when things change |
|
125 | // update the counter when things change | |
128 | $('#gist_list_table').on('draw.dt', function() { |
|
126 | $('#gist_list_table').on('draw.dt', function() { | |
129 | timeagoActivate(); |
|
127 | timeagoActivate(); | |
130 | get_datatable_count(); |
|
128 | get_datatable_count(); | |
131 | }); |
|
129 | }); | |
132 |
|
130 | |||
133 | // filter, filter both grids |
|
131 | // filter, filter both grids | |
134 | $('#q_filter').on( 'keyup', function () { |
|
132 | $('#q_filter').on( 'keyup', function () { | |
135 | var repo_api = $('#gist_list_table').dataTable().api(); |
|
133 | var repo_api = $('#gist_list_table').dataTable().api(); | |
136 | repo_api |
|
134 | repo_api | |
137 | .draw(); |
|
135 | .draw(); | |
138 | }); |
|
136 | }); | |
139 |
|
137 | |||
140 | // refilter table if page load via back button |
|
138 | // refilter table if page load via back button | |
141 | $("#q_filter").trigger('keyup'); |
|
139 | $("#q_filter").trigger('keyup'); | |
142 |
|
140 | |||
143 | }); |
|
141 | }); | |
144 |
|
142 | |||
145 | </script> |
|
143 | </script> | |
146 | </%def> |
|
144 | </%def> | |
147 |
|
145 |
General Comments 0
You need to be logged in to leave comments.
Login now