A website template with lots of features, built with ruby on rails.

blog_posts.js.coffee 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. attachRatingHandler = ->
  2. # to set summernote object
  3. # You should change '#post_content' to your textarea input id
  4. summer_note = $('#blog_post_content')
  5. # to call summernote editor
  6. summer_note.summernote
  7. # to set options
  8. height:300
  9. # toolbar: [
  10. # ['insert', ['picture', 'link']], // no insert buttons
  11. # ["table", ["table"]],
  12. # ["style", ["style"]],
  13. # ["fontsize", ["fontsize"]],
  14. # ["color", ["color"]],
  15. # ["style", ["bold", "italic", "underline", "clear"]],
  16. # ["para", ["ul", "ol", "paragraph"]],
  17. # ["height", ["height"]],
  18. # ["help", ["help"]]
  19. #]
  20. # to set code for summernote
  21. summer_note.code summer_note.val()
  22. # to get code for summernote
  23. summer_note.closest('form').submit ->
  24. # alert $('#post_content').code()
  25. summer_note.val summer_note.code()
  26. true
  27. $(document).ready attachRatingHandler
  28. $(document).on "page:load", attachRatingHandler