OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / view / button.js.coffee
1 class Pettanr.View.Button extends Tag.A\r
2   \r
3   constructor: (@url, @content, options) ->\r
4     super(options)\r
5   \r
6   initialize: (options) ->\r
7     @context = options.context || this\r
8     @class_name = options.class_name\r
9     @click_func = options.click\r
10     el = if _.isFunction(@content)\r
11       content.call(@context)\r
12     else\r
13       @content\r
14     @url = '/' + @url if @url[0] != '/'\r
15     super({\r
16       attr: {href: @url}, \r
17       class_name: @class_name,\r
18       content: el\r
19     })\r
20   \r
21   click: () ->\r
22     super()\r
23     @click_func.call(@context)\r
24     return false\r
25   \r