use of com.erudika.para.core.Tag in project scoold by Erudika.
the class Post method createTags.
private void createTags() {
if (getTags() == null || getTags().isEmpty())
return;
ArrayList<Tag> tagz = new ArrayList<Tag>();
for (int i = 0; i < getTags().size(); i++) {
String ntag = getTags().get(i);
Tag t = new Tag(StringUtils.truncate(Utils.noSpaces(Utils.stripAndTrim(ntag, " "), "-"), 35));
if (!StringUtils.isBlank(t.getTag())) {
Pager tagged = new Pager(1);
client().findTagged(getType(), new String[] { t.getTag() }, tagged);
t.setCount((int) tagged.getCount() + 1);
getTags().set(i, t.getTag());
tagz.add(t);
}
}
client().createAll(tagz);
}
use of com.erudika.para.core.Tag in project scoold by Erudika.
the class TagsController method get.
@GetMapping
public String get(@RequestParam(required = false, defaultValue = "count") String sortby, HttpServletRequest req, Model model) {
Pager itemcount = utils.getPager("page", req);
itemcount.setSortby(sortby);
itemcount.setDesc(!"tag".equals(sortby));
List<Tag> tagslist = utils.getParaClient().findTags("*", itemcount);
model.addAttribute("path", "tags.vm");
model.addAttribute("title", utils.getLang(req).get("tags.title"));
model.addAttribute("tagsSelected", "navbtn-hover");
model.addAttribute("itemcount", itemcount);
model.addAttribute("tagslist", tagslist);
return "base";
}
Aggregations