Merge lp:~hegarty-sam/midori/midori-inline-speeddialtitle into lp:midori

Proposed by Sam Hegarty
Status: Merged
Approved by: Cris Dywan
Approved revision: 6823
Merged at revision: 6839
Proposed branch: lp:~hegarty-sam/midori/midori-inline-speeddialtitle
Merge into: lp:midori
Diff against target: 162 lines (+62/-14)
2 files modified
data/speeddial-head.html (+61/-12)
midori/midori-speeddial.vala (+1/-2)
To merge this branch: bzr merge lp:~hegarty-sam/midori/midori-inline-speeddialtitle
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Sam Hegarty Pending
Paweł Forysiuk Pending
Danielle Foré Pending
Review via email: mp+241171@code.launchpad.net

This proposal supersedes a proposal from 2014-10-06.

Commit message

Inline renaming of speed dials

Description of the change

Change how the user edits the title of shortcuts on the speed dial so instead of a prompt displaying it's done inline.

To post a comment you must log in.
Revision history for this message
Sam Hegarty (hegarty-sam) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Danielle Foré (danrabbit) wrote : Posted in a previous version of this proposal

Is there a reason for changing the indentation on diffline 9?

needs a space after the : on diffline 17

Maybe use "transparent" instead of "rgba(0, 0, 0, 0)"

I can confirm that this fixes the issue :)

review: Needs Fixing
Revision history for this message
Sam Hegarty (hegarty-sam) wrote : Posted in a previous version of this proposal

Woops, didn't notice I'd changed the indentation because of my editor settings. Fixed the other bits as well. Thanks for taking a look!

Revision history for this message
Paweł Forysiuk (tuxator) wrote : Posted in a previous version of this proposal

Please don't set review status yourself. Reviewer will do it for you once review is done.

Maybe i am missing something obvious, but there seems to be no way now to cancel the edit.
If you fat-finger or delete something you did not want to you seem to stuck with it now.
Also you may not remember what was there before the edit.
Seems like whatever was in the edit entry you are stuck with now.

First thing i would try as a user to cancel the edit would be hitting esc or clicking somewhere away from the dial tile (maybe highlight subtly where the given tile ends in the title edit mode?)

Other than that it looks mostly fine from the quick glance.

review: Needs Fixing
Revision history for this message
Sam Hegarty (hegarty-sam) wrote : Posted in a previous version of this proposal

Ah good point. ctrl+z can be used to undo but it would be nice to have a proper way to cancel. What about an 'x' inside the text-box to click?

Revision history for this message
Danielle Foré (danrabbit) wrote : Posted in a previous version of this proposal

I don't think there really needs to be a graphical way to cancel the change as long as there is an undo. There's no cancel when you're renaming in the file browser and I've never heard of this being a major issue people have with file browsers.

Adding 'esc' to cancel would probably be fine. I would personally expect the box losing focus (by clicking outside it for example) to save the change, not to cancel it.

Revision history for this message
Sam Hegarty (hegarty-sam) wrote : Posted in a previous version of this proposal

Alright, I've made pressing escape reset the input to what it was when they started changing it.

Revision history for this message
Sam Hegarty (hegarty-sam) : Posted in a previous version of this proposal
review: Needs Resubmitting
Revision history for this message
Sam Hegarty (hegarty-sam) wrote : Posted in a previous version of this proposal

Realized after commiting I'd read your comment wrong. Woops.

Revision history for this message
Cris Dywan (kalikiana) wrote :

I love it. Unfortunately I completely forgot to actually approve it, sorry :-D It works very well for me in testing. The only "drawback" here is, that it sort of raises the bar of the speed dial UX as far as adding via the dialog and lack of undo go ;-)

