Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

ayystudentunion/hhj

Repository files navigation

Halloped-hakujärjestelmä

Development Environment Setup

See the vagrant set up for the development VM.

Universities

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.fi => 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. halloped.fi/fi/helsinki.
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

Stylesheet

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

Prints

Most pages should print reasonably well as is. Anything that is wanted visible when printed should be in a .section div.

Custom fields for position applications

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

public/universities/helsinki
  _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)

Localization

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 (https://github.com/sferik/rails_admin)

Admin url is https://halloped.fi/en/admin/

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. https://halloped.fi/fi/admin/

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
  human.

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)

Deployment

You need to have ssh keys for the hhj user on the server you wish to deploy to. Then you can use git to deploy:

git push production master

The necessary remotes etc are setup in the development VM.

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 guides.rubyonrails.org/

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 4 MongoDB using mongoid and mongoid-tree CoffeeScript Cucumber FactoryGirl

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

About

Hallinnon opiskelijaedustajien hakujärjestelmä suomalaisille ylioppilaskunnille.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published