Skip to content

Commit

Permalink
view js for the tag
Browse files Browse the repository at this point in the history
  • Loading branch information
BimoZX committed Apr 10, 2012
1 parent 590c831 commit 89462c3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions web-client_v2/app/assets/javascripts/view/list/list_jot_tag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
window.ListJotTagView = Backbone.View.extend({
template: _.template($('#list-jot-tag-template').html()),

render: function(){
this.data = this.model;

$(this.el).html(this.template(this.data));
},

events: {
'click .jot_middle_tags_active': 'remove_tag'
},

remove_tag: function(){
var tag_remove_regex = new RegExp('(.*)#' + this.data.name + '(.*)', 'i');
var new_string = $('#jot-form-title-field').val().replace(tag_remove_regex, '$1$2');

$('#jot-form-title-field').val(new_string);
this.remove();
}

})

0 comments on commit 89462c3

Please sign in to comment.