Commit d99c2ef1 by Anton Sudak

Remove unused methods

parent 3f73b186
......@@ -22,7 +22,6 @@ import ch.insign.cms.blocks.backendlinkblock.BackendLinkBlock;
import ch.insign.cms.blocks.backendlinkblock.BackendMenuItem;
import ch.insign.cms.permissions.BlockPermission;
import ch.insign.cms.blocks.groupingblock.GroupingBlock;
import ch.insign.commons.db.MString;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
......@@ -38,7 +37,6 @@ import play.mvc.Controller;
import play.mvc.Http;
import java.util.*;
import java.util.stream.Stream;
/**
* This is a helper class for templates to work with cms objects.
......@@ -148,52 +146,6 @@ public class Template {
}
/**
* Add the data as html to the template (tags are then rendered, not escaped)
* @param input
* @return html
*/
public static Html html(String input) {
if (input == null) {
input = "";
}
return Html.apply(input);
}
/**
* Add the data as html to the template (tags are then rendered, not escaped)
* @param input
* @return html
*/
public static Html html(MString input) {
if (input == null) {
return Html.apply("");
} else {
return Html.apply(input.get());
}
}
/**
* Return the first not null, not empty string.
* Returns "" if none was found.
*/
public static String nonEmpty(Object... args) {
return Stream.of(args)
.filter(o -> o != null)
.map(Object::toString)
.filter(StringUtils::isNotBlank)
.findFirst()
.orElse("");
}
/**
* Returns whether obj is an instance of clazz
*/
public static boolean isInstanceOf(Object obj, Class clazz) {
return clazz.isInstance(obj);
}
/**
* Filter a block list and return only those that should be shown
* to the current user (applying time- and right restrictions
* and for pages also nav item visible flag checks)
......@@ -274,16 +226,6 @@ public class Template {
}
/**
* Converts any collection of String to a sorted list
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T extends Comparable> List<T> asSortedList(Collection<T> collection) {
T[] array = collection.toArray((T[]) new Comparable[collection.size()]);
Arrays.sort(array);
return Arrays.asList(array);
}
/**
* Check whether this is an internal search index request.
* Usage: @if(!Template.isIndexer) {some not to be indexed template parts}
* Use &indexer=true to test output.
......@@ -327,20 +269,6 @@ public class Template {
}
/**
* Returns the default edit bar for pages if the page is a cms page (and an empty string otherwise)
* Can be used in main layout templates to place the page-level edit bar outside / on top of the page template.
* @param page either a PageBlock (shows the edit bar) or a Page instance (does not show the edit bar since it's no cms page then)
*/
public static Html editBar(Page page) {
if (page instanceof AbstractBlock) {
// Unfortunately play does not generate a render() method for mandatory params only..
return ch.insign.cms.views.html._blockBase.render((AbstractBlock) page, true, true, true, false, "", "", false, "", Html.apply(""));
} else {
return Html.apply("");
}
}
/**
* Used from _blockBase: Tries to return the block template's class name (via stacktrace).
* Important: Use this for debugging purpose only (it's an expensive call)
* @return Class name the method calling the method where this call is placed
......
......@@ -19,14 +19,14 @@
case Template.TR.NONE => {}
}
@if(Template.isInstanceOf(subPage, classOf[GroupingBlock])){<b>}
@subPage.getNavTitle
@if(Template.isInstanceOf(subPage, classOf[GroupingBlock])){</b>}
@if(subPage.isInstanceOf[GroupingBlock]){<b>}
@subPage.getNavTitle
@if(subPage.isInstanceOf[GroupingBlock]){</b>}
@if(subPage.getKey!=null){<span class="text-muted">[@subPage.getKey]</span>}
</div>
<div class="nestable-list-actions">
@if(!Template.isInstanceOf(subPage, classOf[GroupingBlock])) {
@if(!subPage.isInstanceOf[GroupingBlock]) {
@if(subPage.canRead) {
<a href="@subPage.getNavItem.getURL" target="_blank" title="@Messages("cms.navigation.entry.show")">
<i class="fa fa-eye"></i>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment