├── .gitignore
├── README.md
├── assets
├── css
│ └── structuretab.css
└── js
│ └── structuretab.js
├── structure-tabs.gif
└── structuretab.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Kirby-Structure-Tabs
2 | Tabbed Fields for Structured Content
3 |
4 | 
5 |
6 | The structure tab field type is designed specifically for use within the structure field and will not work outside of that context.
7 |
8 | The structure tab field also has the ability to track which tab was open when the user closed the modal. Essentially each time you click on one of that tabs, you're checking the box for that group of content and unchecking the box for the other groups.
9 |
10 | This data can be useful in your templates.
11 |
12 |
13 | #### Blueprint Example
14 | ``` YAML
15 | title: Page
16 | pages: true
17 | files: true
18 | fields:
19 | title:
20 | label: Title
21 | type: text
22 | modules:
23 | label: Modules
24 | type: structure
25 | entry: >
26 | {{projecttitle}}
27 | {{projectdate}}
28 | {{projectdescription}}
29 | {{name}}
30 | {{email}}
31 | fields:
32 | tab1:
33 | label: Project Info
34 | type: structuretab
35 | projecttitle:
36 | label: Project Title
37 | type: text
38 | width: 1/2
39 | projectdate:
40 | label: Project Date
41 | type: date
42 | width: 1/2
43 | projectdescription:
44 | label: Project Description
45 | type: textarea
46 | tab2:
47 | label: Author
48 | type: structuretab
49 | name:
50 | label: Name
51 | type: text
52 | email:
53 | label: Email
54 | type: email
55 | ```
56 |
--------------------------------------------------------------------------------
/assets/css/structuretab.css:
--------------------------------------------------------------------------------
1 | .modal-content-large{
2 | width: 80%;
3 | max-width: 1024px;
4 | }
5 |
6 | .group-title{
7 | position: absolute;
8 | top: -9999px;
9 | left: -9999px;
10 | opacity: 0;
11 | height: 0;
12 | width: 0;
13 | font-size: 0;
14 | }
15 |
16 | ul.tabs{
17 | width: 100%;
18 | margin-bottom: 20px;
19 | padding: 0px;
20 | list-style: none;
21 | border-bottom: 4px solid #dddddd;
22 | float: right;
23 | }
24 |
25 | ul.tabs li{
26 | display: inline-block;
27 | padding: 8px;
28 | margin-right: 5px;
29 | margin-bottom: -4px;
30 | background: none;
31 | display: inline-block;
32 | cursor: pointer;
33 | font-weight: 600;
34 | padding: 10px 15px;
35 | }
36 |
37 | ul.tabs li.current{
38 | border-bottom: 4px solid #8dae28;
39 | background: #efefef;
40 | }
41 |
42 | .group{
43 | display: none;
44 | padding: 15px;
45 | }
46 |
47 | .group.current{
48 | display: inherit;
49 | }
--------------------------------------------------------------------------------
/assets/js/structuretab.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | $(document).ready(function() {
3 |
4 | if (app && typeof app == 'object') {
5 | $(app.modal).on('view:load', initModalModules);
6 | }
7 |
8 | function initModalModules() {
9 |
10 | if ($('.modal-content input.structuretab').length)
11 |
12 | if ($(".modal-content").length){
13 | $('.modal-content').removeClass("modal-content-fixed");
14 | $(".modal-content .form").prepend($("