Would be thrilled to talk about follow up work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/speeddial-head.html'
--- data/speeddial-head.html 2013-06-25 16:12:25 +0000
+++ data/speeddial-head.html 2014-11-15 09:02:34 +0000
@@ -27,7 +27,7 @@
27 cursor: default;27 cursor: default;
28 font-size: 13px;28 font-size: 13px;
29 color: #4d4d4d;29 color: #4d4d4d;
30 -webkit-user-select: none;30 -webkit-user-select: none;
31 }31 }
3232
33 html, body {33 html, body {
@@ -85,8 +85,13 @@
85 }85 }
8686
87 .title {87 .title {
88 background: transparent;
89 border: 1px solid transparent;
90 display: block;
88 text-align: center;91 text-align: center;
89 margin: 8px;92 margin: 8px;
93 margin-left: auto;
94 margin-right: auto;
90 white-space: nowrap;95 white-space: nowrap;
91 text-overflow: ellipsis;96 text-overflow: ellipsis;
92 overflow: hidden;97 overflow: hidden;
@@ -119,9 +124,24 @@
119 outline: 1px dotted black;124 outline: 1px dotted black;
120 background-color: #eef;125 background-color: #eef;
121 }126 }
127
128 .selectable {
129 -webkit-user-select: text;
130 }
122 </style>131 </style>
123132
124 <script type="text/javascript">133 <script type="text/javascript">
134 var previousName = "";
135
136 function input_key_down (ev) {
137 // 13 is the key code for enter
138 if(ev.keyCode == 13) ev.target.blur();
139 // 27 is the key code for escape
140 if(ev.keyCode == 27) {
141 ev.target.value = previousName;
142 ev.target.blur();
143 }
144 }
125145
126 function add_tile (ev) {146 function add_tile (ev) {
127 ev.preventDefault();147 ev.preventDefault();
@@ -137,17 +157,26 @@
137 console.log ("speed_dial-save-add " + id + " " + url);157 console.log ("speed_dial-save-add " + id + " " + url);
138 }158 }
139159
140 function rename_tile (ev) {160 function done_editing_title (ev) {
141 var old_name = ev.target.textContent;161 input = ev.target;
142162 input.style.backgroundColor = "transparent";
143 var name = prompt ("{enter_shortcut_name}", old_name);163 input.style.border = "1px solid transparent";
144 if (!name)164
145 return;165 var name = ev.target.value;
146166 if (name == "")
167 name = previousName;
147 var id = ev.target.parentNode.id;168 var id = ev.target.parentNode.id;
148 console.log ("speed_dial-save-rename " + id + " " + name);169 console.log ("speed_dial-save-rename " + id + " " + name);
149 }170 }
150171
172 function editing_tile (ev) {
173 input = ev.target;
174 previousName = input.value;
175 // indicate to user they are editing the title
176 input.style.backgroundColor = "#F8F8F8";
177 input.style.border = "1px solid #808060";
178 }
179
151 function delete_tile (ev) {180 function delete_tile (ev) {
152 ev.preventDefault();181 ev.preventDefault();
153182
@@ -158,7 +187,6 @@
158 console.log ("speed_dial-save-delete " + id);187 console.log ("speed_dial-save-delete " + id);
159 }188 }
160189
161
162 var firstNode, secondNode;190 var firstNode, secondNode;
163 var cursor;191 var cursor;
164192
@@ -177,6 +205,23 @@
177 if (ev == undefined)205 if (ev == undefined)
178 return;206 return;
179207
208 /* If the target of the event is an element of class title
209 * and not also of class add-shortcut we are editing title
210 */
211 var classes = ev.target.className.split(" ");
212 var edit_title = false;
213 for (var i = 0; i < classes.length; i++) {
214 if(classes[i] == "add-shortcut") {
215 edit_title = false;
216 break;
217 }
218 if(classes[i] == "title")
219 edit_title = true;
220 }
221
222 if(edit_title)
223 return;
224
180 ev.preventDefault();225 ev.preventDefault();
181 var ele = ev.target;226 var ele = ev.target;
182 cursor = ele.style.cursor;227 cursor = ele.style.cursor;
@@ -198,7 +243,8 @@
198 var eparent = get_dial_div (ele);243 var eparent = get_dial_div (ele);
199244
200 ele.style.cursor = cursor;245 ele.style.cursor = cursor;
201 secondNode = eparent.id;246 if(eparent != undefined) secondNode = eparent.id;
247 else return;
202248
203 /* ommit just mere clicking the dial */249 /* ommit just mere clicking the dial */
204 if (firstNode != secondNode && firstNode != undefined)250 if (firstNode != secondNode && firstNode != undefined)
@@ -237,8 +283,11 @@
237 var titles = document.getElementsByClassName ("title");283 var titles = document.getElementsByClassName ("title");
238 var len = titles.length;284 var len = titles.length;
239 for (var i = 0; i < len; i++) {285 for (var i = 0; i < len; i++) {
240 if (titles[i].parentNode.childNodes[0].className != "preview new")286 if (titles[i].parentNode.childNodes[0].className != "preview new") {
241 titles[i].addEventListener ('click', rename_tile, false);287 titles[i].addEventListener ('click', editing_tile, false);
288 titles[i].addEventListener ('blur', done_editing_title, false);
289 titles[i].addEventListener ('keydown', input_key_down, false);
290 }
242 }291 }
243292
244 var crosses = document.getElementsByClassName ("cross");293 var crosses = document.getElementsByClassName ("cross");
245294
=== modified file 'midori/midori-speeddial.vala'
--- midori/midori-speeddial.vala 2013-10-28 23:08:02 +0000
+++ midori/midori-speeddial.vala 2014-11-15 09:02:34 +0000
@@ -188,7 +188,6 @@
188 string header = head.replace ("{title}", _("Speed Dial")).188 string header = head.replace ("{title}", _("Speed Dial")).
189 replace ("{click_to_add}", _("Click to add a shortcut")).189 replace ("{click_to_add}", _("Click to add a shortcut")).
190 replace ("{enter_shortcut_address}", _("Enter shortcut address")).190 replace ("{enter_shortcut_address}", _("Enter shortcut address")).
191 replace ("{enter_shortcut_name}", _("Enter shortcut title")).
192 replace ("{are_you_sure}", _("Are you sure you want to delete this shortcut?"));191 replace ("{are_you_sure}", _("Are you sure you want to delete this shortcut?"));
193 var markup = new StringBuilder (header);192 var markup = new StringBuilder (header);
194193
@@ -251,7 +250,7 @@
251 <div class="shortcut" id="%u"><div class="preview">250 <div class="shortcut" id="%u"><div class="preview">
252 <a class="cross" href="#"></a>251 <a class="cross" href="#"></a>
253 <a href="%s"><img src="data:image/png;base64,%s" title='%s'></a>252 <a href="%s"><img src="data:image/png;base64,%s" title='%s'></a>
254 </div><div class="title">%s</div></div>253 </div><input type="text" class="title selectable" value="%s"></div>
255 """,254 """,
256 slot, uri, encoded ?? "", title, title ?? "");255 slot, uri, encoded ?? "", title, title ?? "");
257 }256 }

Subscribers

People subscribed via source and target branches

to all changes: