Make the tag result list scrollable so long tags can be read
[ajatus.git] / js / content_types / note.js
blobc274f1f2ae9e6feb9cfed041ceb9438e58e4dc40
1 /*
2  * This file is part of
3  *
4  * Ajatus - Distributed CRM
5  * @requires jQuery v1.2.1
6  * 
7  * Copyright (c) 2007 Jerry Jalava <jerry.jalava@gmail.com>
8  * Copyright (c) 2007 Nemein Oy <http://nemein.com>
9  * Website: http://ajatus.info
10  * Licensed under the GPL license
11  * http://www.gnu.org/licenses/gpl.html
12  * 
13  */
15 (function($){
16     $.ajatus = $.ajatus || {};
17     $.ajatus.content_type = $.ajatus.content_type || {};
18     
19     $.ajatus.content_type.note = function()
20     {
21         var self = this;
22         this.name = 'note';
23         this.title = 'Note';
24         this.in_tabs = true;
25         this.history_support = true;
26         this.enable_additionals = true;
27         
28         this.pool_settings = {
29             enabled: true,
30             settings: {
31                 type: 'scroll'
32             }
33         };
34         
35         this.schema = {
36             title: {
37                 label: 'Title',
38                 widget: {
39                     name: 'text',
40                     config: {}
41                 },
42                 def_val: '',
43                 required: true
44             },
45             description: {
46                 label: 'Description',
47                 widget: {
48                     name: 'wiki',
49                     config: {}
50                 },
51                 def_val: ''
52             },
53             tags: {
54                 label: 'Tags',
55                 widget: {
56                     name: 'tags',
57                     config: {}
58                 },
59                 def_val: []
60             }
61         };
63         this.list_map = 'map( doc.value.metadata.created.val, {"_type": doc.value._type,';
64         this.list_map += '"report_id": doc.value.report_id,';
65         this.list_map += '"title": doc.value.title,';
66         this.list_map += '"tags": doc.value.tags,';
67         this.list_map += '"creator": doc.value.metadata.creator,';
68         this.list_map += '"created": doc.value.metadata.created';
69         this.list_map += '});';
70         
71         this.gen_views = function() {
72             this.views = {
73                 list: $.ajatus.views.generate(this.view_header+this.list_map+this.view_footer),
74                 list_at: ''
75             };        
76             this.statics = {
77                 list: this.views.list
78             };
79         };
80         
81         this.list_headers = [
82             'title', 'created', 'creator'
83         ];
84         
85         this.tab = {
86             on_click: function(e) {
87                 $.ajatus.tabs.on_click(e);
88                 this.render();
89             }
90         };
91     };
92     
93     $.ajatus.preferences.client_defaults.content_types['note'] = new $.ajatus.content_type.note();
95 })(jQuery);