Skip to content
Browse files

button click toggling white-space

  • Loading branch information...
1 parent b950a68 commit 3881681abb56ba55d8b80f5bf4ad0fba9e0fe70d @brownman committed Oct 25, 2012
View
1 app/assets/javascripts/backbone/models/comment.js.coffee
@@ -3,6 +3,7 @@ class RailsBackboneRelational.Models.Comment extends Backbone.RelationalModel
defaults:
content: null
+ done: false
#initialize: () ->
#console.log(this)
View
4 app/assets/javascripts/backbone/models/comment.js.coffee~
@@ -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')
View
4 app/assets/javascripts/backbone/templates/comments/comment.jst.ejs
@@ -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 " >
@@ -11,6 +14,7 @@
+
<a href="/comments#/<%= comment.id %>/destroy" class="destroy">kill</a>
View
8 app/assets/javascripts/backbone/templates/comments/comment.jst.ejs~
@@ -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 " >
@@ -11,8 +14,9 @@
+
<a href="/comments#/<%= comment.id %>/destroy" class="destroy">kill</a>
-</td>
+</div>
View
23 app/assets/javascripts/backbone/views/comments/comment_view.js.coffee
@@ -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: () ->
@@ -16,7 +19,8 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
tagName: "td"
-
+ toggleDone : () ->
+ return
destroy: () ->
@model.destroy()
@@ -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()
+
+
+
+
View
25 app/assets/javascripts/backbone/views/comments/comment_view.js.coffee~
@@ -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()
@@ -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()
+
+
+
+
View
15 app/assets/stylesheets/bootstrap_and_overrides.css.less
@@ -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;
+ */
}
+
View
9 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
@@ -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.
Something went wrong with that request. Please try again.