Partials and helpers

There are a number of partials and helpers you can use in your page’s body. If you have a question about one of these partials or helpers, please reply to this topic. If you think there’s an issue with a partial or helper, please submit a bug report. If you’d like a new partial or helper, please submit a feature request.

Helpers

All the helpers you can use are in the landing_helper.rb concern.

user_profile

Renders markup for a user profile. Pass the user object as the first argument, and an options hash as the second. Supported options are (which hopefully are self-explanatory):

  • include_avatar
  • add_bio
  • avatar_size
  • top_extra
  • bottom_extra
  • show_groups
  • show_location

Example usage: pavilion-landing-pages/about/members/body.html.erb at master · paviliondev/pavilion-landing-pages · GitHub.

user_list

Returns a list of users, currently only scoped by groups. Named arguments:

  • group_name: the group to list the users of

Example usage: pavilion-landing-pages/about/members/body.html.erb at master · paviliondev/pavilion-landing-pages · GitHub

topic_list

Returns the results of a topic query. Named arguments

  • opts: Options to pass to the topic query. Full list of options here
  • instance_var: Instance variable to store results of query in
  • username: Username of user to scope topics to. Only topics created by that user will be returned.
  • group_name: Name of group to scope topics to. Only topics created by users in that group will be returned.

Example usage: pavilion-landing-pages/software/discourse/body.html.erb at master · paviliondev/pavilion-landing-pages · GitHub

Partials

All the partials you can use are in the app/views/landing_pages/landing folder.

  • header
  • footer
  • menu
  • contact_form
  • topic_list

Aside from the contact_form, the partial should be relatively self explanatory if you can read and understand html.erb files.

contact_form

This partial lets you render a contact form which will send an email with the submitted message to defined email. There are two site settings you can use as the email endpoint.

  • The landing contact email setting will be used if set.
  • The contact email setting will be used if the landing contact email is not set.

Both the email and message are required parameters, so if the user does not include valid version of either, an error message will be returned.

9da113ec43796a28955d2344358ca862f5c6439f

The email containing the message sent to the landing contact email will be formatted according to the contact_mailer template which can be customised in admin/customize/site_texts

The resulting email will look like this

6ac502e3bcfd521807714d9c7e15c345eac9c8bb