Merge lp:~mttronchetti/novacut/bin into lp:novacut

Proposed by Matteo Ronchetti
Status: Merged
Merged at revision: 281
Proposed branch: lp:~mttronchetti/novacut/bin
Merge into: lp:novacut
Diff against target: 336 lines (+162/-50)
2 files modified
ui/projects.html (+93/-33)
ui/projects.js (+69/-17)
To merge this branch: bzr merge lp:~mttronchetti/novacut/bin
Reviewer Review Type Date Requested Status
Jason Gerard DeRose Approve
Review via email: mp+115151@code.launchpad.net

Description of the change

I did some improvements related to the ex history menu:
1)Calling it history was a bad idea so I removed history name and I've replaced it with a bin icon.In my opinion is easy to understand what this icon stands for so it is good.The small problem is that I have drawn the icon so it is OK but nothing amazing but easy to understand
2)I have made the bin menu looking like this:
      if there aren't removed projects display a simple description of the menu as suggested in this bug https://bugs.launchpad.net/novacut/+bug/1023766
      if there are less than 5 projects show them
      if there are more than 5 projects show the first 5 and also a real time search bar(really cool)
3)To make more understandable where removed projects go I added an animation
4)The small cross that allows you to remove projects now shows you that it is clickable by changing its transparency on mouse over
5)The menu is already shown by onmouseover but I have improved usability using an invisible div that makes easier to move the mouse from the bin icon to the menu.In my opinion it is better than open the menu with a click

I' m very proud of my work but if you don't agree with something tell it to me so we can talk about this and improve novacut :P

P.S. I have done some usability tests with my sister and they went good

To post a comment you must log in.
lp:~mttronchetti/novacut/bin updated
283. By Matteo Ronchetti

small bugfix

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

I love the new feature. You just need to fix the needless chmod changes, please, and then I'll merge this.

just chmod +x on the scripts you see in the diff, and then commit.

review: Needs Fixing
lp:~mttronchetti/novacut/bin updated
284. By Matteo Ronchetti

fix execute permissions

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Looks great, thanks!

