Skip to content
Browse files

Resources Grails Plugin dependencies removed (to be compatible with A…

…sset Pipeline Grails Plugin)
  • Loading branch information...
1 parent bdef139 commit bcbd3e5f67b14c334aa14b48f7caab2540b0595d @benorama benorama committed Mar 24, 2014
View
2 FacebookSdkGrailsPlugin.groovy
@@ -2,7 +2,7 @@ import grails.plugin.facebooksdk.*
class FacebookSdkGrailsPlugin {
- def version = "0.5.0"
+ def version = "0.6.0-SNAPSHOT"
def grailsVersion = "2.0 > *"
def author = "Benoit Hediard"
View
2 grails-app/conf/BuildConfig.groovy
@@ -29,5 +29,5 @@ grails.project.dependency.resolution = {
build(':release:3.0.1', ':rest-client-builder:1.0.3') {
export = false
}
- }
+ }
}
View
31 grails-app/conf/FacebookSdkResources.groovy
@@ -1,31 +0,0 @@
-modules = {
- 'fb-sdk-add-to-page-link' {
- defaultBundle 'facebook-sdk'
- resource url: [plugin: 'facebook-sdk', dir: 'js', file: 'add-to-page-link.js']
- }
-
- 'fb-sdk-invite-link' {
- defaultBundle 'facebook-sdk'
- resource url: [plugin: 'facebook-sdk', dir: 'js', file: 'invite-link.js']
- }
-
- 'fb-sdk-login-link' {
- defaultBundle 'facebook-sdk'
- resource url: [plugin: 'facebook-sdk', dir: 'js', file: 'login-link.js']
- }
-
- 'fb-sdk-logout-link' {
- defaultBundle 'facebook-sdk'
- resource url: [plugin: 'facebook-sdk', dir: 'js', file: 'logout-link.js']
- }
-
- 'fb-sdk-publish-link' {
- defaultBundle 'facebook-sdk'
- resource url: [plugin: 'facebook-sdk', dir: 'js', file: 'publish-link.js']
- }
-
- 'fb-sdk-send-link' {
- defaultBundle 'facebook-sdk'
- resource url: [plugin: 'facebook-sdk', dir: 'js', file: 'send-link.js']
- }
-}
View
24 grails-app/views/tags/_add-to-page-link.gsp
@@ -1,6 +1,26 @@
-<g:if test="${!disabled}"><r:require module="fb-sdk-add-to-page-link" /></g:if>
+<script type="text/javascript">
+ $(function() {
+ $('a.fb-sdk-add-to-page-link').click(function() {
+ var link = $(this);
+ var options = {
+ method: 'pagetab'
+ };
+ if (link.data('display') != undefined) options['display'] = link.data('display');
+ if (link.data('redirect_uri') != undefined) options['redirect_uri'] = link.data('redirect_uri');
+ FB.ui(options, function(response) {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof callback === 'function') {
+ callback(response);
+ }
+ }
+ });
+ return false;
+ });
+ });
+</script>
<a <g:if test="${elementId}">id="${elementId}"</g:if>
- class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-add-to-page-link"
+ class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-add-to-page-link fb-sdk-link"
<g:if test="${callback}">data-callback="${callback}"</g:if>
<g:if test="${display}">data-display="${display}"</g:if>
<g:if test="${returnUrl}">data-redirect_uri="${returnUrl}"</g:if>
View
12 grails-app/views/tags/_init-js.gsp
@@ -1,7 +1,14 @@
<%@page expressionCodec="raw" %>
<div id="fb-root"></div>
<script type="text/javascript">
- window.fbAsyncInit = function() {
+ // Disable all fb sdk links until FB JS SDK is initialized
+ $(function() {
+ if (!window.FB) {
+ $('.fb-sdk-link').attr('disabled', 'disabled').addClass('disabled');
+ }
+ });
+
+ window.fbAsyncInit = function() {
FB.init({
appId: "${appId}",
<g:if test="${channelUrl}">channelUrl: "${channelUrl}", // Custom channel URL</g:if>
@@ -11,8 +18,9 @@
xfbml: <g:if test="${xfbml}">true</g:if><g:else>false</g:else>, // parse XFBML
frictionlessRequests: <g:if test="${frictionlessRequests}">true</g:if><g:else>false</g:else> // to enable frictionless requests
});
+ $('.fb-sdk-link').removeAttr('disabled').removeClass('disabled');
- <g:if test="${autoGrow}">
+ <g:if test="${autoGrow}">
FB.Canvas.setAutoGrow();
</g:if>
View
30 grails-app/views/tags/_invite-link.gsp
@@ -1,7 +1,33 @@
<%@ page import="grails.converters.JSON" %>
-<g:if test="${!disabled}"><r:require module="fb-sdk-invite-link" /></g:if>
+<script type="text/javascript">
+ $(function() {
+ $('a.fb-sdk-invite-link').click(function() {
+ var link = $(this);
+ var options = {
+ method: 'apprequests',
+ message: link.data('message')
+ };
+ if (link.data('data') != undefined) options['data'] = link.data('data');
+ if (link.data('display') != undefined) options['display'] = link.data('display');
+ if (link.data('exclude_ids') != undefined) options['exclude_ids'] = link.data('exclude_ids');
+ if (link.data('filters') != undefined) options['filters'] = link.data('filters');
+ if (link.data('max_recipients') != undefined) options['max_recipients'] = link.data('max_recipients');
+ if (link.data('title') != undefined) options['title'] = link.data('title');
+ if (link.data('to') != undefined) options['to'] = link.data('to');
+ FB.ui(options, function(response) {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof callback === 'function') {
+ callback(response);
+ }
+ }
+ });
+ return false;
+ });
+ });
+</script>
<a <g:if test="${elementId}">id="${elementId}"</g:if>
- class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-invite-link"
+ class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-invite-link fb-sdk-link"
data-message="${message.encodeAsHTML()}"
<g:if test="${callback}">data-callback="${callback}"</g:if>
<g:if test="${data}">data-data="${data}"</g:if>
View
33 grails-app/views/tags/_login-link.gsp
@@ -1,6 +1,35 @@
-<g:if test="${!disabled}"><r:require module="fb-sdk-login-link" /></g:if>
+<script type="text/javascript">
+ $(function() {
+ $('a.fb-sdk-login-link').click(function(event) {
+ var link = $(this);
+ link.attr('disabled', 'disabled');
+ FB.login(function(response) {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof callback === 'function') {
+ callback(response, event.target);
+ }
+ } else if (response.authResponse) {
+ // user is logged
+ if (link.data('return_url')) {
+ window.location.href = link.data('return_url');
+ } else {
+ window.location.reload();
+ }
+ } else if (link.data('cancel_url')) {
+ window.location.href = link.data('cancel_url');
+ } else {
+ link.removeAttr('disabled');
+ }
+ }, {
+ scope: link.data('permissions')
+ });
+ return false;
+ });
+ });
+</script>
<a <g:if test="${elementId}">id="${elementId}"</g:if>
- class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-login-link"
+ class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-login-link fb-sdk-link"
data-permissions="${appPermissions instanceof List ? appPermissions.join(',') : appPermissions}"
<g:if test="${callback}">data-callback="${callback}"</g:if>
<g:if test="${cancelUrl}">data-cancel_url="${cancelUrl}"</g:if>
View
40 grails-app/views/tags/_logout-link.gsp
@@ -1,6 +1,42 @@
-<g:if test="${!disabled}"><r:require module="fb-sdk-logout-link" /></g:if>
+<script type="text/javascript">
+ $(function() {
+ $('a.fb-sdk-logout-link').click(function() {
+ var link = $(this);
+ link.attr('disabled', 'disabled');
+ FB.getLoginStatus(function(response) {
+ if (response.authResponse) {
+ FB.logout(function(response) {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof fn === 'function') {
+ callback(response);
+ }
+ } else if (link.data('next_url')) {
+ window.location.href = link.data('next_url');
+ } else {
+ window.location.reload();
+ }
+ });
+ } else {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof callback === 'function') {
+ callback(response);
+ }
+ } else if (link.data('next_url')) {
+ window.location.href = link.data('next_url');
+ } else {
+ window.location.reload();
+ }
+ }
+ });
+ return false;
+ });
+
+ });
+</script>
<a <g:if test="${elementId}">id="${elementId}"</g:if>
- class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-logout-link"
+ class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-logout-link fb-sdk-link"
<g:if test="${nextUrl}">data-next_url="${nextUrl}"</g:if>
<g:if test="${disabled}">disabled="disabled"</g:if>
href="#">
View
29 grails-app/views/tags/_publish-link.gsp
@@ -1,6 +1,31 @@
-<g:if test="${!disabled}"><r:require module="fb-sdk-publish-link" /></g:if>
+<script type="text/javascript">
+ $(function() {
+ $('a.fb-sdk-publish-link').click(function() {
+ var link = $(this);
+ var options = {
+ method: 'feed'
+ };
+ if (link.data('caption') != undefined) options['caption'] = link.data('caption');
+ if (link.data('display') != undefined) options['display'] = link.data('display');
+ if (link.data('description') != undefined) options['description'] = link.data('description');
+ if (link.data('link') != undefined) options['link'] = link.data('link');
+ if (link.data('name') != undefined) options['name'] = link.data('name');
+ if (link.data('picture') != undefined) options['picture'] = link.data('picture');
+ if (link.data('source') != undefined) options['source'] = link.data('source');
+ FB.ui(options, function(response) {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof callback === 'function') {
+ callback(response);
+ }
+ }
+ });
+ return false;
+ });
+ });
+</script>
<a <g:if test="${elementId}">id="${elementId}"</g:if>
- class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-publish-link"
+ class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-publish-link fb-sdk-link"
<g:if test="${callback}">data-callback="${callback}"</g:if>
<g:if test="${caption}">data-caption="${caption.encodeAsHTML()}"</g:if>
<g:if test="${display}">data-display="${display}"</g:if>
View
28 grails-app/views/tags/_send-link.gsp
@@ -1,6 +1,30 @@
-<g:if test="${!disabled}"><r:require module="fb-sdk-send-link" /></g:if>
+<script type="text/javascript">
+ $(function() {
+ $('a.fb-sdk-send-link').click(function() {
+ var link = $(this);
+ var options = {
+ method: 'send',
+ link: link.data('link'),
+ to: link.data('to')
+ };
+ if (link.data('display') != undefined) options['display'] = link.data('display');
+ if (link.data('description') != undefined) options['description'] = link.data('description');
+ if (link.data('name') != undefined) options['name'] = link.data('name');
+ if (link.data('picture') != undefined) options['picture'] = link.data('picture');
+ FB.ui(options, function(response) {
+ if (link.data('callback') != undefined) {
+ var callback = window[link.data('callback')];
+ if (typeof callback === 'function') {
+ callback(response);
+ }
+ }
+ });
+ return false;
+ });
+ });
+</script>
<a <g:if test="${elementId}">id="${elementId}"</g:if>
- class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-send-link"
+ class="<g:if test="${elementClass}">${elementClass} </g:if>fb-sdk-send-link fb-sdk-link"
<g:if test="${callback}">data-callback="${callback}"</g:if>
data-to="${to}"
<g:if test="${display}">data-display="${display}"</g:if>
View
17 web-app/js/add-to-page-link.js
@@ -1,17 +0,0 @@
-$('a.fb-sdk-add-to-page-link').click(function() {
- var link = $(this);
- var options = {
- method: 'pagetab'
- };
- if (link.data('display') != undefined) options['display'] = link.data('display');
- if (link.data('redirect_uri') != undefined) options['redirect_uri'] = link.data('redirect_uri');
- FB.ui(options, function(response) {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof callback === 'function') {
- callback(response);
- }
- }
- });
- return false;
-});
View
23 web-app/js/invite-link.js
@@ -1,23 +0,0 @@
-$('a.fb-sdk-invite-link').click(function() {
- var link = $(this);
- var options = {
- method: 'apprequests',
- message: link.data('message')
- };
- if (link.data('data') != undefined) options['data'] = link.data('data');
- if (link.data('display') != undefined) options['display'] = link.data('display');
- if (link.data('exclude_ids') != undefined) options['exclude_ids'] = link.data('exclude_ids');
- if (link.data('filters') != undefined) options['filters'] = link.data('filters');
- if (link.data('max_recipients') != undefined) options['max_recipients'] = link.data('max_recipients');
- if (link.data('title') != undefined) options['title'] = link.data('title');
- if (link.data('to') != undefined) options['to'] = link.data('to');
- FB.ui(options, function(response) {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof callback === 'function') {
- callback(response);
- }
- }
- });
- return false;
-});
View
27 web-app/js/login-link.js
@@ -1,27 +0,0 @@
-$('a.fb-sdk-login-link').click(function(event) {
- var link = $(this);
- link.attr('disabled', 'disabled');
- FB.login(function(response) {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof callback === 'function') {
- callback(response, event.target);
- }
- } else if (response.authResponse) {
- // user is logged
- if (link.data('return_url')) {
- window.location.href = link.data('return_url');
- } else {
- window.location.reload();
- }
- } else if (link.data('cancel_url')) {
- window.location.href = link.data('cancel_url');
- } else {
- link.removeAttr('disabled');
- }
- }, {
- scope: link.data('permissions')
- });
- return false;
-});
-
View
33 web-app/js/logout-link.js
@@ -1,33 +0,0 @@
-$('a.fb-sdk-logout-link').click(function() {
- var link = $(this);
- link.attr('disabled', 'disabled');
- FB.getLoginStatus(function(response) {
- if (response.authResponse) {
- FB.logout(function(response) {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof fn === 'function') {
- callback(response);
- }
- } else if (link.data('next_url')) {
- window.location.href = link.data('next_url');
- } else {
- window.location.reload();
- }
- });
- } else {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof callback === 'function') {
- callback(response);
- }
- } else if (link.data('next_url')) {
- window.location.href = link.data('next_url');
- } else {
- window.location.reload();
- }
- }
- });
- return false;
-});
-
View
22 web-app/js/publish-link.js
@@ -1,22 +0,0 @@
-$('a.fb-sdk-publish-link').click(function() {
- var link = $(this);
- var options = {
- method: 'feed'
- };
- if (link.data('caption') != undefined) options['caption'] = link.data('caption');
- if (link.data('display') != undefined) options['display'] = link.data('display');
- if (link.data('description') != undefined) options['description'] = link.data('description');
- if (link.data('link') != undefined) options['link'] = link.data('link');
- if (link.data('name') != undefined) options['name'] = link.data('name');
- if (link.data('picture') != undefined) options['picture'] = link.data('picture');
- if (link.data('source') != undefined) options['source'] = link.data('source');
- FB.ui(options, function(response) {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof callback === 'function') {
- callback(response);
- }
- }
- });
- return false;
-});
View
21 web-app/js/send-link.js
@@ -1,21 +0,0 @@
-$('a.fb-sdk-send-link').click(function() {
- var link = $(this);
- var options = {
- method: 'send',
- link: link.data('link'),
- to: link.data('to')
- };
- if (link.data('display') != undefined) options['display'] = link.data('display');
- if (link.data('description') != undefined) options['description'] = link.data('description');
- if (link.data('name') != undefined) options['name'] = link.data('name');
- if (link.data('picture') != undefined) options['picture'] = link.data('picture');
- FB.ui(options, function(response) {
- if (link.data('callback') != undefined) {
- var callback = window[link.data('callback')];
- if (typeof callback === 'function') {
- callback(response);
- }
- }
- });
- return false;
-});

0 comments on commit bcbd3e5

Please sign in to comment.
Something went wrong with that request. Please try again.