Forms and Templates

From edegan.com
Revision as of 17:03, 26 October 2016 by Ed (talk | contribs)
Jump to navigation Jump to search

Forms and Templates Ready for Use

McNair Projects:

Blog Posts:

McNair Staff:

McNair Faculty:

Deprecated

Topic Areas

Make a new class

Classes consist of a form, template and category. Come up with a spec for your class. 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
    • Name fields something that will look nice on the template. Use single short words in sentence case whenever possible.
    • Use verb phrases for property names whenever possible. See https://www.semantic-mediawiki.org/wiki/Help:Property_naming. Don't use punctuation.
    • Fields should be pages only when there are pages associated with the values (i.e., 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: https://www.semantic-mediawiki.org/wiki/Help:Property_declaration
    • 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 redine it by adding a tag like [[Has type::number]] to that page.
    • If a field is a list of values, 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.

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:

 {{Infobox
 | 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:

 {{Infobox
 | 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:

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


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

 | belowstyle  = background:#ffffff;
 | below       = © McNair Center, 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.