-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sudhir Nimavat
committed
Aug 9, 2013
1 parent
e97161a
commit 0b47377
Showing
11 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/java"/> | ||
<classpathentry kind="src" path="src/groovy"/> | ||
<classpathentry kind="src" path="grails-app/conf"/> | ||
<classpathentry kind="src" path="grails-app/controllers"/> | ||
<classpathentry kind="src" path="grails-app/domain"/> | ||
<classpathentry kind="src" path="grails-app/services"/> | ||
<classpathentry kind="src" path="grails-app/taglib"/> | ||
<classpathentry kind="src" path="test/integration"/> | ||
<classpathentry kind="src" path="test/unit"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="src" path=".link_to_grails_plugins/release-2.2.1/src/groovy"> | ||
<attributes> | ||
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path=".link_to_grails_plugins/release-2.2.1/src/java"> | ||
<attributes> | ||
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path=".link_to_grails_plugins/rest-client-builder-1.0.3/src/groovy"> | ||
<attributes> | ||
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.grails.ide.eclipse.core.CLASSPATH_CONTAINER"/> | ||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/> | ||
<classpathentry kind="output" path="target/eclipseclasses"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.settings | ||
/lib | ||
/scripts | ||
/src | ||
/target | ||
/web-app | ||
/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>facebook-comments</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.grails.ide.eclipse.core.nature</nature> | ||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
<linkedResources> | ||
<link> | ||
<name>.link_to_grails_plugins</name> | ||
<type>2</type> | ||
<location>F:/work/github/facebook-comments/target/plugins</location> | ||
</link> | ||
</linkedResources> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "[email protected]" | ||
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'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} |
63 changes: 63 additions & 0 deletions
63
grails-app/taglib/grails/plugin/facebookcomments/FacebookCommentTagLib.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div id="fb-root"></div> | ||
<script>(function(d, s, id) { | ||
var js, fjs = d.getElementsByTagName(s)[0]; | ||
if (d.getElementById(id)) return; | ||
js = d.createElement(s); js.id = id; | ||
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=${appId}"; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
}(document, 'script', 'facebook-jssdk')); | ||
</script> |