• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scriptype / writ-cms / 21603643815

02 Feb 2026 07:06PM UTC coverage: 38.574% (-0.06%) from 38.638%
21603643815

push

github

scriptype
Extract a selectContentTypesForm component from editProject

and also:
- move common into app dir
- dialog.appenChild

This form will be reused in the main project editing flow. so it was
time to componentize

621 of 3672 branches covered (16.91%)

Branch coverage included in aggregate %.

0 of 25 new or added lines in 3 files covered. (0.0%)

2171 of 3566 relevant lines covered (60.88%)

1756.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/cms/server/public/app/editProject.js
1
import api from '../api.js'
2
import { setIframeSrc } from './common.js'
3
import dialog from './components/dialog.js'
4
import selectContentTypesForm from './components/selectContentTypesForm.js'
5

6
const defaultContentTypes = [{
×
7
  name: 'Homepage',
8
  model: 'homepage',
9
  description: 'A generic landing page',
10
  attributes: {
11
    title: 'title',
12
    description: 'text',
13
    content: 'content'
14
  }
15
}, {
16
  name: 'Subpage',
17
  model: 'subpage',
18
  description: 'A generic subpage',
19
  attributes: {
20
    title: 'title',
21
    description: 'text',
22
    content: 'content'
23
  }
24
}, {
25
  name: 'Blog',
26
  model: 'collection',
27
  description: 'A collection of blog posts',
28
  facets: ['tags', 'date', 'author'],
29
  collectionAlias: 'blog',
30
  categoryContentType: '',
31
  categoryAlias: '',
32
  categoriesAlias: '',
33
  entryContentType: 'BlogPost',
34
  entryAlias: 'post',
35
  entriesAlias: 'posts',
36
  attributes: {
37
    title: 'title',
38
    description: 'text',
39
    content: 'content'
40
  }
41
}, {
42
  name: 'Category',
43
  model: 'category',
44
  description: 'A group of entries in a collection',
45
  attributes: {
46
    title: 'title',
47
    description: 'text',
48
    content: 'content'
49
  }
50
}, {
51
  name: 'BlogPost',
52
  model: 'entry',
53
  description: 'Article in a blog',
54
  attributes: {
55
    title: 'title',
56
    tags: 'strings',
57
    author: 'Person',
58
    date: 'date',
59
    summary: 'text',
60
    content: 'content',
61
    coverImage: 'imageAttachment'
62
  }
63
}, {
64
  name: 'Person',
65
  model: 'entry',
66
  description: 'A person',
67
  attributes: {
68
    title: 'title',
69
    email: 'email',
70
    bio: 'text',
71
    blogPosts: ['+BlogPost:author']
72
  }
73
}]
74

75

76
const editProject = async ({ ssgOptions }) => {
×
77
  console.log('starting editor with ssgOptions', ssgOptions)
×
78
  await api.ssg.watch(ssgOptions)
×
79
  setIframeSrc()
×
80

81
  const contentTypes = await api.contentTypes.get()
×
82
  if (contentTypes.length) {
×
83
    return console.log('contentTypes', contentTypes)
×
84
  }
85
  console.log('no contentTypes')
×
NEW
86
  const { $el: $contentTypeForm } = selectContentTypesForm({
×
87
    defaultContentTypes,
88
    onSubmit: (selectedContentTypes) => {
NEW
89
      console.log('selectedContentTypes', selectedContentTypes)
×
NEW
90
      selectedContentTypes.forEach(async contentType => {
×
NEW
91
        await api.contentTypes.create(contentType)
×
92
      })
NEW
93
      dialog.hide()
×
94
    }
95
  })
NEW
96
  dialog
×
97
    .appendChild($contentTypeForm)
98
    .show()
99
}
100

101
export default editProject
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc