Skip to content

Commit 202f5d3

Browse files
committed
Twill 3.0 docs updates
1 parent 93c1488 commit 202f5d3

File tree

145 files changed

+1864
-1993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1864
-1993
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
Thanks for opening a PR! Your contribution is much appreciated.
3-
Do you have any questions? Check out the contributing docs at https://github.com/area17/twill/blob/2.x/CONTRIBUTING.md,
3+
Do you have any questions? Check out the contributing docs at https://github.com/area17/twill/blob/3.x/CONTRIBUTING.md,
44
or ask in this Pull Request and a Twill maintainer will be happy to help :)
55
-->
66

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Over the last 15 years, nearly every engineer at AREA 17 has contributed to Twil
4141
With contributions from Laurens van Heems, Fernando Petrelli, Gilbert Moufflet, Mubashar Iqbal, Pablo Barrios, Luis Lavena, and Mike Byrne.
4242

4343
# Contributing
44-
We look forward to your contribution to make Twill the best it can be. You can find our contribution guidelines in the Twill [documentation](https://twill.io/docs#contribution-guide).
44+
We look forward to your contribution to make Twill the best it can be. You can find our contribution guidelines in the Twill [documentation](https://twill.io/docs/#content-contribution-guide).
4545

4646
# Security vulnerabilities
4747
If you discover a security vulnerability within Twill, please email us at [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

SECURITY.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
## Supported Versions
44

55
| Version | Supported |
6-
| ------- | ------------------ |
7-
| 3.x | :white_check_mark: |
8-
| 2.x | :white_check_mark: |
6+
|---------|--------------------|
7+
| 3.x | :white_check_mark: |
8+
| 2.x | :white_check_mark: |
99
| 1.2.x | :white_check_mark: |
1010
| < 1.2 | :x: |
1111

config/media_library.php

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
| If using the 'local' endpoint type, define a 'local_path' to store files.
1717
| Supported image services:
1818
| - 'A17\Twill\Services\MediaLibrary\Imgix'
19+
| - 'A17\Twill\Services\MediaLibrary\TwicPics'
1920
| - 'A17\Twill\Services\MediaLibrary\Local'
2021
|
2122
*/
67.3 KB
Loading

docs/_templates/components/contentFooter.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<a
4949
class="text-link !no-underline"
5050
href="{{$githubLink}}"
51-
ref="noopener noreferrer"
51+
rel="noopener noreferrer"
5252
target="_blank">
5353
Edit this page on Github
5454
</a>

docs/_templates/components/grid-auto-generated.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a class="card__link" href="{{ $item['url'] }}">{{ $item['title'] }}</a>
77
@isset($item["metadata"]["summary"])<span class="card__summary">{{ $item["metadata"]["summary"] }}</span>@endisset
88
@isset($item["metadata"]["tag"])<em class="card__tag">{{ $item["metadata"]["tag"] }}</em>@endisset
9-
@isset($item["metadata"]["date"])<stemrong class="card__date">{{ $item["metadata"]["date"] }}</em>@endisset
9+
@isset($item["metadata"]["date"])<em class="card__date">{{ $item["metadata"]["date"] }}</em>@endisset
1010
</p>
1111
</div>
1212
@endforeach

docs/_templates/components/header.blade.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
<x-twilldocs::navLink url="https://twill.io/made" label="#MadeWithTwill" branded />
88
<x-twilldocs::navLink url="https://demo.twill.io/" label="Demo" />
99
<x-twilldocs::navLink url="https://discord.gg/cnWk7EFv8R" label="Chat" />
10-
<x-twilldocs::navLink url="https://twill.io/blog" label="Blog" />
11-
<x-twilldocs::navLink url="https://twill.io/docs" label="Docs" />
10+
<x-twilldocs::navLink url="/blog/" label="Blog" />
11+
<x-twilldocs::navLink url="/guides/" label="Guides" />
12+
<x-twilldocs::navLink url="/docs/" label="Docs" />
1213
<div id="docsearch"></div>
1314
<x-twilldocs::githubBtn />
1415
<x-twilldocs::menuBtn />

docs/_templates/css/chaptersNav.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
margin-top: 0;
3838
}
3939

40-
.chapters-nav-fixed > ul {
41-
@apply p-20 border border-primary;
40+
.chapters-nav-fixed > div > ul {
41+
@apply pt-20;
4242
}
4343

4444
.chapters-nav-fixed > div > ul > li {

docs/_templates/css/markdown.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@apply f-h1 mt-68;
99
}
1010

11-
body[class*="page--blogs"]:not([class~="page--blogs-index"]) .markdown h1 {
11+
body[class*="page--blog"]:not([class~="page--blog-index"]) .markdown h1 {
1212
@apply f-headline;
1313
}
1414

@@ -25,6 +25,10 @@
2525
@apply f-h4 mt-20 font-bold;
2626
}
2727

28+
.markdown h5 {
29+
@apply f-h4 mt-20 font-bold;
30+
}
31+
2832
.markdown p {
2933
@apply f-body;
3034
}

docs/_templates/js/nav.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// active scroll nav behavior
22
const ACTIVE_CLASS = 'text-link'
33
const LIST_ACTIVE = 'is-active'
4-
const INACTIVE_CLASS = 'text-black'
54
const nav = document.querySelector('.chapters-nav-fixed')
65
const headerHeight = 80
76

@@ -15,7 +14,7 @@ if (nav) {
1514

1615
// helper function to get the correct titles href
1716
const _getActiveHref = (titles, pos) => {
18-
let current = []
17+
const current = []
1918
titles.forEach(el => {
2019
// get height to top of page from title
2120
const offset = el.getBoundingClientRect()
@@ -33,15 +32,14 @@ if (nav) {
3332

3433
// pluck the last (most recent) item from that array and serve that :)
3534
// OR if undefined, return the first item
36-
let currentActiveIndex = current[current.length - 1]
35+
return current[current.length - 1]
3736
? current[current.length - 1]
38-
: chapterItems .length > 0 ? (chapterItems[0].querySelector('a') ? `#${chapterItems[0].querySelector('a').getAttribute('id')}` : -1) : -1
39-
return currentActiveIndex
37+
: chapterItems.length > 0 ? (chapterItems[0].querySelector('a') ? `#${chapterItems[0].querySelector('a').getAttribute('id')}` : -1) : -1
4038
}
4139

4240
const setActiveNav = pos => {
4341
const active = _getActiveHref(chapterItems, pos)
44-
console.log(active);
42+
4543
navItems.forEach(elem => {
4644
const linkEl = elem.querySelector('a')
4745
const listEl = elem

docs/_templates/layout.blade.php

+47-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,40 @@
99
<meta charset="UTF-8">
1010
<meta http-equiv="X-UA-Compatible" content="ie=edge">
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
12-
<title>{{ $title }}</title>
12+
<title>{{ $seoTitle ?? ($title . ' — Twill CMS') }}</title>
13+
<link rel="mask-icon" href="/dist/images/favicons/safari-pinned-tab.svg?v=3" color="#000000">
14+
<meta name="msapplication-TileColor" content="#ffffff">
15+
<meta name="theme-color" content="#000000">
16+
<meta property="og:image" content="https://twill.io/dist/images/social_share.png" />
17+
<meta property="og:image:width" content="1200" />
18+
<meta property="og:image:height" content="630" />
19+
20+
<meta name="twitter:image" content="https://twill.io/dist/images/social_share.png">
21+
<meta itemprop="image" content="https://twill.io/dist/images/social_share.png">
22+
23+
<!-- Facebook / Open Graph globals -->
24+
<meta property="og:type" content="website" />
25+
<meta property="og:site_name" content="Twill" />
26+
<meta property="og:author" content="https://www.facebook.com/twillcms/" />
27+
28+
<!-- Twitter globals -->
29+
<meta name="twitter:card" content="summary_large_image" />
30+
<meta name="twitter:site" content="@twillcms" />
31+
<meta name="twitter:domain" content="twill.io" />
32+
<meta name="twitter:creator" content="@twillcms" />
33+
34+
<!-- Main Favicon -->
35+
<link rel="shortcut icon" href="/dist/images/favicons/favicon.ico">
36+
<!-- Apple Touch Icons (ipad/iphone standard+retina) -->
37+
<link rel="apple-touch-icon" href="/dist/images/favicons/favicon-192.png">
38+
<!-- General use iOS/Android icon, auto-downscaled by devices. -->
39+
<link rel="apple-touch-icon" type="image/png" href="/dist/images/favicons/favicon-192.png" sizes="192x192">
40+
<!-- iPhone retina touch icon -->
41+
<link rel="apple-touch-icon" type="image/png" href="/dist/images/favicons/favicon-180.png" sizes="180x180">
42+
<!-- iPad home screen icons -->
43+
<!-- Favicon Fallbacks for old browsers that don't read .ico -->
44+
<link rel="icon" type="image/png" href="/dist/images/favicons/favicon-32.png" sizes="32x32">
45+
<link rel="icon" type="image/png" href="/dist/images/favicons/favicon-16.png" sizes="16x16">
1346
<link rel="preconnect" href="https://fonts.googleapis.com">
1447
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1548
<link rel="preconnect" href="https://89hnjpxalf-dsn.algolia.net" crossorigin />
@@ -20,6 +53,16 @@
2053
<script src="//unpkg.com/alpinejs" defer></script>
2154
</head>
2255

56+
<!-- Google tag (gtag.js) -->
57+
{{--<script async src="https://www.googletagmanager.com/gtag/js?id=G-EE0Y26M81B"></script>--}}
58+
{{--<script>--}}
59+
{{-- window.dataLayer = window.dataLayer || [];--}}
60+
{{-- function gtag(){dataLayer.push(arguments);}--}}
61+
{{-- gtag('js', new Date());--}}
62+
63+
{{-- gtag('config', 'G-EE0Y26M81B');--}}
64+
{{--</script>--}}
65+
2366
<body
2467
class="overflow-x-hidden page--{{ Str::slug(Str::replace(['/', '.html'], ['-', ''], $url)) }}"
2568
x-data="{ isMobile: (window.innerWidth < {{ intval($feConfig['structure']['breakpoints']['lg']) }}) ? true : false, openNav: false }"
@@ -41,14 +84,14 @@ class="overflow-x-hidden page--{{ Str::slug(Str::replace(['/', '.html'], ['-', '
4184
{!! $content !!}
4285
<x-twilldocs::grid-auto-generated :tree="$tree" :currentSegment="$currentSegment" :url="$url" />
4386
</div>
44-
@elseif ($currentSegment === 'blogs' && strpos($url, 'index.html'))
87+
@elseif ($currentSegment === 'blog' && strpos($url, 'index.html'))
4588
{{-- blog index --}}
4689
<div class="content markdown mt-68">
4790
<h1>{{$title}}</h1>
4891
{!! $content !!}
4992
<x-twilldocs::grid-auto-generated :tree="$tree" :currentSegment="$currentSegment" :url="$url" />
5093
</div>
51-
@elseif ($currentSegment === 'documentation' || $currentSegment === 'guides')
94+
@elseif ($currentSegment === 'docs' || $currentSegment === 'guides')
5295
<div class="flex flex-row flex-nowrap justify-between">
5396
<x-twilldocs::sidebar :tree="$tree" :currentSegment="$currentSegment" :url="$url"/>
5497
<div class="content markdown w-full lg:w-9-cols xl:w-6-cols lg:max-w-740 xl:mx-auto">
@@ -84,7 +127,7 @@ class="overflow-x-hidden page--{{ Str::slug(Str::replace(['/', '.html'], ['-', '
84127
<h1>{{$title}}</h1>
85128
{!! $content !!}
86129
</div>
87-
@elseif ($currentSegment === 'blogs')
130+
@elseif ($currentSegment === 'blog')
88131
{{-- blog details --}}
89132
<div class="flex flex-row flex-nowrap">
90133
<div class="content markdown w-full lg:w-9-cols xl:w-6-cols lg:max-w-740 lg:mx-auto mt-68">

docs/content/1_documentation/13_user-management/1_index.md docs/content/1_docs/10_user-management/1_index.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# User Management
22

33
Authentication and authorization are provided by default in Laravel. This package simply leverages what Laravel provides
4-
and configures the views for you. By default, users can login at `/login` and can also reset their password through that
4+
and configures the views for you. By default, users can log in at `/login` and can also reset their password through that
55
same screen. New users have to reset their password before they can gain access to the admin application. By using the
66
twill configuration file, you can change the default redirect path (`auth_login_redirect_path`) and send users to
77
anywhere in your application following login.
@@ -40,7 +40,7 @@ Admin users have the same permissions as publisher users plus:
4040
- full permissions on users
4141

4242
There is also a super admin user that can impersonate other users at `/users/impersonate/{id}`.
43-
The super admin can be a useful tool for testing features with different user roles without having to logout/login
43+
The super admin can be a useful tool for testing features with different user roles without having to log out/login
4444
manually,
4545
as well as for debugging issues reported by specific users. You can stop impersonating by going
4646
to `/users/impersonate/stop`.
@@ -82,9 +82,8 @@ class AppServiceProvider extends ServiceProvider
8282
}
8383
```
8484

85-
Finally, in your `AuthServiceProvider` class,
86-
redefine [Twill's default permissions](https://github.com/area17/twill/blob/e8866e40b7df4a6919e0ddb368990d04caeb705a/src/AuthServiceProvider.php#L26-L48)
87-
if you need to, or add your own, for example:
85+
Finally, in your `AuthServiceProvider` class, redefine [Twill's default permissions](https://github.com/area17/twill/blob/e8866e40b7df4a6919e0ddb368990d04caeb705a/src/AuthServiceProvider.php#L26-L48) if you need to, or
86+
add your own, for example:
8887

8988
```php
9089
<?php
@@ -124,7 +123,7 @@ class AuthServiceProvider extends ServiceProvider
124123
}
125124
```
126125

127-
If you need a more dynamic aproach you can also get the current permission enum using the facade:
126+
If you need a more dynamic approach you can also get the current permission enum using the facade:
128127

129128
```php
130129
TwillPermissons::roles()::PUBLISHER (or any role)
@@ -141,12 +140,10 @@ You can use your new permission and existing ones in many places like the `twill
141140
```
142141

143142
Also in forms blade files using `@can`, as well as in middleware definitions in routes or controllers,
144-
see [Laravel's documentation](https://laravel.com/docs/10.x/authorization#via-middleware) for more info.
143+
see [Laravel documentation](https://laravel.com/docs/10.x/authorization#via-middleware) for more info.
145144

146145
You should follow the Laravel documentation regarding [authorization](https://laravel.com/docs/10.x/authorization). It's
147-
pretty good. Also if you would like to bring administration of roles and permissions to the admin
148-
application, [spatie/laravel-permission](https://github.com/spatie/laravel-permission) would probably be your best
149-
friend.
146+
pretty good.
150147

151148
## Auto login
152149

docs/content/1_documentation/13_user-management/2_advanced-permissions.md docs/content/1_docs/10_user-management/2_advanced-permissions.md

+7-16
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ return [
1919
];
2020
```
2121

22-
In addition to this we have to configure the permissions system. There are 3 levels to choose from:
22+
In addition to this we have to configure the permissions' system. There are 3 levels to choose from:
2323

24-
- [**role**](#level-role): this manages the access of modules based on the role of a user
25-
- [**roleGroup**](#level-rolegroup): this manages the access of modules for a group of users, in addition to `role`
26-
- [**roleGroupItem**](#level-rolegroupitem): this manages the permission of items within a module, in addition
24+
- [**role**](#content-level-role): this manages the access of modules based on the role of a user
25+
- [**roleGroup**](#content-level-rolegroup): this manages the access of modules for a group of users, in addition to `role`
26+
- [**roleGroupItem**](#content-level-rolegroupitem): this manages the permission of items within a module, in addition
2727
to `roleGroup`
2828

2929
Set the `twill.permissions.level` to the desired type. And also set the modules to manage in
@@ -43,7 +43,7 @@ return [
4343
]
4444
```
4545

46-
Once you have setup permission-management, make sure to run your database migrations:
46+
Once you have set up permission-management, make sure to run your database migrations:
4747

4848
```
4949
php artisan migrate
@@ -62,16 +62,12 @@ The permission migration seeds 4 roles by default:
6262
- **Team**: Empty role, without permissions by default.
6363
- **Guest**: Empty role, without permissions by default. But not added to the "Everyone" group.
6464

65-
Below is a screenshot of the admin role to illustrate the options you can configure per role:
66-
67-
![Admin role](./assets/admin-role-screen.png)
68-
6965
## Level: RoleGroup
7066

7167
At it's core the RoleGroup level is the same as the Role level, however we now have an additional layer that can be used
7268
to further Group the users.
7369

74-
By default there is only one group "Everyone" where every user belongs to except for "Guests".
70+
By default, there is only one group "Everyone" where every user belongs to except for "Guests".
7571

7672
You can use Roles in combination with Groups to have more control over the permission a user gets.
7773

@@ -81,11 +77,6 @@ module.
8177
Now you can have a group "Module 1" and "Module 2", together with the "administrator" role, each user can only access
8278
the content for their groups.
8379

84-
![Group screen](./assets/group-screen.png)
85-
8680
## Level: RoleGroupItem
8781

88-
With RoleGroupItem you get all of the above. The difference is that you can also set permissions on a per entity level.
89-
90-
![User access control](./assets/user-access-control.png)
91-
82+
With RoleGroupItem you get all of the above. The difference is that you can also set permissions on a per-entity level.

docs/content/1_documentation/8_dashboard/index.md docs/content/1_docs/11_dashboard/index.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Dashboard
22

3-
Once you have created and configured multiple CRUD modules in your Twill's admin console, you can configure Twill's
4-
dashboard in `config/twill.php`.
3+
Once you have created and configured multiple CRUD modules in your Twill's admin console, you can configure Twill's dashboard in `config/twill.php`.
54

65
## Model activity
76

8-
For each module that you want to enable in a part or all parts of the dashboad, add an entry to the `dashboard.modules`
9-
array, like in the following example:
7+
For each module that you want to enable in a part or all parts of the dashboard, add an entry to the `dashboard.modules` array, like in the following example:
108

119
```php
1210
return [
@@ -31,7 +29,7 @@ return [
3129
];
3230
```
3331

34-
## Google analytics
32+
## Google Analytics
3533

3634
You can also enable a Google Analytics module:
3735

@@ -50,9 +48,7 @@ return [
5048

5149
It is using Spatie's [Laravel Analytics](https://github.com/spatie/laravel-analytics) package.
5250

53-
Follow [Spatie's documentation](https://github.com/spatie/laravel-analytics#how-to-obtain-the-credentials-to-communicate-with-google-analytics)
54-
to setup a Google service account and download a json file containing your credentials, and provide your Analytics view
55-
ID using the `ANALYTICS_VIEW_ID` environment variable.
51+
Follow [Spatie's documentation](https://github.com/spatie/laravel-analytics#how-to-obtain-the-credentials-to-communicate-with-google-analytics) to set up a Google service account and download a json file containing your credentials, and provide your Analytics view ID using the `ANALYTICS_VIEW_ID` environment variable.
5652

5753
## User activity
5854

docs/content/1_documentation/15_packages/1_creating-a-package.md docs/content/1_docs/14_packages/1_creating-a-package.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ php artisan twill:make:capsule Project --packageDirectory=./packages/twill-exten
4848

4949
The command above will create a capsule, if you want to create a singleton capsule you could use `php artisan twill:make:capsule --singleton` instead.
5050

51-
Once this is done you already can go ahead and refresh your twill admin and the new
52-
capsule should appear in the menu!
51+
Once this is done you already can go ahead and refresh your twill admin and the new capsule should appear in the menu!
5352

5453
If you get an error when visiting, do not forget to run your database migrations.
5554

docs/content/1_documentation/15_packages/1_index.md docs/content/1_docs/14_packages/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Packages
22

3-
Packages are a great way to add or create reusable functionality to your twill project.
3+
Packages are a great way to add or create reusable functionality to your Twill project.
44

55
At its base, a Twill package is just a Laravel package but starting from the `TwillPackageServiceProvider`.
66

7-
A package self-registers, and can contain Capsules.
7+
A package self-registers, and can contain [Capsules](../3_modules/4_capsules.md).
88

9-
Packages are composer installable.
9+
Packages are Composer installable.
1010

1111
In the following section we will explain how you can create your own package.
1212

0 commit comments

Comments
 (0)