diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..48a46ce
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7895a3b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+/.settings
+/lib
+/scripts
+/src
+/target
+/web-app
+/test
diff --git a/.project b/.project
new file mode 100644
index 0000000..74342e7
--- /dev/null
+++ b/.project
@@ -0,0 +1,26 @@
+
+
+ facebook-comments
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.grails.ide.eclipse.core.nature
+ org.eclipse.jdt.groovy.core.groovyNature
+ org.eclipse.jdt.core.javanature
+
+
+
+ .link_to_grails_plugins
+ 2
+ F:/work/github/facebook-comments/target/plugins
+
+
+
diff --git a/FacebookCommentsGrailsPlugin.groovy b/FacebookCommentsGrailsPlugin.groovy
new file mode 100644
index 0000000..82e482b
--- /dev/null
+++ b/FacebookCommentsGrailsPlugin.groovy
@@ -0,0 +1,14 @@
+class FacebookCommentsGrailsPlugin {
+ def version = "1.0"
+ def grailsVersion = "1.3 > *"
+ def title = "Facebook Comments Plugin"
+ def author = "Sudhir Nimavat"
+ def authorEmail = "sudhir@nimavat.me"
+ def description = "Easy Facebook Comments Integration"
+
+ def documentation = "http://grails.org/plugin/facebook-comments"
+ def license = "APACHE"
+
+ def issueManagement = [ system: "GITHUB", url: "https://github.com/snimavat/nimble/issues" ]
+ def scm = [system: 'GitHub', url: 'https://github.com/snimavat/nimble']
+}
diff --git a/README.md b/README.md
index 4fd07b0..4e0bd71 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,53 @@ grails-facebook-comments
========================
Facebook comments grails plugin
+
+
+## Configuration
+-----
+Following configuration options are available.
+
+- grails.plugin.facebookcomments.appId
+- grails.plugin.facebookcomments.width
+- grails.plugin.facebookcomments.colorscheme
+- grails.plugin.facebookcomments.num_posts
+- grails.plugin.facebookcomments.mobile
+- grails.plugin.facebookcomments.href = { bean -> }
+
+
+
+All of the config options are optional.
+See [facebook documentation](https://developers.facebook.com/docs/reference/plugins/comments/) for details about possible values.
+
+## Integrating facebook comments into your application.
+----
+Follow this steps for integration
+
+*Step 1*
+Put `` right after opening `
` tag. It will initialize facebook comments js sdk.
+appId parameter is optional and if not specified it will be picked up from config.
+
+*step 2*
+put `` anywhere in the page where you want comments to be displayed.
+Again all of the parameters are optional and if not specified they will be picked up from config.
+
+#### Configuring data-href url
+-----
+href parameter is used identify the page for comments. It can directly specified in `` tag, or it can be configured as a Closure in config.
+When no href parameter is passed to `` tag, it will check if Closure is configured in config, if so, the closure will be called and return value will be used as href.
+
+*Example*
+```
+Config.groovy
+grails.plugin.facebookcomments.href = { bean -> "http://example.com/page?id=$bean.id" }
+
+```
+
+And now in your gsp file
+
+```
+
+
+```
+
+When href is not passed as parameter to `` or not configured in Config.groovy, current request url will be used as href.
diff --git a/application.properties b/application.properties
new file mode 100644
index 0000000..ac186fe
--- /dev/null
+++ b/application.properties
@@ -0,0 +1,4 @@
+#Grails Metadata file
+#Fri Aug 09 22:02:56 IST 2013
+app.grails.version=2.2.4
+app.name=facebook-comments
diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy
new file mode 100644
index 0000000..01c17d6
--- /dev/null
+++ b/grails-app/conf/BuildConfig.groovy
@@ -0,0 +1,18 @@
+grails.project.work.dir = 'target'
+
+grails.project.dependency.resolution = {
+ inherits("global") {
+ }
+ log "warn"
+ repositories {
+ grailsCentral()
+ mavenCentral()
+ mavenLocal()
+ }
+ dependencies {
+ }
+
+ plugins {
+ build ':release:2.2.1', ':rest-client-builder:1.0.3', { export = false }
+ }
+}
diff --git a/grails-app/conf/Config.groovy b/grails-app/conf/Config.groovy
new file mode 100644
index 0000000..bb3dc7f
--- /dev/null
+++ b/grails-app/conf/Config.groovy
@@ -0,0 +1,10 @@
+log4j = {
+ appenders {
+ console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
+ }
+ error 'org.codehaus.groovy.grails',
+ 'org.springframework',
+ 'org.hibernate',
+ 'net.sf.ehcache.hibernate'
+ debug 'grails.plugin.aspectj'
+}
diff --git a/grails-app/conf/DataSource.groovy b/grails-app/conf/DataSource.groovy
new file mode 100644
index 0000000..ade7bd6
--- /dev/null
+++ b/grails-app/conf/DataSource.groovy
@@ -0,0 +1,11 @@
+dataSource {
+ pooled = true
+ driverClassName = "org.h2.Driver"
+ username = "sa"
+ password = ""
+}
+hibernate {
+ cache.use_second_level_cache = true
+ cache.use_query_cache = false
+ cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
+}
diff --git a/grails-app/taglib/grails/plugin/facebookcomments/FacebookCommentTagLib.groovy b/grails-app/taglib/grails/plugin/facebookcomments/FacebookCommentTagLib.groovy
new file mode 100644
index 0000000..ccb9691
--- /dev/null
+++ b/grails-app/taglib/grails/plugin/facebookcomments/FacebookCommentTagLib.groovy
@@ -0,0 +1,63 @@
+package grails.plugin.facebookcomments
+
+import groovy.xml.MarkupBuilder
+
+class FacebookCommentTagLib {
+
+ static namespace = "fb"
+
+ def grailsApplication
+
+ def comments = { attrs ->
+
+ def settings = grailsApplication.config.grails.plugin?.facebookcomments
+
+ def width = attrs.width ?: settings?.width
+ def colorscheme = attrs.colorscheme ?: settings?.colorscheme
+ def num_posts = attrs.num_posts ?: settings?.num_posts
+ def mobile = attrs.mobile ?: settings?.mobile
+
+ def href = attrs.href
+ if(attrs.href) {
+ href = attrs.href
+ } else if(settings.href instanceof Closure) {
+ href = settings.href(attrs.bean)
+ } else {
+ href = request.getRequestURL()
+ }
+
+ Map fbAttrs = ["class":"fb-comments"]
+
+ addFbAttr(fbAttrs, "width", width)
+ addFbAttr(fbAttrs, "colorscheme", colorscheme)
+ addFbAttr(fbAttrs, "num_posts", num_posts)
+ addFbAttr(fbAttrs, "mobile", mobile)
+ addFbAttr(fbAttrs, "href", href)
+
+ 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
+ attrs[name] = value
+ }
+ }
+}
diff --git a/grails-app/views/templates/fb-comment/_fb-comment-js.gsp b/grails-app/views/templates/fb-comment/_fb-comment-js.gsp
new file mode 100644
index 0000000..0a6e6be
--- /dev/null
+++ b/grails-app/views/templates/fb-comment/_fb-comment-js.gsp
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file