Rushabh Mehta | ab1148c | 2012-01-31 18:01:16 +0530 | [diff] [blame] | 1 | // Tools Page |
| 2 | erpnext.ListPage = Class.extend({ |
| 3 | init: function(opts) { |
| 4 | var me = this; |
| 5 | this.opts = opts; |
| 6 | this.page = page_body.add_page[opts.title]; |
| 7 | this.page.wrapper = $a(this.page, 'div', 'layout_wrapper'); |
| 8 | this.page.head = new PageHeading(this.wrapper, this.title) |
| 9 | this.page.list = new wn.widgets.Listing({ |
| 10 | parent: this.page.wrapper, |
| 11 | query: opts.query, |
| 12 | render:row: opts.render_row |
| 13 | }); |
| 14 | }, |
| 15 | show: function() { |
| 16 | if(this.first) { |
| 17 | this.page.list.run(); |
| 18 | this.first = false; |
| 19 | } |
| 20 | page_body.change_to(this.opts.title); |
| 21 | } |
| 22 | }); |
| 23 | |
| 24 | erpnext.ToolsPage = erpnext.ListPage.extend({ |
| 25 | init: function(opts) { |
| 26 | this._super({ |
| 27 | title: opts.module + ' Settings', |
| 28 | query: repl('select name, description from tabDocType where \ |
| 29 | module=%(module)s and ifnull(issingle,0)=1 order by name asc', opts), |
| 30 | render_row: function(parent, data) { |
| 31 | parent.innerHTML = repl('<a href="#!Form/%(name)s/%(name)s">%(name)s</a>\ |
| 32 | <div class="comment">%(description)s</div>', data) |
| 33 | } |
| 34 | }) |
| 35 | } |
| 36 | }); |