source: Dev/branches/rest-dojo-ui/client/config/docs.json @ 386

Last change on this file since 386 was 386, checked in by hendrikvanantwerpen, 13 years ago
  • Changed questions view to return null for empty topic/categorie and leave presentation of null to TabbedQuestionWidget?.
File size: 2.7 KB
Line 
1{
2    "_users/rft_admin": {
3        "__configAction": "ignore",
4        "_id": "org.couchdb.user:rft_admin",
5        "name": "rft_admin",
6        "password": "Welkom01",
7        "roles": [ "rft_admin" ],
8        "type": "user"
9    },
10    "rft/_security": {
11        "__configAction": "ignore",
12        "admins" : {
13            "names" : [],
14            "roles" : ["rft_admin"]
15        },
16        "readers" : {
17            "names" : [],
18            "roles" : ["rft_user"]
19        }
20    },
21    "rft/q1": {
22        "__configAction": "update",
23        "_id": "q1",
24        "title": "How long have you worked here?",
25        "categories": [
26            "Professional background"
27        ],
28        "topic": "Work experience",
29        "type": "Question"
30    },
31    "rft/q2": {
32        "__configAction": "update",
33        "_id": "q2",
34        "title": "How many years have you been employed here?",
35        "categories": [
36            "Respondent personals",
37            "Professional background"
38        ],
39        "topic": "Work experience",
40        "type": "Question"
41    },
42    "rft/q3": {
43        "__configAction": "update",
44        "_id": "q3",
45        "title": "Have you worked here longer than 10 years?",
46        "categories": [
47            "Respondent personals"
48        ],
49        "topic": "Work experience",
50        "type": "Question"
51    },
52    "rft/q4": {
53        "__configAction": "update",
54        "_id": "q4",
55        "title": "Rate your experience at your current employer from 1 to 10.",
56        "type": "Question"
57    },
58    "rft/_design/default": {
59        "__configAction": "replace",
60        "_id": "_design/default",
61        "language": "javascript",
62        "validate_doc_update": "function(newDoc, oldDoc, userCtx, secObj) { if (oldDoc && oldDoc.published) { throw({forbidden: 'Published documents cannot be modified.'}); } }",
63        "views": {
64            "by_type": {
65                "map": "function(doc){ emit(doc.type, doc); }"
66            },
67            "unpublished": {
68                "map": "function(doc){ if ( doc.type === 'Survey' && !doc.published ) { emit(doc._id, doc); } }"
69            },
70            "questions": {
71                "map": "function(doc){ if ( doc.type === 'Question' ) { if ( doc.categories && doc.categories.length > 0 ) { for (var i = 0; i < doc.categories.length; i++) { emit([doc.categories[i],doc.topic || null],1); } } else { emit([null,null],1); } } }",
72                "reduce": "function(keys,values) { return sum(values); }"
73            },
74            "topics": {
75                "map": "function(doc){ if ( doc.type === 'Question' ) { emit(doc.topic, 1); } }",
76                "reduce":   "function(keys, values) { return null; }"
77            }
78        }
79    }
80}
Note: See TracBrowser for help on using the repository browser.