Skip to content

maleficarum/GrailsSupportChat

Repository files navigation

Grails Support Chat README

Requirements

This plugin includes (if you want) all the needed resources to work :

  • jquery 1.7.1
  • jquery ui 1.8.18
  • twitter bootstrap 2.0

... but, you can include your global resources.

Usage

First, you need to define mavenRepo on config/BuildConfig.groovy in repositories section:

mavenRepo "https://raw.github.com/maleficarum/mavenrepo/master/releases"

Then, install plugin

grails install-plugin mx.com.maleficarum:grails-support-chat:0.1

To embbed a support chat window on your grails application you need to modify some files:

Config.groovy
	supportChat {
		supportEntity = com.enterprise.Admin.class
		userEntity = com.enterprise.SingleUser.class
	}

supportEntity : This is the entity that represents a logged valid user as moderator.

userEntity : This is the common user in the application.

Note: If your application not uses logged clients/users, use an Expando instance in every client session.

Index.gsp (or in the target view)
<input type="button" id="openChat" />			(1)
<mm:jquery /> 						(2)
<mm:jqueryui /> 						(3)
<mm:supportChat /> 					(4)

<srcipt>
	$('#openChat').click(function(e) { 			
		$( "#mmsupportchatw" ).dialog( "open" ); 	(5)
	});
</srcipt>
  1. Add a button to launch the chat
  2. If you include directly jquery.js, omit this sentence.
  3. If you include directly jqueryui.js (and other neede resources, as templates, omit this sentence)
  4. Include main chat support window in your view.
  5. Add a listener for the previous button to fire open event in chat window
MainController.groovy
	def index() {
		//If user is admin user, or moderator, then
		def user = new Admin()
		user.setScAdmin(true)
		//If user is not an admin, or not a moderator, then
		user.setScAdmin(false)
	}

Note: The plugin add the method setScAdmin(boolean) in metaclass for the configured classes in the first step.

About

Support chat for grails application

Resources

Stars

Watchers

Forks

Packages

No packages published