mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'master' of github.com:sharelatex/web-sharelatex
This commit is contained in:
commit
92c68177a6
5 changed files with 153 additions and 10 deletions
|
@ -435,6 +435,7 @@
|
||||||
|
|
||||||
script(type='text/template')#changeListItemTemplate
|
script(type='text/template')#changeListItemTemplate
|
||||||
div(class='change-selectors')
|
div(class='change-selectors')
|
||||||
|
div.range
|
||||||
input(type="radio",name="fromVersion").change-selector-from
|
input(type="radio",name="fromVersion").change-selector-from
|
||||||
input(type="radio",name="toVersion").change-selector-to
|
input(type="radio",name="toVersion").change-selector-to
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ define () ->
|
||||||
\\begin{array}{${1:cc}}
|
\\begin{array}{${1:cc}}
|
||||||
$2 & $3 \\\\\\\\
|
$2 & $3 \\\\\\\\
|
||||||
$4 & $5
|
$4 & $5
|
||||||
\\end{array}"
|
\\end{array}
|
||||||
"""
|
"""
|
||||||
meta: "env"
|
meta: "env"
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -54,12 +54,42 @@ define [
|
||||||
@resetAllSelectors()
|
@resetAllSelectors()
|
||||||
@triggerChangeDiff()
|
@triggerChangeDiff()
|
||||||
|
|
||||||
|
view.on "mouseenter:to", (e) =>
|
||||||
|
@hoverToIndex = index
|
||||||
|
@resetHoverStates()
|
||||||
|
|
||||||
|
view.on "mouseleave:to", (e) =>
|
||||||
|
delete @hoverToIndex
|
||||||
|
@resetHoverStates()
|
||||||
|
|
||||||
|
view.on "mouseenter:from", (e) =>
|
||||||
|
@hoverFromIndex = index
|
||||||
|
@resetHoverStates()
|
||||||
|
|
||||||
|
view.on "mouseleave:from", (e) =>
|
||||||
|
delete @hoverFromIndex
|
||||||
|
@resetHoverStates()
|
||||||
|
|
||||||
view.resetSelector(index, @selectedFromIndex, @selectedToIndex)
|
view.resetSelector(index, @selectedFromIndex, @selectedToIndex)
|
||||||
|
|
||||||
resetAllSelectors: () ->
|
resetAllSelectors: () ->
|
||||||
for view, i in @itemViews
|
for view, i in @itemViews
|
||||||
view.resetSelector(i, @selectedFromIndex, @selectedToIndex)
|
view.resetSelector(i, @selectedFromIndex, @selectedToIndex)
|
||||||
|
|
||||||
|
resetHoverStates: () ->
|
||||||
|
if @hoverToIndex?
|
||||||
|
@$("ul").addClass("hover-state")
|
||||||
|
for view, i in @itemViews
|
||||||
|
view.resetHoverState(i, @selectedFromIndex, @hoverToIndex)
|
||||||
|
else if @hoverFromIndex?
|
||||||
|
@$("ul").addClass("hover-state")
|
||||||
|
for view, i in @itemViews
|
||||||
|
view.resetHoverState(i, @hoverFromIndex, @selectedToIndex)
|
||||||
|
else
|
||||||
|
@$("ul").removeClass("hover-state")
|
||||||
|
for view, i in @itemViews
|
||||||
|
view.setHoverUnselected()
|
||||||
|
|
||||||
triggerChangeDiff: () ->
|
triggerChangeDiff: () ->
|
||||||
@trigger "change_diff", @collection.models[@selectedFromIndex], @collection.models[@selectedToIndex]
|
@trigger "change_diff", @collection.models[@selectedFromIndex], @collection.models[@selectedToIndex]
|
||||||
|
|
||||||
|
@ -114,6 +144,15 @@ define [
|
||||||
"click .change-description" : "onClick"
|
"click .change-description" : "onClick"
|
||||||
"click .change-selector-from" : "onFromSelectorClick"
|
"click .change-selector-from" : "onFromSelectorClick"
|
||||||
"click .change-selector-to" : "onToSelectorClick"
|
"click .change-selector-to" : "onToSelectorClick"
|
||||||
|
"mouseenter .change-selector-to": (args...) ->
|
||||||
|
@trigger "mouseenter:to", args...
|
||||||
|
"mouseleave .change-selector-to": (args...) ->
|
||||||
|
@trigger "mouseleave:to", args...
|
||||||
|
"mouseenter .change-selector-from": (args...) ->
|
||||||
|
@trigger "mouseenter:from", args...
|
||||||
|
"mouseleave .change-selector-from": (args...) ->
|
||||||
|
@trigger "mouseleave:from", args...
|
||||||
|
|
||||||
|
|
||||||
template : $("#changeListItemTemplate").html()
|
template : $("#changeListItemTemplate").html()
|
||||||
|
|
||||||
|
@ -168,12 +207,38 @@ define [
|
||||||
setToChecked: (checked) ->
|
setToChecked: (checked) ->
|
||||||
@$(".change-selector-to").prop("checked", checked)
|
@$(".change-selector-to").prop("checked", checked)
|
||||||
|
|
||||||
setSelected: () ->
|
setSelected: (first, last) ->
|
||||||
@$el.addClass("selected")
|
@$el.addClass("selected")
|
||||||
|
if first
|
||||||
|
@$el.addClass("selected-to")
|
||||||
|
else
|
||||||
|
@$el.removeClass("selected-to")
|
||||||
|
if last
|
||||||
|
@$el.addClass("selected-from")
|
||||||
|
else
|
||||||
|
@$el.removeClass("selected-from")
|
||||||
|
|
||||||
setUnselected: () ->
|
setUnselected: () ->
|
||||||
|
@$el.removeClass("selected-to")
|
||||||
|
@$el.removeClass("selected-from")
|
||||||
@$el.removeClass("selected")
|
@$el.removeClass("selected")
|
||||||
|
|
||||||
|
setHoverSelected: (first, last) ->
|
||||||
|
@$el.addClass("hover-selected")
|
||||||
|
if first
|
||||||
|
@$el.addClass("hover-selected-to")
|
||||||
|
else
|
||||||
|
@$el.removeClass("hover-selected-to")
|
||||||
|
if last
|
||||||
|
@$el.addClass("hover-selected-from")
|
||||||
|
else
|
||||||
|
@$el.removeClass("hover-selected-from")
|
||||||
|
|
||||||
|
setHoverUnselected: () ->
|
||||||
|
@$el.removeClass("hover-selected-to")
|
||||||
|
@$el.removeClass("hover-selected-from")
|
||||||
|
@$el.removeClass("hover-selected")
|
||||||
|
|
||||||
resetSelector: (myIndex, selectedFromIndex, selectedToIndex) ->
|
resetSelector: (myIndex, selectedFromIndex, selectedToIndex) ->
|
||||||
if myIndex >= selectedToIndex
|
if myIndex >= selectedToIndex
|
||||||
@showFromSelector()
|
@showFromSelector()
|
||||||
|
@ -186,13 +251,19 @@ define [
|
||||||
@hideToSelector()
|
@hideToSelector()
|
||||||
|
|
||||||
if selectedToIndex <= myIndex <= selectedFromIndex
|
if selectedToIndex <= myIndex <= selectedFromIndex
|
||||||
@setSelected()
|
@setSelected(selectedToIndex == myIndex, selectedFromIndex == myIndex)
|
||||||
else
|
else
|
||||||
@setUnselected()
|
@setUnselected()
|
||||||
|
|
||||||
@setFromChecked(myIndex == selectedFromIndex)
|
@setFromChecked(myIndex == selectedFromIndex)
|
||||||
@setToChecked(myIndex == selectedToIndex)
|
@setToChecked(myIndex == selectedToIndex)
|
||||||
|
|
||||||
|
resetHoverState: (myIndex, hoverFromIndex, hoverToIndex) ->
|
||||||
|
if hoverToIndex <= myIndex <= hoverFromIndex
|
||||||
|
@setHoverSelected(hoverToIndex == myIndex, hoverFromIndex == myIndex)
|
||||||
|
else
|
||||||
|
@setHoverUnselected()
|
||||||
|
|
||||||
|
|
||||||
return ChangeListView
|
return ChangeListView
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ define [
|
||||||
column = 0
|
column = 0
|
||||||
for entry, i in @model.get("diff") or []
|
for entry, i in @model.get("diff") or []
|
||||||
content = entry.u or entry.i or entry.d
|
content = entry.u or entry.i or entry.d
|
||||||
|
content ||= ""
|
||||||
lines = content.split("\n")
|
lines = content.split("\n")
|
||||||
startRow = row
|
startRow = row
|
||||||
startColumn = column
|
startColumn = column
|
||||||
|
|
|
@ -75,23 +75,30 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
min-height: 38px;
|
||||||
.change-selectors {
|
.change-selectors {
|
||||||
position: absolute;
|
|
||||||
top: 4px;
|
|
||||||
left: 6px;
|
|
||||||
.change-selector-from {
|
.change-selector-from {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
bottom: 5px;
|
||||||
left: 0;
|
left: 8px;
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
.change-selector-to {
|
.change-selector-to {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
left: 8px;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
.range {
|
||||||
|
position: absolute;
|
||||||
|
left: 12px;
|
||||||
|
width: 4px;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 20px;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.change-description {
|
.change-description {
|
||||||
padding-left: 42px;
|
padding-left: 26px;
|
||||||
}
|
}
|
||||||
.change-name {
|
.change-name {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
|
@ -111,6 +118,69 @@
|
||||||
}
|
}
|
||||||
li.selected {
|
li.selected {
|
||||||
background-color: #eaeaea;
|
background-color: #eaeaea;
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
background-color: rgb(0, 143, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.selected-to {
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
.change-selector-to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.selected-from {
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
bottom: 10px;
|
||||||
|
}
|
||||||
|
.change-selector-from {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul.change-list.hover-state {
|
||||||
|
li {
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
background-color: transparent;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.hover-selected {
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
background-color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.hover-selected-to {
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
.change-selector-to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.hover-selected-from {
|
||||||
|
.change-selectors {
|
||||||
|
.range {
|
||||||
|
bottom: 10px;
|
||||||
|
}
|
||||||
|
.change-selector-from {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue