This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update diff view - Add/Remove over the same text. #29
- Change color styles. - Add the status 'add' to transform as text. - Refactor text introducing the concept of "section" - Change jade template to ripple template. - Add slide to left on toggle side view.
- Loading branch information
Showing
14 changed files
with
169 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
span(class='{{type}}') {{text}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"templates": [ | ||
"template.jade" | ||
, "content.jade" | ||
, "change.jade" | ||
], | ||
"main": "view.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,56 @@ | ||
var View = require('view'); | ||
var template = require('./template'); | ||
var changeTemplate = require('./change'); | ||
var content = require('./content'); | ||
var ripple = require('ripple'); | ||
var dom = require('dom'); | ||
|
||
module.exports = SideView; | ||
|
||
function SideView() { | ||
function SideView(changes) { | ||
if (!this instanceof SideView) { | ||
return new SideView(); | ||
return new SideView(changes); | ||
} | ||
|
||
View.call(this, template); | ||
this.status = 'hidden'; | ||
this.attachedView = {}; | ||
this.container = {}; | ||
this.diff = changes; | ||
} | ||
|
||
//TODO: maybe should remove the dependency of Global view, and use as ripple view. | ||
View(SideView); | ||
|
||
SideView.prototype.toggle = function () { | ||
var viewStatus = this.attachedView.get('status'); | ||
if ('hidden' === viewStatus) { | ||
this.attachedView.set('status', 'visible'); | ||
this.emit('sidebar-status:visible'); | ||
this.container.removeClass('low-point'); | ||
|
||
} else { | ||
this.attachedView.set('status', 'hidden'); | ||
this.emit('sidebar-status:hidden'); | ||
} | ||
}; | ||
|
||
SideView.prototype.addContent = function () { | ||
|
||
SideView.prototype.bindActions = function (callback) { | ||
var Template = ripple(content()); | ||
var self = this; | ||
var status = 'hidden'; //Initial status | ||
|
||
Template.directive('click-at', function (index, el, view) { | ||
el.addEventListener('click', function () { | ||
self.toggle(view); | ||
}); | ||
el.addEventListener('click', callback); | ||
}); | ||
|
||
this.attachedView = new Template({ | ||
status: status | ||
}); | ||
|
||
this.el.append(this.attachedView.el); | ||
this.addChanges(); | ||
}; | ||
|
||
SideView.prototype.addChanges = function (diff) { | ||
SideView.prototype.addChanges = function () { | ||
var self = this; | ||
self.addContent(); | ||
//TODO: this must replace with ripple template | ||
diff.changes.forEach(function (change) { | ||
var changeHtml = dom('<span class="' + change.type + '">' + change.text + '</span>'); | ||
dom('.text', self.attachedView.el).append(changeHtml); | ||
this.diff.forEach(function (change) { | ||
var changeView = ripple(changeTemplate()); | ||
var changeHtml = new changeView(change); | ||
dom('.text', self.attachedView.el).append(changeHtml.el); | ||
}); | ||
}; | ||
|
||
//Fixme: this relation it's turn on creepy | ||
SideView.prototype.addContainer = function (template) { | ||
this.el.appendTo(template); | ||
this.container = template; | ||
}; | ||
module.exports = SideView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
span(class='{{type}}') {{text}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "text-section", | ||
"description": "", | ||
"dependencies": { | ||
"visionmedia/jade": "1.3.1", | ||
"component/dom": "1.0.5" | ||
, "ripplejs/ripple": "0.5.3" | ||
}, | ||
"local": [ | ||
"view" | ||
, "side-view" | ||
], | ||
"scripts": [ | ||
"view.js" | ||
], | ||
"styles": ["styles.styl"], | ||
"templates": [ | ||
"template.jade" | ||
, "change.jade" | ||
], | ||
"main": "view.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
p | ||
position: relative | ||
font-size: 16px; | ||
|
||
&.low-point | ||
opacity: 0.2 | ||
|
||
&.changes | ||
opacity: 1 | ||
|
||
.add | ||
border-radius: 4px; | ||
color: #333333; | ||
padding: 1px 2px; | ||
background-color: #EAFFEA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
p |
Oops, something went wrong.