Coder Social home page Coder Social logo

softmonkeyjapan / angular-google-picker Goto Github PK

View Code? Open in Web Editor NEW
78.0 5.0 29.0 168 KB

An Angular directive that interact with Google Picker API

Home Page: http://softmonkeyjapan.github.io/angular-google-picker/

JavaScript 70.51% HTML 19.09% CSS 10.41%
angularjs google-picker javascript gulpjs

angular-google-picker's People

Contributors

danielmana avatar jakxz avatar jhoger avatar softmonkeyjapan avatar wombleton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

angular-google-picker's Issues

Make the views more flexible?

It would be nice if you can somehow change the settings of the views maybe inside the controller or something.
Imagine that you have more than one picker on a site. So what you want to do is the change the "DocsUploadView.setParent(string)" on each picker

Event-chain broken causing the popup block

"Note that clicking on Pick files button may fail the first time because your browser may block the popup"

This can be avoided by pre-loading the required javascript files "auth" + "picker" instead of triggering them on bind-click. By firing them on bind-click the event-chain is lost and Google does not trust this to be a user-invoked-action.

Solution:
move api-load out of click chain

gapi.load('auth');
gapi.load('picker');

element.bind('click', function(e) {
   instanciate(); // will now call onApiAuthLoad without having to load files that breaks event-chain
});

Google Picker on modal

I've tried using angular-google-picker on modal, but it didn't seems to work.
The picker went behind the modal and I can't choose files.

How to make this work on modal?

P.S. I'm also using angular-ui bootstrap

Can't get callback to work

I've tried to implement the callback functionality as shown in the readme, but the function never fires. I never get output to the console or any errors. Here's my code.

In the view...

<a href="javascript:;" lk-google-picker picker-files="googleFiles" after-select="afterSelectCallback(googleFiles)" class="apply-file google-drive">Google Drive</a>

And in my controller...

    $scope.googleFiles = [];
    $scope.afterSelectCallback = function(files){
        console.log(files);
    };

Getting a download url

Hi,

So we are using your angular google picker to to try to download a file from google drive and pass it to our node js backend, currently we only have the url or embedUrl, i was curious if you new how to be able to generate a download or direct url that we could then pass to our nodejs backend.

Regards,
John

Views configutation - help needed

Hi

After many attempts, I haven't be able to add label to view linked to custom folder.
I have something like this:

angular.module('myApp', ['lk-google-picker'])
.config(['lkGoogleSettingsProvider', function (lkGoogleSettingsProvider) {
  lkGoogleSettingsProvider.views([
    'DocsView().setParent("XXXXXXXXXXXXXXX").setIncludeFolders(true)'
  ]);
}])

I tried to use ViewGroup. I manage to add label toViewGroup, but I can't link created label, with custom directory.

Have you ever create view linked to custom directory and define label for it? If you managed to do that, could you share the script?

imediate as a parameter

It is posible to implement the parameter inmediate: false as a parameter like scope, where we could define true or false?
Best regards

Syntax error in Readme

Minor thing but might be annoying. Tried to create a PR, but don't have permissions apparently.

The variable data is not defined. Google returns a plain array now, so we are good to go with docs.

