Show More
@@ -1,139 +1,147 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 {}').format(c.rhodecode_user.username)} |
|
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 {}').format(c.rhodecode_user.username)} |
|
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 | <%def name="main()"> |
|
23 | <%def name="main()"> | |
24 |
|
24 | |||
25 | <div class="box"> |
|
25 | <div class="box"> | |
26 | <div class="title"> |
|
26 | <div class="title"> | |
27 |
|
27 | |||
28 | <ul class="button-links"> |
|
28 | <ul class="button-links"> | |
29 | % if c.is_super_admin: |
|
29 | % if c.is_super_admin: | |
30 | <li class="btn ${h.is_active('all', c.active)}"><a href="${h.route_path('gists_show', _query={'all': 1})}">${_('All gists')}</a></li> |
|
30 | <li class="btn ${h.is_active('all', c.active)}"><a href="${h.route_path('gists_show', _query={'all': 1})}">${_('All gists')}</a></li> | |
31 | %endif |
|
31 | %endif | |
32 | <li class="btn ${h.is_active('public', c.active)}"><a href="${h.route_path('gists_show')}">${_('All public')}</a></li> |
|
32 | <li class="btn ${h.is_active('public', c.active)}"><a href="${h.route_path('gists_show')}">${_('All public')}</a></li> | |
33 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
33 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
34 | <li class="btn ${h.is_active('my_all', c.active)}"><a href="${h.route_path('gists_show', _query={'public':1, 'private': 1})}">${_('My gists')}</a></li> |
|
34 | <li class="btn ${h.is_active('my_all', c.active)}"><a href="${h.route_path('gists_show', _query={'public':1, 'private': 1})}">${_('My gists')}</a></li> | |
35 | <li class="btn ${h.is_active('my_private', c.active)}"><a href="${h.route_path('gists_show', _query={'private': 1})}">${_('My private')}</a></li> |
|
35 | <li class="btn ${h.is_active('my_private', c.active)}"><a href="${h.route_path('gists_show', _query={'private': 1})}">${_('My private')}</a></li> | |
36 | <li class="btn ${h.is_active('my_public', c.active)}"><a href="${h.route_path('gists_show', _query={'public': 1})}">${_('My public')}</a></li> |
|
36 | <li class="btn ${h.is_active('my_public', c.active)}"><a href="${h.route_path('gists_show', _query={'public': 1})}">${_('My public')}</a></li> | |
37 | %endif |
|
37 | %endif | |
38 | </ul> |
|
38 | </ul> | |
39 |
|
39 | |||
|
40 | % if c.rhodecode_user.username != h.DEFAULT_USER: | |||
|
41 | <div class="pull-right"> | |||
|
42 | <a class="btn btn-primary" href="${h.route_path('gists_new')}" > | |||
|
43 | ${_(u'Create New Gist')} | |||
|
44 | </a> | |||
|
45 | </div> | |||
|
46 | % endif | |||
|
47 | ||||
40 | <div class="grid-quick-filter"> |
|
48 | <div class="grid-quick-filter"> | |
41 | <ul class="grid-filter-box"> |
|
49 | <ul class="grid-filter-box"> | |
42 | <li class="grid-filter-box-icon"> |
|
50 | <li class="grid-filter-box-icon"> | |
43 | <i class="icon-search"></i> |
|
51 | <i class="icon-search"></i> | |
44 | </li> |
|
52 | </li> | |
45 | <li class="grid-filter-box-input"> |
|
53 | <li class="grid-filter-box-input"> | |
46 | <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=""/> | |
47 | </li> |
|
55 | </li> | |
48 | </ul> |
|
56 | </ul> | |
49 | </div> |
|
57 | </div> | |
50 |
|
58 | |||
51 | </div> |
|
59 | </div> | |
52 |
|
60 | |||
53 | <div class="main-content-full-width"> |
|
61 | <div class="main-content-full-width"> | |
54 | <div id="repos_list_wrap"> |
|
62 | <div id="repos_list_wrap"> | |
55 | <table id="gist_list_table" class="display"></table> |
|
63 | <table id="gist_list_table" class="display"></table> | |
56 | </div> |
|
64 | </div> | |
57 | </div> |
|
65 | </div> | |
58 |
|
66 | |||
59 | </div> |
|
67 | </div> | |
60 |
|
68 | |||
61 | <script type="text/javascript"> |
|
69 | <script type="text/javascript"> | |
62 | $(document).ready(function() { |
|
70 | $(document).ready(function() { | |
63 |
|
71 | |||
64 | var get_datatable_count = function(){ |
|
72 | var get_datatable_count = function(){ | |
65 | var api = $('#gist_list_table').dataTable().api(); |
|
73 | var api = $('#gist_list_table').dataTable().api(); | |
66 | $('#gists_count').text(api.page.info().recordsDisplay); |
|
74 | $('#gists_count').text(api.page.info().recordsDisplay); | |
67 | }; |
|
75 | }; | |
68 |
|
76 | |||
69 |
|
77 | |||
70 | // custom filter that filters by access_id, description or author |
|
78 | // custom filter that filters by access_id, description or author | |
71 | $.fn.dataTable.ext.search.push( |
|
79 | $.fn.dataTable.ext.search.push( | |
72 | function( settings, data, dataIndex ) { |
|
80 | function( settings, data, dataIndex ) { | |
73 | var query = $('#q_filter').val(); |
|
81 | var query = $('#q_filter').val(); | |
74 | var author = data[0].strip(); |
|
82 | var author = data[0].strip(); | |
75 | var access_id = data[2].strip(); |
|
83 | var access_id = data[2].strip(); | |
76 | var description = data[3].strip(); |
|
84 | var description = data[3].strip(); | |
77 |
|
85 | |||
78 | var query_str = (access_id + " " + author + " " + description).toLowerCase(); |
|
86 | var query_str = (access_id + " " + author + " " + description).toLowerCase(); | |
79 |
|
87 | |||
80 | if(query_str.indexOf(query.toLowerCase()) !== -1){ |
|
88 | if(query_str.indexOf(query.toLowerCase()) !== -1){ | |
81 | return true; |
|
89 | return true; | |
82 | } |
|
90 | } | |
83 | return false; |
|
91 | return false; | |
84 | } |
|
92 | } | |
85 | ); |
|
93 | ); | |
86 |
|
94 | |||
87 | // gists list |
|
95 | // gists list | |
88 | $('#gist_list_table').DataTable({ |
|
96 | $('#gist_list_table').DataTable({ | |
89 | data: ${c.data|n}, |
|
97 | data: ${c.data|n}, | |
90 | dom: 'rtp', |
|
98 | dom: 'rtp', | |
91 | pageLength: ${c.visual.dashboard_items}, |
|
99 | pageLength: ${c.visual.dashboard_items}, | |
92 | order: [[ 4, "desc" ]], |
|
100 | order: [[ 4, "desc" ]], | |
93 | columns: [ |
|
101 | columns: [ | |
94 | { data: {"_": "author", |
|
102 | { data: {"_": "author", | |
95 | "sort": "author_raw"}, title: "${_("Author")}", width: "250px", className: "td-user" }, |
|
103 | "sort": "author_raw"}, title: "${_("Author")}", width: "250px", className: "td-user" }, | |
96 | { data: {"_": "type", |
|
104 | { data: {"_": "type", | |
97 | "sort": "type"}, title: "${_("Type")}", width: "70px", className: "td-tags" }, |
|
105 | "sort": "type"}, title: "${_("Type")}", width: "70px", className: "td-tags" }, | |
98 | { data: {"_": "access_id", |
|
106 | { data: {"_": "access_id", | |
99 | "sort": "access_id"}, title: "${_("Name")}", width:"150px", className: "td-componentname" }, |
|
107 | "sort": "access_id"}, title: "${_("Name")}", width:"150px", className: "td-componentname" }, | |
100 | { data: {"_": "description", |
|
108 | { data: {"_": "description", | |
101 | "sort": "description"}, title: "${_("Description")}", width: "250px", className: "td-description" }, |
|
109 | "sort": "description"}, title: "${_("Description")}", width: "250px", className: "td-description" }, | |
102 | { data: {"_": "created_on", |
|
110 | { data: {"_": "created_on", | |
103 | "sort": "created_on_raw"}, title: "${_("Created on")}", className: "td-time" }, |
|
111 | "sort": "created_on_raw"}, title: "${_("Created on")}", className: "td-time" }, | |
104 | { data: {"_": "expires", |
|
112 | { data: {"_": "expires", | |
105 | "sort": "expires"}, title: "${_("Expires")}", className: "td-exp" } |
|
113 | "sort": "expires"}, title: "${_("Expires")}", className: "td-exp" } | |
106 | ], |
|
114 | ], | |
107 | language: { |
|
115 | language: { | |
108 | paginate: DEFAULT_GRID_PAGINATION, |
|
116 | paginate: DEFAULT_GRID_PAGINATION, | |
109 | emptyTable: _gettext("No gists available yet.") |
|
117 | emptyTable: _gettext("No gists available yet.") | |
110 | }, |
|
118 | }, | |
111 | "initComplete": function( settings, json ) { |
|
119 | "initComplete": function( settings, json ) { | |
112 | timeagoActivate(); |
|
120 | timeagoActivate(); | |
113 | tooltipActivate(); |
|
121 | tooltipActivate(); | |
114 | get_datatable_count(); |
|
122 | get_datatable_count(); | |
115 | } |
|
123 | } | |
116 | }); |
|
124 | }); | |
117 |
|
125 | |||
118 | // update the counter when things change |
|
126 | // update the counter when things change | |
119 | $('#gist_list_table').on('draw.dt', function() { |
|
127 | $('#gist_list_table').on('draw.dt', function() { | |
120 | timeagoActivate(); |
|
128 | timeagoActivate(); | |
121 | tooltipActivate(); |
|
129 | tooltipActivate(); | |
122 | get_datatable_count(); |
|
130 | get_datatable_count(); | |
123 | }); |
|
131 | }); | |
124 |
|
132 | |||
125 | // filter, filter both grids |
|
133 | // filter, filter both grids | |
126 | $('#q_filter').on( 'keyup', function () { |
|
134 | $('#q_filter').on( 'keyup', function () { | |
127 | var repo_api = $('#gist_list_table').dataTable().api(); |
|
135 | var repo_api = $('#gist_list_table').dataTable().api(); | |
128 | repo_api |
|
136 | repo_api | |
129 | .draw(); |
|
137 | .draw(); | |
130 | }); |
|
138 | }); | |
131 |
|
139 | |||
132 | // refilter table if page load via back button |
|
140 | // refilter table if page load via back button | |
133 | $("#q_filter").trigger('keyup'); |
|
141 | $("#q_filter").trigger('keyup'); | |
134 |
|
142 | |||
135 | }); |
|
143 | }); | |
136 |
|
144 | |||
137 | </script> |
|
145 | </script> | |
138 | </%def> |
|
146 | </%def> | |
139 |
|
147 |
@@ -1,85 +1,86 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 | ${_('New Gist')} |
|
5 | ${_('New Gist')} | |
6 | %if c.rhodecode_name: |
|
6 | %if c.rhodecode_name: | |
7 | · ${h.branding(c.rhodecode_name)} |
|
7 | · ${h.branding(c.rhodecode_name)} | |
8 | %endif |
|
8 | %endif | |
9 | </%def> |
|
9 | </%def> | |
10 |
|
10 | |||
11 | <%def name="breadcrumbs_links()"></%def> |
|
11 | <%def name="breadcrumbs_links()"></%def> | |
12 |
|
12 | |||
13 | <%def name="menu_bar_nav()"> |
|
13 | <%def name="menu_bar_nav()"> | |
14 | ${self.menu_items(active='gists')} |
|
14 | ${self.menu_items(active='gists')} | |
15 | </%def> |
|
15 | </%def> | |
16 |
|
16 | |||
17 | <%def name="main()"> |
|
17 | <%def name="main()"> | |
18 | <div class="box"> |
|
18 | <div class="box"> | |
19 | <!-- box / title --> |
|
19 | <!-- box / title --> | |
20 | <div class="title"> |
|
20 | <div class="title"> | |
21 |
|
21 | |||
22 | </div> |
|
22 | </div> | |
23 |
|
23 | |||
24 | <div class="table"> |
|
24 | <div class="table"> | |
25 | <div id="files_data"> |
|
25 | <div id="files_data"> | |
26 | ${h.secure_form(h.route_path('gists_create'), id='eform', request=request)} |
|
26 | ${h.secure_form(h.route_path('gists_create'), id='eform', request=request)} | |
27 | <div> |
|
27 | <div> | |
28 | <span class="gist-gravatar"> |
|
28 | <span class="gist-gravatar"> | |
29 | ${self.gravatar(c.rhodecode_user.email, 30)} |
|
29 | ${self.gravatar(c.rhodecode_user.email, 30)} | |
30 | </span> |
|
30 | </span> | |
31 | <label for='gistid'>${_('Gist id')}</label> |
|
31 | <label for='gistid'>${_('Gist id')}</label> | |
32 | ${h.text('gistid', placeholder=_('Auto generated'))} |
|
32 | ${h.text('gistid', placeholder=_('Auto generated'))} | |
33 |
|
33 | |||
34 | <label for='lifetime'>${_('Gist lifetime')}</label> |
|
34 | <label for='lifetime'>${_('Gist lifetime')}</label> | |
35 | ${h.dropdownmenu('lifetime', '', c.lifetime_options)} |
|
35 | ${h.dropdownmenu('lifetime', '', c.lifetime_options)} | |
36 |
|
36 | |||
37 | <label for='acl_level'>${_('Gist access level')}</label> |
|
37 | <label for='acl_level'>${_('Private Gist access level')}</label> | |
38 | ${h.dropdownmenu('gist_acl_level', '', c.acl_options)} |
|
38 | ${h.dropdownmenu('gist_acl_level', '', c.acl_options)} | |
39 |
|
39 | |||
40 | <textarea style="margin-top: 5px; border-color: #dbd9da" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> |
|
40 | <textarea style="margin-top: 5px; border-color: #dbd9da" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> | |
41 | </div> |
|
41 | </div> | |
42 |
|
42 | |||
43 | <div id="codeblock" class="codeblock"> |
|
43 | <div id="codeblock" class="codeblock"> | |
44 | <div class="code-header"> |
|
44 | <div class="code-header"> | |
45 | <div class="form"> |
|
45 | <div class="form"> | |
46 | <div class="fields"> |
|
46 | <div class="fields"> | |
47 | ${h.text('filename', size=30, placeholder=_('name gist file...'))} |
|
47 | ${h.text('filename', size=30, placeholder=_('name gist file...'))} | |
48 | ${h.dropdownmenu('mimetype','plain',[('plain',_('plain'))],enable_filter=True)} |
|
48 | ${h.dropdownmenu('mimetype','plain',[('plain',_('plain'))],enable_filter=True)} | |
49 | </div> |
|
49 | </div> | |
50 | </div> |
|
50 | </div> | |
51 | </div> |
|
51 | </div> | |
52 |
|
52 | |||
53 | <div id="editor_container"> |
|
53 | <div id="editor_container"> | |
54 | <div id="editor_pre"></div> |
|
54 | <div id="editor_pre"></div> | |
55 | <textarea id="editor" name="content" ></textarea> |
|
55 | <textarea id="editor" name="content" ></textarea> | |
56 | </div> |
|
56 | </div> | |
57 | </div> |
|
57 | </div> | |
58 |
|
58 | |||
59 | <div class="pull-right"> |
|
59 | <div class="pull-right"> | |
|
60 | <i class="tooltip icon-info" title="${_('Secret gists are hidden from listing, but accessible to anyone who knows the url.')}"></i> | |||
60 | ${h.submit('private',_('Create Private Gist'),class_="btn")} |
|
61 | ${h.submit('private',_('Create Private Gist'),class_="btn")} | |
61 | ${h.submit('public',_('Create Public Gist'),class_="btn")} |
|
62 | ${h.submit('public',_('Create Public Gist'),class_="btn")} | |
62 | </div> |
|
63 | </div> | |
63 | ${h.end_form()} |
|
64 | ${h.end_form()} | |
64 | </div> |
|
65 | </div> | |
65 | </div> |
|
66 | </div> | |
66 |
|
67 | |||
67 | </div> |
|
68 | </div> | |
68 |
|
69 | |||
69 | <script type="text/javascript"> |
|
70 | <script type="text/javascript"> | |
70 | var myCodeMirror = initCodeMirror('editor', ''); |
|
71 | var myCodeMirror = initCodeMirror('editor', ''); | |
71 |
|
72 | |||
72 | var modes_select = $('#mimetype'); |
|
73 | var modes_select = $('#mimetype'); | |
73 | fillCodeMirrorOptions(modes_select); |
|
74 | fillCodeMirrorOptions(modes_select); | |
74 |
|
75 | |||
75 | var filename_selector = '#filename'; |
|
76 | var filename_selector = '#filename'; | |
76 | // on change of select field set mode |
|
77 | // on change of select field set mode | |
77 | setCodeMirrorModeFromSelect( |
|
78 | setCodeMirrorModeFromSelect( | |
78 | modes_select, filename_selector, myCodeMirror, null); |
|
79 | modes_select, filename_selector, myCodeMirror, null); | |
79 |
|
80 | |||
80 | // on entering the new filename set mode, from given extension |
|
81 | // on entering the new filename set mode, from given extension | |
81 | setCodeMirrorModeFromInput( |
|
82 | setCodeMirrorModeFromInput( | |
82 | modes_select, filename_selector, myCodeMirror, null); |
|
83 | modes_select, filename_selector, myCodeMirror, null); | |
83 |
|
84 | |||
84 | </script> |
|
85 | </script> | |
85 | </%def> |
|
86 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now