Permalink
Browse files

span4

  • Loading branch information...
brownman committed Oct 22, 2012
1 parent f4ffa8e commit 5aeddca810516eb87cc688444662137b50433738
Binary file not shown.
@@ -3,7 +3,10 @@ class RailsBackboneRelational.Models.Comment extends Backbone.RelationalModel
defaults:
content: null
-
+
+ #initialize: () ->
+ #console.log(this)
+ #alert('brothers:')
#save: ->
#alert('save')
@@ -3,7 +3,10 @@ class RailsBackboneRelational.Models.Comment extends Backbone.RelationalModel
defaults:
content: null
-
+
+ initialize: () ->
+ console.log(this)
+ #alert('brothers:')
#save: ->
#alert('save')
@@ -30,9 +33,9 @@ class RailsBackboneRelational.Models.Comment extends Backbone.RelationalModel
story_arr = story_enc.split('$')
story_arr
- toJSON : () ->
- json = _.clone(this.attributes);
- json
+ #toJSON : () ->
+ #json = _.clone(this.attributes);
+ #json
class RailsBackboneRelational.Collections.CommentsCollection extends Backbone.Collection
model: RailsBackboneRelational.Models.Comment
@@ -1,16 +1,23 @@
-<div class="todo-array btn-group" >
+<a>(<%= comment.id %>)</a>
+ <div class="field1">
+ <label for="title"> Enter Title:</label>
+
+ <input type="text" name="title1" id="title1" value="<%= comment.content %>" ></input>
+
+ <input type="text" name="title2" id="title2" value="<%= comment.id %>" ></input>
+ </div>
+
+
+
+<div class="btn-group todo-array " >
<%= listed2 %>
</div>
-<a>(<%= comment.id %>)</a>
-<div class="view"><%= comment.content %></div>
-
-<a></a>
<a href="/comments#/<%= comment.id %>/destroy" class="destroy">kill</a>
@@ -1,17 +1,25 @@
-<div class="todo-array btn-group" >
+<a>(<%= comment.id %>)</a>
+ <div class="field1">
+ <label for="title"> Enter Title:</label>
+
+ <input type="text" name="title1" id="title1" value="<%= comment.content %>" ></input>
+
+ <input type="text" name="title2" id="title2" value="<%= comment.id %>" ></input>
+ </div>
+
+
+
+<div class="btn-group todo-array " >
<%= listed2 %>
</div>
-
-<a>(<%= comment.id %>)</a>
<div class="view"><%= comment.content %></div>
-<a></a>
-<a href="/comments#/<%= comment.id %>/destroy" class="destroy1">kill</a>
+<a href="/comments#/<%= comment.id %>/destroy" class="destroy">kill</a>
@@ -1,5 +1,5 @@
-<tbody>
-<tr class="comments-list">
+<tbody class="comments-list">
+<tr>
</tr>
</tbody>
@@ -1,4 +1,4 @@
<div class="field">
- <label for="content"> Add comment:</label>
+ <label for="content"> Add Draft:</label>
<input type="text" name="content" class="content" value="<%= content %>" >
</div>
@@ -0,0 +1,4 @@
+<div class="field">
+ <label for="content"> Add Story:</label>
+ <input type="text" name="content" class="content" value="<%= content %>" >
+</div>
@@ -1,17 +1,20 @@
<div class="accordion-heading">
- <div class="accordion-toggle" data-toggle="collapse" data-parent="#posts-list" href="#collapseOne<%= id %>">
-<a class="title">(<%= id %>)<%= title %></a>
-<a href="#/<%= id %>/edit" class="edit"></a>
-<a href="#/<%= id %>/destroy" class="destroy"></a>
+ <div class="accordion-toggle" data-toggle="collapse" data-parent="#posts-list" href="#collapseOne<%= post.id %>">
+<a class="title">(<%= post.id %>)<%= post.title %></a>
+<a href="#/<%= post.id %>/edit" class="edit"></a>
+<a href="#/<%= post.id %>/destroy" class="destroy"></a>
</div>
</div>
- <div id="collapseOne<%= id %>" class="accordion-body collapse">
+ <div id="collapseOne<%= post.id %>" class="accordion-body collapse">
<div class="accordion-inner">
-<div class="comments"></div>
-<div class="new_comment"></div>
+ <div class="new_comment"></div>
+
+ <div class="comments" ></div>
+
+
</div>
</div>
@@ -1,17 +1,20 @@
<div class="accordion-heading">
- <div class="accordion-toggle" data-toggle="collapse" data-parent="#posts-list" href="#collapseOne<%= id %>">
-<a class="title">(<%= id %>)<%= title %></a>
-<a href="#/<%= id %>/edit" class="edit"></a>
-<a href="#/<%= id %>/destroy" class="destroy"></a>
+ <div class="accordion-toggle" data-toggle="collapse" data-parent="#posts-list" href="#collapseOne<%= post.id %>">
+<a class="title">(<%= post.id %>)<%= post.title %></a>
+<a href="#/<%= post.id %>/edit" class="edit"></a>
+<a href="#/<%= post.id %>/destroy" class="destroy"></a>
</div>
</div>
- <div id="collapseOne<%= id %>" class="accordion-body collapse in">
+ <div id="collapseOne<%= post.id %>" class="accordion-body collapse">
<div class="accordion-inner">
-<div class="comments"></div>
-<div class="new_comment"></div>
+ <div class="new_comment"></div>
+
+ <div class="comments ></div>
+
+
</div>
</div>
@@ -6,12 +6,14 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
events:
"click .destroy" : "destroy"
"click .todo-array button": "show_index"
+ #"hover .todo-array button": "show_tooltip"
initialize: () ->
this.model.bind('change', this.render);
+ console.log(@el)
+
+ className: 'span4'
-
- className: "span4"
tagName: "td"
@@ -28,15 +30,14 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
#return this;
render: =>
-
listed2 = this.splitted2()
- comment = @model #.toJSON()
+ comment = @model.toJSON()
tmp = @template(
- 'comment':comment
+ 'comment': comment
'listed2': listed2
)
-
+ console.log(tmp)
$(@el).html(tmp)
return this
@@ -54,11 +55,14 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
#console.log(arr)
arr
-
+ show_tooltip: (ev) ->
+ num = $(ev.target).index()
+ #$(@el).popover({title: 'im the title'})
+ alert(num)
+
show_index: (ev) ->
num = $(ev.target).index()
- #alert(num)
array = @model.split()
array[num...num] = ['=']
text = array.join("")
@@ -6,12 +6,14 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
events:
"click .destroy" : "destroy"
"click .todo-array button": "show_index"
+ #"hover .todo-array button": "show_tooltip"
initialize: () ->
this.model.bind('change', this.render);
+ console.log(@el)
+
+ className: 'span4'
-
- className: "span4"
tagName: "td"
@@ -28,15 +30,14 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
#return this;
render: =>
-
listed2 = this.splitted2()
comment = @model #.toJSON()
tmp = @template(
- 'comment':comment
+ 'comment': comment
'listed2': listed2
)
-
+ console.log(tmp)
$(@el).html(tmp)
return this
@@ -49,16 +50,19 @@ class RailsBackboneRelational.Views.Comments.CommentView extends Backbone.View
splitted2: ->
str = @model.split()
- list = "<% _.each(people, function(name) { %> <button class='btn btn-info btn-block CodeMirror-wrap '><%= name %></button> <% }); %>";
+ list = "<% _.each(people, function(name) { %> <button class='btn btn-info btn-block CodeMirror-wrap test'><%= name %></button> <% }); %>";
arr = _.template(list, {people : str});
#console.log(arr)
arr
-
+ show_tooltip: (ev) ->
+ num = $(ev.target).index()
+ #$(@el).popover({title: 'im the title'})
+ alert(num)
+
show_index: (ev) ->
num = $(ev.target).index()
- #alert(num)
array = @model.split()
array[num...num] = ['=']
text = array.join("")
@@ -11,7 +11,7 @@ class RailsBackboneRelational.Views.Comments.IndexView extends Backbone.View
addOne: (comment) =>
view = new RailsBackboneRelational.Views.Comments.CommentView({model : comment})
- @$(".comments-list.tr").append(view.render().el)
+ @$(".comments-list").append(view.render().el)
render: =>
$(@el).html(@template(comments: @options.comments.toJSON() ))
@@ -6,7 +6,9 @@ class RailsBackboneRelational.Views.Posts.PostView extends Backbone.View
events:
"click .destroy" : "destroy"
-
+ initialize: () ->
+ #alert('init post')
+ #alert((@model.get('comments')).length)
className: "accordion-group"
@@ -19,5 +21,25 @@ class RailsBackboneRelational.Views.Posts.PostView extends Backbone.View
return false
render: ->
- $(@el).html(@template(@model.toJSON() ))
+ num = @model.get('comments').length
+ post = @model.toJSON()
+ #alert(num)
+ tmp = @template(
+ 'post': post
+ #'length': num
+ )
+ $(@el).html(tmp)
+ return this
+
+ render2: =>
+
+ listed2 = this.splitted2()
+
+ comment = @model #.toJSON()
+ tmp = @template(
+ 'comment':comment
+ 'listed2': listed2
+ )
+
+ $(@el).html(tmp)
return this
@@ -6,16 +6,40 @@ class RailsBackboneRelational.Views.Posts.PostView extends Backbone.View
events:
"click .destroy" : "destroy"
- tagName: "div"
+ initialize: () ->
+ #alert('init post')
+ #alert((@model.get('comments')).length)
className: "accordion-group"
+ tagName: "div"
+
destroy: () ->
@model.destroy()
this.remove()
return false
render: ->
- $(@el).html(@template(@model.toJSON() ))
+ num = @model.get('comments').length
+ post = @model.toJSON()
+ #alert(num)
+ tmp = @template(
+ 'post': post
+ 'length': num
+ )
+ $(@el).html(tmp)
+ return this
+
+ render2: =>
+
+ listed2 = this.splitted2()
+
+ comment = @model #.toJSON()
+ tmp = @template(
+ 'comment':comment
+ 'listed2': listed2
+ )
+
+ $(@el).html(tmp)
return this
Oops, something went wrong.

0 comments on commit 5aeddca

Please sign in to comment.