Merge lp:~openerp-dev/openerp-web/trunk-improve-shortcutkeys-hotkeys-bth into lp:openerp-web

Proposed by Harry (OpenERP)
Status: Work in progress
Proposed branch: lp:~openerp-dev/openerp-web/trunk-improve-shortcutkeys-hotkeys-bth
Merge into: lp:openerp-web
Diff against target: 240 lines (+129/-9)
6 files modified
addons/web/static/src/css/base.css (+7/-2)
addons/web/static/src/css/base.sass (+3/-0)
addons/web/static/src/js/chrome.js (+87/-0)
addons/web/static/src/js/view_form.js (+25/-0)
addons/web/static/src/xml/base.xml (+6/-6)
addons/web_kanban/static/src/xml/web_kanban.xml (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-improve-shortcutkeys-hotkeys-bth
Reviewer Review Type Date Requested Status
OpenERP R&D Web Team Pending
Review via email: mp+196239@code.launchpad.net
To post a comment you must log in.
3875. By Bhumi Thakkar (Open ERP)

[MERGE]With Trunk.

3876. By Dharmraj Zala(OpenERP)

[MERGE] with trunk

3877. By Dharmraj Zala(OpenERP)

[MERGE] with trunk

Unmerged revisions

3877. By Dharmraj Zala(OpenERP)

[MERGE] with trunk

3876. By Dharmraj Zala(OpenERP)

[MERGE] with trunk

3875. By Bhumi Thakkar (Open ERP)

[MERGE]With Trunk.

3874. By Bhumi Thakkar (Open ERP)

[MERGE]Merge trunk.

3873. By Bhumi Thakkar (Open ERP)

[IMP]Removed code shortcuts for switch view and links. added for pager on left & right arrows.

3872. By Bhumi Thakkar (Open ERP)

[MERGE]Merge trunk.

3871. By Bhumi Thakkar (Open ERP)

[MERGE]Merge trunk.

3870. By Bhumi Thakkar (Open ERP)

[IMP]IMproved code for accesskeys.Accesskeys in lowercase.

3869. By Bhumi Thakkar (Open ERP)

[MERGE]Merge trunk.

3868. By Bhumi Thakkar (Open ERP)

[IMP]Using hotkeys events called.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/css/base.css'
2--- addons/web/static/src/css/base.css 2014-01-31 00:52:02 +0000
3+++ addons/web/static/src/css/base.css 2014-02-03 06:03:15 +0000
4@@ -1,4 +1,4 @@
5-@charset "UTF-8";
6+@charset "utf-8";
7 @font-face {
8 font-family: "mnmliconsRegular";
9 src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot");
10@@ -893,7 +893,7 @@
11 background-image: -moz-linear-gradient(top, #fc8787, maroon);
12 background-image: -ms-linear-gradient(top, #fc8787, maroon);
13 background-image: -o-linear-gradient(top, #fc8787, maroon);
14- background-image: linear-gradient(to bottom, #fc8787, #800000);
15+ background-image: linear-gradient(to bottom, #fc8787, maroon);
16 }
17 .openerp .navbar .oe_topbar_anonymous_login a {
18 display: block;
19@@ -3153,6 +3153,10 @@
20 margin: 3px 3px 0 !important;
21 }
22
23+.accesshighlight:first-letter, .highlight {
24+ text-decoration: underline;
25+}
26+
27 @-moz-document url-prefix() {
28 .openerp .oe_searchview .oe_searchview_search {
29 top: -1px;
30@@ -3434,6 +3438,7 @@
31 overflow: hidden !important;
32 }
33 }
34+
35 .ui-icon {
36 width: 18px;
37 height: 18px;
38
39=== modified file 'addons/web/static/src/css/base.sass'
40--- addons/web/static/src/css/base.sass 2014-01-31 00:52:02 +0000
41+++ addons/web/static/src/css/base.sass 2014-02-03 06:03:15 +0000
42@@ -2531,6 +2531,9 @@
43 .oe_msg_subtype_check
44 margin: 3px 3px 0 !important
45 // }}}
46+
47+.accesshighlight:first-letter, .highlight
48+ text-decoration: underline
49
50 @-moz-document url-prefix()
51 .openerp
52
53=== modified file 'addons/web/static/src/js/chrome.js'
54--- addons/web/static/src/js/chrome.js 2014-01-16 18:15:19 +0000
55+++ addons/web/static/src/js/chrome.js 2014-02-03 06:03:15 +0000
56@@ -9,6 +9,93 @@
57 var QWeb = instance.web.qweb,
58 _t = instance.web._t;
59
60+/* using jquery.hotkeys */
61+$(document).bind('keydown', 'alt', function(e) {
62+ highlightAccessKeys();
63+}).bind('keydown', 'shift', function(e) {
64+ highlightAccessKeys();
65+}).keyup(function() {
66+ unhighlightAccessKeys();
67+});
68+
69+/* replace character with span tag into exist element */
70+function replaceHtml(key, el) {
71+ $(el).html($(el).text().replace(key, '<span class ="highlight">' + key + '</span>'))
72+}
73+/*
74+ * find accesskey is assigned to anyother element. if assigned then find nextone character else assign.
75+ * */
76+function addkey(key, el, index, flag) {
77+ if ($.inArray(key,this.keys) == -1) {
78+ $(el).attr('accesskey', key.toLowerCase());
79+ if (index == 0) {
80+ replaceHtml($(el).attr('accesskey').toUpperCase(), el);
81+ } else {
82+ if (flag) keyval = key;
83+ else keyval = key.toLowerCase();
84+ replaceHtml(keyval, el);
85+ }
86+ this.keys.push(key);
87+ } else {
88+ index++;
89+ val = $(el).text().replace(/\s/g, '').charAt(index);
90+ conval = $(el).text().replace(/\s/g, '').charAt(index).toUpperCase();
91+ key = $(el).text().replace(/\s/g, '').charAt(index).toUpperCase();
92+ if(index < ($.trim($(el).text()).length + 1)){
93+ addkey(key, el, index, val == conval);
94+ }
95+ }
96+}
97+/*
98+ * highlightAccesskeys() - find element which has accesskey attribute and also element which has to assign accesskey attribute
99+ * */
100+function highlightAccessKeys() {
101+ var keys = [];
102+
103+ // accesskey for header
104+ $hedaer = $('.oe_view_manager_current > table');
105+
106+ _.each($($hedaer).find('.oe_view_manager_buttons > div'), function(el) {
107+ if ($(el).css('display') == 'block') {
108+ _.each($(el).find('button[accesskey]'), function (btn) {
109+ replaceHtml($(btn).attr('accesskey').toUpperCase(), btn);
110+ keys.push($(btn).attr('accesskey').toUpperCase())
111+ });
112+ _.each($(el).find('a[accesskey]:visible'), function ($a) {
113+ $($a).attr('accesskey').toLowerCase()
114+ replaceHtml($($a).attr('accesskey').toUpperCase(), $a);
115+ keys.push($($a).attr('accesskey').toUpperCase())
116+ });
117+ }
118+ });
119+
120+ // sidebar menu
121+ _.each($hedaer.find('.oe_view_manager_sidebar').find('button[accesskey]'), function (el) {
122+ $(el).attr('accesskey', $(el).attr('accesskey').toLowerCase());
123+ replaceHtml($(el).attr('accesskey').toUpperCase(), el);
124+ keys.push($(el).attr('accesskey').toUpperCase());
125+ });
126+
127+ this.keys = keys;
128+
129+ // accesskey for body
130+ _.each ($('.oe_view_manager_body > div:not(.oe_view_manager_view_kanban)'), function(el) {
131+ if ($(el).css('display') == 'block') {
132+ _.each($(el).find('button:not(.oe_form_invisible):visible'), function (el) {
133+ var index = 0;
134+ if (!$(el).hasClass('oe_follower') && !$(el).hasClass('oe_link') && !$(el).hasClass('oe_i')) {
135+ key = $(el).text().replace(/\s/g, '').charAt(0).toUpperCase();
136+ if (key)
137+ addkey(key, el, index);
138+ }
139+ });
140+ }
141+ });
142+}
143+function unhighlightAccessKeys() {
144+ $('span.highlight').removeClass('highlight');
145+ $('li.highlight').removeClass('highlight');
146+}
147 instance.web.Notification = instance.web.Widget.extend({
148 template: 'Notification',
149 init: function() {
150
151=== modified file 'addons/web/static/src/js/view_form.js'
152--- addons/web/static/src/js/view_form.js 2014-01-31 00:52:02 +0000
153+++ addons/web/static/src/js/view_form.js 2014-02-03 06:03:15 +0000
154@@ -359,6 +359,31 @@
155 }
156 self.$el.add(self.$buttons).removeClass('oe_form_dirty');
157 self.autofocus();
158+
159+ // shortcut for pager (on left arrow - right arrow)
160+ $(document).bind('keydown', 'left', function (event) {
161+ event.stopPropagation();
162+ event.stopImmediatePropagation();
163+ switch (event.data) {
164+ case 'left':
165+ self.dataset.previous();
166+ break;
167+ }
168+ var def = self.reload();
169+ self.trigger('pager_action_executed');
170+ return def;
171+ }).bind('keydown', 'right', function(event) {
172+ event.stopPropagation();
173+ event.stopImmediatePropagation();
174+ switch (event.data) {
175+ case 'right':
176+ self.dataset.next();
177+ break;
178+ }
179+ var def = self.reload();
180+ self.trigger('pager_action_executed');
181+ return def;
182+ });
183 });
184 },
185 /**
186
187=== modified file 'addons/web/static/src/xml/base.xml'
188--- addons/web/static/src/xml/base.xml 2014-01-14 13:39:53 +0000
189+++ addons/web/static/src/xml/base.xml 2014-02-03 06:03:15 +0000
190@@ -583,7 +583,7 @@
191 <div class="oe_sidebar">
192 <t t-foreach="widget.sections" t-as="section">
193 <div class="oe_form_dropdown_section">
194- <button class="oe_dropdown_toggle oe_dropdown_arrow">
195+ <button class="oe_dropdown_toggle oe_dropdown_arrow" t-att-accesskey="section.label[0]">
196 <t t-if="section.name == 'files'" t-raw="widget.items[section.name].length || ''"/>
197 <t t-esc="section.label"/>
198 </button>
199@@ -710,7 +710,7 @@
200 <t t-name="ListView.buttons">
201 <div class="oe_list_buttons">
202 <t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable and widget.is_action_enabled('create')">
203- <button type="button" class="oe_button oe_list_add oe_highlight">
204+ <button type="button" class="oe_button oe_list_add oe_highlight" accesskey="c">
205 <t t-esc="widget.options.addable"/>
206 </button>
207 </t>
208@@ -791,15 +791,15 @@
209 <span class="oe_form_buttons_view">
210 <!-- required for the bounce effect on button -->
211 <div t-if="widget.is_action_enabled('edit')" style="display: inline-block;">
212- <button type="button" class="oe_button oe_form_button_edit" accesskey="E">Edit</button>
213+ <button type="button" class="oe_button oe_form_button_edit" accesskey="e">Edit</button>
214 </div>
215 <button t-if="widget.is_action_enabled('create')"
216- type="button" class="oe_button oe_form_button_create" accesskey="C">Create</button>
217+ type="button" class="oe_button oe_form_button_create" accesskey="c">Create</button>
218 </span>
219 <span class="oe_form_buttons_edit">
220- <button type="button" class="oe_button oe_form_button_save oe_highlight" accesskey="S">Save</button>
221+ <button type="button" class="oe_button oe_form_button_save oe_highlight" accesskey="s">Save</button>
222 <span class="oe_fade">or</span>
223- <a href="#" class="oe_bold oe_form_button_cancel" accesskey="D">Discard</a>
224+ <a href="#" class="oe_bold oe_form_button_cancel" accesskey="d">Discard</a>
225 </span>
226 </t>
227 </div>
228
229=== modified file 'addons/web_kanban/static/src/xml/web_kanban.xml'
230--- addons/web_kanban/static/src/xml/web_kanban.xml 2013-05-17 05:41:10 +0000
231+++ addons/web_kanban/static/src/xml/web_kanban.xml 2014-02-03 06:03:15 +0000
232@@ -15,7 +15,7 @@
233 <div t-name="KanbanView.buttons" class="oe_kanban_buttons">
234 <t t-if="widget.options.action_buttons !== false">
235 <t t-if="widget.is_action_enabled('create')">
236- <button type="button" class="oe_kanban_button_new oe_highlight">
237+ <button type="button" class="oe_kanban_button_new oe_highlight" accesskey="c">
238 <t t-esc="widget.options.create_text || _t('Create')"/>
239 </button>
240 <span class="oe_alternative" style="display: none">