package extensions;

import play.mvc.Http;
import play.templates.JavaExtensions;

/**
 * @author Manuel Bernhardt <bernhardt.manuel@gmail.com>
 */
public class ViewExtensions extends JavaExtensions {

    public static String isCurrent(String action) {
        return Http.Request.current().action.startsWith(action) ? "current" : "";
    }

    public static String pluralize(String singular) {
        return !singular.endsWith("y") ? singular + "s" : singular.substring(0, singular.length() - 1) + "ies";
    }

    public static String shorten(String source, Integer length) {
         return source.length() > length ? source.substring(0, length) + "..." : source;
    }




}



@@ -295,18 +295,16 @@
 ion.
-startsWith
+contains
 (act

use contains instead of startsWith to have the currents state trickle down into create and edit mode