Search in sources :

Example 1 with ContentForm

use of org.jasig.portlet.cms.mvc.form.ContentForm in project SimpleContentPortlet by Jasig.

the class ConfigureContentController method getForm.

/**
 * Get the form object for the portlet configuration.  If this portlet has
 * already been configured with content, the current HTML will be
 * pre-populated into the form object.  If this is a new portlet, the
 * initial content will be an empty string.
 *
 * @param request PortletRequest
 * @return form object for the portlet configuration
 */
@ModelAttribute("form")
public ContentForm getForm(PortletRequest request) {
    // TODO: Get the locale specified in the drop-down list
    String content = this.contentDao.getContent(request, null);
    ContentForm form = new ContentForm();
    form.setContent(content);
    return form;
}
Also used : ContentForm(org.jasig.portlet.cms.mvc.form.ContentForm) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute)

Example 2 with ContentForm

use of org.jasig.portlet.cms.mvc.form.ContentForm in project SimpleContentPortlet by Jasig.

the class ConfigureContentControllerTest method testUpdateConfigurationWithoutCleaning.

@Test
public void testUpdateConfigurationWithoutCleaning() throws PortletModeException {
    when(preferences.getValue("cleanContent", "true")).thenReturn("false");
    ContentForm form = new ContentForm();
    form.setContent(content);
    controller.updateConfiguration(request, response, form);
    verify(contentDao).saveContent(request, content, null);
}
Also used : ContentForm(org.jasig.portlet.cms.mvc.form.ContentForm) Test(org.junit.Test)

Example 3 with ContentForm

use of org.jasig.portlet.cms.mvc.form.ContentForm in project SimpleContentPortlet by Jasig.

the class ConfigureContentControllerTest method testUpdateConfiguration.

@Test
public void testUpdateConfiguration() throws ReadOnlyException, PortletModeException {
    ContentForm form = new ContentForm();
    form.setContent(content);
    controller.updateConfiguration(request, response, form);
    verify(contentDao).saveContent(request, cleanContent, null);
    verify(response).setPortletMode(PortletMode.VIEW);
}
Also used : ContentForm(org.jasig.portlet.cms.mvc.form.ContentForm) Test(org.junit.Test)

Aggregations

ContentForm (org.jasig.portlet.cms.mvc.form.ContentForm)3 Test (org.junit.Test)2 ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)1