Coder Social home page Coder Social logo

grails-sanchez-plugin's Introduction

Sanchez Grails Plugin

Grails plugin for sanchez.js Javascript templating framework.

This plugin allows simple inclusion of Sanchez templates in a Grails project, and re-use of grails partial templates on the client side.

Use

Install sanchez-grails-plugin

In your Grails BuildConfig.groovy, add the following to the plugins section:

plugins {
	...
	runtime ':sanchez:{{current_version}}'
	...
}

Including the javascript

Next, you'll want to include the sanchez.js javascript file in your app.

Sanchez defines a resource module called sanchez in SanchezResources.groovy.

With Grails Resources plugin

In ApplicationResources.groovy

dependsOn 'jquery, sanchez'

Directly in a GSP

<r:require modules="jquery,sanchez"/>

Include a template

Render a Grails partial template as a sanchez template

Inside a standard GSP file, you can include a gsp partial template as a sanchez template using the sanchez taglib:

<sanchez:render template="/section/tname" id="my_template" runtimeVars="data"/>

This will render /grails-app/views/section/_tname.gsp as a sanchez template with id my_template.

Use the template

In your javascript:

sanchez.replaceWith("#oldContainer", "my_template", {data:"whatever"});

Examples

grails-sanchez-plugin's People

Contributors

alxndrsn avatar burtbeckwith avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.