Forms and Templates

Jump to navigation Jump to search

Forms and Templates Ready for Use

McNair Projects:

Blog Posts:

Academic Papers:

McNair Staff:

McNair Faculty:

McNair Affiliates:

McNair Affiliates:


Topic Areas

See also

Here are some Best Practices for Forms and Templates; they are clearly a work in progress, so please add to them.

Make a new class

Classes consist of a form, template and category. Come up with a spec for your class. A spec should include the name of the class you are creating, a format for the title of pages that will be put in your class, and field/property titles. Get your spec approved by your peers, Ed, or Anne, as is appropriate.

Then go to Special:CreateClass and implement your spec as follows:

  • Name the template.
    • Choose something simple. Spaces should be avoided. Sentence case is preferred. (i.e. MyName, not myname or Myname, etc.).
    • Check that your template name doesn't already exist by going here: Special:Templates
  • Generally choose side infobox
  • Name the Form the same as the template. You should probably use spaces in the category name (i.e., My Name, not MyName) for readability though.
  • Create field names and their types
    • Use verb phrases for property names whenever possible. See Don't use punctuation.
    • Fields should be pages only when there are pages associated with the values (i.e., the text in the field will be a page title)
    • Generally fields should be text unless some built-in property type (like email, url, etc,) directly applies and then we should use the appropriate field name (like email, url, etc.) when applicable. A list of built in property types is here:
    • Note that property types can be changed later. Each property has its own page. See Special:Properties for a list. You can go a property's page and redefine it by adding a tag like [[Has type::number]] to that page.
    • If you want to have a list of values in a field, choose the property type appropriately (usually text) and put the value names in a comma separated list in the Allowed Values box. Name values with a single short word whenever possible and use sentence case. When people use this template, this will allow them to only pick values that you have preselected.

Check your class

Go to your form and template pages and check them.

You can do this by typing Form:Form_Name and Template:Template_Name into the URL bar, or by searching for the forms and templates using Special:Forms and Special:Templates. If for some reason your form doesn't exist, try using Special:CreateForm - just select the right template to work with from the drop down list.

Go to your category page and check that it includes the code {{#default_form:MyName}} and so is associated with your form.

Fix your template's design

Find the <includeonly>...</includeonly> section and replace the table with an infobox

Example header old code:

 {| style="width: 30em; font-size: 90%; border: 1px solid #aaaaaa; 
 background-color: #f9f9f9; color: black; margin-bottom: 0.5em; margin-left: 1em; padding: 0.2em; 
 float: right; clear: right; text-align:left;"
 ! style="text-align: center; background-color:#ccccff;" colspan="2" 
 |<span style="font-size: larger;">{{PAGENAME}}</span>

If you'd like a template with a picture replace it with this code:

 | bodystyle   = width: 25em; background-color: #ffffff; border: 1px solid #a63c07; 
 | title       = Your Title 
 | abovestyle  = background:#0d776e; font-size: 125%; color:#ffffff
 | above       = {{{position|}}} 
 | image       = [[File:{{{image_field|placeholderimage.png}}}|200px|thumb|center]] 
 | headerstyle = background:#0d776e; color:#ffffff;
 | subheader   = {{{name}}}
 | header1     = Sub Header Text 
 | labelstyle   = width: 33%; 

Otherwise, if you just want a standard infobox, replace it with this code:

 | bodystyle   = width: 25em; background-color: #ffffff; border: 1px solid #a63c07; 
 | headerstyle = background:#0d776e; color:#ffffff;
 | subheader   = {{{name}}}
 | header1     = Your header
 | labelstyle   = width: 33%; 

Then change the body of the table to the body of an infobox by making everyline that looks like this:

 ! Title
 | [[Has title::{{{Title|}}}]] 
 ! Content status
 | {{#arraymap:{{{Content status|}}}|,|x|[[Has content status::x]]}}

Look like this instead:

 | label2      = Title
 | data2       = [[Has title::{{{Title|}}}]] 
 | label3      = Content status
 | data3       = {{#arraymap:{{{Content status|}}}|,|x|[[Has content status::x]]}}

Also replace the bottom of the table - |} - with the following:

 | belowstyle  = background:#ffffff;
 | below       = ©, 2016

Set security for a class

When a class is used for the first time, the category will exist. You should then go to Special:IntraACL and create the appropriate permissions for that category. Generally, we set the adminstration of the ACL to the Adminstrators group, and give read, write, and edit access to the Researchers group.

Note that the form and template for the class will be automatically protected by the existing ACL rules that limit form access to Researchers and template write access to Researchers. You'll need to set new ACL permissions on the specific form and template pages if you want members of the public, registered users, or other groups of users to be able to use a form and/or modify a template.

Deleting a class

To delete a class, just delete the template and the form, and remove all pages from the category.