app/assets/javascripts/backbone/views/page.js.coffee in tawork-0.0.17 vs app/assets/javascripts/backbone/views/page.js.coffee in tawork-0.0.18
- old
+ new
@@ -1,13 +1,27 @@
class Tawork.Views.PageView extends Backbone.View
events:
'click a.star': 'starred'
initialize: (options = {}) ->
- @page_id = @$el.data("page-id")
+ @page_id = page_id = @$el.data("page-id")
@initialize_sortable_tree()
@setup_uploader()
@$("[data-toggle=tooltip]").tooltip()
+ @$("#tag_list").tokenfield().on 'tokenfield:createtoken', (e) ->
+ $.ajax
+ method: "POST"
+ url: "/wiki/pages/#{page_id}/add_tag"
+ data:
+ tag: e.token.value
+
+ @$("#tag_list").on 'tokenfield:removetoken', (e) ->
+ $.ajax
+ method: "POST"
+ url: "/wiki/pages/#{page_id}/remove_tag"
+ data:
+ tag: e.token.value
+
initialize_sortable_tree: ->
$self = @
$( "#sortable_#{@page_id}" ).nestedSortable
handle: ".node-handle"