annotate app/assets/javascripts/zp.new.coffee @ 373:6e3e1e7b0212

Handle unique error in model instead of controller.
author nanaya <me@myconan.net>
date Sat, 06 Jun 2015 22:12:56 +0900
parents 5a4d31e97937
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
351
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
1 #= require jquery.autosize
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
2 #= require autosize_box_fix
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
3 window.zp.new =
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
4 input: -> $("#paste_paste")
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
5
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
6 clear: (e) ->
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
7 e.preventDefault()
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
8 @input().val("").focus()
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
9
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
10 init: ->
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
11 return unless @input().length
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
12
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
13 $(document).on "click", "#reset_paste", $.proxy(@clear, this)
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
14 @input().autosize className: "mirrored_text form-control", append: "\n"
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
15 $.autosize_box_fix $(".mirrored_text")
66fd92af3977 coffee: new.
edogawaconan <me@myconan.net>
parents: 347
diff changeset
16 @input().focus()