Lab 8: Job Site

20 points

In this lab you will get some practice with content types and Views by setting up a job board for your lab website. The job board will allow site users to submit and view job opportunities and to apply online. A custom views will show available jobs in selected departments.


    Define a Job content type

  1. If you haven't already, enable Clean URLs for your website. This requires telling Apache2 to allow the use of .htaccess files (such as /var/www/html/.htaccess) to set configuration options. To do so, edit /etc/apache2/apache2.conf and in the section set AllowOverride to All. Restart apache and enable Clean URLs in the Configuration administration menu.
  2. Install and enable Entity, Entity Reference, and Chaos Tools [if it isn't already installed]. Also enable the Entity API module. Make sure Field, Field UI, Number, and List are enabled.
  3. Create a new content type called "Job". Set the description to "A currently available job." Change the Title field label to "Job title". Disallow comments. Click "Save and add fields."
  4. Now make some additions and changes to the fields.
  5. Click the Manage Display tab to adjust the way the fields will appear.
    • Make the Description field last and set its label to "Above". Make the other three fields "Inline".
    • Click the gear icon to the right of the salary field and set the thousands marker to a comma.
    • Click the gear icon to the right of the Contact field and check "Link label to the referenced entity".
  6. Next, let's make some adjustments to the teaser view of a job. Still under Manage Display, click the "Teaser" button in the upper right.
    • Move the Department field to the top of the list and Salary just below it.
    • Set the salary thousand marker to comma again.
    • Set the labels to Inline for Department and Salary. Set the Description label to Hidden.
    • Set the Description trim length to 200.
  7. Set user role permissions so editors will be able to create Job content, delete own job content, and edit own job content. Administrators should have all permissions for job content.
  8. Add three example jobs from two different departments. In addition to title, salary, and contact person, put in job descriptions that are one or two sentences long.
  9. Define a Job Application content type

  10. Create a content type called Job Application with description "An application for a position." Set publishing options so that job applications are not promoted to the front page.
  11. Change the name of the Body field to "Introductory Note."
  12. Add a new field titled "Job" (machine name field_jobref) of type Entity Reference. Use a select list as the entry widget. Set the target type to Node and click the Job checkbox.
  13. Add a field titled "Resume" of type file. Enter help text "Upload your resume." Set the allowed file extensions to "pdf doc docx txt pages odf". Limit uploads to 2MB.
  14. Order the fields Title, Job, Introductory Note, Resume.
  15. Set up permissions so that administrators have all permissions on job applications and authenticated users can create them.

    Set up a job view

  16. Install the modules Views and Advanced help. Enable Views, Views UI, and Advanced Help.
  17. Next, we will create a view that allows us to browse the available jobs. Click Structure -> Views -> Add to create a new view titled "Jobs" of Content of type Job. Set the title to "Available positions", the path to jobs, and display format to Table. Also create a menu link titled "Available Positions" and an RSS feed. Click "Continue & Edit".

    Next we'll adjust some settings on the main Views page. Note that you can scroll down to the bottom to see the preview at any point.

  18. In the Fields section, the Title is already show. Add the fields Content: Contact, Content: Post date, and Content: Salary. For the Contact field, click "Link label to referenced entity." For the Content: Contact field accept the default display options. For the Post date field, set the Date format to "Time ago (with "ago" appended)." For the Salary field set the thousands marker to comma. Click the down arrow beside "add" and select "rearrange" to put the fields in the order Title, Post date, Salary, Contact.
  19. Note that we are currently displaying jobs in all departments. We want to add a contextual filter to allow us to select the department. Click Advanced to show the advanced options. Add a contextual filter, and
    • Select Content: Department.
    • Click to Display a Summary when the filter value is not in the URL
    • Click the "Override title" checkbox and enter "Jobs in the %1 department".
    • In the More section, set Case to Capitalize each word, Case in Path to Lower case, and click Transform Spaces to dashes in URL.
  20. Click to save your view. In the preview section, enter a department name in the box and update the preview. Note the change in the jobs listed. Also check out the yourwebsite/jobs page.

    Set up an applications view

  21. Add a new view with settings as follows:
    View settingValue
    View nameApplications
    ShowContent of type Job application
    Page Settings 
    Display formatTable
    Create a menu linkChecked; Menu: Navigation menu
  22. Add the fields Content: Job and Content: Post date. Select the date short format.
  23. We also want to add the name of the applicant, but it's not in the list. There is a field Content: Author uid, but the message under the field says "If you need more fields than the uid add the content: author relationship." Let's do that.

    In the advanced section add a relationship. Select Content: Author and click Apply. Now you can add the User: Name field to the list of fields. Put the fields in the order Post date, Title, Name, Job.

  24. Job applications are obviously sensitive, so set it so that only editors view applications. In the page settings section, click Permission. Click Role, then Editor. Save your changes.
  25. Click Save to save your view.
  26. Add a job application with a random file attached as a "resume". Follow the link in the navigation menu to view it.

    Turn In

    I will check your lab website directly from the link on the course page.