Views

Keywords: 

Earlier, the team made a list of the views the IS needs:

  • Members (public)
  • People (manager)
  • Members with unpaid dues (manager)
  • Projects (public)
  • Projects (manager)
  • Events (public and manager)

Time to make them.

You can see the public views on the site. To see what the IS looks like for an org manager, go to the IS’s login page, and login with user name manager and password password. You can see all the edit pages, but you won’t be able to change anything.

Members (public)

The team made these decisions about this view:

View Members (public)
Access Public
Content type Person
Filter Affiliation is Member
Node is published
Fields Name
Major(s)
Project(s)
Display Table

It’s easier to make the view, when we have a specification like this. W00t for planning!

Structure | Views, Add new view. Settings:

Members settings

  • Show content of type Person
  • Create a page
  • Show a table
  • No pager
  • Make a menu link

Save.

Here’s the model again:

View Members (public)
Access Public
Content type Person
Filter Affiliation is Member
Node is published
Fields Name
Major(s)
Project(s)
Display Table

We need to finish the filter and the fields, and check the access.

Here are the rest of the settings:

More settings.

Let’s see:

  • Fields – add major and project
  • Filter – published, content type is Person, Affiliation is member
  • Sorting by Title, labelled as Name
  • Access is open

Looks good. Try it. Yahoo!

Next view.

People (manager)

View People
Access Managers
Content type Person
Filter None
Fields Everything
Display Table

Here are the settings:

Settings

Things to note:

  • The team changed the title of the view, because Drupal already had a built-in People view.
  • Published is a field, so users can see which nodes are on hold.
  • The last field is a link with the text Edit. More later.
  • The only filter is for the content type.
  • Access is restricted by role, to Administrator and Org manager.

Here’s what it looks like:

People

Each row has an Edit link on the right. Clicking it will show the edit form for that node, same as if you’d gone to the page for that node and clicked the Edit tab:

Edit tab

Members with unpaid dues (manager)

Here’s the model for the view.

View Unpaid dues
Access Managers
Content type Person
Filter Due paid? = No
Affiliation = Member
Fields Name
Email
Phone
Published
Display Table

Here’s the views settings:

Unpaid dues settings

Nothing new here. Access is restricted by role, to Administrator and Org manager. Remember, you can see the management views by going to the IS’s login page, and login with user name manager and password password.

Projects (public) and Projects (manager)

This view shows the projects that org members are working on. Specs:

View Projects (public)
Access Public
Content type Project
Filter Published = Yes
Fields Everything
Display Unformatted list

Here’s how the view looks to the public:

Projects, public

Here’s how it looks to managers:

Projects, managers

The only difference is that managers see an Edit link.

We can make one view for both. Make a view with an Edit link. Drupal will only show the link for users who have permission to edit. We already set the permissions to give Org managers permission to edit Projects, while Anonymous users don’t have permission to edit Projects. So everything is already set.

W00t for smart business software!

Here are the settings for the view:

Settings

Events

Here are the settings:

Events settings

Notice the edit link. It will only show for users with permission to edit content. So the one view works for managers and the public.

Exercise

Exercise: Your gamerz: views
Create the views for your gamerz site. You’ll need:
  • Members (public)
  • People (manager)
  • Members with unpaid dues (manager)
  • Projects (public)
  • Projects (manager)
  • Events (public and manager)
Submit the URL of your site, and the login credentials for user 1.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Summary

W00t! We have all the views. For each one, we looked at the view’s model, and made a view to match. Because Drupal is smart about only showing Edit links to people who have permission to edit, one view could serve both managers and the public, for Projects and Events.