Class TemplatesController
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.module.web.controllers.dashboard.TemplatesController
-
@Controller public class TemplatesController extends java.lang.Object
The controller that deals with the templates pages
-
-
Constructor Summary
Constructors Constructor Description TemplatesController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
addGet(org.springframework.ui.Model model)
Handles GET requests to the add template pagejava.lang.String
addPost(@Valid TemplateForm templateForm, org.springframework.validation.BindingResult result, AccountWrapper account, boolean isAjax, org.springframework.ui.Model model)
Handles POST requests to the add template pagejava.lang.String
detectorsGetFragment(org.springframework.ui.Model model, boolean isAjax, java.lang.String language)
Handles GET requests to the detectors list page, which lists the detectors available for the specified languagejava.lang.String
indexGet()
Handles GET requests to the templates pagejava.lang.String
listGetFragment(AccountWrapper account, boolean isAjax, org.springframework.ui.Model model)
Handles GET requests to the template list page
-
-
-
Method Detail
-
indexGet
@GetMapping("/dashboard/templates") public java.lang.String indexGet()
Handles GET requests to the templates page- Returns:
- the path to the templates page template
-
listGetFragment
@GetMapping("/dashboard/templates/list") public java.lang.String listGetFragment(@ModelAttribute("account") AccountWrapper account, @ModelAttribute("isAjax") boolean isAjax, org.springframework.ui.Model model) throws NotAjaxRequest
Handles GET requests to the template list page- Parameters:
account
- the account of the current userisAjax
- whether or not the request was ajax or notmodel
- holder for model attributes- Returns:
- the path to the template list page template
- Throws:
NotAjaxRequest
- if the request was not an ajax one, the message is where to redirect the user to
-
addGet
@GetMapping("/dashboard/templates/add") public java.lang.String addGet(org.springframework.ui.Model model)
Handles GET requests to the add template page- Parameters:
model
- holder for model attributes- Returns:
- the path to the add template page template
-
addPost
@PostMapping("/dashboard/templates/add") public java.lang.String addPost(@Valid @ModelAttribute @Valid TemplateForm templateForm, org.springframework.validation.BindingResult result, @ModelAttribute("account") AccountWrapper account, @ModelAttribute("isAjax") boolean isAjax, org.springframework.ui.Model model) throws NotTemplateOwner
Handles POST requests to the add template page- Parameters:
templateForm
- the form that should be submitted in the requestresult
- the results of the validation on the form aboveaccount
- the account of the current userisAjax
- whether or not the request was ajax or notmodel
- holder for model attributes- Returns:
- the path to the add template page template
- Throws:
NotTemplateOwner
- if the user attempts to modify a template that is public and not theirs
-
detectorsGetFragment
@GetMapping("/dashboard/templates/detectors/{language}") public java.lang.String detectorsGetFragment(org.springframework.ui.Model model, @ModelAttribute("isAjax") boolean isAjax, @PathVariable("language") java.lang.String language) throws NotAjaxRequest
Handles GET requests to the detectors list page, which lists the detectors available for the specified language- Parameters:
model
- holder for model attributesisAjax
- whether or not the request was ajax or notlanguage
- the language to fetch the detectors for- Returns:
- the path to the detectors list template
- Throws:
NotAjaxRequest
- if the request was not an ajax one, the message is where to redirect the user to
-
-