use of org.mamute.model.TagPage in project mamute by caelum.
the class TagPageController method newTagPage.
@Post
@CustomBrutauthRules(ModeratorOnlyRule.class)
public void newTagPage(String tagName, MarkedText about) {
if (!validator.validateCreationWithTag(tagName))
return;
Tag tag = tags.findByName(tagName);
TagPage tagPage = new TagPage(tag, about);
if (!validator.validate(tagPage)) {
validator.onErrorRedirectTo(TagPageController.class).tagPageForm(tagPage.getTagName());
return;
}
tagPages.save(tagPage);
result.redirectTo(this).showTagPage(tagPage.getTagName());
}
use of org.mamute.model.TagPage in project mamute by caelum.
the class TagPageController method showTagPage.
@Get
public void showTagPage(String tagName) {
TagPage tagPage = tagPages.findByTag(tagName);
result.include(tagPage);
result.include("hasAbout", tags.hasAbout(tagPage.getTag()));
}
use of org.mamute.model.TagPage in project mamute by caelum.
the class TagPageController method editTagPage.
@Post
@CustomBrutauthRules(ModeratorOnlyRule.class)
public void editTagPage(String tagName, MarkedText about) {
TagPage tagPage = tagPages.findByTag(tagName);
tagPage.setAbout(about);
if (!validator.validate(tagPage)) {
validator.onErrorRedirectTo(TagPageController.class).editTagPageForm(tagPage.getTagName());
return;
}
result.redirectTo(this).showTagPage(tagPage.getTagName());
}
use of org.mamute.model.TagPage in project mamute by caelum.
the class TagPageController method editTagPageForm.
@Get
@CustomBrutauthRules(ModeratorOnlyRule.class)
public void editTagPageForm(String tagName) {
TagPage tagPage = tagPages.findByTag(tagName);
result.include("tagPage", tagPage);
}
use of org.mamute.model.TagPage in project mamute by caelum.
the class TagPageDAOTest method should_get_tag_page_by_tag.
@Test
public void should_get_tag_page_by_tag() {
TagPageDAO tagPages = new TagPageDAO(session);
Tag java = tag("java");
session.save(java);
tagPages.save(new TagPage(java, notMarked("aboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutaboutabout")));
TagPage javaPage = tagPages.findByTag(java.getName());
assertEquals(java.getName(), javaPage.getTagName());
}
Aggregations