Permalink
Browse files

user form: can change delay of expended cell

  • Loading branch information...
1 parent ee61cd4 commit 7e6d2604d504d2f89d6b934ba2e927b9c8fbd374 @brownman committed Nov 6, 2012
View
4 app/assets/javascripts/backbone/templates/comments/comment.jst.ejs
@@ -7,8 +7,10 @@
<input type="checkbox" name="direction" class="direction checkbox span12" <%= obj.direction ? 'checked="checked"' : '' %> />
<input class='span12' height='1em' type='text' value='<%= obj.title %>'></input>
+<input label='time: ' tooltip='delay in seconds' class='seconds span12' height='1em' type='text' value='<%= obj3 %>'></input>
-<input height='1em' class='span12' name="content" value='<%= obj.content %>' />
+
+<input height='1em' class=' span12' name="content" value='<%= obj.content %>' />
View
6 app/assets/javascripts/backbone/templates/comments/comment.jst.ejs~
@@ -4,11 +4,13 @@
-<input type="checkbox" name="direction" class="checkbox span12" <%= obj.direction ? 'checked="checked"' : '' %> />
+<input type="checkbox" name="direction" class="direction checkbox span12" <%= obj.direction ? 'checked="checked"' : '' %> />
<input class='span12' height='1em' type='text' value='<%= obj.title %>'></input>
+<input tooltip='delay in seconds' class='seconds span12' height='1em' type='text' value='<%= obj3 %>'></input>
-<input height='1em' class='span12' name="content" value='<%= obj.content %>' />
+
+<input height='1em' class=' span12' name="content" value='<%= obj.content %>' />
View
43 app/assets/javascripts/backbone/views/comments/comment_view.js.coffee
@@ -4,27 +4,26 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
template: JST["backbone/templates/comments/comment"]
- @status = 'saved'
+ this.log = _.bind(alert, console);
+
events:
"click .destroy" : "destroy"
- "dblclick .todo-array button": "show_index"
+ "dblclick .todo-array button": "push_index"
"click .todo-array button": "whiteSpaceCheck"
"click .direction" : "toggleDone"
"click .save" : "save_array"
+
+ "blur .seconds" : "set_delay"
#"hover .todo-array button": "show_tooltip"
initialize: () ->
-
- @status = 'false'
-
- #@update_status(false)
-
- @status = 'saved!'
- this.model.bind('change', this.before_render);
+ @status = 'saved'
+ @seconds = 10
+ this.model.bind('change', this.before_render);
before_render:() =>
@status = 'saved'
@@ -60,10 +59,13 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
comment = @model.toJSON()
status = @status.toString()
+ seconds = @seconds.toString()
+
tmp = @template(
'obj': comment
'listed2': listed2
'obj2': status
+ 'obj3': seconds
)
$(@el).html(tmp)
@@ -83,7 +85,7 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
alert(num)
- show_index: (ev) ->
+ push_index: (ev) ->
item = $(ev.target)
num =(item).index()
array = @get_array()
@@ -110,16 +112,23 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
content: text
)
+
+
whiteSpaceCheck: (ev) ->
- item = $(ev.target)
- str = item.context.innerText
-
+ item = ev.target
+ str = $(item).context.innerText
if(str != '=')
- $(item).toggleClass("test1");
- num =(item).index()
+ _.delay(_.bind(this.something, item), @seconds * 1000 , 'logged later')
+ $(item).toggleClass("test1")
else
- @show_index(ev)
-
+ @push_index(ev)
+
+ something: (msg) ->
+ $(this).toggleClass("test1")
+
+ set_delay: (ev) ->
+ @seconds = ev.target.value
+ console.log(@seconds)
View
45 app/assets/javascripts/backbone/views/comments/comment_view.js.coffee~
@@ -4,27 +4,26 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
template: JST["backbone/templates/comments/comment"]
- @status = 'saved'
+ this.log = _.bind(alert, console);
+
events:
"click .destroy" : "destroy"
- "dblclick .todo-array button": "show_index"
+ "dblclick .todo-array button": "push_index"
"click .todo-array button": "whiteSpaceCheck"
"click .direction" : "toggleDone"
"click .save" : "save_array"
+
+ "blur .seconds" : "set_delay"
#"hover .todo-array button": "show_tooltip"
initialize: () ->
-
- @status = 'false'
-
- #@update_status(false)
-
- @status = 'saved!'
- this.model.bind('change', this.before_render);
+ @status = 'saved'
+ @seconds = 10
+ this.model.bind('change', this.before_render);
before_render:() =>
@status = 'saved'
@@ -60,10 +59,13 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
comment = @model.toJSON()
status = @status.toString()
+ seconds = @seconds.toString()
+
tmp = @template(
'obj': comment
'listed2': listed2
'obj2': status
+ 'obj3': seconds
)
$(@el).html(tmp)
@@ -72,7 +74,7 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
splitted2: ->
arr0 = @get_array()
- list = "<% _.each(people, function(name) { %> <button class='btn btn-info btn-block CodeMirror-wrap test'><%= name %></button> <% }); %>";
+ list = "<% _.each(people, function(name) { %> <button class='btn btn-info btn-block test'><%= name %></button> <% }); %>";
arr = _.template(list, {people : arr0});
#console.log(arr)
arr
@@ -83,7 +85,7 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
alert(num)
- show_index: (ev) ->
+ push_index: (ev) ->
item = $(ev.target)
num =(item).index()
array = @get_array()
@@ -110,16 +112,23 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
content: text
)
+
+
whiteSpaceCheck: (ev) ->
- item = $(ev.target)
- str = item.context.innerText
-
+ item = ev.target
+ str = $(item).context.innerText
if(str != '=')
- $(item).toggleClass("test1");
- num =(item).index()
+ _.delay(_.bind(this.something, item), @seconds * 1000 , 'logged later')
+ $(item).toggleClass("test1")
else
- @show_index(ev)
-
+ @push_index(ev)
+
+ something: (msg) ->
+ $(this).toggleClass("test1")
+
+ set_delay: (ev) ->
+ @seconds = ev.target.value
+ console.log(@seconds)
View
3 app/assets/javascripts/bootstrap.js.coffee
@@ -6,3 +6,6 @@ jQuery ->
toggle: true
})
console.log('start')
+
+ #fn.do_ping: () =>
+ #alert('ping')
View
9 app/assets/javascripts/bootstrap.js.coffee~
@@ -2,7 +2,10 @@ jQuery ->
#$("a[rel=popover]").popover()
#$(".tooltip").tooltip()
#$("a[rel=tooltip]").tooltip()
- #$('.accordion-group').collapse({
- #toggle: true
- #})
+ $('.accordion-group').collapse({
+ toggle: true
+ })
console.log('start')
+
+ fn.do_ping: () =>
+ alert('ping')

0 comments on commit 7e6d260

Please sign in to comment.