app/assets/javascripts/hooch.js in hooch-0.15.22 vs app/assets/javascripts/hooch.js in hooch-0.15.23
- old
+ new
@@ -848,11 +848,33 @@
})
}
}),
Link: Class.extend({
init: function($link){
- $link.click(function(){
- window.location = $link.attr('href');
+ this.$link = $link;
+ this.getTarget()
+ this.bindLink()
+ },
+ getTarget: function($link){
+ this.target = this.$link.data('link-target')
+ },
+ bindLink: function(){
+ if(this.target){
+ this.bindWithTarget()
+ } else {
+ this.bindWithoutTarget()
+ }
+ },
+ bindWithTarget: function(){
+ var link = this
+ this.$link.on('click', function(){
+ window.open(link.$link.attr('href'), this.$target)
+ })
+ },
+ bindWithoutTarget: function(){
+ var link = this
+ this.$link.on('click', function(){
+ window.location = link.$link.attr('href');
})
}
}),
CheckboxHiddenProxy: Class.extend({
init: function($checkbox){