diff --git a/README.md b/README.md
index 12df294..b617cfc 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,7 @@ Download [https://github.com/softmonkeyjapan/angular-google-picker/archive/0.2.2
      }

      $scope.onPicked = function (docs) {
-       angular.forEach(data.docs, function (file, index) {
+       angular.forEach(docs, function (file, index) {
          $scope.files.push(file);
        });
      }

Auth without the popup

Is there a way to avoid opening the popup for the google auth? I'd rather it redirect and back again on the same page.

Don't early load gapi.auth and gapi.picker

My app functions offline, so I only load Drive on user request (click). But angular picker directive is part of my page so it loads before they can click the button. What I found in my console log was some crashing of picker because gapi is null if I'm offline.

I looked at the code and I only see one place where gapi is used at load time:

Around line 142:
gapi.load('auth');
gapi.load('picker');

These seem unnecessary to me since they are also loaded in the instantiate() function. Instantiate is bound to click. So those modules will load at the appropriate time.

Recommend that the two early calls be removed unless there's a good reason to keep them. I remove them and everything functions the same for me.

At the very least I recommend refactor by calling instantiate instead of doing the same thing in two places. Also in instantiate() check gapi before invoking load.

Error on file select

Hi I'm getting an error in console using chrome when I select a file from drive.
Cannot read property 'push' of undefined.

on this line:
scope.pickerFiles.push(file);

Returning 'data' instead of 'data.docs'

Hi there! Thank you very much for this picker :)

I would like to suggest you to pass the 'data' object instead of just 'data.docs' in the picker callback, so you can also do something when the user closes the picker (checking 'data.action').
I needed 'pickerCallback' instead of 'pickerFiles' and the mentioned functionality, so I forked your repo some weeks ago. If you want a PR with something just tell me: https://github.com/frankdiox/angular-google-picker/commits/master

I also modified README.md with the new examples.
Thanks again!

Google Picker z-index

Can u add increase z-index for google picker.
Cause i use for modal which z-index is higher than google picker.
I solved it by adding increasing z-index in google-picker.js.
but it is not the right way.. cause when i run bower update it will effect the googlepicker.js
Thanks

Not able to add views

I want to fetch only documents and presentations from google drive, so when i try to rewrite views, i got the following error lkGoogleSettingsProvider.views is not a function, Will you please help me to fix this?

var googlepickerController = angular.module('googlepickerControllers', ['lk-google-picker'])

googlepickerController.config(['lkGoogleSettingsProvider', function(lkGoogleSettingsProvider) {
    // Configure the API credentials here
    lkGoogleSettingsProvider.configure({
        apiKey   : '*****************************',
        clientId : '*************************************************',
        views    : ['DocsView()'],
    });
}])

Error while login

This is the error i'm getting in console, when i loggin to gmail account
selection_033

Cancel Action Not Being Sent to Callback

When the user Cancels a selection in the Google Picker dialog, the Cancel action is not being passed back to the after-select callback function. From a quick look at the directive source, it appears that the callback is only being called from the directive when the action === 'picked':

if (data.action == google.picker.Action.PICKED) {
  gapi.client.load('drive', 'v2', function () {
    scope.afterSelect(data);
    scope.$apply();
  });
}

Should the callback function also be called when the action is 'cancel'?

Also, why load the drive API here? What does it provide? It doesn't appear to be interpreting the returned data.

Demo Not working

  1. That’s an error.

Error: origin_mismatch

Application: Angular Google Drive Picker Demo

You can email the developer of this application at: [email protected]

Request Details
proxy=oauth2relay672633426
immediate=false
scope=https://www.googleapis.com/auth/drive
origin=https://softmonkeyjapan.github.io
response_type=token
redirect_uri=postmessage
state=848035323|0.1860715458
client_id=20787361493-372fi66o31k7t4t2ha3nvj5j36blm417.apps.googleusercontent.com
include_granted_scopes=true
That’s all we know.

Origin mismatch

The picker is running fine when I login with my email since I already filled "Authorized JavaScript origins" with a link like the following:
https://n-pzh4f6xxxxxxvdpjinpsahxzdhphhc5ak4iq-script.googleusercontent.com
but when logging in with another gmail account, I'm getting origin mismatch error, should I add another origin in "Authorized JavaScript origins"
What is the setting that should I add in order to work with all emails account.
and Thanks in advance.

Documents thumbnails

Hi,
I wondered if it was possible to get thumbnails (especially for photos/videos) from Drive in the array of documents? Am I missing parameters?

Thanks a lot for your work,

Jonathan

Publish to npm

This package looks great and i'm gonna use it either way, but it'd be cool if it were on npm.

Authorization error

When i tried to upload files it's return an error "Server Rejected".

Also getting two errors in console.

  1. Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://docs.google.com') does not match the recipient window's origin ('http://localhost:13080').(anonymous function) @ cb=gapi.loaded_0:77

  2. Invalid 'X-Frame-Options' header encountered when loading 'https://docs.google.com/picker?protocol=gadgets&origin=http%3A%2F%2Flocalho…%3Atrue%7D))&rpctoken=tic259j42wgf&rpcService=c36g0mksuysk&thirdParty=true': 'ALLOW-FROM http://localhost:13080' is not a recognized directive. The header will be ignored.

Give me a solution for that.

Many thanks,
Bhavik Mulia

Multiple Directive Resource Contention

The lk-google-picker directive causes an error when added to an HTML element with another directive that is creating an isolate scope. (See https://docs.angularjs.org/error/$compile/multidir). Using the directive on an that also contains tooltip directives from the angular-ui project. HTML source code is:

<a class="list-group-item" id="mnuGooglePicker" lk-google-picker after-select="afterSelectCallback" ng-disabled="isUploading" ng-show="!pageIsReadOnly" tooltip="Get Images from Google Drive" tooltip-popup-delay="750" tooltip-placement="right" tooltip-append-to-body="true">
    <i class="fa fa-fw fa-google"></i>&nbsp;Google Drive
</a>

Is it possible to use this directive in conjunction with other directives that may be creating their own isolate scope?

Errors in console Google Chrome

Hi,

Great library! Exactly what I needed and simple to use. I managed to get it working, however there are some errors in Google Chrome, also on your demo website. Can you take a look at it?

Greetings,
Karens

capture

Error when file is uploaded

When we try to upload a file, the file upload shows the progress in the progress bar and when it completes, it closes the file upload dialog and throws the following error :

Refused to get unsafe header "X-HTTP-Status-Code-Override"
t.getResponseHeader @ 2423154982-picker_modularized_i18n_opc.js:329t.Rja @ 2423154982-picker_modularized_i18n_opc.js:1231t.Sja @ 2423154982-picker_modularized_i18n_opc.js:1231UV.R_ @ 2423154982-picker_modularized_i18n_opc.js:1232t.Mla @ 2423154982-picker_modularized_i18n_opc.js:1228t.NF @ 2423154982-picker_modularized_i18n_opc.js:192t.dispatchEvent @ 2423154982-picker_modularized_i18n_opc.js:190t.dra @ 2423154982-picker_modularized_i18n_opc.js:326t.K3 @ 2423154982-picker_modularized_i18n_opc.js:325b @ 2423154982-picker_modularized_i18n_opc.js:367t.fra @ 2423154982-picker_modularized_i18n_opc.js:325
2423154982-picker_modularized_i18n_opc.js:329

Refused to get unsafe header "X-HTTP-Status-Code-Override"

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.