Skip to content
Hallinnon opiskelijaedustajien hakujärjestelmä suomalaisille ylioppilaskunnille.
Ruby HTML CSS Cucumber CoffeeScript JavaScript Other
Find file
Latest commit 0ce19e2 @JukkaKarvonen JukkaKarvonen Merge pull request #115 from experq/bring_dependencies_up2date
Bring dependencies up to date



Development Environment Setup

Install RVM and Ruby

bash -s stable < <(curl -s
source ~/.bash_profile

rvm install ruby-2.0.0-p645
rvm use ruby-2.0.0-p645

Install node.js

sudo apt-get install node
brew install node

Clone the Halloped Project Repository

git clone

Install Gem Dependencies

cd hhj

rvm pkg install zlib openssl libxml2 libxslt
rvm reinstall ruby-2.0.0-p645

sudo apt-get install libqt4-dev # For qmake on Linux
brew install Qt # For qmake on OS X

If you're getting trouble from nokogiri, do

rm -rf $rvm_path/usr
rvm requirements # Copy the apt-get [...] part and sudo it
rvm reinstall ruby-2.0.0-p645

Then install bundled dependencies

gem install bundler
bundle install

Initialize development database

rake db:seed

Run tests

rake test

Run application

rails server

Run only unit tests

rake spec

Run only system tests

rake cucumber

Re-initialize development database later when needed

rake db:drop db:seed


University custom folder

All customization files of universities are in single place, under public/universities. See public/universities/helsinki for an example.

Adding a new university

Create yaml file that has university organisation. See public/universities/helsinki/helsinki.yml for an example

Note! The file name and folder name must be the same as the first part of university domain name. E.g. for => helsinki/helsinki.yml or for TTY tty/tty.yml.
Application will internally use that part or domain name as a key for university. It will also show in the url, e.g.
So if you name your folder wrong way or import organization from file with wrong name, then your organization will not work.

Execute the rake task:
  RAILS_ENV=production rake db:import:university ./public/universities/myuniversity/myuniversity.yml


Custom stylesheet for university is public/universities/myuniversity/stylesheet/myuniversity.css.styl

Custom prints

Custom pdf prints are e.g. for calls in public/universities/myuniversity/calls/show.pdf.slim

See template overriding below for more info

Custom fields for position applications

University can have its own custom fields in position applications for applicants.
See example from

  _fields.html.slim (used to render extra applicaiton fields and showing the preview of them to the applicant)
  _fields_show.html.slim  (used for showing the data for call admin)


Localizations needed for the custom fields in position applications are in public/universities/myuniversity/locales.
See public/universities/helsinki/locales for example

You should also be able to override any localization in config/locales for current university using the university specific locale file.

Template overriding

Basicly all ui templates can be overriden for university. The current university custom folder has top priority when Rails searches
for ui templates. For example, if helsinki is current university, then the open calls page calls/index.html.slim is first searched under
the public/universities/helsinki and if not found then under app/views. This is how the overriding of print templates etc. is achieved.

Even though it is possible to override other than pdf print templates also, be aware that it should not be done just because you can and
will probably lead to maintenance problems and other dark places.

Security concerns

Keep in mind that all university specific files are under pubic folder, so they can be directly accessed freely if you know the resource path.
This should not be a problem since there is no sensitive data by default there. And this whole repo is open anyway.

Admin view

Database can be administrated using rails_admin plugin (

Admin url is

You can basicly add Organ, Organization, User, more Admins or whatever with it. You can edit names etc.

If you need to edit localized string that is stored in database (like organ name) you can change the language of
admin view to edit the string for that language. E.g.

Remember to use very strong passwords for all the admins!!!

Eligibility rules

You can define eligibility rules for applicants using the Admin view.

  First add new Eligibility rule. Currently only rules that compare a known haka edu person field to a list of valid values is supported.

  Then add a rule set to hold the rule you created. You need to add the rule set also to a root level organization (university).

  You can of course define multiple rules for rulesets. And rulesets can share rules, even between universities. But rulesets are university
  specific. They will show up in the new call form, where you can select any rule set you have defined for university.

  If eligibility rules are not met by applicant then applicant is marked as not eligible. Call admin can then decide whether to
  reject or select the applicant. Eligibility rules do not technically prevent selecting applicant, that decision is always made by

Production environment Setup

Install Qt (PDF printing has qt dependency)

yum install qt

You might also need to install wkhtmltopdf binary manually. At least Redhat could not use the wkhtmltopdf binary that comes with the gems. Install working wkhtmltopdf binary to ~/bin folder (app is configured to use it from there)

Technology stack and documentation

Application is built with the Rails conventions and using lot of existing gems. If you need documentation of application, then this is good place to start

Same applies also to many other parts of applicaiton that uses existing gems. Check the gem, google for its documentation and read it.

Just to mention some technologies used: Rails 3 MongoDB using mongoid and mongoid-tree CoffeeScript Cucumber FactoryGirl

See more from the Gemfile (and google them for documentation if you need any)

Something went wrong with that request. Please try again.