A lovely feature that I'm sure will be a crowd pleaser :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gen-random-project.py' (properties changed: +x to -x)
=== added file 'ui/bin2.png'
0Binary files ui/bin2.png 1970-01-01 00:00:00 +0000 and ui/bin2.png 2012-07-16 17:50:27 +0000 differ0Binary files ui/bin2.png 1970-01-01 00:00:00 +0000 and ui/bin2.png 2012-07-16 17:50:27 +0000 differ
=== modified file 'ui/projects.html'
--- ui/projects.html 2012-06-19 16:57:22 +0000
+++ ui/projects.html 2012-07-16 17:50:27 +0000
@@ -15,22 +15,38 @@
15 ev.dataTransfer.effectAllowed = 'move';15 ev.dataTransfer.effectAllowed = 'move';
16 }16 }
17 function enter(ev){17 function enter(ev){
18 ev.target.setAttribute("style","background-color: rgba(255,255,255,0.15); height: 2000px;width = 2000px;");18 ev.preventDefault();
19 //ev.target.setAttribute("style","cursor: ;");
19 return false;20 return false;
20 }21 }
21 function leave(ev){22 function leave(ev){
22 ev.target.setAttribute("style","height: 2000px;width = 2000px");
23 return false;23 return false;
24 }24 }
25 function d(ev){25 function d(ev){
26 ev.preventDefault();26 ev.preventDefault();
27 ev.target.setAttribute("style","height: 2000px;width = 2000px;");
28 var data=ev.dataTransfer.getData("Text");27 var data=ev.dataTransfer.getData("Text");
29 Hub.send('sos_project', data);28 Hub.send('sos_project', data);
30 element = document.getElementById(data);29 element = document.getElementById(data);
31 element.parentNode.removeChild(element);30 element.parentNode.removeChild(element);
32 var doc = novacut.get_sync(data) 31 var doc = novacut.get_sync(data)
33 UI.add_item(data,doc.title,doc.time,countFiles(data));32 UI.add_item(data,doc.title,doc.time,countFiles(data));
33 var old = UI.removed.length;
34 for(var b in UI.removed){//remove the project from the list
35 if(UI.removed[b][0] == data){
36 UI.removed.splice(b,1);
37 break;
38 }
39 }
40 if(UI.removed.length == 0)document.getElementById("cont").innerHTML=UI.binDesc;
41 else if(UI.removed.length > UI.binMax)UI.add_history(UI.removed[UI.binMax-1][0],UI.removed[UI.binMax-1][1],UI.removed[UI.binMax-1][2],UI.removed[UI.binMax-1][3]);
42 if(UI.removed.length == UI.binMax){
43 document.getElementById("cont").innerHTML="";
44 document.getElementById("list").innerHTML="";
45 for(var b = 0;b<UI.binMax;b++){
46 var a = UI.removed[b];
47 UI.add_history(a[0],a[1],a[2],a[3]);
48 }
49 }
34 return false;50 return false;
35 }51 }
36 function over(ev){52 function over(ev){
@@ -48,6 +64,15 @@
48 cursor: default;64 cursor: default;
49}65}
5066
67#menu img{
68width: 31px;
69margin-top: -7px;
70margin-right: -8px;
71-webkit-animation-duration: .8s;
72 -webkit-animation-iteration-count: 1;
73 -webkit-animation-timing-function: linear;
74
75}
51#menu li{76#menu li{
52 float: left;77 float: left;
53 padding: 0 0 10px 0;78 padding: 0 0 10px 0;
@@ -57,48 +82,79 @@
57#menu li:hover > a{82#menu li:hover > a{
58 color: #fafafa;83 color: #fafafa;
59}84}
60#menu li:hover > ul{85#menu li:hover > #bi{
61 display: block;86 display: block;
62}87}
6388
64#menu ul{ /*container*/89#bi{ /*container*/
65 min-width: 320px;90 min-width: 320px;
66 min-height: 26px;91 min-height: 26px;
67 list-style: none;92 list-style: none;
68 margin: 0px -269px;93 margin: 0px -302px;
69 padding: 4px;94 padding: 4px;
70 display: none;95 display: none;
71 position: absolute;96 position: absolute;
72 top: 35px;97 top: 39px;
73 left: 0;98 left: 0;
74 z-index: 99999;99 z-index: 99999;
75 background: #444;100 background: -webkit-linear-gradient(top,rgb(87,87,87),rgb(65,65,65));
76 border-radius: 10px;101 border-radius: 10px;
77 box-shadow: 1px 1px 10px rgba(0,0,0,0.5);102 box-shadow: 1px 1px 10px rgba(0,0,0,0.5);
78}103}
79#menu ul li{ /* projects*/104
105#menu input{
106 width: 282px;
107 margin: 6px 3px 2px 5px;
108 border-radius: 15px;
109 background: -webkit-linear-gradient(top,#E6E6E6,#FAFAFA);
110 border: solid 1px rgba(0, 0, 0, 0.72);
111 box-shadow: none;
112 padding-left: 28px;
113 color: black;
114}
115
116#lens{
117margin-left: -313px;
118margin-bottom: -11px;
119}
120#menu ul ul li{ /* projects*/
80 float: none;121 float: none;
81 margin: 10px;122 margin: 10px;
82 padding: 0;123 padding: 0;
83 display: block;124 display: block;
84 cursor: move;125 cursor: move;
85}126}
86#menu ul:after{
87 content: '';
88 position: absolute;
89 left: 284px;
90 top: -15px;
91 width: 0;
92 height: 0;
93 border-left: 10px solid transparent;
94 border-right: 10px solid transparent;
95 border-bottom: 15px solid;
96}
97127
98#menu ul:after{128#menu ul:after{
99 border-bottom-color: #444;129 border-bottom-color: #444;
100}130}
101131
132.project{
133-webkit-animation-duration: 0.3s;
134 -webkit-animation-iteration-count: 1;
135 -webkit-animation-timing-function: cubic-bezier(0.4,0,0.8,1);
136}
137
138.project img{
139opacity: 0.7;
140}
141
142.project img:hover{
143opacity: 1;
144}
145
146#cont p{
147margin: 5px;
148margin-left: 7px;
149text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
150}
151
152#inv{/*invisible div used to make bin menu easier to use*/
153height:60px;
154width:300px;
155margin-top:-60px;
156}
157
102 </style>158 </style>
103 </head>159 </head>
104 <body>160 <body>
@@ -107,11 +163,15 @@
107 <input placeholder="New project name" type="text" class="grid_4" autofocus>163 <input placeholder="New project name" type="text" class="grid_4" autofocus>
108 <button class="grid_4" disabled>Create Project</button>164 <button class="grid_4" disabled>Create Project</button>
109 <ul id="menu"><li>165 <ul id="menu"><li>
110 <a>History</a>166 <img src="bin2.png" class="ico" id="ico"/>
167 <ul id="bi">
168 <div id="inv"></div>
169 <div id="cont"></div>
111 <ul id="list"></ul>170 <ul id="list"></ul>
171 </ul>
112 </li></ul>172 </li></ul>
113 </div>173 </div>
114 </form>174 </form>
115<ul style="height: 200px;width = 200px;" id="projects" ondragenter="enter(event)" ondragleave="leave(event)" ondrop="d(event)" ondragover="over(event);"></ul>175<ul style="height: 800px;width = 800px;" id="projects" ondragenter="enter(event)" ondragleave="leave(event)" ondrop="d(event)" ondragover="over(event);"></ul>
116 </body>176 </body>
117</html>177</html>
118178
=== modified file 'ui/projects.js'
--- ui/projects.js 2012-06-19 16:57:22 +0000
+++ ui/projects.js 2012-07-16 17:50:27 +0000
@@ -1,6 +1,5 @@
1"use strict";1"use strict";
22
3
4function open_project(project_id) {3function open_project(project_id) {
5 window.location.assign('cutter.html#' + project_id); 4 window.location.assign('cutter.html#' + project_id);
6}5}
@@ -16,24 +15,47 @@
16 return filecount;15 return filecount;
17}16}
1817
18function getOffset( el ) {//get the coordinates of an element
19 var _x = 0;
20 var _y = 0;
21 while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
22 _x += el.offsetLeft - el.scrollLeft;
23 _y += el.offsetTop - el.scrollTop;
24 el = el.offsetParent;
25 }
26 return { y: _y, x: _x };
27}
28
29function generateAnimation(x,y){//generate the animation for the elimination of a project
30 var keyframeprefix = "-webkit-";
31 var keyframes = '@' + keyframeprefix + 'keyframes arg { '+'0% {' + keyframeprefix + 'transform:scale(1)}'+'100% {' + keyframeprefix + 'transform:translatex('+x+'px) translatey('+y+'px) scale(0.001)}'+'}';
32 var s = document.createElement( 'style' );
33 s.innerHTML = keyframes;
34 document.getElementsByTagName( 'head' )[ 0 ].appendChild( s );
35}
36
19var UI = {37var UI = {
20 init: function() {38 init: function() {
21 UI.form = $('new_project');39 UI.form = $('new_project');
22 UI.input = UI.form.getElementsByTagName('input')[0];40 UI.input = UI.form.getElementsByTagName('input')[0];
23 UI.button = UI.form.getElementsByTagName('button')[0];41 UI.button = UI.form.getElementsByTagName('button')[0];
24 //UI.project = new Project(novacut);
25 //UI.items = new Items('projects');
26 42
27 UI.form.onsubmit = UI.on_submit;43 UI.form.onsubmit = UI.on_submit;
28 UI.input.oninput = UI.on_input;44 UI.input.oninput = UI.on_input;
29 45
30 UI.hist = document.getElementById('list');46 UI.hist = document.getElementById('list');
31 UI.proj = document.getElementById('projects');47 UI.proj = document.getElementById('projects');
48
49
50 UI.binDesc ="<p>Here you can find your removed projects<br>Click on <img style=\"width:13px;\" src=\"delete.png\"></img>&nbsp;&nbsp;&nbsp;to remove a project<br>Drag a project out of here to restore it</p>";
51 UI.binMax = 5;
52 UI.binSearch = "<input id=\"s\" onkeyup=\"UI.Search()\"><img id=\"lens\" src=\"search.png\"></img></input>";
53
54 UI.removed = new Array();
32 UI.load_items();55 UI.load_items();
33 },56 },
3457
35 load_items: function() {58 load_items: function() {
36 //UI.add_history("qwe","nome",3333,3);
37 console.log('load_items');59 console.log('load_items');
38 novacut.view(UI.on_items, 'project', 'title');60 novacut.view(UI.on_items, 'project', 'title');
39 },61 },
@@ -42,18 +64,41 @@
42 var rows = req.read().rows;64 var rows = req.read().rows;
43 console.log(rows.length);65 console.log(rows.length);
44 for(var b in rows){66 for(var b in rows){
45 var a = rows[b]67 var a = rows[b];
46 var pdb = new couch.Database("novacut-0-" + a.id.toLowerCase());68 var filecount = countFiles(a.id);
47 try{69 var doc = novacut.get_sync(a.id);
48 var filecount = pdb.view_sync('doc', 'type', {key: 'dmedia/file'}).rows[0].value;
49 }
50 catch(e){
51 var filecount = 0;
52 }
53 var doc = novacut.get_sync(a.id)
54 if(!doc.isdeleted) UI.add_item(a.id,a.key,a.value,filecount);70 if(!doc.isdeleted) UI.add_item(a.id,a.key,a.value,filecount);
55 else UI.add_history(a.id,a.key,a.value,filecount);71 else UI.removed.push(Array(a.id,a.key,a.value,filecount));
56 }72 }
73 if(UI.removed.length == 0){
74 document.getElementById("cont").innerHTML=UI.binDesc;
75 }else if(UI.removed.length <= UI.binMax){
76 for(var b in UI.removed){
77 var a = UI.removed[b];
78 UI.add_history(a[0],a[1],a[2],a[3]);
79 }
80
81 }else{
82 document.getElementById("cont").innerHTML = UI.binSearch;
83 for(var b = 0;b<UI.binMax;b++){
84 var a = UI.removed[b];
85 UI.add_history(a[0],a[1],a[2],a[3]);
86 }
87 }
88 },
89
90 Search: function(){
91 var text = document.getElementById("s").value;
92 UI.hist.innerHTML = "";
93 var count = 0;
94 for(var b in UI.removed){
95 var a = UI.removed[b];
96 if(a[1].indexOf(text) != -1){
97 count++;
98 UI.add_history(a[0],a[1],a[2],a[3]);
99 if(count == UI.binMax)break;
100 }
101 }
57 },102 },
58103
59 add_history: function(id,name,date,filecount){104 add_history: function(id,name,date,filecount){
@@ -80,7 +125,6 @@
80 li.appendChild(info);125 li.appendChild(info);
81 UI.hist.appendChild(li);126 UI.hist.appendChild(li);
82 },127 },
83
84 add_item: function(id,name,date,filecount) {128 add_item: function(id,name,date,filecount) {
85 var li = $el('li', {'class': 'project', 'id': id});129 var li = $el('li', {'class': 'project', 'id': id});
86 var thumb = $el('div', {'class': 'thumbnail'});130 var thumb = $el('div', {'class': 'thumbnail'});
@@ -105,10 +149,18 @@
105 del.setAttribute('src', 'delete.png');149 del.setAttribute('src', 'delete.png');
106 del.setAttribute('align', 'right');150 del.setAttribute('align', 'right');
107 del.onclick = function(){151 del.onclick = function(){
108 this.parentNode.parentNode.removeChild(this.parentNode);152 var pos = getOffset(this.parentNode);
153 var end = getOffset( document.getElementById("ico"));
154 generateAnimation(end.x-pos.x,end.y-pos.y-30);
155 this.parentNode.style.webkitAnimationName = "arg";
156 var s = this;
157 setTimeout(function(){s.parentNode.parentNode.removeChild(s.parentNode)},320,s);
109 Hub.send('delete_project', id)158 Hub.send('delete_project', id)
110 var doc = novacut.get_sync(id)159 var doc = novacut.get_sync(id)
111 UI.add_history(id,doc.title,doc.time,countFiles(id));160 UI.removed.push(Array(id,doc.title,doc.time,countFiles(id)));
161 document.getElementById("cont").innerHTML = "";
162 if (UI.removed.length > UI.binMax) document.getElementById("cont").innerHTML = UI.binSearch;
163 else UI.add_history(id,doc.title,doc.time,countFiles(id));
112 }164 }
113 li.appendChild(del);165 li.appendChild(del);
114 thumb.onclick = function() {166 thumb.onclick = function() {
115167
=== added file 'ui/search.png'
116Binary files ui/search.png 1970-01-01 00:00:00 +0000 and ui/search.png 2012-07-16 17:50:27 +0000 differ168Binary files ui/search.png 1970-01-01 00:00:00 +0000 and ui/search.png 2012-07-16 17:50:27 +0000 differ

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: