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