Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86115720
studies.coffee
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Oct 4, 09:12
Size
802 B
Mime Type
text/x-c++
Expires
Sun, Oct 6, 09:12 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21353017
Attached To
R7177 epiph
studies.coffee
View Options
class @Study
constructor: (doc) ->
_.extend this, doc
creator: ->
Meteor.users.findOne _id: @creatorId
editingNotAllowed: ->
false
@Studies = new Meteor.Collection("studies",
transform: (doc) ->
new Study(doc)
)
Studies.before.insert BeforeInsertTimestampHook
Studies.before.update BeforeUpdateTimestampHook
Studies.allow
update: (userId, doc, fieldNames, modifier) ->
#TODO check if allowed
notAllowedFields = _.without fieldNames, 'title', 'updatedAt'
return false if notAllowedFields.length > 0
true
Meteor.methods
"createStudy": (title) ->
#TODO: check if allowed
_id = Studies.insert
title: "new Study"
creatorId: Meteor.userId()
_id
"removeStudy": (_id) ->
#TODO: check if allowed
Studies.remove
_id: _id
Event Timeline
Log In to Comment