Skip to content

Commit

Permalink
forgot to commit taglib
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudhir Nimavat committed Aug 9, 2013
1 parent 0b47377 commit 07a9bcd
Showing 1 changed file with 32 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,38 @@ class FacebookCommentTagLib {

def grailsApplication

/**
* Initialize facebook comments js
*
* @param appId facebook application Id - optional
*
*/
def initFbCommentsJS = { attrs ->
def settings = grailsApplication.config.grails.plugin?.facebookcomments

def appId
if(attrs.appId) {
appId = attrs.appId
} else {
appId = settings?.appId
}

if(!appId) {
throwTagError("Facebook appId is neither configured in config nor specified in tag")
}

out << render(template:"/templates/fb-comment/fb-comment-js", contextPath: pluginContextPath, model:[appId:appId])
}

/**
* Initialize comments container
*
* @param width width - optional
* @param colorscheme colorscheme - optional
* @param num_posts numbers of posts to show - optional
* @param mobile mobile - optional
* @param href facebook comments url - optional
*/
def comments = { attrs ->

def settings = grailsApplication.config.grails.plugin?.facebookcomments
Expand Down Expand Up @@ -37,23 +69,6 @@ class FacebookCommentTagLib {
new MarkupBuilder(out).div(fbAttrs)
}

def initFbCommentsJS = {attrs ->
def settings = grailsApplication.config.grails.plugin?.facebookcomments

def appId
if(attrs.appId) {
appId = attrs.appId
} else {
appId = settings?.appId
}

if(!appId) {
throwTagError("Facebook appId is neither configured in config nor specified in tag")
}

out << render(template:"/templates/fb-comment/fb-comment-js", contextPath: pluginContextPath, model:[appId:appId])
}

private void addFbAttr(Map attrs, name, value) {
if(name && value) {
name = "data-"+name
Expand Down

0 comments on commit 07a9bcd

Please sign in to comment.