Skip to content
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 Gutenberg blocks for existing widgets #2

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d5e49fe
Start a blocks scaffold
ryelle Dec 3, 2017
e57dc88
Set up with babel
ryelle Dec 4, 2017
8e19a0a
Add webpack
ryelle Dec 4, 2017
1366fa4
Build out block controls
ryelle Dec 8, 2017
34e0cb1
Add file & function comments for PHPCS
ryelle Dec 25, 2017
213edcf
Add hot reloading
ryelle Dec 25, 2017
b7ead10
Update build CSS name
ryelle Dec 25, 2017
2bd4104
Set port 8081 as a config param
ryelle Dec 25, 2017
4a65924
Add config for the group block, set up for fetching data from API
ryelle Dec 29, 2017
f14ef28
Add API endpoint to get group events list
ryelle Dec 29, 2017
7627f69
Add permission check, enabling endpoint for logged in users only
ryelle Dec 30, 2017
bb5074d
Add a handler-class for the v3 endpoints of meetup.com’s API, use thi…
ryelle Dec 30, 2017
57452b4
Pass event ID through prepared object
ryelle Dec 30, 2017
0f5a9c1
Add a single-event endpoint
ryelle Dec 30, 2017
1e0a988
Add schema + validation (and a default) to the count param
ryelle Dec 30, 2017
3bcb867
Add endpoint for getting API user’s upcoming events
ryelle Dec 30, 2017
f61f255
Rename API controller class & file
ryelle Dec 30, 2017
9074767
Add prettier & eslint
ryelle Dec 31, 2017
482b59e
Split out edit functionality into component, save/front end render sh…
ryelle Dec 31, 2017
65c6374
Stub out an endpoint to fetch the API user’s groups
ryelle Jan 2, 2018
821969a
Fetch the API user’s groups, and use that to populate a dropdown list
ryelle Jan 3, 2018
f0890b5
Ignore the mock-data directory
ryelle Jan 3, 2018
e3d74f4
Get user groups from the real API
ryelle Jan 3, 2018
d0b2f09
Add an editable placeholder string for when there are no upcoming events
ryelle Jan 3, 2018
5113f5f
Check for properties before using them
ryelle Jan 3, 2018
9253e9b
Restructure files, yes, again
ryelle Jan 3, 2018
df76141
Move blocks.php to a class structure
ryelle Jan 3, 2018
2fbfd06
Send build files to a folder in plugin root, ignore build
ryelle Jan 3, 2018
c6af9e4
Update count param to `per_page` in endpoint
ryelle Jan 4, 2018
7e09faa
Clean up templating
ryelle Jan 6, 2018
71b18af
Move placeholder text to a control, was causing js errors on reload b…
ryelle Jan 6, 2018
bfbe64f
Use pug templates
ryelle Jan 6, 2018
7093b00
Add PHP pug support via composer
ryelle Jan 7, 2018
b121e50
Set block scripts in `register_block_type`, rather than enqueuing dir…
ryelle Jan 7, 2018
4bb0ad4
Set minimum php version in composer
ryelle Jan 7, 2018
cdd8c0d
Convert Pug templates to PHP expressions
ryelle Jan 7, 2018
cb385f6
Switch from Pug to Handlebars, cuts out the 2s page render time
ryelle Jan 7, 2018
f8f1780
Move title into template for front-end display
ryelle Jan 8, 2018
9b9ad3b
Rename second blocks folder
ryelle Jan 8, 2018
fe4f36b
Add a user-list block to get events for the current API user
ryelle Jan 8, 2018
f5103fe
Add classes & styling for events list
ryelle Jan 8, 2018
c88707c
Add an exception to permissions check for requests from this same ser…
ryelle Jan 9, 2018
23d231d
Add READMEs
ryelle Jan 9, 2018
a1769bb
Throw error (and handle error state) if the API key is not defined
ryelle Jan 10, 2018
e81f2de
Update changelog & version numbers
ryelle Jan 10, 2018
b15ac90
Check for Gutenberg before trying to register the blocks
ryelle Jan 20, 2018
f58af46
Merge block improvements back into the widgets
ryelle Jan 22, 2018
e202d52
Update changelog
ryelle Jan 22, 2018
232581a
Update block setting title
ryelle Jan 22, 2018
29eed0b
Add script to generate zip file
ryelle Jan 25, 2018
9058b3e
Fix typo in label
ryelle Jan 27, 2018
99591f9
Update Editable to RichText
ryelle Mar 19, 2018
752c3b0
Allow only showing 1 event
ryelle Mar 19, 2018
4b53c9e
Update eslint config
ryelle Mar 19, 2018
15b0eed
Switch to new components, auto format files
ryelle Mar 19, 2018
b397067
Update RichText component
ryelle May 19, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 Edge versions",
"last 2 Opera versions",
"last 2 iOS versions",
"last 1 Android version",
"last 1 ChromeAndroid version",
"ie 11",
"> 1%"
]
}
}
]
],
"plugins": [
"transform-object-rest-spread",
[
"transform-react-jsx",
{
"pragma": "wp.element.createElement"
}
]
]
}
164 changes: 164 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"root": true,
"parser": "babel-eslint",
"extends": [
"wordpress",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended"
],
"env": {
"browser": false,
"es6": true,
"node": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"globals": {
"TEMPLATE_DIRECTORY": true,
"wp": true,
"wpApiSettings": true,
"window": true,
"document": true
},
"plugins": [
"wordpress",
"react",
"jsx-a11y"
],
"settings": {
"react": {
"pragma": "wp"
}
},
"rules": {
"array-bracket-spacing": [ "error", "always" ],
"brace-style": [ "error", "1tbs" ],
"camelcase": "off",
"comma-dangle": [ "error", "always-multiline" ],
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": [ "error", "always" ],
"constructor-super": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": "error",
"func-call-spacing": "error",
"indent": [ "error", "tab", { "SwitchCase": 1 } ],
"jsx-a11y/label-has-for": [ "error", { "required": "id" } ],
"jsx-a11y/media-has-caption": "off",
"jsx-a11y/no-noninteractive-tabindex": "off",
"jsx-a11y/role-has-required-aria-props": "off",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"lines-around-comment": "off",
"no-alert": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-console": "error",
"no-const-assign": "error",
"no-debugger": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-eval": "error",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-lonely-if": "error",
"no-mixed-operators": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multiple-empty-lines": [ "error", { "max": 1 } ],
"no-multi-spaces": "error",
"no-multi-str": "off",
"no-negated-in-lhs": "error",
"no-nested-ternary": "error",
"no-redeclare": "error",
"no-restricted-syntax": [
"error",
{
"selector": "CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
"message": "Translate function arguments must be string literals."
},
{
"selector": "CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
"message": "Translate function arguments must be string literals."
},
{
"selector": "CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
"message": "Translate function arguments must be string literals."
},
{
"selector": "CallExpression[callee.name='__'][arguments.length!=2]",
"message": "Translate function __ must always be invoked with two arguments."
},
{
"selector": "CallExpression[callee.name='_x'][arguments.length!=3]",
"message": "Translate function _x must always be invoked with three arguments."
},
{
"selector": "CallExpression[callee.name='_n'][arguments.length!=4]",
"message": "Translate function _n must always be invoked with four arguments."
},
{
"selector": "CallExpression[callee.name='_nx'][arguments.length!=5]",
"message": "Translate function _nx must always be invoked with five arguments."
}
],
"no-shadow": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-unreachable": "error",
"no-unsafe-negation": "error",
"no-unused-expressions": "error",
"no-unused-vars": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": [ "error", "always" ],
"padded-blocks": [ "error", "never" ],
"prefer-const": "error",
"quote-props": [ "error", "as-needed" ],
"react/display-name": "off",
"react/jsx-curly-spacing": [
"error",
{
"when": "always",
"children": true
}
],
"react/jsx-equals-spacing": "error",
"react/jsx-indent": [ "error", "tab" ],
"react/jsx-indent-props": [ "error", "tab" ],
"react/jsx-key": "error",
"react/jsx-tag-spacing": "error",
"react/no-children-prop": "off",
"react/no-find-dom-node": "warn",
"react/prop-types": "off",
"semi": "error",
"semi-spacing": "error",
"space-before-blocks": [ "error", "always" ],
"space-before-function-paren": [ "error", "never" ],
"space-in-parens": [ "error", "always" ],
"space-infix-ops": [ "error", { "int32Hint": false } ],
"space-unary-ops": [
"error",
{
"overrides": {
"!": true
}
}
],
"template-curly-spacing": [ "error", "always" ],
"valid-typeof": "error",
"yoda": "off"
}
}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Directories/files used for wp.org
.svn
screenshot-1.png
screenshot-2.png

