Skip to content

Commit

Permalink
Merge branch 'master' of github.com:markhuot/craftql
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Jan 5, 2018
2 parents 3ff58c0 + f8c9a6b commit fb8893c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ No software is ever done. There's a lot still to do in order to make _CraftQL_ f
- [x] Mutations need a lot more testing
- [x] `relatedTo:` improvements to take source/target
- [ ] [Persisted queries](https://github.com/markhuot/craftql/issues/10)
- [ ] [Subclassed enum fields](https://github.com/markhuot/craftql/issues/40) that are able to return the raw field value

## Requirements

Expand Down
6 changes: 3 additions & 3 deletions src/Controllers/CpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ function actionTokengenerate()
$token->token = Yii::$app->security->generateRandomString(64);
$token->save();

$this->redirect('/admin/settings/plugins/craftql');
$this->redirect('settings/plugins/craftql');
}

function actionTokendelete($tokenId)
{
$token = Token::find()->where(['id' => $tokenId])->one();
$token->delete();

$this->redirect('/admin/settings/plugins/craftql');
$this->redirect('settings/plugins/craftql');
}

function actionTokenscopes($tokenId)
Expand All @@ -44,7 +44,7 @@ function actionSavetokenscopes($tokenId)

Craft::$app->getSession()->setNotice(Craft::t('app', 'Scopes saved.'));

$this->redirect('/admin/craftql/token/'.$tokenId.'/scopes');
$this->redirect('craftql/token/'.$tokenId.'/scopes');
}

function actionIndex()
Expand Down
8 changes: 4 additions & 4 deletions src/templates/scopes.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{% set fullPageForm = true %}
{% set title = "Token Scopes"|t %}
{% set crumbs = [
{'label': 'Settings', 'url': '/admin/settings'},
{'label': 'Plugins', 'url': '/admin/settings/plugins'},
{'label': 'CraftQL', 'url': '/admin/settings/plugins/craftql'},
{'label': 'Settings', 'url': url('settings')},
{'label': 'Plugins', 'url': url('settings/plugins')},
{'label': 'CraftQL', 'url': url('settings/plugins/craftql')},
] %}

{% set content %}
Expand All @@ -23,7 +23,7 @@
</style>
<div class="fieldlayoutform">
<h2>Try it out</h2>
<p>You can explore your API with the permissions of this token by navigating to <a href="/admin/craftql/browse/{{ token.token }}">/admin/craftql/browse/{token}</a>.
<p>You can explore your API with the permissions of this token in <a href="{{ url('craftql/browse/' ~ token.token ) }}">GraphiQL</a>.
</div>

<hr>
Expand Down
10 changes: 5 additions & 5 deletions src/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@

You can access your GraphQL endpoint in two ways,

1. **[GraphiQL](/admin/craftql/browse)** <p>will show you a graphical interface to GraphQL. Use it to explore your schema and test requests. Click _Docs_ in the upper right hand corner to see all the fields you can query against.</p>
1. **[GraphiQL]({{ url('craftql/browse') }})** <p>will show you a graphical interface to GraphQL. Use it to explore your schema and test requests. Click _Docs_ in the upper right hand corner to see all the fields you can query against.</p>

2. **Curl**
{% if settings.tokens|length %}<p>You can query your schema directly by passing a GraphQL statement throuh a `query` variable. The following Curl statement should get you started,</p>
<p><pre style="background: whiteSmoke; padding: 15px;"><code class="shell">$ curl -H "Authorization: bearer {{ settings.tokens[0].token|default('{TOKEN}') }}" -H "Content-type: application/json" -d '{"query":"{ helloWorld }"}' {{ siteUrl }}{{ settings.uri }}</code></pre></p>
{% else %}
<p>Before you can use Curl you need to [add a token](/admin/craftql/token-gen) for authenticated access in to Craft.</p>
<p>Before you can use Curl you need to [add a token]({{ url('craftql/token-gen') }}) for authenticated access in to Craft.</p>
{% endif %}
{% endset %}

Expand All @@ -77,7 +77,7 @@ <h2>URI</h2>
<h2>Tokens</h2>
<p>Tokens control access in to your API. Instead of authenticating with a username and password, API access is granted via a token. Treat this token like a password because it provides privileged access in to your Craft website.</p>

<p><a href="/admin/craftql/token-gen">Generate a new token</a> (for my user)</p>
<p><a href="{{ url('craftql/token-gen') }}">Generate a new token</a> (for my user)</p>

{% if settings.tokens|length > 0 %}
<table class="data fullwidth collapsible">
Expand All @@ -93,8 +93,8 @@ <h2>Tokens</h2>
<tr>
<td><input type="text" name="token[{{ token.id }}][name]" class="text" placeholder="Name..." value="{{ token.name }}" /></td>
<td>{{ token.token }}</td>
<td><a href="/admin/craftql/token/{{ token.id }}/scopes">Scopes&hellip;</a></td>
<td><a class="delete icon" title="Delete" role="button" href="/admin/craftql/token-del/{{ token.id }}"></a></td>
<td><a href="{{ url('craftql/token/' ~ token.id ~ '/scopes') }}">Scopes&hellip;</a></td>
<td><a class="delete icon" title="Delete" role="button" href="{{ url('craftql/token-del/' ~ token.id) }}"></a></td>
</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit fb8893c

Please sign in to comment.