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