Remove old unused backbone code
This commit is contained in:
parent
f05b787ac3
commit
ac64d04a51
@ -11,7 +11,6 @@
|
||||
//= require underscore-min
|
||||
//= require backbone-min
|
||||
//= require jquery.timeago
|
||||
//= require backbone/asciinema
|
||||
|
||||
$(function() {
|
||||
$('abbr.timeago').timeago();
|
||||
|
@ -1,11 +0,0 @@
|
||||
#= require_self
|
||||
#= require_tree ./templates
|
||||
#= require_tree ./models
|
||||
#= require_tree ./views
|
||||
#= require_tree ./routers
|
||||
|
||||
window.Asciinema =
|
||||
Models: {}
|
||||
Collections: {}
|
||||
Routers: {}
|
||||
Views: {}
|
@ -1,7 +0,0 @@
|
||||
class Asciinema.Models.Comment extends Backbone.Model
|
||||
|
||||
user: ->
|
||||
this.get('user')
|
||||
|
||||
class Asciinema.Collections.Comments extends Backbone.Collection
|
||||
model: Asciinema.Models.Comment
|
@ -1,4 +0,0 @@
|
||||
class Asciinema.Views.Base extends Backbone.View
|
||||
|
||||
current_user: ->
|
||||
Asciinema.current_user
|
@ -1,33 +0,0 @@
|
||||
class Asciinema.Views.CommentsIndex extends Asciinema.Views.Base
|
||||
|
||||
el: '#comments'
|
||||
|
||||
initialize: ->
|
||||
@collection.on('reset', @addAll, this)
|
||||
@collection.on('add', @addOne, this)
|
||||
|
||||
$('#new-comment').submit (event) =>
|
||||
@createComment(event)
|
||||
|
||||
addAll: ->
|
||||
@collection.each (comment) =>
|
||||
@addOne(comment)
|
||||
|
||||
addOne:(comment) ->
|
||||
view = new Asciinema.Views.CommentEntry({ model: comment, collection: @collection})
|
||||
$(this.el).append view.render().el
|
||||
|
||||
createComment: (event) ->
|
||||
event.preventDefault()
|
||||
|
||||
attrs = body: $('#comment-body').val()
|
||||
@collection.create attrs,
|
||||
wait: true
|
||||
success: -> $('#new-comment')[0].reset()
|
||||
error: @handleError
|
||||
|
||||
handleError: (comment, response) ->
|
||||
if response.status == 422
|
||||
errors = $.parseJSON(response.responseText).errors
|
||||
for attribute, messages of errors
|
||||
alert "#{attribute} #{message}" for message in messages
|
@ -1,5 +0,0 @@
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
Asciinema.current_user = <%= raw current_user.to_json(:only => [:id, :nickname, :avatar_url]) %>;
|
||||
});
|
||||
</script>
|
@ -8,7 +8,6 @@ html[lang="en"]
|
||||
= javascript_include_tag "application"
|
||||
= javascript_include_tag "player"
|
||||
= favicon_link_tag 'favicon.png'
|
||||
= render :partial => 'layouts/current_user_js'
|
||||
= render :partial => 'layouts/ga'
|
||||
script
|
||||
| window.mainWorkerPath = '#{javascript_path "main_worker"}';
|
||||
|
Loading…
Reference in New Issue
Block a user