fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5fa4771
)
history wip: Selecting versions in history view
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 13 Jun 2013 13:27:20 +0000
(15:27 +0200)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 13 Jun 2013 13:27:20 +0000
(15:27 +0200)
modules/documentHistory/documentHistory.js
patch
|
blob
|
history
modules/documentHistory/documentHistory.less
patch
|
blob
|
history
modules/documentHistory/templates/item.html
patch
|
blob
|
history
diff --git
a/modules/documentHistory/documentHistory.js
b/modules/documentHistory/documentHistory.js
index
0db2a75
..
d5f20d4
100644
(file)
--- a/
modules/documentHistory/documentHistory.js
+++ b/
modules/documentHistory/documentHistory.js
@@
-27,16
+27,17
@@
return function(sandbox) {
\r
var toggleItemViews = function(toggle) {
\r
itemViews.forEach(function(view) {
\r
\r
var toggleItemViews = function(toggle) {
\r
itemViews.forEach(function(view) {
\r
- view.toggle(toggle);
\r
+ if(!historyItems.selected(view.item))
\r
+ view.toggle(toggle);
\r
});
\r
}
\r
\r
var historyItems = {
\r
_itemsById: {},
\r
_selected: [],
\r
});
\r
}
\r
\r
var historyItems = {
\r
_itemsById: {},
\r
_selected: [],
\r
- select: function(i
d
) {
\r
+ select: function(i
tem
) {
\r
if(this._selected.length < 2) {
\r
if(this._selected.length < 2) {
\r
- this._selected.push(i
d
);
\r
+ this._selected.push(i
tem.version
);
\r
if(this._selected.length === 2)
\r
toggleItemViews(false);
\r
return true;
\r
if(this._selected.length === 2)
\r
toggleItemViews(false);
\r
return true;
\r
@@
-44,40
+45,40
@@
return function(sandbox) {
return false;
\r
},
\r
unselect: function(item) {
\r
return false;
\r
},
\r
unselect: function(item) {
\r
- this._selected = _.without(this._selected, i
d
);
\r
+ this._selected = _.without(this._selected, i
tem.version
);
\r
if(this._selected.length < 2)
\r
toggleItemViews(true);
\r
},
\r
add: function(item) {
\r
if(this._selected.length < 2)
\r
toggleItemViews(true);
\r
},
\r
add: function(item) {
\r
- this._itemsById[item.
id
] = item;
\r
+ this._itemsById[item.
version
] = item;
\r
},
\r
selected: function(item) {
\r
},
\r
selected: function(item) {
\r
- return _.contains(
_selected, item.id
);
\r
+ return _.contains(
this._selected, item.version
);
\r
}
\r
};
\r
\r
var itemView = function(item) {
\r
this.item = item;
\r
this.dom = $(this.template(item));
\r
}
\r
};
\r
\r
var itemView = function(item) {
\r
this.item = item;
\r
this.dom = $(this.template(item));
\r
- this.dom.on('click',
this.onItemClicked
);
\r
+ this.dom.on('click',
_.bind(this.onItemClicked, this)
);
\r
};
\r
itemView.prototype.template = _.template(itemTemplateSrc);
\r
itemView.prototype.onItemClicked = function() {
\r
};
\r
itemView.prototype.template = _.template(itemTemplateSrc);
\r
itemView.prototype.onItemClicked = function() {
\r
- if(historyItems.selected(item)) {
\r
- historyItems.unselect(item);
\r
+ if(historyItems.selected(
this.
item)) {
\r
+ historyItems.unselect(
this.
item);
\r
this.dimItem();
\r
this.dimItem();
\r
- } else if(historyItems.select(item)) {
\r
+ } else if(historyItems.select(
this.
item)) {
\r
this.highlightItem();
\r
}
\r
};
\r
itemView.prototype.highlightItem = function() {
\r
this.highlightItem();
\r
}
\r
};
\r
itemView.prototype.highlightItem = function() {
\r
-
\r
+ this.dom.addClass('highlighted');
\r
};
\r
itemView.prototype.dimItem = function() {
\r
};
\r
itemView.prototype.dimItem = function() {
\r
-
\r
+ this.dom.removeClass('highlighted');
\r
};
\r
itemView.prototype.toggle = function(toggle) {
\r
};
\r
itemView.prototype.toggle = function(toggle) {
\r
-
\r
+ this.dom.toggleClass('disabled', !toggle);
\r
};
\r
\r
\r
};
\r
\r
\r
diff --git
a/modules/documentHistory/documentHistory.less
b/modules/documentHistory/documentHistory.less
index
0c2e9b5
..
9a73977
100644
(file)
--- a/
modules/documentHistory/documentHistory.less
+++ b/
modules/documentHistory/documentHistory.less
@@
-1,18
+1,30
@@
-.rng-module-documentHistory
-item
{
\r
+.rng-module-documentHistory {
\r
\r
\r
- margin: 0 0 15px 0;
\r
-
\r
- .version {
\r
- float: left;
\r
- width: 30px;
\r
- font-weight: bold;
\r
+ .item {
\r
+ padding: 5px 5px;
\r
+ margin: 0 0 15px 0;
\r
+ cursor: pointer;
\r
+
\r
+ .version {
\r
+ float: left;
\r
+ width: 30px;
\r
+ font-weight: bold;
\r
+ }
\r
+
\r
+ .date, .author, .description {
\r
+ margin: 5px 10px 0 40px;
\r
+ }
\r
+
\r
+ .description {
\r
+ font-size: .9em;
\r
+ }
\r
}
\r
\r
}
\r
\r
- .
date, .author, .description
{
\r
-
margin: 5px 10px 0 40px
;
\r
+ .
item.highlighted
{
\r
+
background: #ffec63
;
\r
}
\r
\r
}
\r
\r
- .
description
{
\r
-
font-size: .9em
;
\r
+ .
item.disabled
{
\r
+
cursor: default
;
\r
}
\r
}
\ No newline at end of file
}
\r
}
\ No newline at end of file
diff --git
a/modules/documentHistory/templates/item.html
b/modules/documentHistory/templates/item.html
index
d5b81a7
..
f3afb3d
100644
(file)
--- a/
modules/documentHistory/templates/item.html
+++ b/
modules/documentHistory/templates/item.html
@@
-1,4
+1,4
@@
-<div class="
rng-module-documentHistory-
item">
\r
+<div class="item">
\r
<div class="version"><%= version %></div>
\r
<div class="date"><%= date %></div>
\r
<div class="author"><%= author %></div>
\r
<div class="version"><%= version %></div>
\r
<div class="date"><%= date %></div>
\r
<div class="author"><%= author %></div>
\r