##// END OF EJS Templates
nav: bring back quick filter and cleanup titles
marcink -
r3589:aac6b163 new-ui
parent child Browse files
Show More
@@ -1,112 +1,115 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3 <%namespace name="base" file="/base/base.mako"/>
3 <%namespace name="base" file="/base/base.mako"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 ${_('Admin audit log entry')}
6 ${_('Admin audit log entry')}
7 %if c.rhodecode_name:
7 %if c.rhodecode_name:
8 &middot; ${h.branding(c.rhodecode_name)}
8 &middot; ${h.branding(c.rhodecode_name)}
9 %endif
9 %endif
10 </%def>
10 </%def>
11
11
12 <%def name="breadcrumbs_links()">
12 <%def name="breadcrumbs_links()"></%def>
13 ${_('Audit long entry')} ${c.audit_log_entry.entry_id}
14 </%def>
15
13
16 <%def name="menu_bar_nav()">
14 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
15 ${self.menu_items(active='admin')}
18 </%def>
16 </%def>
17
18 <%def name="menu_bar_subnav()">
19 ${self.admin_menu(active='audit_logs')}
20 </%def>
21
19 <%def name="main()">
22 <%def name="main()">
20 <div class="box">
23 <div class="box">
21 <!-- box / title -->
24
22 <div class="title">
25 <div class="title">
23 ${self.breadcrumbs()}
26 ${_('Audit long entry')} ${c.audit_log_entry.entry_id}
24 </div>
27 </div>
25 <!-- end box / title -->
28
26 <div class="table">
29 <div class="table">
27 <div id="user_log">
30 <div id="user_log">
28 <table class="rctable audit-log">
31 <table class="rctable audit-log">
29 <tr>
32 <tr>
30 <td>
33 <td>
31 ${_('User')}:
34 ${_('User')}:
32 </td>
35 </td>
33 <td>
36 <td>
34 %if c.audit_log_entry.user is not None:
37 %if c.audit_log_entry.user is not None:
35 ${base.gravatar_with_user(c.audit_log_entry.user.email)}
38 ${base.gravatar_with_user(c.audit_log_entry.user.email)}
36 %else:
39 %else:
37 ${c.audit_log_entry.username}
40 ${c.audit_log_entry.username}
38 %endif
41 %endif
39 </td>
42 </td>
40 </tr>
43 </tr>
41 <tr>
44 <tr>
42 <td>
45 <td>
43 ${_('Date')}:
46 ${_('Date')}:
44 </td>
47 </td>
45 <td>
48 <td>
46 ${h.format_date(c.audit_log_entry.action_date)}
49 ${h.format_date(c.audit_log_entry.action_date)}
47 </td>
50 </td>
48 </tr>
51 </tr>
49 <tr>
52 <tr>
50 <td>
53 <td>
51 ${_('IP')}:
54 ${_('IP')}:
52 </td>
55 </td>
53 <td>
56 <td>
54 ${c.audit_log_entry.user_ip}
57 ${c.audit_log_entry.user_ip}
55 </td>
58 </td>
56 </tr>
59 </tr>
57
60
58 <tr>
61 <tr>
59 <td>
62 <td>
60 ${_('Action')}:
63 ${_('Action')}:
61 </td>
64 </td>
62 <td>
65 <td>
63 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_1:
66 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_1:
64 ${h.action_parser(request, l)[0]()}
67 ${h.action_parser(request, l)[0]()}
65 % else:
68 % else:
66 ${h.literal(c.audit_log_entry.action)}
69 ${h.literal(c.audit_log_entry.action)}
67 % endif
70 % endif
68
71
69 <div class="journal_action_params">
72 <div class="journal_action_params">
70 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_1:
73 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_1:
71 ${h.literal(h.action_parser(request, l)[1]())}
74 ${h.literal(h.action_parser(request, l)[1]())}
72 % endif
75 % endif
73 </div>
76 </div>
74 </td>
77 </td>
75 </tr>
78 </tr>
76 <tr>
79 <tr>
77 <td>
80 <td>
78 ${_('Action Data')}:
81 ${_('Action Data')}:
79 </td>
82 </td>
80 <td class="td-journalaction">
83 <td class="td-journalaction">
81 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_2:
84 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_2:
82 <div>
85 <div>
83 <pre>${h.json.dumps(c.audit_log_entry.action_data, indent=4, sort_keys=True)}</pre>
86 <pre>${h.json.dumps(c.audit_log_entry.action_data, indent=4, sort_keys=True)}</pre>
84 </div>
87 </div>
85 % else:
88 % else:
86 <pre title="${_('data not available for v1 entries type')}">-</pre>
89 <pre title="${_('data not available for v1 entries type')}">-</pre>
87 % endif
90 % endif
88 </td>
91 </td>
89 </tr>
92 </tr>
90 <tr>
93 <tr>
91 <td>
94 <td>
92 ${_('Repository')}:
95 ${_('Repository')}:
93 </td>
96 </td>
94 <td class="td-journalaction">
97 <td class="td-journalaction">
95 %if c.audit_log_entry.repository is not None:
98 %if c.audit_log_entry.repository is not None:
96 ${h.link_to(c.audit_log_entry.repository.repo_name, h.route_path('repo_summary',repo_name=c.audit_log_entry.repository.repo_name))}
99 ${h.link_to(c.audit_log_entry.repository.repo_name, h.route_path('repo_summary',repo_name=c.audit_log_entry.repository.repo_name))}
97 %else:
100 %else:
98 ${c.audit_log_entry.repository_name or '-'}
101 ${c.audit_log_entry.repository_name or '-'}
99 %endif
102 %endif
100 </td>
103 </td>
101 </tr>
104 </tr>
102
105
103 </table>
106 </table>
104
107
105 </div>
108 </div>
106 </div>
109 </div>
107 </div>
110 </div>
108
111
109 <script>
112 <script>
110 $('#j_filter').autoGrowInput();
113 $('#j_filter').autoGrowInput();
111 </script>
114 </script>
112 </%def>
115 </%def>
@@ -1,41 +1,43 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 ${_('Admin audit logs')}
5 ${_('Admin audit logs')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 ${h.form(None, id_="filter_form", method="get")}
13 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or ''}" placeholder="${_('filter...')}"/>
14 <input type='submit' value="${_('filter')}" class="btn" />
15 ${_('Audit logs')} - ${_ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)}
16 ${h.end_form()}
17 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
18 <pre id="search-help" style="display: none">${h.tooltip(h.journal_filter_help(request))}</pre>
19 </%def>
20
12
21 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
22 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
23 </%def>
15 </%def>
24
16
25 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
26 ${self.admin_menu(active='audit_logs')}
18 ${self.admin_menu(active='audit_logs')}
27 </%def>
19 </%def>
28
20
29 <%def name="main()">
21 <%def name="main()">
30 <div class="box">
22 <div class="box">
23 <div class="title">
24 ${h.form(None, id_="filter_form", method="get")}
25 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or ''}" placeholder="${_('filter...')}"/>
26 <input type='submit' value="${_('filter')}" class="btn" />
27 ${_('Audit logs')} - ${_ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)}
28 ${h.end_form()}
29 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p>
30 <pre id="search-help" style="display: none">${h.tooltip(h.journal_filter_help(request))}</pre>
31 </div>
32
31 <div class="table">
33 <div class="table">
32 <div id="user_log">
34 <div id="user_log">
33 <%include file="/admin/admin_log_base.mako" />
35 <%include file="/admin/admin_log_base.mako" />
34 </div>
36 </div>
35 </div>
37 </div>
36 </div>
38 </div>
37
39
38 <script>
40 <script>
39 $('#j_filter').autoGrowInput();
41 $('#j_filter').autoGrowInput();
40 </script>
42 </script>
41 </%def>
43 </%def>
@@ -1,127 +1,123 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 ${_('Authentication Settings')}
5 ${_('Authentication Settings')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}}
7 &middot; ${h.branding(c.rhodecode_name)}}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 &raquo;
14 ${_('Authentication Plugins')}
15 </%def>
16
12
17 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
18 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
19 </%def>
15 </%def>
20
16
21 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
22 ${self.admin_menu(active='authentication')}
18 ${self.admin_menu(active='authentication')}
23 </%def>
19 </%def>
24
20
25 <%def name="main()">
21 <%def name="main()">
26
22
27 <div class="box">
23 <div class="box">
28
24
29 <div class='sidebar-col-wrapper'>
25 <div class='sidebar-col-wrapper'>
30
26
31 <div class="sidebar">
27 <div class="sidebar">
32 <ul class="nav nav-pills nav-stacked">
28 <ul class="nav nav-pills nav-stacked">
33 % for item in resource.get_root().get_nav_list():
29 % for item in resource.get_root().get_nav_list():
34 <li ${('class=active' if item == resource else '')}>
30 <li ${('class=active' if item == resource else '')}>
35 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
31 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
36 </li>
32 </li>
37 % endfor
33 % endfor
38 </ul>
34 </ul>
39 </div>
35 </div>
40
36
41 <div class="main-content-full-width">
37 <div class="main-content-full-width">
42 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
38 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
43 <div class="panel panel-default">
39 <div class="panel panel-default">
44
40
45 <div class="panel-heading">
41 <div class="panel-heading">
46 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
42 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
47 </div>
43 </div>
48
44
49 <div class="panel-body">
45 <div class="panel-body">
50
46
51
47
52 <div class="label">${_("Ordered Activated Plugins")}</div>
48 <div class="label">${_("Ordered Activated Plugins")}</div>
53 <div class="textarea text-area editor">
49 <div class="textarea text-area editor">
54 ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
50 ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
55 </div>
51 </div>
56 <div class="field">
52 <div class="field">
57 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
53 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
58 '\nThe order of the plugins is also the order in which '
54 '\nThe order of the plugins is also the order in which '
59 'RhodeCode Enterprise will try to authenticate a user.')}
55 'RhodeCode Enterprise will try to authenticate a user.')}
60 </p>
56 </p>
61 </div>
57 </div>
62
58
63 <table class="rctable">
59 <table class="rctable">
64 <th>${_('Activate')}</th>
60 <th>${_('Activate')}</th>
65 <th>${_('Plugin Name')}</th>
61 <th>${_('Plugin Name')}</th>
66 <th>${_('Documentation')}</th>
62 <th>${_('Documentation')}</th>
67 <th>${_('Plugin ID')}</th>
63 <th>${_('Plugin ID')}</th>
68 <th>${_('Enabled')}</th>
64 <th>${_('Enabled')}</th>
69 %for plugin in available_plugins:
65 %for plugin in available_plugins:
70 <tr class="${('inactive' if (not plugin.is_active() and plugin.get_id() in enabled_plugins) else '')}">
66 <tr class="${('inactive' if (not plugin.is_active() and plugin.get_id() in enabled_plugins) else '')}">
71 <td>
67 <td>
72 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${('btn-success' if plugin.get_id() in enabled_plugins else '')}">
68 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${('btn-success' if plugin.get_id() in enabled_plugins else '')}">
73 ${(_('activated') if plugin.get_id() in enabled_plugins else _('not active'))}
69 ${(_('activated') if plugin.get_id() in enabled_plugins else _('not active'))}
74 </span>
70 </span>
75 </td>
71 </td>
76 <td>${plugin.get_display_name()}</td>
72 <td>${plugin.get_display_name()}</td>
77 <td>
73 <td>
78 % if plugin.docs():
74 % if plugin.docs():
79 <a href="${plugin.docs()}">docs</a>
75 <a href="${plugin.docs()}">docs</a>
80 % endif
76 % endif
81 </td>
77 </td>
82 <td>${plugin.get_id()}</td>
78 <td>${plugin.get_id()}</td>
83 <td>${h.bool2icon(plugin.is_active(),show_at_false=False)}</td>
79 <td>${h.bool2icon(plugin.is_active(),show_at_false=False)}</td>
84 </tr>
80 </tr>
85 %endfor
81 %endfor
86 </table>
82 </table>
87
83
88 <div class="buttons">
84 <div class="buttons">
89 ${h.submit('save',_('Save'),class_="btn")}
85 ${h.submit('save',_('Save'),class_="btn")}
90 </div>
86 </div>
91 </div>
87 </div>
92 </div>
88 </div>
93 ${h.end_form()}
89 ${h.end_form()}
94 </div>
90 </div>
95 </div>
91 </div>
96 </div>
92 </div>
97
93
98 <script>
94 <script>
99 $('.toggle-plugin').click(function(e){
95 $('.toggle-plugin').click(function(e){
100 var auth_plugins_input = $('#auth_plugins');
96 var auth_plugins_input = $('#auth_plugins');
101 var elems = [];
97 var elems = [];
102
98
103 $.each(auth_plugins_input.val().split(',') , function (index, element) {
99 $.each(auth_plugins_input.val().split(',') , function (index, element) {
104 if (element !== "") {
100 if (element !== "") {
105 elems.push(element.strip())
101 elems.push(element.strip())
106 }
102 }
107 });
103 });
108
104
109 var cur_button = e.currentTarget;
105 var cur_button = e.currentTarget;
110 var plugin_id = $(cur_button).attr('plugin_id');
106 var plugin_id = $(cur_button).attr('plugin_id');
111 if($(cur_button).hasClass('btn-success')){
107 if($(cur_button).hasClass('btn-success')){
112 elems.splice(elems.indexOf(plugin_id), 1);
108 elems.splice(elems.indexOf(plugin_id), 1);
113 auth_plugins_input.val(elems.join(',\n'));
109 auth_plugins_input.val(elems.join(',\n'));
114 $(cur_button).removeClass('btn-success');
110 $(cur_button).removeClass('btn-success');
115 cur_button.innerHTML = _gettext('not active');
111 cur_button.innerHTML = _gettext('not active');
116 }
112 }
117 else{
113 else{
118 if (elems.indexOf(plugin_id) === -1) {
114 if (elems.indexOf(plugin_id) === -1) {
119 elems.push(plugin_id);
115 elems.push(plugin_id);
120 }
116 }
121 auth_plugins_input.val(elems.join(',\n'));
117 auth_plugins_input.val(elems.join(',\n'));
122 $(cur_button).addClass('btn-success');
118 $(cur_button).addClass('btn-success');
123 cur_button.innerHTML = _gettext('activated');
119 cur_button.innerHTML = _gettext('activated');
124 }
120 }
125 });
121 });
126 </script>
122 </script>
127 </%def>
123 </%def>
@@ -1,42 +1,38 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 ${_('Settings administration')}
5 ${_('Settings administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 &raquo;
14 ${_('Settings')}
15 </%def>
16
12
17 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
18 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
19 </%def>
15 </%def>
20
16
21 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
22 ${self.admin_menu()}
18 ${self.admin_menu()}
23 </%def>
19 </%def>
24
20
25 <%def name="side_bar_nav()">
21 <%def name="side_bar_nav()">
26
22
27 </%def>
23 </%def>
28
24
29 <%def name="main_content()">
25 <%def name="main_content()">
30 Hello Admin
26 Hello Admin
31 </%def>
27 </%def>
32
28
33 <%def name="main()">
29 <%def name="main()">
34 <div class="box">
30 <div class="box">
35
31
36 ##main
32 ##main
37 <div class="main-content-auto-width">
33 <div class="main-content-auto-width">
38 ${self.main_content()}
34 ${self.main_content()}
39 </div>
35 </div>
40 </div>
36 </div>
41
37
42 </%def> No newline at end of file
38 </%def>
@@ -1,68 +1,67 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 ${_('My Notifications')} ${c.rhodecode_user.username}
5 ${_('My Notifications')} ${c.rhodecode_user.username}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 ${_('My Notifications')}
13 </%def>
14
12
15 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
16 ${self.menu_items(active='my_account')}
14 ${self.menu_items(active='my_account')}
17 </%def>
15 </%def>
18
16
19 <%def name="main()">
17 <%def name="main()">
20 <div class="box">
18 <div class="box">
21 <div class="title">
19 <div class="title">
22 ${self.breadcrumbs()}
20 ${_('My Notifications')}
21
23 <div class="notifications_buttons">
22 <div class="notifications_buttons">
24 %if c.notifications:
23 %if c.notifications:
25 <button id='mark_all_read' class="btn btn-default" type="submit">
24 <button id='mark_all_read' class="btn btn-default" type="submit">
26 ${_('Mark all as read')}
25 ${_('Mark all as read')}
27 </button>
26 </button>
28 %else:
27 %else:
29 <button class="btn btn-default" type="submit" disabled="disabled">
28 <button class="btn btn-default" type="submit" disabled="disabled">
30 ${_('Mark all as read')}
29 ${_('Mark all as read')}
31 </button>
30 </button>
32 %endif
31 %endif
33 </div>
32 </div>
34 </div>
33 </div>
35
34
36 <div class="sidebar-col-wrapper scw-small">
35 <div class="sidebar-col-wrapper scw-small">
37 ##main
36 ##main
38 <div class="sidebar">
37 <div class="sidebar">
39 <ul class="nav nav-pills nav-stacked">
38 <ul class="nav nav-pills nav-stacked">
40 <li id='unread' class="${'active' if c.current_filter=='unread' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.unread_type))}">${_('Unread')} (${c.unread_count})</a></li>
39 <li id='unread' class="${'active' if c.current_filter=='unread' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.unread_type))}">${_('Unread')} (${c.unread_count})</a></li>
41 <li id='all' class="${'active' if c.current_filter=='all' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.all_type))}">${_('All')}</a></li>
40 <li id='all' class="${'active' if c.current_filter=='all' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.all_type))}">${_('All')}</a></li>
42 <li id='comment' class="${'active' if c.current_filter=='comment' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.comment_type))}">${_('Comments')}</a></li>
41 <li id='comment' class="${'active' if c.current_filter=='comment' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.comment_type))}">${_('Comments')}</a></li>
43 <li id='pull_request' class="${'active' if c.current_filter=='pull_request' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.pull_request_type))}">${_('Pull Requests')}</a></li>
42 <li id='pull_request' class="${'active' if c.current_filter=='pull_request' else ''}"><a href="${h.route_path('notifications_show_all', _query=dict(type=c.pull_request_type))}">${_('Pull Requests')}</a></li>
44 </ul>
43 </ul>
45 </div>
44 </div>
46
45
47 <div class="main-content-full-width">
46 <div class="main-content-full-width">
48 <%include file='notifications_data.mako'/>
47 <%include file='notifications_data.mako'/>
49 </div>
48 </div>
50 </div>
49 </div>
51 </div>
50 </div>
52
51
53 <script type="text/javascript">
52 <script type="text/javascript">
54
53
55 $('#mark_all_read').on('click',function(e){
54 $('#mark_all_read').on('click',function(e){
56 //set notifications as read
55 //set notifications as read
57 var url = "${h.route_path('notifications_mark_all_read', _query=request.GET.mixed())}";
56 var url = "${h.route_path('notifications_mark_all_read', _query=request.GET.mixed())}";
58 $.post(url, {'csrf_token': CSRF_TOKEN}).
57 $.post(url, {'csrf_token': CSRF_TOKEN}).
59 done(function(data){
58 done(function(data){
60 window.location = "${request.current_route_path(_query=request.GET.mixed())}";
59 window.location = "${request.current_route_path(_query=request.GET.mixed())}";
61 })
60 })
62 .fail(function(data, textStatus, errorThrown){
61 .fail(function(data, textStatus, errorThrown){
63 alert("Error while saving notifications.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
62 alert("Error while saving notifications.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
64 });
63 });
65 });
64 });
66
65
67 </script>
66 </script>
68 </%def>
67 </%def>
@@ -1,101 +1,101 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 ${_('Repository groups administration')}
5 ${_('Repository groups administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.route_path('admin_home'))} &raquo; <span id="repo_group_count">0</span> ${_('repository groups')}
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.admin_menu(active='repository_groups')}
18 ${self.admin_menu(active='repository_groups')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25 <div class="box">
22 <div class="box">
23
26 <div class="title">
24 <div class="title">
25 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
26 <span id="repo_group_count">0</span> ${_('repository groups')}
27
27
28 <ul class="links">
28 <ul class="links">
29 %if c.can_create_repo_group:
29 %if c.can_create_repo_group:
30 <li>
30 <li>
31 <a href="${h.route_path('repo_group_new')}" class="btn btn-small btn-success">${_(u'Add Repository Group')}</a>
31 <a href="${h.route_path('repo_group_new')}" class="btn btn-small btn-success">${_(u'Add Repository Group')}</a>
32 </li>
32 </li>
33 %endif
33 %endif
34 </ul>
34 </ul>
35 </div>
35 </div>
36 <div id="repos_list_wrap">
36 <div id="repos_list_wrap">
37 <table id="group_list_table" class="display"></table>
37 <table id="group_list_table" class="display"></table>
38 </div>
38 </div>
39 </div>
39 </div>
40
40
41 <script>
41 <script>
42 $(document).ready(function() {
42 $(document).ready(function() {
43
43
44 var get_datatable_count = function(){
44 var get_datatable_count = function(){
45 var api = $('#group_list_table').dataTable().api();
45 var api = $('#group_list_table').dataTable().api();
46 $('#repo_group_count').text(api.page.info().recordsDisplay);
46 $('#repo_group_count').text(api.page.info().recordsDisplay);
47 };
47 };
48
48
49 // repo group list
49 // repo group list
50 $('#group_list_table').DataTable({
50 $('#group_list_table').DataTable({
51 data: ${c.data|n},
51 data: ${c.data|n},
52 dom: 'rtp',
52 dom: 'rtp',
53 pageLength: ${c.visual.admin_grid_items},
53 pageLength: ${c.visual.admin_grid_items},
54 order: [[ 0, "asc" ]],
54 order: [[ 0, "asc" ]],
55 columns: [
55 columns: [
56 { data: {"_": "name",
56 { data: {"_": "name",
57 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
57 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
58 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
58 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
59 { data: {"_": "desc",
59 { data: {"_": "desc",
60 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
60 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
61 { data: {"_": "last_change",
61 { data: {"_": "last_change",
62 "sort": "last_change_raw",
62 "sort": "last_change_raw",
63 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
63 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
64 { data: {"_": "top_level_repos",
64 { data: {"_": "top_level_repos",
65 "sort": "top_level_repos"}, title: "${_('Number of top level repositories')}" },
65 "sort": "top_level_repos"}, title: "${_('Number of top level repositories')}" },
66 { data: {"_": "owner",
66 { data: {"_": "owner",
67 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
67 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
68 { data: {"_": "action",
68 { data: {"_": "action",
69 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
69 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
70 ],
70 ],
71 language: {
71 language: {
72 paginate: DEFAULT_GRID_PAGINATION,
72 paginate: DEFAULT_GRID_PAGINATION,
73 emptyTable: _gettext("No repository groups available yet.")
73 emptyTable: _gettext("No repository groups available yet.")
74 },
74 },
75 "initComplete": function( settings, json ) {
75 "initComplete": function( settings, json ) {
76 get_datatable_count();
76 get_datatable_count();
77 quick_repo_menu();
77 quick_repo_menu();
78 }
78 }
79 });
79 });
80
80
81 // update the counter when doing search
81 // update the counter when doing search
82 $('#group_list_table').on( 'search.dt', function (e,settings) {
82 $('#group_list_table').on( 'search.dt', function (e,settings) {
83 get_datatable_count();
83 get_datatable_count();
84 });
84 });
85
85
86 // filter, filter both grids
86 // filter, filter both grids
87 $('#q_filter').on( 'keyup', function () {
87 $('#q_filter').on( 'keyup', function () {
88
88
89 var repo_group_api = $('#group_list_table').dataTable().api();
89 var repo_group_api = $('#group_list_table').dataTable().api();
90 repo_group_api
90 repo_group_api
91 .columns(0)
91 .columns(0)
92 .search(this.value)
92 .search(this.value)
93 .draw();
93 .draw();
94 });
94 });
95
95
96 // refilter table if page load via back button
96 // refilter table if page load via back button
97 $("#q_filter").trigger('keyup');
97 $("#q_filter").trigger('keyup');
98 });
98 });
99 </script>
99 </script>
100 </%def>
100 </%def>
101
101
@@ -1,104 +1,105 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 ${_('Repositories administration')}
5 ${_('Repositories administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.route_path('admin_home'))} &raquo; <span id="repo_count">0</span> ${_('repositories')}
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.admin_menu(active='repositories')}
18 ${self.admin_menu(active='repositories')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25 <div class="box">
22 <div class="box">
23
26 <div class="title">
24 <div class="title">
25 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
26 <span id="repo_count">0</span> ${_('repositories')}
27
27 <ul class="links">
28 <ul class="links">
28 %if c.can_create_repo:
29 %if c.can_create_repo:
29 <li>
30 <li>
30 <a href="${h.route_path('repo_new')}" class="btn btn-small btn-success">${_(u'Add Repository')}</a>
31 <a href="${h.route_path('repo_new')}" class="btn btn-small btn-success">${_(u'Add Repository')}</a>
31 </li>
32 </li>
32 %endif
33 %endif
33 </ul>
34 </ul>
34 </div>
35 </div>
35 <div id="repos_list_wrap">
36 <div id="repos_list_wrap">
36 <table id="repo_list_table" class="display"></table>
37 <table id="repo_list_table" class="display"></table>
37 </div>
38 </div>
38 </div>
39 </div>
39
40
40 <script>
41 <script>
41 $(document).ready(function() {
42 $(document).ready(function() {
42
43
43 var get_datatable_count = function(){
44 var get_datatable_count = function(){
44 var api = $('#repo_list_table').dataTable().api();
45 var api = $('#repo_list_table').dataTable().api();
45 $('#repo_count').text(api.page.info().recordsDisplay);
46 $('#repo_count').text(api.page.info().recordsDisplay);
46 };
47 };
47
48
48
49
49 // repo list
50 // repo list
50 $('#repo_list_table').DataTable({
51 $('#repo_list_table').DataTable({
51 data: ${c.data|n},
52 data: ${c.data|n},
52 dom: 'rtp',
53 dom: 'rtp',
53 pageLength: ${c.visual.admin_grid_items},
54 pageLength: ${c.visual.admin_grid_items},
54 order: [[ 0, "asc" ]],
55 order: [[ 0, "asc" ]],
55 columns: [
56 columns: [
56 { data: {"_": "name",
57 { data: {"_": "name",
57 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
58 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
58 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
59 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
59 { data: {"_": "desc",
60 { data: {"_": "desc",
60 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
61 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
61 { data: {"_": "last_change",
62 { data: {"_": "last_change",
62 "sort": "last_change_raw",
63 "sort": "last_change_raw",
63 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
64 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
64 { data: {"_": "last_changeset",
65 { data: {"_": "last_changeset",
65 "sort": "last_changeset_raw",
66 "sort": "last_changeset_raw",
66 "type": Number}, title: "${_('Commit')}", className: "td-commit" },
67 "type": Number}, title: "${_('Commit')}", className: "td-commit" },
67 { data: {"_": "owner",
68 { data: {"_": "owner",
68 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
69 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
69 { data: {"_": "state",
70 { data: {"_": "state",
70 "sort": "state"}, title: "${_('State')}", className: "td-tags td-state" },
71 "sort": "state"}, title: "${_('State')}", className: "td-tags td-state" },
71 { data: {"_": "action",
72 { data: {"_": "action",
72 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
73 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
73 ],
74 ],
74 language: {
75 language: {
75 paginate: DEFAULT_GRID_PAGINATION,
76 paginate: DEFAULT_GRID_PAGINATION,
76 emptyTable:_gettext("No repositories available yet.")
77 emptyTable:_gettext("No repositories available yet.")
77 },
78 },
78 "initComplete": function( settings, json ) {
79 "initComplete": function( settings, json ) {
79 get_datatable_count();
80 get_datatable_count();
80 quick_repo_menu();
81 quick_repo_menu();
81 }
82 }
82 });
83 });
83
84
84 // update the counter when doing search
85 // update the counter when doing search
85 $('#repo_list_table').on( 'search.dt', function (e,settings) {
86 $('#repo_list_table').on( 'search.dt', function (e,settings) {
86 get_datatable_count();
87 get_datatable_count();
87 });
88 });
88
89
89 // filter, filter both grids
90 // filter, filter both grids
90 $('#q_filter').on( 'keyup', function () {
91 $('#q_filter').on( 'keyup', function () {
91 var repo_api = $('#repo_list_table').dataTable().api();
92 var repo_api = $('#repo_list_table').dataTable().api();
92 repo_api
93 repo_api
93 .columns(0)
94 .columns(0)
94 .search(this.value)
95 .search(this.value)
95 .draw();
96 .draw();
96 });
97 });
97
98
98 // refilter table if page load via back button
99 // refilter table if page load via back button
99 $("#q_filter").trigger('keyup');
100 $("#q_filter").trigger('keyup');
100 });
101 });
101
102
102 </script>
103 </script>
103
104
104 </%def>
105 </%def>
@@ -1,118 +1,118 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 ${_('User groups administration')}
5 ${_('User groups administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.route_path('admin_home'))} &raquo; <span id="user_group_count">0</span>
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.admin_menu(active='user_groups')}
18 ${self.admin_menu(active='user_groups')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25 <div class="box">
22 <div class="box">
26
23
27 <div class="title">
24 <div class="title">
25 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
26 <span id="user_group_count">0</span>
27
28 <ul class="links">
28 <ul class="links">
29 %if c.can_create_user_group:
29 %if c.can_create_user_group:
30 <li>
30 <li>
31 <a href="${h.route_path('user_groups_new')}" class="btn btn-small btn-success">${_(u'Add User Group')}</a>
31 <a href="${h.route_path('user_groups_new')}" class="btn btn-small btn-success">${_(u'Add User Group')}</a>
32 </li>
32 </li>
33 %endif
33 %endif
34 </ul>
34 </ul>
35 </div>
35 </div>
36
36
37 <div id="repos_list_wrap">
37 <div id="repos_list_wrap">
38 <table id="user_group_list_table" class="display"></table>
38 <table id="user_group_list_table" class="display"></table>
39 </div>
39 </div>
40
40
41 </div>
41 </div>
42 <script>
42 <script>
43 $(document).ready(function() {
43 $(document).ready(function() {
44 var $userGroupsListTable = $('#user_group_list_table');
44 var $userGroupsListTable = $('#user_group_list_table');
45
45
46 // user list
46 // user list
47 $userGroupsListTable.DataTable({
47 $userGroupsListTable.DataTable({
48 processing: true,
48 processing: true,
49 serverSide: true,
49 serverSide: true,
50 ajax: {
50 ajax: {
51 "url": "${h.route_path('user_groups_data')}",
51 "url": "${h.route_path('user_groups_data')}",
52 "dataSrc": function (json) {
52 "dataSrc": function (json) {
53 var filteredCount = json.recordsFiltered;
53 var filteredCount = json.recordsFiltered;
54 var filteredInactiveCount = json.recordsFilteredInactive;
54 var filteredInactiveCount = json.recordsFilteredInactive;
55 var totalInactive = json.recordsTotalInactive;
55 var totalInactive = json.recordsTotalInactive;
56 var total = json.recordsTotal;
56 var total = json.recordsTotal;
57
57
58 var _text = _gettext(
58 var _text = _gettext(
59 "{0} ({1} inactive) of {2} user groups ({3} inactive)").format(
59 "{0} ({1} inactive) of {2} user groups ({3} inactive)").format(
60 filteredCount, filteredInactiveCount, total, totalInactive);
60 filteredCount, filteredInactiveCount, total, totalInactive);
61
61
62 if (total === filteredCount) {
62 if (total === filteredCount) {
63 _text = _gettext(
63 _text = _gettext(
64 "{0} user groups ({1} inactive)").format(total, totalInactive);
64 "{0} user groups ({1} inactive)").format(total, totalInactive);
65 }
65 }
66 $('#user_group_count').text(_text);
66 $('#user_group_count').text(_text);
67 return json.data;
67 return json.data;
68 },
68 },
69 },
69 },
70
70
71 dom: 'rtp',
71 dom: 'rtp',
72 pageLength: ${c.visual.admin_grid_items},
72 pageLength: ${c.visual.admin_grid_items},
73 order: [[ 0, "asc" ]],
73 order: [[ 0, "asc" ]],
74 columns: [
74 columns: [
75 { data: {"_": "users_group_name",
75 { data: {"_": "users_group_name",
76 "sort": "users_group_name"}, title: "${_('Name')}", className: "td-componentname" },
76 "sort": "users_group_name"}, title: "${_('Name')}", className: "td-componentname" },
77 { data: {"_": "description",
77 { data: {"_": "description",
78 "sort": "description"}, title: "${_('Description')}", className: "td-description" },
78 "sort": "description"}, title: "${_('Description')}", className: "td-description" },
79 { data: {"_": "members",
79 { data: {"_": "members",
80 "sort": "members"}, title: "${_('Members')}", className: "td-number" },
80 "sort": "members"}, title: "${_('Members')}", className: "td-number" },
81 { data: {"_": "sync",
81 { data: {"_": "sync",
82 "sort": "sync"}, title: "${_('Sync')}", className: "td-sync" },
82 "sort": "sync"}, title: "${_('Sync')}", className: "td-sync" },
83 { data: {"_": "active",
83 { data: {"_": "active",
84 "sort": "active"}, title: "${_('Active')}", className: "td-active" },
84 "sort": "active"}, title: "${_('Active')}", className: "td-active" },
85 { data: {"_": "owner",
85 { data: {"_": "owner",
86 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
86 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
87 { data: {"_": "action",
87 { data: {"_": "action",
88 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false}
88 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false}
89 ],
89 ],
90 language: {
90 language: {
91 paginate: DEFAULT_GRID_PAGINATION,
91 paginate: DEFAULT_GRID_PAGINATION,
92 sProcessing: _gettext('loading...'),
92 sProcessing: _gettext('loading...'),
93 emptyTable: _gettext("No user groups available yet.")
93 emptyTable: _gettext("No user groups available yet.")
94 }
94 }
95 });
95 });
96
96
97 $userGroupsListTable.on('xhr.dt', function(e, settings, json, xhr){
97 $userGroupsListTable.on('xhr.dt', function(e, settings, json, xhr){
98 $userGroupsListTable.css('opacity', 1);
98 $userGroupsListTable.css('opacity', 1);
99 });
99 });
100
100
101 $userGroupsListTable.on('preXhr.dt', function(e, settings, data){
101 $userGroupsListTable.on('preXhr.dt', function(e, settings, data){
102 $userGroupsListTable.css('opacity', 0.3);
102 $userGroupsListTable.css('opacity', 0.3);
103 });
103 });
104
104
105 // filter
105 // filter
106 $('#q_filter').on('keyup',
106 $('#q_filter').on('keyup',
107 $.debounce(250, function() {
107 $.debounce(250, function() {
108 $('#user_group_list_table').DataTable().search(
108 $('#user_group_list_table').DataTable().search(
109 $('#q_filter').val()
109 $('#q_filter').val()
110 ).draw();
110 ).draw();
111 })
111 })
112 );
112 );
113
113
114 });
114 });
115
115
116 </script>
116 </script>
117
117
118 </%def>
118 </%def>
@@ -1,60 +1,59 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 ${_('%s user settings') % c.user.username}
5 ${_('%s user settings') % c.user.username}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 &raquo;
13 &raquo;
14 ${h.link_to(_('Users'),h.route_path('users'))}
14 ${h.link_to(_('Users'),h.route_path('users'))}
15 &raquo;
15 &raquo;
16 % if c.user.active:
17 ${c.user.username}
18 % else:
19 <strike title="${_('This user is set as disabled')}">${c.user.username}</strike>
20 % endif
21
22 </%def>
16 </%def>
23
17
24 <%def name="menu_bar_nav()">
18 <%def name="menu_bar_nav()">
25 ${self.menu_items(active='admin')}
19 ${self.menu_items(active='admin')}
26 </%def>
20 </%def>
27
21
28 <%def name="menu_bar_subnav()">
22 <%def name="menu_bar_subnav()">
29 ${self.admin_menu(active='users')}
23 ${self.admin_menu(active='users')}
30 </%def>
24 </%def>
31
25
32
26
33 <%def name="main()">
27 <%def name="main()">
34 <div class="box user_settings">
28 <div class="box user_settings">
29 % if not c.user.active:
30 <div class="alert alert-warning text-center">
31 <strong>${_('This user is set as disabled')}</strong>
32 </div>
33 % endif
35
34
36 ##main
35 ##main
37 <div class="sidebar-col-wrapper">
36 <div class="sidebar-col-wrapper">
38 <div class="sidebar">
37 <div class="sidebar">
39 <ul class="nav nav-pills nav-stacked">
38 <ul class="nav nav-pills nav-stacked">
40 <li class="${'active' if c.active=='profile' else ''}"><a href="${h.route_path('user_edit', user_id=c.user.user_id)}">${_('User Profile')}</a></li>
39 <li class="${'active' if c.active=='profile' else ''}"><a href="${h.route_path('user_edit', user_id=c.user.user_id)}">${_('User Profile')}</a></li>
41 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.route_path('edit_user_auth_tokens', user_id=c.user.user_id)}">${_('Auth tokens')}</a></li>
40 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.route_path('edit_user_auth_tokens', user_id=c.user.user_id)}">${_('Auth tokens')}</a></li>
42 <li class="${'active' if c.active in ['ssh_keys','ssh_keys_generate'] else ''}"><a href="${h.route_path('edit_user_ssh_keys', user_id=c.user.user_id)}">${_('SSH Keys')}</a></li>
41 <li class="${'active' if c.active in ['ssh_keys','ssh_keys_generate'] else ''}"><a href="${h.route_path('edit_user_ssh_keys', user_id=c.user.user_id)}">${_('SSH Keys')}</a></li>
43 <li class="${'active' if c.active=='advanced' else ''}"><a href="${h.route_path('user_edit_advanced', user_id=c.user.user_id)}">${_('Advanced')}</a></li>
42 <li class="${'active' if c.active=='advanced' else ''}"><a href="${h.route_path('user_edit_advanced', user_id=c.user.user_id)}">${_('Advanced')}</a></li>
44 <li class="${'active' if c.active=='global_perms' else ''}"><a href="${h.route_path('user_edit_global_perms', user_id=c.user.user_id)}">${_('Global permissions')}</a></li>
43 <li class="${'active' if c.active=='global_perms' else ''}"><a href="${h.route_path('user_edit_global_perms', user_id=c.user.user_id)}">${_('Global permissions')}</a></li>
45 <li class="${'active' if c.active=='perms_summary' else ''}"><a href="${h.route_path('edit_user_perms_summary', user_id=c.user.user_id)}">${_('Permissions summary')}</a></li>
44 <li class="${'active' if c.active=='perms_summary' else ''}"><a href="${h.route_path('edit_user_perms_summary', user_id=c.user.user_id)}">${_('Permissions summary')}</a></li>
46 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.route_path('edit_user_emails', user_id=c.user.user_id)}">${_('Emails')}</a></li>
45 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.route_path('edit_user_emails', user_id=c.user.user_id)}">${_('Emails')}</a></li>
47 <li class="${'active' if c.active=='ips' else ''}"><a href="${h.route_path('edit_user_ips', user_id=c.user.user_id)}">${_('Ip Whitelist')}</a></li>
46 <li class="${'active' if c.active=='ips' else ''}"><a href="${h.route_path('edit_user_ips', user_id=c.user.user_id)}">${_('Ip Whitelist')}</a></li>
48 <li class="${'active' if c.active=='groups' else ''}"><a href="${h.route_path('edit_user_groups_management', user_id=c.user.user_id)}">${_('User Groups Management')}</a></li>
47 <li class="${'active' if c.active=='groups' else ''}"><a href="${h.route_path('edit_user_groups_management', user_id=c.user.user_id)}">${_('User Groups Management')}</a></li>
49 <li class="${'active' if c.active=='audit' else ''}"><a href="${h.route_path('edit_user_audit_logs', user_id=c.user.user_id)}">${_('Audit logs')}</a></li>
48 <li class="${'active' if c.active=='audit' else ''}"><a href="${h.route_path('edit_user_audit_logs', user_id=c.user.user_id)}">${_('Audit logs')}</a></li>
50 <li class="${'active' if c.active=='caches' else ''}"><a href="${h.route_path('edit_user_caches', user_id=c.user.user_id)}">${_('Caches')}</a></li>
49 <li class="${'active' if c.active=='caches' else ''}"><a href="${h.route_path('edit_user_caches', user_id=c.user.user_id)}">${_('Caches')}</a></li>
51 </ul>
50 </ul>
52 </div>
51 </div>
53
52
54 <div class="main-content-full-width">
53 <div class="main-content-full-width">
55 <%include file="/admin/users/user_edit_${c.active}.mako"/>
54 <%include file="/admin/users/user_edit_${c.active}.mako"/>
56 </div>
55 </div>
57 </div>
56 </div>
58 </div>
57 </div>
59
58
60 </%def>
59 </%def>
@@ -1,126 +1,126 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 ${_('Users administration')}
5 ${_('Users administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.route_path('admin_home'))} &raquo; <span id="user_count">0</span>
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
14 ${self.menu_items(active='admin')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.admin_menu(active='users')}
18 ${self.admin_menu(active='users')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25
22
26 <div class="box">
23 <div class="box">
27
24
28 <div class="title">
25 <div class="title">
26 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
27 <span id="user_count">0</span>
28
29 <ul class="links">
29 <ul class="links">
30 <li>
30 <li>
31 <a href="${h.route_path('users_new')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
31 <a href="${h.route_path('users_new')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
32 </li>
32 </li>
33 </ul>
33 </ul>
34 </div>
34 </div>
35
35
36 <div id="repos_list_wrap">
36 <div id="repos_list_wrap">
37 <table id="user_list_table" class="display"></table>
37 <table id="user_list_table" class="display"></table>
38 </div>
38 </div>
39 </div>
39 </div>
40
40
41 <script type="text/javascript">
41 <script type="text/javascript">
42
42
43 $(document).ready(function() {
43 $(document).ready(function() {
44 var $userListTable = $('#user_list_table');
44 var $userListTable = $('#user_list_table');
45 // user list
45 // user list
46 $userListTable.DataTable({
46 $userListTable.DataTable({
47 processing: true,
47 processing: true,
48 serverSide: true,
48 serverSide: true,
49 ajax: {
49 ajax: {
50 "url": "${h.route_path('users_data')}",
50 "url": "${h.route_path('users_data')}",
51 "dataSrc": function ( json ) {
51 "dataSrc": function ( json ) {
52 var filteredCount = json.recordsFiltered;
52 var filteredCount = json.recordsFiltered;
53 var filteredInactiveCount = json.recordsFilteredInactive;
53 var filteredInactiveCount = json.recordsFilteredInactive;
54 var totalInactive = json.recordsTotalInactive;
54 var totalInactive = json.recordsTotalInactive;
55 var total = json.recordsTotal;
55 var total = json.recordsTotal;
56
56
57 var _text = _gettext(
57 var _text = _gettext(
58 "{0} ({1} inactive) of {2} users ({3} inactive)").format(
58 "{0} ({1} inactive) of {2} users ({3} inactive)").format(
59 filteredCount, filteredInactiveCount, total, totalInactive);
59 filteredCount, filteredInactiveCount, total, totalInactive);
60
60
61 if(total === filteredCount){
61 if(total === filteredCount){
62 _text = _gettext(
62 _text = _gettext(
63 "{0} users ({1} inactive)").format(total, totalInactive);
63 "{0} users ({1} inactive)").format(total, totalInactive);
64 }
64 }
65 $('#user_count').text(_text);
65 $('#user_count').text(_text);
66 return json.data;
66 return json.data;
67 }
67 }
68 },
68 },
69 dom: 'rtp',
69 dom: 'rtp',
70 pageLength: ${c.visual.admin_grid_items},
70 pageLength: ${c.visual.admin_grid_items},
71 order: [[ 0, "asc" ]],
71 order: [[ 0, "asc" ]],
72 columns: [
72 columns: [
73 { data: {"_": "username",
73 { data: {"_": "username",
74 "sort": "username"}, title: "${_('Username')}", className: "td-user" },
74 "sort": "username"}, title: "${_('Username')}", className: "td-user" },
75 { data: {"_": "email",
75 { data: {"_": "email",
76 "sort": "email"}, title: "${_('Email')}", className: "td-email" },
76 "sort": "email"}, title: "${_('Email')}", className: "td-email" },
77 { data: {"_": "first_name",
77 { data: {"_": "first_name",
78 "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
78 "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
79 { data: {"_": "last_name",
79 { data: {"_": "last_name",
80 "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
80 "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
81 { data: {"_": "last_activity",
81 { data: {"_": "last_activity",
82 "sort": "last_activity",
82 "sort": "last_activity",
83 "type": Number}, title: "${_('Last activity')}", className: "td-time" },
83 "type": Number}, title: "${_('Last activity')}", className: "td-time" },
84 { data: {"_": "active",
84 { data: {"_": "active",
85 "sort": "active"}, title: "${_('Active')}", className: "td-active" },
85 "sort": "active"}, title: "${_('Active')}", className: "td-active" },
86 { data: {"_": "admin",
86 { data: {"_": "admin",
87 "sort": "admin"}, title: "${_('Super admin')}", className: "td-admin" },
87 "sort": "admin"}, title: "${_('Super admin')}", className: "td-admin" },
88 { data: {"_": "extern_type",
88 { data: {"_": "extern_type",
89 "sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" },
89 "sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" },
90 { data: {"_": "action",
90 { data: {"_": "action",
91 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
91 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
92 ],
92 ],
93 language: {
93 language: {
94 paginate: DEFAULT_GRID_PAGINATION,
94 paginate: DEFAULT_GRID_PAGINATION,
95 sProcessing: _gettext('loading...'),
95 sProcessing: _gettext('loading...'),
96 emptyTable: _gettext("No users available yet.")
96 emptyTable: _gettext("No users available yet.")
97 },
97 },
98
98
99 "createdRow": function ( row, data, index ) {
99 "createdRow": function ( row, data, index ) {
100 if (!data['active_raw']){
100 if (!data['active_raw']){
101 $(row).addClass('closed')
101 $(row).addClass('closed')
102 }
102 }
103 }
103 }
104 });
104 });
105
105
106 $userListTable.on('xhr.dt', function(e, settings, json, xhr){
106 $userListTable.on('xhr.dt', function(e, settings, json, xhr){
107 $userListTable.css('opacity', 1);
107 $userListTable.css('opacity', 1);
108 });
108 });
109
109
110 $userListTable.on('preXhr.dt', function(e, settings, data){
110 $userListTable.on('preXhr.dt', function(e, settings, data){
111 $userListTable.css('opacity', 0.3);
111 $userListTable.css('opacity', 0.3);
112 });
112 });
113
113
114 // filter
114 // filter
115 $('#q_filter').on('keyup',
115 $('#q_filter').on('keyup',
116 $.debounce(250, function() {
116 $.debounce(250, function() {
117 $userListTable.DataTable().search(
117 $userListTable.DataTable().search(
118 $('#q_filter').val()
118 $('#q_filter').val()
119 ).draw();
119 ).draw();
120 })
120 })
121 );
121 );
122
122
123 });
123 });
124 </script>
124 </script>
125
125
126 </%def>
126 </%def>
@@ -1,102 +1,100 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 ${_('%s Bookmarks') % c.repo_name}
5 ${_('%s Bookmarks') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 <span id="obj_count">0</span> ${_('bookmarks')}
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
14 ${self.menu_items(active='repositories')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='summary')}
18 ${self.repo_menu(active='summary')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25 <div class="box">
22 <div class="box">
26 <div class="title">
23 <div class="title">
27
24
28 %if c.has_references:
25 %if c.has_references:
29 <ul class="links">
26 <ul class="links">
30 <li>
27 <li>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Bookmarks')}">
28 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Bookmarks')}">
32 </li>
29 </li>
33 </ul>
30 </ul>
34 %endif
31 %endif
35 %if c.has_references:
32 %if c.has_references:
36 ${self.breadcrumbs()}
33 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
34 <span id="obj_count">0</span> ${_('bookmarks')}
37 %endif
35 %endif
38 </div>
36 </div>
39 <table id="obj_list_table" class="display"></table>
37 <table id="obj_list_table" class="display"></table>
40 </div>
38 </div>
41
39
42
40
43 <script type="text/javascript">
41 <script type="text/javascript">
44 $(document).ready(function() {
42 $(document).ready(function() {
45
43
46 var get_datatable_count = function(){
44 var get_datatable_count = function(){
47 var api = $('#obj_list_table').dataTable().api();
45 var api = $('#obj_list_table').dataTable().api();
48 $('#obj_count').text(api.page.info().recordsDisplay);
46 $('#obj_count').text(api.page.info().recordsDisplay);
49 };
47 };
50
48
51 // object list
49 // object list
52 $('#obj_list_table').DataTable({
50 $('#obj_list_table').DataTable({
53 data: ${c.data|n},
51 data: ${c.data|n},
54 dom: 'rtp',
52 dom: 'rtp',
55 pageLength: ${c.visual.dashboard_items},
53 pageLength: ${c.visual.dashboard_items},
56 order: [[ 0, "asc" ]],
54 order: [[ 0, "asc" ]],
57 columns: [
55 columns: [
58 { data: {"_": "name",
56 { data: {"_": "name",
59 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
57 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
60 { data: {"_": "date",
58 { data: {"_": "date",
61 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
59 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
62 { data: {"_": "author",
60 { data: {"_": "author",
63 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
61 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
64 { data: {"_": "commit",
62 { data: {"_": "commit",
65 "sort": "commit_raw",
63 "sort": "commit_raw",
66 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
64 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
67 { data: {"_": "compare",
65 { data: {"_": "compare",
68 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
66 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
69 ],
67 ],
70 language: {
68 language: {
71 paginate: DEFAULT_GRID_PAGINATION,
69 paginate: DEFAULT_GRID_PAGINATION,
72 emptyTable: _gettext("No bookmarks available yet.")
70 emptyTable: _gettext("No bookmarks available yet.")
73 },
71 },
74 "initComplete": function(settings, json) {
72 "initComplete": function(settings, json) {
75 get_datatable_count();
73 get_datatable_count();
76 timeagoActivate();
74 timeagoActivate();
77 compare_radio_buttons("${c.repo_name}", 'book');
75 compare_radio_buttons("${c.repo_name}", 'book');
78 }
76 }
79 });
77 });
80
78
81 // update when things change
79 // update when things change
82 $('#obj_list_table').on('draw.dt', function() {
80 $('#obj_list_table').on('draw.dt', function() {
83 get_datatable_count();
81 get_datatable_count();
84 timeagoActivate();
82 timeagoActivate();
85 });
83 });
86
84
87 // filter, filter both grids
85 // filter, filter both grids
88 $('#q_filter').on('keyup', function() {
86 $('#q_filter').on('keyup', function() {
89 var obj_api = $('#obj_list_table').dataTable().api();
87 var obj_api = $('#obj_list_table').dataTable().api();
90 obj_api
88 obj_api
91 .columns(0)
89 .columns(0)
92 .search(this.value)
90 .search(this.value)
93 .draw();
91 .draw();
94 });
92 });
95
93
96 // refilter table if page load via back button
94 // refilter table if page load via back button
97 $("#q_filter").trigger('keyup');
95 $("#q_filter").trigger('keyup');
98
96
99 });
97 });
100
98
101 </script>
99 </script>
102 </%def>
100 </%def>
@@ -1,101 +1,99 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 ${_('%s Branches') % c.repo_name}
5 ${_('%s Branches') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 <span id="obj_count">0</span> ${_('branches')}
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
14 ${self.menu_items(active='repositories')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='summary')}
18 ${self.repo_menu(active='summary')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25 <div class="box">
22 <div class="box">
26 <div class="title">
23 <div class="title">
27
24
28 %if c.has_references:
25 %if c.has_references:
29 <ul class="links">
26 <ul class="links">
30 <li>
27 <li>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Branches')}"/>
28 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Branches')}"/>
32 </li>
29 </li>
33 </ul>
30 </ul>
34 %endif
31 %endif
35 %if c.has_references:
32 %if c.has_references:
36 ${self.breadcrumbs()}
33 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
34 <span id="obj_count">0</span> ${_('branches')}
37 %endif
35 %endif
38 </div>
36 </div>
39 <table id="obj_list_table" class="display"></table>
37 <table id="obj_list_table" class="display"></table>
40 </div>
38 </div>
41
39
42 <script type="text/javascript">
40 <script type="text/javascript">
43 $(document).ready(function() {
41 $(document).ready(function() {
44
42
45 var get_datatable_count = function(){
43 var get_datatable_count = function(){
46 var api = $('#obj_list_table').dataTable().api();
44 var api = $('#obj_list_table').dataTable().api();
47 $('#obj_count').text(api.page.info().recordsDisplay);
45 $('#obj_count').text(api.page.info().recordsDisplay);
48 };
46 };
49
47
50 // object list
48 // object list
51 $('#obj_list_table').DataTable({
49 $('#obj_list_table').DataTable({
52 data: ${c.data|n},
50 data: ${c.data|n},
53 dom: 'rtp',
51 dom: 'rtp',
54 pageLength: ${c.visual.dashboard_items},
52 pageLength: ${c.visual.dashboard_items},
55 order: [[ 0, "asc" ]],
53 order: [[ 0, "asc" ]],
56 columns: [
54 columns: [
57 { data: {"_": "name",
55 { data: {"_": "name",
58 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
56 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
59 { data: {"_": "date",
57 { data: {"_": "date",
60 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
58 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
61 { data: {"_": "author",
59 { data: {"_": "author",
62 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
60 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
63 { data: {"_": "commit",
61 { data: {"_": "commit",
64 "sort": "commit_raw",
62 "sort": "commit_raw",
65 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
63 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
66 { data: {"_": "compare",
64 { data: {"_": "compare",
67 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
65 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
68 ],
66 ],
69 language: {
67 language: {
70 paginate: DEFAULT_GRID_PAGINATION,
68 paginate: DEFAULT_GRID_PAGINATION,
71 emptyTable: _gettext("No branches available yet.")
69 emptyTable: _gettext("No branches available yet.")
72 },
70 },
73 "initComplete": function( settings, json ) {
71 "initComplete": function( settings, json ) {
74 get_datatable_count();
72 get_datatable_count();
75 timeagoActivate();
73 timeagoActivate();
76 compare_radio_buttons("${c.repo_name}", 'branch');
74 compare_radio_buttons("${c.repo_name}", 'branch');
77 }
75 }
78 });
76 });
79
77
80 // update when things change
78 // update when things change
81 $('#obj_list_table').on('draw.dt', function() {
79 $('#obj_list_table').on('draw.dt', function() {
82 get_datatable_count();
80 get_datatable_count();
83 timeagoActivate();
81 timeagoActivate();
84 });
82 });
85
83
86 // filter, filter both grids
84 // filter, filter both grids
87 $('#q_filter').on( 'keyup', function () {
85 $('#q_filter').on( 'keyup', function () {
88 var obj_api = $('#obj_list_table').dataTable().api();
86 var obj_api = $('#obj_list_table').dataTable().api();
89 obj_api
87 obj_api
90 .columns(0)
88 .columns(0)
91 .search(this.value)
89 .search(this.value)
92 .draw();
90 .draw();
93 });
91 });
94
92
95 // refilter table if page load via back button
93 // refilter table if page load via back button
96 $("#q_filter").trigger('keyup');
94 $("#q_filter").trigger('keyup');
97
95
98 });
96 });
99
97
100 </script>
98 </script>
101 </%def>
99 </%def>
@@ -1,305 +1,303 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
3 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 %if c.compare_home:
6 %if c.compare_home:
7 ${_('%s Compare') % c.repo_name}
7 ${_('%s Compare') % c.repo_name}
8 %else:
8 %else:
9 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} &gt; ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}
9 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} &gt; ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}
10 %endif
10 %endif
11 %if c.rhodecode_name:
11 %if c.rhodecode_name:
12 &middot; ${h.branding(c.rhodecode_name)}
12 &middot; ${h.branding(c.rhodecode_name)}
13 %endif
13 %endif
14 </%def>
14 </%def>
15
15
16 <%def name="breadcrumbs_links()">
16 <%def name="breadcrumbs_links()"></%def>
17 ${_ungettext('%s commit','%s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
18 </%def>
19
17
20 <%def name="menu_bar_nav()">
18 <%def name="menu_bar_nav()">
21 ${self.menu_items(active='repositories')}
19 ${self.menu_items(active='repositories')}
22 </%def>
20 </%def>
23
21
24 <%def name="menu_bar_subnav()">
22 <%def name="menu_bar_subnav()">
25 ${self.repo_menu(active='compare')}
23 ${self.repo_menu(active='compare')}
26 </%def>
24 </%def>
27
25
28 <%def name="main()">
26 <%def name="main()">
29 <script type="text/javascript">
27 <script type="text/javascript">
30 // set fake commitId on this commit-range page
28 // set fake commitId on this commit-range page
31 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
29 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
32 </script>
30 </script>
33
31
34 <div class="box">
32 <div class="box">
35 <div class="summary changeset">
33 <div class="summary changeset">
36 <div class="summary-detail">
34 <div class="summary-detail">
37 <div class="summary-detail-header">
35 <div class="summary-detail-header">
38 <span class="breadcrumbs files_location">
36 <span class="breadcrumbs files_location">
39 <h4>
37 <h4>
40 ${_('Compare Commits')}
38 ${_('Compare Commits')}
41 % if c.file_path:
39 % if c.file_path:
42 ${_('for file')} <a href="#${'a_' + h.FID('',c.file_path)}">${c.file_path}</a>
40 ${_('for file')} <a href="#${'a_' + h.FID('',c.file_path)}">${c.file_path}</a>
43 % endif
41 % endif
44
42
45 % if c.commit_ranges:
43 % if c.commit_ranges:
46 <code>
44 <code>
47 r${c.source_commit.idx}:${h.short_id(c.source_commit.raw_id)}...r${c.target_commit.idx}:${h.short_id(c.target_commit.raw_id)}
45 r${c.source_commit.idx}:${h.short_id(c.source_commit.raw_id)}...r${c.target_commit.idx}:${h.short_id(c.target_commit.raw_id)}
48 </code>
46 </code>
49 % endif
47 % endif
50 </h4>
48 </h4>
51 </span>
49 </span>
52 </div>
50 </div>
53
51
54 <div class="fieldset">
52 <div class="fieldset">
55 <div class="left-label">
53 <div class="left-label">
56 ${_('Target')}:
54 ${_('Target')}:
57 </div>
55 </div>
58 <div class="right-content">
56 <div class="right-content">
59 <div>
57 <div>
60 <div class="code-header" >
58 <div class="code-header" >
61 <div class="compare_header">
59 <div class="compare_header">
62 ## The hidden elements are replaced with a select2 widget
60 ## The hidden elements are replaced with a select2 widget
63 ${h.hidden('compare_source')}
61 ${h.hidden('compare_source')}
64 </div>
62 </div>
65 </div>
63 </div>
66 </div>
64 </div>
67 </div>
65 </div>
68 </div>
66 </div>
69
67
70 <div class="fieldset">
68 <div class="fieldset">
71 <div class="left-label">
69 <div class="left-label">
72 ${_('Source')}:
70 ${_('Source')}:
73 </div>
71 </div>
74 <div class="right-content">
72 <div class="right-content">
75 <div>
73 <div>
76 <div class="code-header" >
74 <div class="code-header" >
77 <div class="compare_header">
75 <div class="compare_header">
78 ## The hidden elements are replaced with a select2 widget
76 ## The hidden elements are replaced with a select2 widget
79 ${h.hidden('compare_target')}
77 ${h.hidden('compare_target')}
80 </div>
78 </div>
81 </div>
79 </div>
82 </div>
80 </div>
83 </div>
81 </div>
84 </div>
82 </div>
85
83
86 <div class="fieldset">
84 <div class="fieldset">
87 <div class="left-label">
85 <div class="left-label">
88 ${_('Actions')}:
86 ${_('Actions')}:
89 </div>
87 </div>
90 <div class="right-content">
88 <div class="right-content">
91 <div>
89 <div>
92 <div class="code-header" >
90 <div class="code-header" >
93 <div class="compare_header">
91 <div class="compare_header">
94
92
95 <div class="compare-buttons">
93 <div class="compare-buttons">
96 % if c.compare_home:
94 % if c.compare_home:
97 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
95 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
98
96
99 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
97 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
100 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
98 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
101 <div id="changeset_compare_view_content">
99 <div id="changeset_compare_view_content">
102 <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div>
100 <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div>
103 </div>
101 </div>
104
102
105 % elif c.preview_mode:
103 % elif c.preview_mode:
106 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Compare Commits')}</a>
104 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Compare Commits')}</a>
107 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
105 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
108 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
106 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
109
107
110 % else:
108 % else:
111 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
109 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
112 <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}">${_('Swap')}</a>
110 <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}">${_('Swap')}</a>
113
111
114 ## allow comment only if there are commits to comment on
112 ## allow comment only if there are commits to comment on
115 % if c.diffset and c.diffset.files and c.commit_ranges:
113 % if c.diffset and c.diffset.files and c.commit_ranges:
116 <a id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</a>
114 <a id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</a>
117 % else:
115 % else:
118 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
116 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
119 % endif
117 % endif
120 % endif
118 % endif
121 </div>
119 </div>
122 </div>
120 </div>
123 </div>
121 </div>
124 </div>
122 </div>
125 </div>
123 </div>
126 </div>
124 </div>
127
125
128 ## commit status form
126 ## commit status form
129 <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;">
127 <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;">
130 <div class="left-label">
128 <div class="left-label">
131 ${_('Commit status')}:
129 ${_('Commit status')}:
132 </div>
130 </div>
133 <div class="right-content">
131 <div class="right-content">
134 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
132 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
135 ## main comment form and it status
133 ## main comment form and it status
136 <%
134 <%
137 def revs(_revs):
135 def revs(_revs):
138 form_inputs = []
136 form_inputs = []
139 for cs in _revs:
137 for cs in _revs:
140 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
138 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
141 form_inputs.append(tmpl)
139 form_inputs.append(tmpl)
142 return form_inputs
140 return form_inputs
143 %>
141 %>
144 <div>
142 <div>
145 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
143 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
146 </div>
144 </div>
147 </div>
145 </div>
148 </div>
146 </div>
149
147
150 </div> <!-- end summary-detail -->
148 </div> <!-- end summary-detail -->
151 </div> <!-- end summary -->
149 </div> <!-- end summary -->
152
150
153 ## use JS script to load it quickly before potentially large diffs render long time
151 ## use JS script to load it quickly before potentially large diffs render long time
154 ## this prevents from situation when large diffs block rendering of select2 fields
152 ## this prevents from situation when large diffs block rendering of select2 fields
155 <script type="text/javascript">
153 <script type="text/javascript">
156
154
157 var cache = {};
155 var cache = {};
158
156
159 var formatSelection = function(repoName){
157 var formatSelection = function(repoName){
160 return function(data, container, escapeMarkup) {
158 return function(data, container, escapeMarkup) {
161 var selection = data ? this.text(data) : "";
159 var selection = data ? this.text(data) : "";
162 return escapeMarkup('{0}@{1}'.format(repoName, selection));
160 return escapeMarkup('{0}@{1}'.format(repoName, selection));
163 }
161 }
164 };
162 };
165
163
166 var feedCompareData = function(query, cachedValue){
164 var feedCompareData = function(query, cachedValue){
167 var data = {results: []};
165 var data = {results: []};
168 //filter results
166 //filter results
169 $.each(cachedValue.results, function() {
167 $.each(cachedValue.results, function() {
170 var section = this.text;
168 var section = this.text;
171 var children = [];
169 var children = [];
172 $.each(this.children, function() {
170 $.each(this.children, function() {
173 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
171 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
174 children.push({
172 children.push({
175 'id': this.id,
173 'id': this.id,
176 'text': this.text,
174 'text': this.text,
177 'type': this.type
175 'type': this.type
178 })
176 })
179 }
177 }
180 });
178 });
181 data.results.push({
179 data.results.push({
182 'text': section,
180 'text': section,
183 'children': children
181 'children': children
184 })
182 })
185 });
183 });
186 //push the typed in changeset
184 //push the typed in changeset
187 data.results.push({
185 data.results.push({
188 'text': _gettext('specify commit'),
186 'text': _gettext('specify commit'),
189 'children': [{
187 'children': [{
190 'id': query.term,
188 'id': query.term,
191 'text': query.term,
189 'text': query.term,
192 'type': 'rev'
190 'type': 'rev'
193 }]
191 }]
194 });
192 });
195 query.callback(data);
193 query.callback(data);
196 };
194 };
197
195
198 var loadCompareData = function(repoName, query, cache){
196 var loadCompareData = function(repoName, query, cache){
199 $.ajax({
197 $.ajax({
200 url: pyroutes.url('repo_refs_data', {'repo_name': repoName}),
198 url: pyroutes.url('repo_refs_data', {'repo_name': repoName}),
201 data: {},
199 data: {},
202 dataType: 'json',
200 dataType: 'json',
203 type: 'GET',
201 type: 'GET',
204 success: function(data) {
202 success: function(data) {
205 cache[repoName] = data;
203 cache[repoName] = data;
206 query.callback({results: data.results});
204 query.callback({results: data.results});
207 }
205 }
208 })
206 })
209 };
207 };
210
208
211 var enable_fields = ${"false" if c.preview_mode else "true"};
209 var enable_fields = ${"false" if c.preview_mode else "true"};
212 $("#compare_source").select2({
210 $("#compare_source").select2({
213 placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}",
211 placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}",
214 containerCssClass: "drop-menu",
212 containerCssClass: "drop-menu",
215 dropdownCssClass: "drop-menu-dropdown",
213 dropdownCssClass: "drop-menu-dropdown",
216 formatSelection: formatSelection("${c.source_repo.repo_name}"),
214 formatSelection: formatSelection("${c.source_repo.repo_name}"),
217 dropdownAutoWidth: true,
215 dropdownAutoWidth: true,
218 query: function(query) {
216 query: function(query) {
219 var repoName = '${c.source_repo.repo_name}';
217 var repoName = '${c.source_repo.repo_name}';
220 var cachedValue = cache[repoName];
218 var cachedValue = cache[repoName];
221
219
222 if (cachedValue){
220 if (cachedValue){
223 feedCompareData(query, cachedValue);
221 feedCompareData(query, cachedValue);
224 }
222 }
225 else {
223 else {
226 loadCompareData(repoName, query, cache);
224 loadCompareData(repoName, query, cache);
227 }
225 }
228 }
226 }
229 }).select2("enable", enable_fields);
227 }).select2("enable", enable_fields);
230
228
231 $("#compare_target").select2({
229 $("#compare_target").select2({
232 placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}",
230 placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}",
233 dropdownAutoWidth: true,
231 dropdownAutoWidth: true,
234 containerCssClass: "drop-menu",
232 containerCssClass: "drop-menu",
235 dropdownCssClass: "drop-menu-dropdown",
233 dropdownCssClass: "drop-menu-dropdown",
236 formatSelection: formatSelection("${c.target_repo.repo_name}"),
234 formatSelection: formatSelection("${c.target_repo.repo_name}"),
237 query: function(query) {
235 query: function(query) {
238 var repoName = '${c.target_repo.repo_name}';
236 var repoName = '${c.target_repo.repo_name}';
239 var cachedValue = cache[repoName];
237 var cachedValue = cache[repoName];
240
238
241 if (cachedValue){
239 if (cachedValue){
242 feedCompareData(query, cachedValue);
240 feedCompareData(query, cachedValue);
243 }
241 }
244 else {
242 else {
245 loadCompareData(repoName, query, cache);
243 loadCompareData(repoName, query, cache);
246 }
244 }
247 }
245 }
248 }).select2("enable", enable_fields);
246 }).select2("enable", enable_fields);
249 var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"};
247 var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"};
250 var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"};
248 var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"};
251
249
252 $('#compare_revs').on('click', function(e) {
250 $('#compare_revs').on('click', function(e) {
253 var source = $('#compare_source').select2('data') || initial_compare_source;
251 var source = $('#compare_source').select2('data') || initial_compare_source;
254 var target = $('#compare_target').select2('data') || initial_compare_target;
252 var target = $('#compare_target').select2('data') || initial_compare_target;
255 if (source && target) {
253 if (source && target) {
256 var url_data = {
254 var url_data = {
257 repo_name: "${c.repo_name}",
255 repo_name: "${c.repo_name}",
258 source_ref: source.id,
256 source_ref: source.id,
259 source_ref_type: source.type,
257 source_ref_type: source.type,
260 target_ref: target.id,
258 target_ref: target.id,
261 target_ref_type: target.type
259 target_ref_type: target.type
262 };
260 };
263 window.location = pyroutes.url('repo_compare', url_data);
261 window.location = pyroutes.url('repo_compare', url_data);
264 }
262 }
265 });
263 });
266 $('#compare_changeset_status_toggle').on('click', function(e) {
264 $('#compare_changeset_status_toggle').on('click', function(e) {
267 $('#compare_changeset_status').toggle();
265 $('#compare_changeset_status').toggle();
268 });
266 });
269
267
270 </script>
268 </script>
271
269
272 ## table diff data
270 ## table diff data
273 <div class="table">
271 <div class="table">
274
272
275
273
276 % if not c.compare_home:
274 % if not c.compare_home:
277 <div id="changeset_compare_view_content">
275 <div id="changeset_compare_view_content">
278 <div class="pull-left">
276 <div class="pull-left">
279 <div class="btn-group">
277 <div class="btn-group">
280 <a
278 <a
281 class="btn"
279 class="btn"
282 href="#"
280 href="#"
283 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
281 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
284 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
282 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
285 </a>
283 </a>
286 <a
284 <a
287 class="btn"
285 class="btn"
288 href="#"
286 href="#"
289 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
287 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
290 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
288 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
291 </a>
289 </a>
292 </div>
290 </div>
293 </div>
291 </div>
294 <div style="padding:0 10px 10px 0px" class="pull-left"></div>
292 <div style="padding:0 10px 10px 0px" class="pull-left"></div>
295 ## commit compare generated below
293 ## commit compare generated below
296 <%include file="compare_commits.mako"/>
294 <%include file="compare_commits.mako"/>
297 ${cbdiffs.render_diffset_menu(c.diffset)}
295 ${cbdiffs.render_diffset_menu(c.diffset)}
298 ${cbdiffs.render_diffset(c.diffset)}
296 ${cbdiffs.render_diffset(c.diffset)}
299 </div>
297 </div>
300 % endif
298 % endif
301
299
302 </div>
300 </div>
303 </div>
301 </div>
304
302
305 </%def>
303 </%def>
@@ -1,106 +1,104 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 ${_('%s Forks') % c.repo_name}
5 ${_('%s Forks') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 ${_('Forks')}
13 </%def>
14
12
15 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
16 ${self.menu_items(active='repositories')}
14 ${self.menu_items(active='repositories')}
17 </%def>
15 </%def>
18
16
19 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
20 ${self.repo_menu(active='summary')}
18 ${self.repo_menu(active='summary')}
21 </%def>
19 </%def>
22
20
23 <%def name="main()">
21 <%def name="main()">
24 <div class="box">
22 <div class="box">
25 <div class="title">
23 <div class="title">
26
24
27 <ul class="links">
25 <ul class="links">
28 <li>
26 <li>
29 <a class="btn btn-small btn-success" href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">
27 <a class="btn btn-small btn-success" href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">
30 ${_('Create new fork')}
28 ${_('Create new fork')}
31 </a>
29 </a>
32 </li>
30 </li>
33 </ul>
31 </ul>
34 </div>
32 </div>
35
33
36 <div id="fork_list_wrap">
34 <div id="fork_list_wrap">
37 <table id="fork_list_table" class="display"></table>
35 <table id="fork_list_table" class="display"></table>
38 </div>
36 </div>
39 </div>
37 </div>
40
38
41
39
42
40
43 <script type="text/javascript">
41 <script type="text/javascript">
44
42
45 $(document).ready(function() {
43 $(document).ready(function() {
46 var $forksListTable = $('#fork_list_table');
44 var $forksListTable = $('#fork_list_table');
47
45
48 // fork list
46 // fork list
49 $forksListTable.DataTable({
47 $forksListTable.DataTable({
50 processing: true,
48 processing: true,
51 serverSide: true,
49 serverSide: true,
52 ajax: {
50 ajax: {
53 "url": "${h.route_path('repo_forks_data', repo_name=c.repo_name)}",
51 "url": "${h.route_path('repo_forks_data', repo_name=c.repo_name)}",
54 },
52 },
55 dom: 'rtp',
53 dom: 'rtp',
56 pageLength: ${c.visual.dashboard_items},
54 pageLength: ${c.visual.dashboard_items},
57 order: [[ 0, "asc" ]],
55 order: [[ 0, "asc" ]],
58 columns: [
56 columns: [
59 { data: {"_": "username",
57 { data: {"_": "username",
60 "sort": "username"}, title: "${_('Owner')}", className: "td-user" },
58 "sort": "username"}, title: "${_('Owner')}", className: "td-user" },
61 { data: {"_": "fork_name",
59 { data: {"_": "fork_name",
62 "sort": "fork_name"}, title: "${_('Fork name')}", className: "td-email" },
60 "sort": "fork_name"}, title: "${_('Fork name')}", className: "td-email" },
63 { data: {"_": "description",
61 { data: {"_": "description",
64 "sort": "description"}, title: "${_('Description')}", className: "td-user" },
62 "sort": "description"}, title: "${_('Description')}", className: "td-user" },
65 { data: {"_": "fork_date",
63 { data: {"_": "fork_date",
66 "sort": "fork_date"}, title: "${_('Forked')}", className: "td-user" },
64 "sort": "fork_date"}, title: "${_('Forked')}", className: "td-user" },
67 { data: {"_": "last_activity",
65 { data: {"_": "last_activity",
68 "sort": "last_activity",
66 "sort": "last_activity",
69 "type": Number}, title: "${_('Last activity')}", className: "td-time" },
67 "type": Number}, title: "${_('Last activity')}", className: "td-time" },
70 { data: {"_": "action",
68 { data: {"_": "action",
71 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
69 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
72 ],
70 ],
73
71
74 language: {
72 language: {
75 paginate: DEFAULT_GRID_PAGINATION,
73 paginate: DEFAULT_GRID_PAGINATION,
76 sProcessing: _gettext('loading...'),
74 sProcessing: _gettext('loading...'),
77 emptyTable: _gettext("No forks available yet.")
75 emptyTable: _gettext("No forks available yet.")
78 },
76 },
79
77
80 "createdRow": function ( row, data, index ) {
78 "createdRow": function ( row, data, index ) {
81 if (!data['active_raw']){
79 if (!data['active_raw']){
82 $(row).addClass('closed')
80 $(row).addClass('closed')
83 }
81 }
84 }
82 }
85 });
83 });
86
84
87 $forksListTable.on('xhr.dt', function(e, settings, json, xhr){
85 $forksListTable.on('xhr.dt', function(e, settings, json, xhr){
88 $forksListTable.css('opacity', 1);
86 $forksListTable.css('opacity', 1);
89 });
87 });
90
88
91 $forksListTable.on('preXhr.dt', function(e, settings, data){
89 $forksListTable.on('preXhr.dt', function(e, settings, data){
92 $forksListTable.css('opacity', 0.3);
90 $forksListTable.css('opacity', 0.3);
93 });
91 });
94
92
95 // filter
93 // filter
96 $('#q_filter').on('keyup',
94 $('#q_filter').on('keyup',
97 $.debounce(250, function() {
95 $.debounce(250, function() {
98 $forksListTable.DataTable().search(
96 $forksListTable.DataTable().search(
99 $('#q_filter').val()
97 $('#q_filter').val()
100 ).draw();
98 ).draw();
101 })
99 })
102 );
100 );
103
101
104 });
102 });
105 </script>
103 </script>
106 </%def>
104 </%def>
@@ -1,544 +1,542 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
2 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${c.repo_name} ${_('New pull request')}
5 ${c.repo_name} ${_('New pull request')}
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()"></%def>
9 ${_('New pull request')}
10 </%def>
11
9
12 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
13 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
14 </%def>
12 </%def>
15
13
16 <%def name="menu_bar_subnav()">
14 <%def name="menu_bar_subnav()">
17 ${self.repo_menu(active='showpullrequest')}
15 ${self.repo_menu(active='showpullrequest')}
18 </%def>
16 </%def>
19
17
20 <%def name="main()">
18 <%def name="main()">
21 <div class="box">
19 <div class="box">
22 ${h.secure_form(h.route_path('pullrequest_create', repo_name=c.repo_name, _query=request.GET.mixed()), id='pull_request_form', request=request)}
20 ${h.secure_form(h.route_path('pullrequest_create', repo_name=c.repo_name, _query=request.GET.mixed()), id='pull_request_form', request=request)}
23
21
24 ${self.breadcrumbs()}
22 ${_('New pull request')}
25
23
26 <div class="box pr-summary">
24 <div class="box pr-summary">
27
25
28 <div class="summary-details block-left">
26 <div class="summary-details block-left">
29
27
30
28
31 <div class="pr-details-title">
29 <div class="pr-details-title">
32 ${_('Summary')}
30 ${_('Summary')}
33 </div>
31 </div>
34
32
35 <div class="form" style="padding-top: 10px">
33 <div class="form" style="padding-top: 10px">
36 <!-- fields -->
34 <!-- fields -->
37
35
38 <div class="fields" >
36 <div class="fields" >
39
37
40 <div class="field">
38 <div class="field">
41 <div class="label">
39 <div class="label">
42 <label for="pullrequest_title">${_('Title')}:</label>
40 <label for="pullrequest_title">${_('Title')}:</label>
43 </div>
41 </div>
44 <div class="input">
42 <div class="input">
45 ${h.text('pullrequest_title', c.default_title, class_="medium autogenerated-title")}
43 ${h.text('pullrequest_title', c.default_title, class_="medium autogenerated-title")}
46 </div>
44 </div>
47 </div>
45 </div>
48
46
49 <div class="field">
47 <div class="field">
50 <div class="label label-textarea">
48 <div class="label label-textarea">
51 <label for="pullrequest_desc">${_('Description')}:</label>
49 <label for="pullrequest_desc">${_('Description')}:</label>
52 </div>
50 </div>
53 <div class="textarea text-area editor">
51 <div class="textarea text-area editor">
54 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
52 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
55 ${dt.markup_form('pullrequest_desc')}
53 ${dt.markup_form('pullrequest_desc')}
56 </div>
54 </div>
57 </div>
55 </div>
58
56
59 <div class="field">
57 <div class="field">
60 <div class="label label-textarea">
58 <div class="label label-textarea">
61 <label for="commit_flow">${_('Commit flow')}:</label>
59 <label for="commit_flow">${_('Commit flow')}:</label>
62 </div>
60 </div>
63
61
64 ## TODO: johbo: Abusing the "content" class here to get the
62 ## TODO: johbo: Abusing the "content" class here to get the
65 ## desired effect. Should be replaced by a proper solution.
63 ## desired effect. Should be replaced by a proper solution.
66
64
67 ##ORG
65 ##ORG
68 <div class="content">
66 <div class="content">
69 <strong>${_('Source repository')}:</strong>
67 <strong>${_('Source repository')}:</strong>
70 ${c.rhodecode_db_repo.description}
68 ${c.rhodecode_db_repo.description}
71 </div>
69 </div>
72 <div class="content">
70 <div class="content">
73 ${h.hidden('source_repo')}
71 ${h.hidden('source_repo')}
74 ${h.hidden('source_ref')}
72 ${h.hidden('source_ref')}
75 </div>
73 </div>
76
74
77 ##OTHER, most Probably the PARENT OF THIS FORK
75 ##OTHER, most Probably the PARENT OF THIS FORK
78 <div class="content">
76 <div class="content">
79 ## filled with JS
77 ## filled with JS
80 <div id="target_repo_desc"></div>
78 <div id="target_repo_desc"></div>
81 </div>
79 </div>
82
80
83 <div class="content">
81 <div class="content">
84 ${h.hidden('target_repo')}
82 ${h.hidden('target_repo')}
85 ${h.hidden('target_ref')}
83 ${h.hidden('target_ref')}
86 <span id="target_ref_loading" style="display: none">
84 <span id="target_ref_loading" style="display: none">
87 ${_('Loading refs...')}
85 ${_('Loading refs...')}
88 </span>
86 </span>
89 </div>
87 </div>
90 </div>
88 </div>
91
89
92 <div class="field">
90 <div class="field">
93 <div class="label label-textarea">
91 <div class="label label-textarea">
94 <label for="pullrequest_submit"></label>
92 <label for="pullrequest_submit"></label>
95 </div>
93 </div>
96 <div class="input">
94 <div class="input">
97 <div class="pr-submit-button">
95 <div class="pr-submit-button">
98 <input id="pr_submit" class="btn" name="save" type="submit" value="${_('Submit Pull Request')}">
96 <input id="pr_submit" class="btn" name="save" type="submit" value="${_('Submit Pull Request')}">
99 </div>
97 </div>
100 <div id="pr_open_message"></div>
98 <div id="pr_open_message"></div>
101 </div>
99 </div>
102 </div>
100 </div>
103
101
104 <div class="pr-spacing-container"></div>
102 <div class="pr-spacing-container"></div>
105 </div>
103 </div>
106 </div>
104 </div>
107 </div>
105 </div>
108 <div>
106 <div>
109 ## AUTHOR
107 ## AUTHOR
110 <div class="reviewers-title block-right">
108 <div class="reviewers-title block-right">
111 <div class="pr-details-title">
109 <div class="pr-details-title">
112 ${_('Author of this pull request')}
110 ${_('Author of this pull request')}
113 </div>
111 </div>
114 </div>
112 </div>
115 <div class="block-right pr-details-content reviewers">
113 <div class="block-right pr-details-content reviewers">
116 <ul class="group_members">
114 <ul class="group_members">
117 <li>
115 <li>
118 ${self.gravatar_with_user(c.rhodecode_user.email, 16)}
116 ${self.gravatar_with_user(c.rhodecode_user.email, 16)}
119 </li>
117 </li>
120 </ul>
118 </ul>
121 </div>
119 </div>
122
120
123 ## REVIEW RULES
121 ## REVIEW RULES
124 <div id="review_rules" style="display: none" class="reviewers-title block-right">
122 <div id="review_rules" style="display: none" class="reviewers-title block-right">
125 <div class="pr-details-title">
123 <div class="pr-details-title">
126 ${_('Reviewer rules')}
124 ${_('Reviewer rules')}
127 </div>
125 </div>
128 <div class="pr-reviewer-rules">
126 <div class="pr-reviewer-rules">
129 ## review rules will be appended here, by default reviewers logic
127 ## review rules will be appended here, by default reviewers logic
130 </div>
128 </div>
131 </div>
129 </div>
132
130
133 ## REVIEWERS
131 ## REVIEWERS
134 <div class="reviewers-title block-right">
132 <div class="reviewers-title block-right">
135 <div class="pr-details-title">
133 <div class="pr-details-title">
136 ${_('Pull request reviewers')}
134 ${_('Pull request reviewers')}
137 <span class="calculate-reviewers"> - ${_('loading...')}</span>
135 <span class="calculate-reviewers"> - ${_('loading...')}</span>
138 </div>
136 </div>
139 </div>
137 </div>
140 <div id="reviewers" class="block-right pr-details-content reviewers">
138 <div id="reviewers" class="block-right pr-details-content reviewers">
141 ## members goes here, filled via JS based on initial selection !
139 ## members goes here, filled via JS based on initial selection !
142 <input type="hidden" name="__start__" value="review_members:sequence">
140 <input type="hidden" name="__start__" value="review_members:sequence">
143 <ul id="review_members" class="group_members"></ul>
141 <ul id="review_members" class="group_members"></ul>
144 <input type="hidden" name="__end__" value="review_members:sequence">
142 <input type="hidden" name="__end__" value="review_members:sequence">
145 <div id="add_reviewer_input" class='ac'>
143 <div id="add_reviewer_input" class='ac'>
146 <div class="reviewer_ac">
144 <div class="reviewer_ac">
147 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
145 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
148 <div id="reviewers_container"></div>
146 <div id="reviewers_container"></div>
149 </div>
147 </div>
150 </div>
148 </div>
151 </div>
149 </div>
152 </div>
150 </div>
153 </div>
151 </div>
154 <div class="box">
152 <div class="box">
155 <div>
153 <div>
156 ## overview pulled by ajax
154 ## overview pulled by ajax
157 <div id="pull_request_overview"></div>
155 <div id="pull_request_overview"></div>
158 </div>
156 </div>
159 </div>
157 </div>
160 ${h.end_form()}
158 ${h.end_form()}
161 </div>
159 </div>
162
160
163 <script type="text/javascript">
161 <script type="text/javascript">
164 $(function(){
162 $(function(){
165 var defaultSourceRepo = '${c.default_repo_data['source_repo_name']}';
163 var defaultSourceRepo = '${c.default_repo_data['source_repo_name']}';
166 var defaultSourceRepoData = ${c.default_repo_data['source_refs_json']|n};
164 var defaultSourceRepoData = ${c.default_repo_data['source_refs_json']|n};
167 var defaultTargetRepo = '${c.default_repo_data['target_repo_name']}';
165 var defaultTargetRepo = '${c.default_repo_data['target_repo_name']}';
168 var defaultTargetRepoData = ${c.default_repo_data['target_refs_json']|n};
166 var defaultTargetRepoData = ${c.default_repo_data['target_refs_json']|n};
169
167
170 var $pullRequestForm = $('#pull_request_form');
168 var $pullRequestForm = $('#pull_request_form');
171 var $pullRequestSubmit = $('#pr_submit', $pullRequestForm);
169 var $pullRequestSubmit = $('#pr_submit', $pullRequestForm);
172 var $sourceRepo = $('#source_repo', $pullRequestForm);
170 var $sourceRepo = $('#source_repo', $pullRequestForm);
173 var $targetRepo = $('#target_repo', $pullRequestForm);
171 var $targetRepo = $('#target_repo', $pullRequestForm);
174 var $sourceRef = $('#source_ref', $pullRequestForm);
172 var $sourceRef = $('#source_ref', $pullRequestForm);
175 var $targetRef = $('#target_ref', $pullRequestForm);
173 var $targetRef = $('#target_ref', $pullRequestForm);
176
174
177 var sourceRepo = function() { return $sourceRepo.eq(0).val() };
175 var sourceRepo = function() { return $sourceRepo.eq(0).val() };
178 var sourceRef = function() { return $sourceRef.eq(0).val().split(':') };
176 var sourceRef = function() { return $sourceRef.eq(0).val().split(':') };
179
177
180 var targetRepo = function() { return $targetRepo.eq(0).val() };
178 var targetRepo = function() { return $targetRepo.eq(0).val() };
181 var targetRef = function() { return $targetRef.eq(0).val().split(':') };
179 var targetRef = function() { return $targetRef.eq(0).val().split(':') };
182
180
183 var calculateContainerWidth = function() {
181 var calculateContainerWidth = function() {
184 var maxWidth = 0;
182 var maxWidth = 0;
185 var repoSelect2Containers = ['#source_repo', '#target_repo'];
183 var repoSelect2Containers = ['#source_repo', '#target_repo'];
186 $.each(repoSelect2Containers, function(idx, value) {
184 $.each(repoSelect2Containers, function(idx, value) {
187 $(value).select2('container').width('auto');
185 $(value).select2('container').width('auto');
188 var curWidth = $(value).select2('container').width();
186 var curWidth = $(value).select2('container').width();
189 if (maxWidth <= curWidth) {
187 if (maxWidth <= curWidth) {
190 maxWidth = curWidth;
188 maxWidth = curWidth;
191 }
189 }
192 $.each(repoSelect2Containers, function(idx, value) {
190 $.each(repoSelect2Containers, function(idx, value) {
193 $(value).select2('container').width(maxWidth + 10);
191 $(value).select2('container').width(maxWidth + 10);
194 });
192 });
195 });
193 });
196 };
194 };
197
195
198 var initRefSelection = function(selectedRef) {
196 var initRefSelection = function(selectedRef) {
199 return function(element, callback) {
197 return function(element, callback) {
200 // translate our select2 id into a text, it's a mapping to show
198 // translate our select2 id into a text, it's a mapping to show
201 // simple label when selecting by internal ID.
199 // simple label when selecting by internal ID.
202 var id, refData;
200 var id, refData;
203 if (selectedRef === undefined || selectedRef === null) {
201 if (selectedRef === undefined || selectedRef === null) {
204 id = element.val();
202 id = element.val();
205 refData = element.val().split(':');
203 refData = element.val().split(':');
206
204
207 if (refData.length !== 3){
205 if (refData.length !== 3){
208 refData = ["", "", ""]
206 refData = ["", "", ""]
209 }
207 }
210 } else {
208 } else {
211 id = selectedRef;
209 id = selectedRef;
212 refData = selectedRef.split(':');
210 refData = selectedRef.split(':');
213 }
211 }
214
212
215 var text = refData[1];
213 var text = refData[1];
216 if (refData[0] === 'rev') {
214 if (refData[0] === 'rev') {
217 text = text.substring(0, 12);
215 text = text.substring(0, 12);
218 }
216 }
219
217
220 var data = {id: id, text: text};
218 var data = {id: id, text: text};
221 callback(data);
219 callback(data);
222 };
220 };
223 };
221 };
224
222
225 var formatRefSelection = function(data, container, escapeMarkup) {
223 var formatRefSelection = function(data, container, escapeMarkup) {
226 var prefix = '';
224 var prefix = '';
227 var refData = data.id.split(':');
225 var refData = data.id.split(':');
228 if (refData[0] === 'branch') {
226 if (refData[0] === 'branch') {
229 prefix = '<i class="icon-branch"></i>';
227 prefix = '<i class="icon-branch"></i>';
230 }
228 }
231 else if (refData[0] === 'book') {
229 else if (refData[0] === 'book') {
232 prefix = '<i class="icon-bookmark"></i>';
230 prefix = '<i class="icon-bookmark"></i>';
233 }
231 }
234 else if (refData[0] === 'tag') {
232 else if (refData[0] === 'tag') {
235 prefix = '<i class="icon-tag"></i>';
233 prefix = '<i class="icon-tag"></i>';
236 }
234 }
237
235
238 var originalOption = data.element;
236 var originalOption = data.element;
239 return prefix + escapeMarkup(data.text);
237 return prefix + escapeMarkup(data.text);
240 };formatSelection:
238 };formatSelection:
241
239
242 // custom code mirror
240 // custom code mirror
243 var codeMirrorInstance = $('#pullrequest_desc').get(0).MarkupForm.cm;
241 var codeMirrorInstance = $('#pullrequest_desc').get(0).MarkupForm.cm;
244
242
245 reviewersController = new ReviewersController();
243 reviewersController = new ReviewersController();
246
244
247 var queryTargetRepo = function(self, query) {
245 var queryTargetRepo = function(self, query) {
248 // cache ALL results if query is empty
246 // cache ALL results if query is empty
249 var cacheKey = query.term || '__';
247 var cacheKey = query.term || '__';
250 var cachedData = self.cachedDataSource[cacheKey];
248 var cachedData = self.cachedDataSource[cacheKey];
251
249
252 if (cachedData) {
250 if (cachedData) {
253 query.callback({results: cachedData.results});
251 query.callback({results: cachedData.results});
254 } else {
252 } else {
255 $.ajax({
253 $.ajax({
256 url: pyroutes.url('pullrequest_repo_targets', {'repo_name': templateContext.repo_name}),
254 url: pyroutes.url('pullrequest_repo_targets', {'repo_name': templateContext.repo_name}),
257 data: {query: query.term},
255 data: {query: query.term},
258 dataType: 'json',
256 dataType: 'json',
259 type: 'GET',
257 type: 'GET',
260 success: function(data) {
258 success: function(data) {
261 self.cachedDataSource[cacheKey] = data;
259 self.cachedDataSource[cacheKey] = data;
262 query.callback({results: data.results});
260 query.callback({results: data.results});
263 },
261 },
264 error: function(data, textStatus, errorThrown) {
262 error: function(data, textStatus, errorThrown) {
265 alert(
263 alert(
266 "Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
264 "Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
267 }
265 }
268 });
266 });
269 }
267 }
270 };
268 };
271
269
272 var queryTargetRefs = function(initialData, query) {
270 var queryTargetRefs = function(initialData, query) {
273 var data = {results: []};
271 var data = {results: []};
274 // filter initialData
272 // filter initialData
275 $.each(initialData, function() {
273 $.each(initialData, function() {
276 var section = this.text;
274 var section = this.text;
277 var children = [];
275 var children = [];
278 $.each(this.children, function() {
276 $.each(this.children, function() {
279 if (query.term.length === 0 ||
277 if (query.term.length === 0 ||
280 this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ) {
278 this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ) {
281 children.push({'id': this.id, 'text': this.text})
279 children.push({'id': this.id, 'text': this.text})
282 }
280 }
283 });
281 });
284 data.results.push({'text': section, 'children': children})
282 data.results.push({'text': section, 'children': children})
285 });
283 });
286 query.callback({results: data.results});
284 query.callback({results: data.results});
287 };
285 };
288
286
289 var loadRepoRefDiffPreview = function() {
287 var loadRepoRefDiffPreview = function() {
290
288
291 var url_data = {
289 var url_data = {
292 'repo_name': targetRepo(),
290 'repo_name': targetRepo(),
293 'target_repo': sourceRepo(),
291 'target_repo': sourceRepo(),
294 'source_ref': targetRef()[2],
292 'source_ref': targetRef()[2],
295 'source_ref_type': 'rev',
293 'source_ref_type': 'rev',
296 'target_ref': sourceRef()[2],
294 'target_ref': sourceRef()[2],
297 'target_ref_type': 'rev',
295 'target_ref_type': 'rev',
298 'merge': true,
296 'merge': true,
299 '_': Date.now() // bypass browser caching
297 '_': Date.now() // bypass browser caching
300 }; // gather the source/target ref and repo here
298 }; // gather the source/target ref and repo here
301
299
302 if (sourceRef().length !== 3 || targetRef().length !== 3) {
300 if (sourceRef().length !== 3 || targetRef().length !== 3) {
303 prButtonLock(true, "${_('Please select source and target')}");
301 prButtonLock(true, "${_('Please select source and target')}");
304 return;
302 return;
305 }
303 }
306 var url = pyroutes.url('repo_compare', url_data);
304 var url = pyroutes.url('repo_compare', url_data);
307
305
308 // lock PR button, so we cannot send PR before it's calculated
306 // lock PR button, so we cannot send PR before it's calculated
309 prButtonLock(true, "${_('Loading compare ...')}", 'compare');
307 prButtonLock(true, "${_('Loading compare ...')}", 'compare');
310
308
311 if (loadRepoRefDiffPreview._currentRequest) {
309 if (loadRepoRefDiffPreview._currentRequest) {
312 loadRepoRefDiffPreview._currentRequest.abort();
310 loadRepoRefDiffPreview._currentRequest.abort();
313 }
311 }
314
312
315 loadRepoRefDiffPreview._currentRequest = $.get(url)
313 loadRepoRefDiffPreview._currentRequest = $.get(url)
316 .error(function(data, textStatus, errorThrown) {
314 .error(function(data, textStatus, errorThrown) {
317 if (textStatus !== 'abort') {
315 if (textStatus !== 'abort') {
318 alert(
316 alert(
319 "Error while processing request.\nError code {0} ({1}).".format(
317 "Error while processing request.\nError code {0} ({1}).".format(
320 data.status, data.statusText));
318 data.status, data.statusText));
321 }
319 }
322
320
323 })
321 })
324 .done(function(data) {
322 .done(function(data) {
325 loadRepoRefDiffPreview._currentRequest = null;
323 loadRepoRefDiffPreview._currentRequest = null;
326 $('#pull_request_overview').html(data);
324 $('#pull_request_overview').html(data);
327
325
328 var commitElements = $(data).find('tr[commit_id]');
326 var commitElements = $(data).find('tr[commit_id]');
329
327
330 var prTitleAndDesc = getTitleAndDescription(
328 var prTitleAndDesc = getTitleAndDescription(
331 sourceRef()[1], commitElements, 5);
329 sourceRef()[1], commitElements, 5);
332
330
333 var title = prTitleAndDesc[0];
331 var title = prTitleAndDesc[0];
334 var proposedDescription = prTitleAndDesc[1];
332 var proposedDescription = prTitleAndDesc[1];
335
333
336 var useGeneratedTitle = (
334 var useGeneratedTitle = (
337 $('#pullrequest_title').hasClass('autogenerated-title') ||
335 $('#pullrequest_title').hasClass('autogenerated-title') ||
338 $('#pullrequest_title').val() === "");
336 $('#pullrequest_title').val() === "");
339
337
340 if (title && useGeneratedTitle) {
338 if (title && useGeneratedTitle) {
341 // use generated title if we haven't specified our own
339 // use generated title if we haven't specified our own
342 $('#pullrequest_title').val(title);
340 $('#pullrequest_title').val(title);
343 $('#pullrequest_title').addClass('autogenerated-title');
341 $('#pullrequest_title').addClass('autogenerated-title');
344
342
345 }
343 }
346
344
347 var useGeneratedDescription = (
345 var useGeneratedDescription = (
348 !codeMirrorInstance._userDefinedValue ||
346 !codeMirrorInstance._userDefinedValue ||
349 codeMirrorInstance.getValue() === "");
347 codeMirrorInstance.getValue() === "");
350
348
351 if (proposedDescription && useGeneratedDescription) {
349 if (proposedDescription && useGeneratedDescription) {
352 // set proposed content, if we haven't defined our own,
350 // set proposed content, if we haven't defined our own,
353 // or we don't have description written
351 // or we don't have description written
354 codeMirrorInstance._userDefinedValue = false; // reset state
352 codeMirrorInstance._userDefinedValue = false; // reset state
355 codeMirrorInstance.setValue(proposedDescription);
353 codeMirrorInstance.setValue(proposedDescription);
356 }
354 }
357
355
358 // refresh our codeMirror so events kicks in and it's change aware
356 // refresh our codeMirror so events kicks in and it's change aware
359 codeMirrorInstance.refresh();
357 codeMirrorInstance.refresh();
360
358
361 var msg = '';
359 var msg = '';
362 if (commitElements.length === 1) {
360 if (commitElements.length === 1) {
363 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 1)}";
361 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 1)}";
364 } else {
362 } else {
365 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 2)}";
363 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 2)}";
366 }
364 }
367
365
368 msg += ' <a id="pull_request_overview_url" href="{0}" target="_blank">${_('Show detailed compare.')}</a>'.format(url);
366 msg += ' <a id="pull_request_overview_url" href="{0}" target="_blank">${_('Show detailed compare.')}</a>'.format(url);
369
367
370 if (commitElements.length) {
368 if (commitElements.length) {
371 var commitsLink = '<a href="#pull_request_overview"><strong>{0}</strong></a>'.format(commitElements.length);
369 var commitsLink = '<a href="#pull_request_overview"><strong>{0}</strong></a>'.format(commitElements.length);
372 prButtonLock(false, msg.replace('__COMMITS__', commitsLink), 'compare');
370 prButtonLock(false, msg.replace('__COMMITS__', commitsLink), 'compare');
373 }
371 }
374 else {
372 else {
375 prButtonLock(true, "${_('There are no commits to merge.')}", 'compare');
373 prButtonLock(true, "${_('There are no commits to merge.')}", 'compare');
376 }
374 }
377
375
378
376
379 });
377 });
380 };
378 };
381
379
382 var Select2Box = function(element, overrides) {
380 var Select2Box = function(element, overrides) {
383 var globalDefaults = {
381 var globalDefaults = {
384 dropdownAutoWidth: true,
382 dropdownAutoWidth: true,
385 containerCssClass: "drop-menu",
383 containerCssClass: "drop-menu",
386 dropdownCssClass: "drop-menu-dropdown"
384 dropdownCssClass: "drop-menu-dropdown"
387 };
385 };
388
386
389 var initSelect2 = function(defaultOptions) {
387 var initSelect2 = function(defaultOptions) {
390 var options = jQuery.extend(globalDefaults, defaultOptions, overrides);
388 var options = jQuery.extend(globalDefaults, defaultOptions, overrides);
391 element.select2(options);
389 element.select2(options);
392 };
390 };
393
391
394 return {
392 return {
395 initRef: function() {
393 initRef: function() {
396 var defaultOptions = {
394 var defaultOptions = {
397 minimumResultsForSearch: 5,
395 minimumResultsForSearch: 5,
398 formatSelection: formatRefSelection
396 formatSelection: formatRefSelection
399 };
397 };
400
398
401 initSelect2(defaultOptions);
399 initSelect2(defaultOptions);
402 },
400 },
403
401
404 initRepo: function(defaultValue, readOnly) {
402 initRepo: function(defaultValue, readOnly) {
405 var defaultOptions = {
403 var defaultOptions = {
406 initSelection : function (element, callback) {
404 initSelection : function (element, callback) {
407 var data = {id: defaultValue, text: defaultValue};
405 var data = {id: defaultValue, text: defaultValue};
408 callback(data);
406 callback(data);
409 }
407 }
410 };
408 };
411
409
412 initSelect2(defaultOptions);
410 initSelect2(defaultOptions);
413
411
414 element.select2('val', defaultSourceRepo);
412 element.select2('val', defaultSourceRepo);
415 if (readOnly === true) {
413 if (readOnly === true) {
416 element.select2('readonly', true);
414 element.select2('readonly', true);
417 }
415 }
418 }
416 }
419 };
417 };
420 };
418 };
421
419
422 var initTargetRefs = function(refsData, selectedRef) {
420 var initTargetRefs = function(refsData, selectedRef) {
423
421
424 Select2Box($targetRef, {
422 Select2Box($targetRef, {
425 placeholder: "${_('Select commit reference')}",
423 placeholder: "${_('Select commit reference')}",
426 query: function(query) {
424 query: function(query) {
427 queryTargetRefs(refsData, query);
425 queryTargetRefs(refsData, query);
428 },
426 },
429 initSelection : initRefSelection(selectedRef)
427 initSelection : initRefSelection(selectedRef)
430 }).initRef();
428 }).initRef();
431
429
432 if (!(selectedRef === undefined)) {
430 if (!(selectedRef === undefined)) {
433 $targetRef.select2('val', selectedRef);
431 $targetRef.select2('val', selectedRef);
434 }
432 }
435 };
433 };
436
434
437 var targetRepoChanged = function(repoData) {
435 var targetRepoChanged = function(repoData) {
438 // generate new DESC of target repo displayed next to select
436 // generate new DESC of target repo displayed next to select
439 var prLink = pyroutes.url('pullrequest_new', {'repo_name': repoData['name']});
437 var prLink = pyroutes.url('pullrequest_new', {'repo_name': repoData['name']});
440 $('#target_repo_desc').html(
438 $('#target_repo_desc').html(
441 "<strong>${_('Target repository')}</strong>: {0}. <a href=\"{1}\">Switch base, and use as source.</a>".format(repoData['description'], prLink)
439 "<strong>${_('Target repository')}</strong>: {0}. <a href=\"{1}\">Switch base, and use as source.</a>".format(repoData['description'], prLink)
442 );
440 );
443
441
444 // generate dynamic select2 for refs.
442 // generate dynamic select2 for refs.
445 initTargetRefs(repoData['refs']['select2_refs'],
443 initTargetRefs(repoData['refs']['select2_refs'],
446 repoData['refs']['selected_ref']);
444 repoData['refs']['selected_ref']);
447
445
448 };
446 };
449
447
450 var sourceRefSelect2 = Select2Box($sourceRef, {
448 var sourceRefSelect2 = Select2Box($sourceRef, {
451 placeholder: "${_('Select commit reference')}",
449 placeholder: "${_('Select commit reference')}",
452 query: function(query) {
450 query: function(query) {
453 var initialData = defaultSourceRepoData['refs']['select2_refs'];
451 var initialData = defaultSourceRepoData['refs']['select2_refs'];
454 queryTargetRefs(initialData, query)
452 queryTargetRefs(initialData, query)
455 },
453 },
456 initSelection: initRefSelection()
454 initSelection: initRefSelection()
457 }
455 }
458 );
456 );
459
457
460 var sourceRepoSelect2 = Select2Box($sourceRepo, {
458 var sourceRepoSelect2 = Select2Box($sourceRepo, {
461 query: function(query) {}
459 query: function(query) {}
462 });
460 });
463
461
464 var targetRepoSelect2 = Select2Box($targetRepo, {
462 var targetRepoSelect2 = Select2Box($targetRepo, {
465 cachedDataSource: {},
463 cachedDataSource: {},
466 query: $.debounce(250, function(query) {
464 query: $.debounce(250, function(query) {
467 queryTargetRepo(this, query);
465 queryTargetRepo(this, query);
468 }),
466 }),
469 formatResult: formatRepoResult
467 formatResult: formatRepoResult
470 });
468 });
471
469
472 sourceRefSelect2.initRef();
470 sourceRefSelect2.initRef();
473
471
474 sourceRepoSelect2.initRepo(defaultSourceRepo, true);
472 sourceRepoSelect2.initRepo(defaultSourceRepo, true);
475
473
476 targetRepoSelect2.initRepo(defaultTargetRepo, false);
474 targetRepoSelect2.initRepo(defaultTargetRepo, false);
477
475
478 $sourceRef.on('change', function(e){
476 $sourceRef.on('change', function(e){
479 loadRepoRefDiffPreview();
477 loadRepoRefDiffPreview();
480 reviewersController.loadDefaultReviewers(
478 reviewersController.loadDefaultReviewers(
481 sourceRepo(), sourceRef(), targetRepo(), targetRef());
479 sourceRepo(), sourceRef(), targetRepo(), targetRef());
482 });
480 });
483
481
484 $targetRef.on('change', function(e){
482 $targetRef.on('change', function(e){
485 loadRepoRefDiffPreview();
483 loadRepoRefDiffPreview();
486 reviewersController.loadDefaultReviewers(
484 reviewersController.loadDefaultReviewers(
487 sourceRepo(), sourceRef(), targetRepo(), targetRef());
485 sourceRepo(), sourceRef(), targetRepo(), targetRef());
488 });
486 });
489
487
490 $targetRepo.on('change', function(e){
488 $targetRepo.on('change', function(e){
491 var repoName = $(this).val();
489 var repoName = $(this).val();
492 calculateContainerWidth();
490 calculateContainerWidth();
493 $targetRef.select2('destroy');
491 $targetRef.select2('destroy');
494 $('#target_ref_loading').show();
492 $('#target_ref_loading').show();
495
493
496 $.ajax({
494 $.ajax({
497 url: pyroutes.url('pullrequest_repo_refs',
495 url: pyroutes.url('pullrequest_repo_refs',
498 {'repo_name': templateContext.repo_name, 'target_repo_name':repoName}),
496 {'repo_name': templateContext.repo_name, 'target_repo_name':repoName}),
499 data: {},
497 data: {},
500 dataType: 'json',
498 dataType: 'json',
501 type: 'GET',
499 type: 'GET',
502 success: function(data) {
500 success: function(data) {
503 $('#target_ref_loading').hide();
501 $('#target_ref_loading').hide();
504 targetRepoChanged(data);
502 targetRepoChanged(data);
505 loadRepoRefDiffPreview();
503 loadRepoRefDiffPreview();
506 },
504 },
507 error: function(data, textStatus, errorThrown) {
505 error: function(data, textStatus, errorThrown) {
508 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
506 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
509 }
507 }
510 })
508 })
511
509
512 });
510 });
513
511
514 $pullRequestForm.on('submit', function(e){
512 $pullRequestForm.on('submit', function(e){
515 // Flush changes into textarea
513 // Flush changes into textarea
516 codeMirrorInstance.save();
514 codeMirrorInstance.save();
517 prButtonLock(true, null, 'all');
515 prButtonLock(true, null, 'all');
518 });
516 });
519
517
520 prButtonLock(true, "${_('Please select source and target')}", 'all');
518 prButtonLock(true, "${_('Please select source and target')}", 'all');
521
519
522 // auto-load on init, the target refs select2
520 // auto-load on init, the target refs select2
523 calculateContainerWidth();
521 calculateContainerWidth();
524 targetRepoChanged(defaultTargetRepoData);
522 targetRepoChanged(defaultTargetRepoData);
525
523
526 $('#pullrequest_title').on('keyup', function(e){
524 $('#pullrequest_title').on('keyup', function(e){
527 $(this).removeClass('autogenerated-title');
525 $(this).removeClass('autogenerated-title');
528 });
526 });
529
527
530 % if c.default_source_ref:
528 % if c.default_source_ref:
531 // in case we have a pre-selected value, use it now
529 // in case we have a pre-selected value, use it now
532 $sourceRef.select2('val', '${c.default_source_ref}');
530 $sourceRef.select2('val', '${c.default_source_ref}');
533 // diff preview load
531 // diff preview load
534 loadRepoRefDiffPreview();
532 loadRepoRefDiffPreview();
535 // default reviewers
533 // default reviewers
536 reviewersController.loadDefaultReviewers(
534 reviewersController.loadDefaultReviewers(
537 sourceRepo(), sourceRef(), targetRepo(), targetRef());
535 sourceRepo(), sourceRef(), targetRepo(), targetRef());
538 % endif
536 % endif
539
537
540 ReviewerAutoComplete('#user');
538 ReviewerAutoComplete('#user');
541 });
539 });
542 </script>
540 </script>
543
541
544 </%def>
542 </%def>
@@ -1,144 +1,142 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Pull Requests') % c.repo_name}
4 ${_('%s Pull Requests') % c.repo_name}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="breadcrumbs_links()">
10 <%def name="breadcrumbs_links()"></%def>
11
12 </%def>
13
11
14 <%def name="menu_bar_nav()">
12 <%def name="menu_bar_nav()">
15 ${self.menu_items(active='repositories')}
13 ${self.menu_items(active='repositories')}
16 </%def>
14 </%def>
17
15
18
16
19 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
20 ${self.repo_menu(active='showpullrequest')}
18 ${self.repo_menu(active='showpullrequest')}
21 </%def>
19 </%def>
22
20
23
21
24 <%def name="main()">
22 <%def name="main()">
25 <div class="box">
23 <div class="box">
26 <div class="title">
24 <div class="title">
27 <ul class="links">
25 <ul class="links">
28 <li>
26 <li>
29 %if c.rhodecode_user.username != h.DEFAULT_USER:
27 %if c.rhodecode_user.username != h.DEFAULT_USER:
30 <span>
28 <span>
31 <a id="open_new_pull_request" class="btn btn-small btn-success" href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">
29 <a id="open_new_pull_request" class="btn btn-small btn-success" href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">
32 ${_('Open new Pull Request')}
30 ${_('Open new Pull Request')}
33 </a>
31 </a>
34 </span>
32 </span>
35 %endif
33 %endif
36 </li>
34 </li>
37 </ul>
35 </ul>
38
36
39 ${self.breadcrumbs()}
37 ${self.breadcrumbs()}
40 </div>
38 </div>
41
39
42 <div class="sidebar-col-wrapper">
40 <div class="sidebar-col-wrapper">
43 ##main
41 ##main
44 <div class="sidebar">
42 <div class="sidebar">
45 <ul class="nav nav-pills nav-stacked">
43 <ul class="nav nav-pills nav-stacked">
46 <li class="${'active' if c.active=='open' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0})}">${_('Opened')}</a></li>
44 <li class="${'active' if c.active=='open' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0})}">${_('Opened')}</a></li>
47 <li class="${'active' if c.active=='my' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'my':1})}">${_('Opened by me')}</a></li>
45 <li class="${'active' if c.active=='my' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'my':1})}">${_('Opened by me')}</a></li>
48 <li class="${'active' if c.active=='awaiting' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'awaiting_review':1})}">${_('Awaiting review')}</a></li>
46 <li class="${'active' if c.active=='awaiting' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'awaiting_review':1})}">${_('Awaiting review')}</a></li>
49 <li class="${'active' if c.active=='awaiting_my' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'awaiting_my_review':1})}">${_('Awaiting my review')}</a></li>
47 <li class="${'active' if c.active=='awaiting_my' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'awaiting_my_review':1})}">${_('Awaiting my review')}</a></li>
50 <li class="${'active' if c.active=='closed' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'closed':1})}">${_('Closed')}</a></li>
48 <li class="${'active' if c.active=='closed' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':0,'closed':1})}">${_('Closed')}</a></li>
51 <li class="${'active' if c.active=='source' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':1})}">${_('From this repo')}</a></li>
49 <li class="${'active' if c.active=='source' else ''}"><a href="${h.route_path('pullrequest_show_all',repo_name=c.repo_name, _query={'source':1})}">${_('From this repo')}</a></li>
52 </ul>
50 </ul>
53 </div>
51 </div>
54
52
55 <div class="main-content-full-width">
53 <div class="main-content-full-width">
56 <div class="panel panel-default">
54 <div class="panel panel-default">
57 <div class="panel-heading">
55 <div class="panel-heading">
58 <h3 class="panel-title">
56 <h3 class="panel-title">
59 %if c.source:
57 %if c.source:
60 ${_('Pull Requests from %(repo_name)s repository') % {'repo_name': c.repo_name}}
58 ${_('Pull Requests from %(repo_name)s repository') % {'repo_name': c.repo_name}}
61 %elif c.closed:
59 %elif c.closed:
62 ${_('Closed Pull Requests to repository %(repo_name)s') % {'repo_name': c.repo_name}}
60 ${_('Closed Pull Requests to repository %(repo_name)s') % {'repo_name': c.repo_name}}
63 %elif c.my:
61 %elif c.my:
64 ${_('Pull Requests to %(repo_name)s repository opened by me') % {'repo_name': c.repo_name}}
62 ${_('Pull Requests to %(repo_name)s repository opened by me') % {'repo_name': c.repo_name}}
65 %elif c.awaiting_review:
63 %elif c.awaiting_review:
66 ${_('Pull Requests to %(repo_name)s repository awaiting review') % {'repo_name': c.repo_name}}
64 ${_('Pull Requests to %(repo_name)s repository awaiting review') % {'repo_name': c.repo_name}}
67 %elif c.awaiting_my_review:
65 %elif c.awaiting_my_review:
68 ${_('Pull Requests to %(repo_name)s repository awaiting my review') % {'repo_name': c.repo_name}}
66 ${_('Pull Requests to %(repo_name)s repository awaiting my review') % {'repo_name': c.repo_name}}
69 %else:
67 %else:
70 ${_('Pull Requests to %(repo_name)s repository') % {'repo_name': c.repo_name}}
68 ${_('Pull Requests to %(repo_name)s repository') % {'repo_name': c.repo_name}}
71 %endif
69 %endif
72 </h3>
70 </h3>
73 </div>
71 </div>
74 <div class="panel-body panel-body-min-height">
72 <div class="panel-body panel-body-min-height">
75 <table id="pull_request_list_table" class="display"></table>
73 <table id="pull_request_list_table" class="display"></table>
76 </div>
74 </div>
77 </div>
75 </div>
78 </div>
76 </div>
79 </div>
77 </div>
80 </div>
78 </div>
81
79
82 <script type="text/javascript">
80 <script type="text/javascript">
83 $(document).ready(function() {
81 $(document).ready(function() {
84
82
85 var $pullRequestListTable = $('#pull_request_list_table');
83 var $pullRequestListTable = $('#pull_request_list_table');
86
84
87 // object list
85 // object list
88 $pullRequestListTable.DataTable({
86 $pullRequestListTable.DataTable({
89 processing: true,
87 processing: true,
90 serverSide: true,
88 serverSide: true,
91 ajax: {
89 ajax: {
92 "url": "${h.route_path('pullrequest_show_all_data', repo_name=c.repo_name)}",
90 "url": "${h.route_path('pullrequest_show_all_data', repo_name=c.repo_name)}",
93 "data": function (d) {
91 "data": function (d) {
94 d.source = "${c.source}";
92 d.source = "${c.source}";
95 d.closed = "${c.closed}";
93 d.closed = "${c.closed}";
96 d.my = "${c.my}";
94 d.my = "${c.my}";
97 d.awaiting_review = "${c.awaiting_review}";
95 d.awaiting_review = "${c.awaiting_review}";
98 d.awaiting_my_review = "${c.awaiting_my_review}";
96 d.awaiting_my_review = "${c.awaiting_my_review}";
99 }
97 }
100 },
98 },
101 dom: 'rtp',
99 dom: 'rtp',
102 pageLength: ${c.visual.dashboard_items},
100 pageLength: ${c.visual.dashboard_items},
103 order: [[ 1, "desc" ]],
101 order: [[ 1, "desc" ]],
104 columns: [
102 columns: [
105 { data: {"_": "status",
103 { data: {"_": "status",
106 "sort": "status"}, title: "", className: "td-status", orderable: false},
104 "sort": "status"}, title: "", className: "td-status", orderable: false},
107 { data: {"_": "name",
105 { data: {"_": "name",
108 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname", "type": "num" },
106 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname", "type": "num" },
109 { data: {"_": "author",
107 { data: {"_": "author",
110 "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false },
108 "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false },
111 { data: {"_": "title",
109 { data: {"_": "title",
112 "sort": "title"}, title: "${_('Title')}", className: "td-description" },
110 "sort": "title"}, title: "${_('Title')}", className: "td-description" },
113 { data: {"_": "comments",
111 { data: {"_": "comments",
114 "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false},
112 "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false},
115 { data: {"_": "updated_on",
113 { data: {"_": "updated_on",
116 "sort": "updated_on_raw"}, title: "${_('Last Update')}", className: "td-time" }
114 "sort": "updated_on_raw"}, title: "${_('Last Update')}", className: "td-time" }
117 ],
115 ],
118 language: {
116 language: {
119 paginate: DEFAULT_GRID_PAGINATION,
117 paginate: DEFAULT_GRID_PAGINATION,
120 sProcessing: _gettext('loading...'),
118 sProcessing: _gettext('loading...'),
121 emptyTable: _gettext("No pull requests available yet.")
119 emptyTable: _gettext("No pull requests available yet.")
122 },
120 },
123 "drawCallback": function( settings, json ) {
121 "drawCallback": function( settings, json ) {
124 timeagoActivate();
122 timeagoActivate();
125 },
123 },
126 "createdRow": function ( row, data, index ) {
124 "createdRow": function ( row, data, index ) {
127 if (data['closed']) {
125 if (data['closed']) {
128 $(row).addClass('closed');
126 $(row).addClass('closed');
129 }
127 }
130 }
128 }
131 });
129 });
132
130
133 $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){
131 $pullRequestListTable.on('xhr.dt', function(e, settings, json, xhr){
134 $pullRequestListTable.css('opacity', 1);
132 $pullRequestListTable.css('opacity', 1);
135 });
133 });
136
134
137 $pullRequestListTable.on('preXhr.dt', function(e, settings, data){
135 $pullRequestListTable.on('preXhr.dt', function(e, settings, data){
138 $pullRequestListTable.css('opacity', 0.3);
136 $pullRequestListTable.css('opacity', 0.3);
139 });
137 });
140
138
141 });
139 });
142
140
143 </script>
141 </script>
144 </%def>
142 </%def>
@@ -1,29 +1,28 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ## represents page title
4 ## represents page title
5 ${_('%s Summary') % c.repo_name}
5 ${_('%s Summary') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11
11
12 <%def name="head_extra()">
12 <%def name="head_extra()">
13 <link href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${h.tooltip(_('%s ATOM feed') % c.repo_name)}" type="application/atom+xml" />
13 <link href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${h.tooltip(_('%s ATOM feed') % c.repo_name)}" type="application/atom+xml" />
14 <link href="${h.route_path('rss_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${h.tooltip(_('%s RSS feed') % c.repo_name)}" type="application/rss+xml" />
14 <link href="${h.route_path('rss_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" rel="alternate" title="${h.tooltip(_('%s RSS feed') % c.repo_name)}" type="application/rss+xml" />
15 </%def>
15 </%def>
16
16
17
17
18 <%def name="menu_bar_nav()">
18 <%def name="menu_bar_nav()">
19 ${self.menu_items(active='repositories')}
19 ${self.menu_items(active='repositories')}
20 </%def>
20 </%def>
21
21
22
22
23 <%def name="breadcrumbs_links()">
23 <%def name="breadcrumbs_links()"></%def>
24 </%def>
25
24
26
25
27 <%def name="main()">
26 <%def name="main()">
28 ${next.main()}
27 ${next.main()}
29 </%def>
28 </%def>
@@ -1,101 +1,99 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 ${_('%s Tags') % c.repo_name}
5 ${_('%s Tags') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()"></%def>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 <span id="obj_count">0</span> ${_('tags')}
14 </%def>
15
12
16 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
14 ${self.menu_items(active='repositories')}
18 </%def>
15 </%def>
19
16
20 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='summary')}
18 ${self.repo_menu(active='summary')}
22 </%def>
19 </%def>
23
20
24 <%def name="main()">
21 <%def name="main()">
25 <div class="box">
22 <div class="box">
26 <div class="title">
23 <div class="title">
27
24
28 %if c.has_references:
25 %if c.has_references:
29 <ul class="links">
26 <ul class="links">
30 <li>
27 <li>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Tags')}">
28 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Tags')}">
32 </li>
29 </li>
33 </ul>
30 </ul>
34 %endif
31 %endif
35 %if c.has_references:
32 %if c.has_references:
36 ${self.breadcrumbs()}
33 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
34 <span id="obj_count">0</span> ${_('tags')}
37 %endif
35 %endif
38 </div>
36 </div>
39 <table id="obj_list_table" class="display"></table>
37 <table id="obj_list_table" class="display"></table>
40 </div>
38 </div>
41
39
42
40
43 <script type="text/javascript">
41 <script type="text/javascript">
44 $(document).ready(function() {
42 $(document).ready(function() {
45
43
46 var get_datatable_count = function(){
44 var get_datatable_count = function(){
47 var api = $('#obj_list_table').dataTable().api();
45 var api = $('#obj_list_table').dataTable().api();
48 $('#obj_count').text(api.page.info().recordsDisplay);
46 $('#obj_count').text(api.page.info().recordsDisplay);
49 };
47 };
50
48
51 // object list
49 // object list
52 $('#obj_list_table').DataTable({
50 $('#obj_list_table').DataTable({
53 data: ${c.data|n},
51 data: ${c.data|n},
54 dom: 'rtp',
52 dom: 'rtp',
55 pageLength: ${c.visual.dashboard_items},
53 pageLength: ${c.visual.dashboard_items},
56 order: [[ 0, "asc" ]],
54 order: [[ 0, "asc" ]],
57 columns: [
55 columns: [
58 { data: {"_": "name",
56 { data: {"_": "name",
59 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
57 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
60 { data: {"_": "date",
58 { data: {"_": "date",
61 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
59 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
62 { data: {"_": "author",
60 { data: {"_": "author",
63 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
61 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
64 { data: {"_": "commit",
62 { data: {"_": "commit",
65 "sort": "commit_raw",
63 "sort": "commit_raw",
66 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
64 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
67 { data: {"_": "compare",
65 { data: {"_": "compare",
68 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
66 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
69 ],
67 ],
70 language: {
68 language: {
71 paginate: DEFAULT_GRID_PAGINATION,
69 paginate: DEFAULT_GRID_PAGINATION,
72 emptyTable: _gettext("No tags available yet.")
70 emptyTable: _gettext("No tags available yet.")
73 },
71 },
74 "initComplete": function(settings, json) {
72 "initComplete": function(settings, json) {
75 get_datatable_count();
73 get_datatable_count();
76 timeagoActivate();
74 timeagoActivate();
77 compare_radio_buttons("${c.repo_name}", 'tag');
75 compare_radio_buttons("${c.repo_name}", 'tag');
78 }
76 }
79 });
77 });
80
78
81 // update when things change
79 // update when things change
82 $('#obj_list_table').on('draw.dt', function() {
80 $('#obj_list_table').on('draw.dt', function() {
83 get_datatable_count();
81 get_datatable_count();
84 timeagoActivate();
82 timeagoActivate();
85 });
83 });
86
84
87 // filter, filter both grids
85 // filter, filter both grids
88 $('#q_filter').on('keyup', function() {
86 $('#q_filter').on('keyup', function() {
89 var obj_api = $('#obj_list_table').dataTable().api();
87 var obj_api = $('#obj_list_table').dataTable().api();
90 obj_api
88 obj_api
91 .columns(0)
89 .columns(0)
92 .search(this.value)
90 .search(this.value)
93 .draw();
91 .draw();
94 });
92 });
95
93
96 // refilter table if page load via back button
94 // refilter table if page load via back button
97 $("#q_filter").trigger('keyup');
95 $("#q_filter").trigger('keyup');
98 });
96 });
99
97
100 </script>
98 </script>
101 </%def>
99 </%def>
General Comments 0
You need to be logged in to leave comments. Login now