- Notifications
You must be signed in to change notification settings - Fork 456
Add a sample web app #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a sample web app #135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍
- Update license header
- Coding nits
- I'd upgrade to Angular 2 if you can.
samples/WebApp/Callback.html Outdated
| | ||
| <script> | ||
| var email = '<?= email ?>'; | ||
| var isSignedIn = '<?= isSignedIn ?>' == 'true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use ===.
sed -i -e 's/==/===/g' **/*.*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
samples/WebApp/Callback.html Outdated
| @@ -0,0 +1,50 @@ | |||
| <!-- | |||
| * Copyright 2016 Google Inc. All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line has changed since 2016; Google is a LLC. See go/releasing or look here:
Copyright 2018 Google LLC There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| /** | ||
| * Gets the user's GitHub repos. | ||
| */ | ||
| function getGitHubRepos() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine getGitHubRepos and getGitHubProfile.
These method are too similar. I only see 1 difference (url).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept them as separate methods, but combined the common bits.
| * Create a wrapped version of google.script.run that | ||
| * is adapted for Angular promises. | ||
| */ | ||
| var ScriptService = function($q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is $q? Please document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a standard Angular module. Added an @see annotation with a link.
| return $q(function(resolve, reject) { | ||
| google.script.run | ||
| .withSuccessHandler(resolve) | ||
| .withFailureHandler(reject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing ;?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the next line is part of the same statement.
| }; | ||
| | ||
| /** | ||
| * The controller for the sample. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They aren't really parameters, but Angular dependencies. $scope is always just one thing, as with $window. script and intercom are services defined below. There really isn't anything to say about them individually.
samples/WebApp/README.md Outdated
| 1. Run the following commands: | ||
| ```sh | ||
| clasp version "Initial version" | ||
| clasp deploy 1 "Web App" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just clasp deploy unless you really want the version description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
samples/WebApp/README.md Outdated
| | ||
| ## AngularJS | ||
| | ||
| This web app uses the [AngularJS 1 framework](https://angularjs.org/) to make it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Why don't we upgrade to Angular 2?
- Can we say Angular instead of AngularJS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the PR description, I took the existing Add-on sample and converted it into a web app. I don't think it's worth the effort to upgrade to the latest Angular version, as I believe it's not a straightforward upgrade process.
.gitignore Outdated
| @@ -1,2 +1,4 @@ | |||
| node_modules/ | |||
| *.log | |||
| samples/**/Secrets.gs | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mention where we create this Secrets.gs file in the README or in a comment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| This sample web application connects to your GitHub account using the Apps | ||
| Script OAuth2 library and displays some information about the repositories you | ||
| own. It demonstrates some best practices for using this library in a web app. | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include a picture here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Adapted the code in the sample add-on, but adjusted for a web app deployment. Moved the library's
.clasp.jsonfile to thesrc/directory so that clasp could be used to deploy the web app.