Skip to content

Commit

Permalink
button click toggling white-space
Browse files Browse the repository at this point in the history
  • Loading branch information
brownman committed Oct 25, 2012
1 parent b950a68 commit 3881681
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 14 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/backbone/models/comment.js.coffee
Expand Up @@ -3,6 +3,7 @@ class RailsBackboneRelational.Models.Comment extends Backbone.RelationalModel

defaults:
content: null
done: false

#initialize: () ->
#console.log(this)
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/backbone/models/comment.js.coffee~
Expand Up @@ -4,8 +4,8 @@ class RailsBackboneRelational.Models.Comment extends Backbone.RelationalModel
defaults:
content: null

initialize: () ->
console.log(this)
#initialize: () ->
#console.log(this)
#alert('brothers:')
#save: ->
#alert('save')
Expand Down
@@ -1,6 +1,9 @@
<div >


<input class='span12' type='text' value='<%= comment.content %>'></input>

<input class="check" type="checkbox" <%= comment.done ? 'checked="checked"' : '' %> />


<div class="btn-group todo-array " >
Expand All @@ -11,6 +14,7 @@




<a href="/comments#/<%= comment.id %>/destroy" class="destroy">kill</a>


Expand Down
@@ -1,6 +1,9 @@
<td>
<div >


<input class='span12' type='text' value='<%= comment.content %>'></input>

<input class="check" type="checkbox" <%= done ? 'checked="checked"' : '' %> />


<div class="btn-group todo-array " >
Expand All @@ -11,8 +14,9 @@




<a href="/comments#/<%= comment.id %>/destroy" class="destroy">kill</a>


</td>
</div>

Expand Up @@ -5,8 +5,11 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View

events:
"click .destroy" : "destroy"
"click .todo-array button": "show_index"
"dblclick .todo-array button": "show_index"

"click .todo-array button": "whiteSpaceCheck"
"click .check" : "toggleDone"

#"hover .todo-array button": "show_tooltip"

initialize: () ->
Expand All @@ -16,7 +19,8 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View

tagName: "td"


toggleDone : () ->
return

destroy: () ->
@model.destroy()
Expand Down Expand Up @@ -60,12 +64,23 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
alert(num)


show_index: (ev) ->
num = $(ev.target).index()
show_index: (ev) ->
item = $(ev.target)
num =(item).index()
array = @model.split()
array[num...num] = ['=']
text = array.join("")
@model.save(
content: text
)

whiteSpaceCheck: (ev) ->
item = $(ev.target)

$(item).toggleClass("test1");
num =(item).index()





Expand Up @@ -5,18 +5,22 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View

events:
"click .destroy" : "destroy"
"click .todo-array button": "show_index"
"dblclick .todo-array button": "show_index"

"click .todo-array button": "whiteSpaceCheck"
"click .check" : "toggleDone"

#"hover .todo-array button": "show_tooltip"

initialize: () ->
this.model.bind('change', this.render);

className: 'sspann'

tagName: "div"

tagName: "td"

toggleDone : () ->
return

destroy: () ->
@model.destroy()
Expand Down Expand Up @@ -60,12 +64,23 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
alert(num)


show_index: (ev) ->
num = $(ev.target).index()
show_index: (ev) ->
item = $(ev.target)
num =(item).index()
array = @model.split()
array[num...num] = ['=']
text = array.join("")
@model.save(
content: text
)

whiteSpaceCheck: (ev) ->
item = $(ev.target)

$(item).toggleClass("test1");
num =(item).index()





15 changes: 15 additions & 0 deletions app/assets/stylesheets/bootstrap_and_overrides.css.less
Expand Up @@ -108,5 +108,20 @@ white-space:normal;
border:1px solid #0000ff;
font-stretch:expanded;
font-weight:bold;
/*
*transition-delay: 1s;
*/
}
.test1{

white-space:normal;

border:1px solid #0000ff;
font-stretch:expanded;
font-weight:bold;
/*
*transition-delay: 1s;
*/
}


9 changes: 8 additions & 1 deletion app/assets/stylesheets/bootstrap_and_overrides.css.less~
@@ -1,5 +1,7 @@
@import "twitter/bootstrap/bootstrap";
@import "twitter/bootstrap/responsive";
/*
*@import "twitter/bootstrap/responsive";
*/


// Set the correct sprite paths
Expand Down Expand Up @@ -106,5 +108,10 @@ white-space:normal;
border:1px solid #0000ff;
font-stretch:expanded;
font-weight:bold;
transition-delay: 11s;
}
.test1{

}


0 comments on commit 3881681

Please sign in to comment.