Skip to content

Commit

Permalink
use multi-line strings instead of concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 2, 2013
1 parent 79433f0 commit 7a1801b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ assets
deploy
.DS_Store
test.sh
dudefile.js
dudefile.js
.sass-cache
18 changes: 9 additions & 9 deletions js/list-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ C.listCollection = {

render: function () {

this.el = $('<div id="list-collection" class="collection">'
+ '<div class="credit">Made by Evan You <br> Original iOS app by Realmac</div>'
+ '<div class="item dummy-item top list-item empty">'
+ '<div class="slider" style="background-color:rgb(23,128,247)"><div class="inner">'
+ '<span class="title">Pull to Create List</span>'
+ '<div class="count">0</div>'
+ '</div></div>'
+ '</div>'
+ '</div>');
this.el = $('<div id="list-collection" class="collection">\
<div class="credit">Made by Evan You <br> Original iOS app by Realmac</div>\
<div class="item dummy-item top list-item empty">\
<div class="slider" style="background-color:rgb(23,128,247)"><div class="inner">\
<span class="title">Pull to Create List</span>\
<div class="count">0</div>\
</div></div>\
</div>\
</div>');

this.style = this.el[0].style;

Expand Down
20 changes: 9 additions & 11 deletions js/list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@

render: function () {

this.el = $('<div class="item list-item'
+ (this.count ? '' : ' empty')
+ '">'
+ '<div class="slider">'
+ '<div class="inner">'
+ '<span class="title"><span class="text">' + this.data.title + '</span></span>'
+ '<div class="count">' + this.count + '</div>'
+ '<input class="field" type="text" value="' + this.data.title + '">'
+ '</div>'
+ '</div>'
+ '</div>');
this.el = $('<div class="item list-item' + (this.count ? '' : ' empty') + '">\
<div class="slider">\
<div class="inner">\
<span class="title"><span class="text">' + this.data.title + '</span></span>\
<div class="count">' + this.count + '</div>\
<input class="field" type="text" value="' + this.data.title + '">\
</div>\
</div>\
</div>');

this.countEl =this.el.find('.count');

Expand Down
28 changes: 14 additions & 14 deletions js/todo-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ C.TodoCollection.prototype = {

render: function () {

this.el = $('<div class="collection">'
+ '<div class="top-switch">'
+ '<img class="arrow" src="img/arrow.png"> <span class="text">Switch To Lists</span>'
+ '</div>'
+ '<div class="bottom-switch">'
+ '<div class="drawer"><img class="arrow-small" src="img/arrow-small.png"></div>'
+ '<span class="text">Pull to Clear</span>'
+ '</div>'
+ '<div class="item dummy-item top">'
+ '<div class="slider" style="background-color:rgb(235,0,23)"><div class="inner">'
+ '<span class="title">Pull to Create Item</span>'
+ '</div></div>'
+ '</div>'
+ '</div>');
this.el = $('<div class="collection">\
<div class="top-switch">\
<img class="arrow" src="img/arrow.png"> <span class="text">Switch To Lists</span>\
</div>\
<div class="bottom-switch">\
<div class="drawer"><img class="arrow-small" src="img/arrow-small.png"></div>\
<span class="text">Pull to Clear</span>\
</div>\
<div class="item dummy-item top">\
<div class="slider" style="background-color:rgb(235,0,23)"><div class="inner">\
<span class="title">Pull to Create Item</span>\
</div></div>\
</div>\
</div>');

this.style = this.el[0].style;

Expand Down
22 changes: 11 additions & 11 deletions js/todo-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@

render: function () {

this.el = $('<div class="item todo-item' + (this.data.done ? ' done' : '') + '" style="z-index:' + this.data.order + '">'
+ '<div class="slider">'
+ '<div class="inner">'
+ '<span class="title">'
+ '<span class="text">' + this.data.title + '</span>'
+ '<span class="line"></span>'
+ '</span>'
+ '<input class="field" type="text" value="' + this.data.title + '">'
+ '</div>'
+ '</div>'
+ '</div>');
this.el = $('<div class="item todo-item' + (this.data.done ? ' done' : '') + '" style="z-index:' + this.data.order + '">\
<div class="slider">\
<div class="inner">\
<span class="title">\
<span class="text">' + this.data.title + '</span>\
<span class="line"></span>\
</span>\
<input class="field" type="text" value="' + this.data.title + '">\
</div>\
</div>\
</div>');

this.lineStyle = this.el.find('.line')[0].style;
if (this.data.done) this.lineStyle.width = '100%';
Expand Down

0 comments on commit 7a1801b

Please sign in to comment.