-
-
Notifications
You must be signed in to change notification settings - Fork 196
Alaveteli Projects
Gareth Rees edited this page Jan 26, 2023
·
11 revisions
Set ENABLE_PROJECTS: true
in config/general.yml
.
Migrate the database bundle exec rake db:migrate
if you don't have the projects
table.
Run bundle exec rake db:seed
to ensure you have the roles necessary for projects.
user = User.find_by(email: 'annie@localhost')
project = Project.create(
owner: user,
title: 'My first project',
briefing: '<p>Collaborate!</p>'
)
# Examples of how to add requests or batches
# Note that your user needs to have these already created
project.batches << user.info_request_batches.last
project.requests << user.info_requests.where(info_request_batch_id: nil).last
# Add some contributors
project.contributors << User.find_by(email: 'bob@localhost')
Visit /projects/1
.
p = Project.find(1)
ks = Dataset::KeySet.create(resource: p)
k1 = Dataset::Key.create(key_set: ks, title: 'Is there anything of interest in this request?', format: 'text', order: 1)
k2 = Dataset::Key.create(key_set: ks, title: 'Did they attach a spreadsheet?', format: 'boolean', order: 2)
k3 = Dataset::Key.create(key_set: ks, title: 'How many things are there?', format: 'numeric', order: 3)
Note that order
must be unique per KeySet
.
token = SecureRandom.hex(6)
# => "b2b4ae955453"
project.update(invite_token: token)
Visit /p/b2b4ae955453
.
See #7542.