# Directories/files that may be generated by this project
node_modules
blocks/build

# Directories/files that may appear in your environment
.DS_Store
*.log
phpcs.xml
yarn.lock
package-lock.json
mock-data
build

/vendor/
composer.lock
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "ryelle/meetup-widgets",
"type": "project",
"require": {
"php": ">=5.6",
"xamin/handlebars.php": "dev-master"
},
"license": "GPL-2.0+",
"authors": [
{
"name": "Kelly Dwan"
}
],
"minimum-stability": "stable"
}
26 changes: 26 additions & 0 deletions includes/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
API
===

This folder contains controllers for Meetup.com proxy endpoints, using the API key set in wp-admin. These endpoints are each accessible by `GET` requests only, and only by logged-in users.

### Event Lists

meetup/v1/events/self

This lists upcoming events for the user who created the API key.

meetup/v1/events/(?P<group_urlname>[^/]+)

This lists upcoming events for the group passed through. This is the group `urlname`, for example, if the URL for your meetup is `https://www.meetup.com/boston-wordpress-meetup/`, the `urlname` is `boston-wordpress-meetup`.

### Single Event

meetup/v1/events/(?P<group_urlname>[^/]+)/(?P<event_id>[^/]+)

This gets information about a single event in a group. See above for the `group_urlname` description. The event ID is the part after `/events/` in a URL for a single event.

### Groups List

meetup/v1/groups/self

This lists the groups that the API key owner is a member of.
Loading