AnsweredAssumed Answered

PluginTemplateDefinition JavaScript Issue

Question asked by MarkoSelf on Jul 21, 2014
Latest reply on Jul 22, 2014 by MarkoSelf

I've been trying to get the Extending Jive with Plugin Template Definitions implementation working in Jive 7, but the soy files never load for some reason.  I've even set "supports" to return true and load the JS on every page, but with no luck.  I'm hoping someone can find an issue in the code:

 

ViewDocumentTemplateDefinition.java

public class ViewDocumentTemplateDefinition implements PluginTemplateDefinition {

    private PermissionChecker permissionChecker;
   
    public void setPermissionChecker(PermissionChecker permissionChecker) {
        this.permissionChecker = permissionChecker;
    }

    @Override
    public boolean supports(ActionDescriptor actionDescriptor) {
        return true;
        /*if (actionDescriptor.getAction() instanceof DocumentAction) {
            DocumentAction documentAction = (DocumentAction) actionDescriptor.getAction();
            Document document = documentAction.getDocument();
            if (document != null && document.isTextBody() == false) {
                return permissionChecker.isDownloadingRestrictedFor(document.getJiveContainer());
            }
        }
       
        return false;*/
    }

    @Override
    public String getHeadTemplateName() {
        //return "jive.teletech.download.removeDownloadLinksCSS";
        return null;
    }

    @Override
    public String getBodyTemplateName() {
        return "jive.teletech.download.removeDownloadLinks";
    }

    @Override
    public Object getModel(ActionInvocation ai, Object actionModel) {
        return null;
    }

}


 

restricted-download.soy

{namespace jive.teletech.download}

/**
*
*/
{template .removeDownloadLinks}

    {call jive.shared.soy.resourceInlineJs}
        {param code}
            $j(function() {lb}
                $j("div.jive-wiki-body-download").remove();
            {rb});
        {/param}
    {/call}
   
{/template}


/**
*
*/
{template .removeDownloadLinksCSS}
     <link rel="stylesheet" href="{resourceUrl('/plugins/place-permissions/resources/styles/restricted-download.css')}" type="text/css" media="all" />

   
{/template}

 

spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
       default-autowire="no" default-init-method="init" default-destroy-method="destroy">

    <bean class="com.jivesoftware.teletech.permissions.PlacePermissionsPlugin"/>
   
    <bean id="teletechPermissionChecker" class="com.jivesoftware.teletech.permissions.PermissionCheckerImpl"/>
   
    <bean parent="pluginTemplateDefinitions" class="com.jivesoftware.community.util.spring.MergeableCollection">
        <property name="source">
            <util:list>
                <bean class="com.jivesoftware.teletech.permissions.web.soy.ViewDocumentTemplateDefinition"/>
            </util:list>
        </property>
    </bean>

   
</beans>


 

Folder Structure

Outcomes