terrazzo 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +101 -0
- data/Rakefile +1 -0
- data/app/controllers/terrazzo/application_controller.rb +63 -14
- data/app/helpers/terrazzo/collection_actions_helper.rb +38 -13
- data/app/helpers/terrazzo/resource_paths_helper.rb +55 -0
- data/app/views/terrazzo/application/_edit_base.json.props +7 -4
- data/app/views/terrazzo/application/_index_base.json.props +83 -7
- data/app/views/terrazzo/application/_navigation.json.props +7 -4
- data/app/views/terrazzo/application/_new_base.json.props +6 -3
- data/app/views/terrazzo/application/_show_base.json.props +7 -5
- data/lib/generators/terrazzo/dashboard/dashboard_generator.rb +48 -24
- data/lib/generators/terrazzo/dashboard/templates/controller.rb.erb +8 -4
- data/lib/generators/terrazzo/dashboard/templates/dashboard.rb.erb +33 -25
- data/lib/generators/terrazzo/eject/eject_generator.rb +223 -113
- data/lib/generators/terrazzo/field/field_generator.rb +51 -7
- data/lib/generators/terrazzo/field/templates/FormField.jsx.erb +2 -3
- data/lib/generators/terrazzo/install/install_generator.rb +641 -4
- data/lib/generators/terrazzo/install/templates/admin.css +2 -0
- data/lib/generators/terrazzo/install/templates/application.js.erb +3 -0
- data/lib/generators/terrazzo/install/templates/components.json.erb +17 -0
- data/lib/generators/terrazzo/install/templates/custom_page_mapping.js.erb +5 -0
- data/lib/generators/terrazzo/install/templates/generated_page_mapping.js.erb +10 -0
- data/lib/generators/terrazzo/install/templates/jsconfig.json +8 -0
- data/lib/generators/terrazzo/install/templates/page_to_page_mapping.js.erb +9 -1
- data/lib/generators/terrazzo/install/templates/superglue.html.erb.erb +2 -2
- data/lib/generators/terrazzo/routes/routes_generator.rb +55 -20
- data/lib/generators/terrazzo/views/edit_generator.rb +16 -10
- data/lib/generators/terrazzo/views/eject_compatibility.rb +19 -0
- data/lib/generators/terrazzo/views/field_generator.rb +18 -6
- data/lib/generators/terrazzo/views/generated_defaults_helper.rb +110 -0
- data/lib/generators/terrazzo/views/index_generator.rb +9 -8
- data/lib/generators/terrazzo/views/layout_generator.rb +4 -3
- data/lib/generators/terrazzo/views/navigation_generator.rb +5 -1
- data/lib/generators/terrazzo/views/new_generator.rb +16 -10
- data/lib/generators/terrazzo/views/page_mapping_helper.rb +131 -8
- data/lib/generators/terrazzo/views/show_generator.rb +7 -6
- data/lib/generators/terrazzo/views/templates/components/CollectionFilters.jsx +25 -0
- data/lib/generators/terrazzo/views/templates/components/CollectionItemActions.jsx +68 -0
- data/lib/generators/terrazzo/views/templates/components/CollectionToolbarActions.jsx +60 -0
- data/lib/generators/terrazzo/views/templates/components/HasManyPagination.jsx +36 -0
- data/lib/generators/terrazzo/views/templates/components/Layout.jsx +9 -4
- data/lib/generators/terrazzo/views/templates/components/Pagination.jsx +32 -24
- data/lib/generators/terrazzo/views/templates/components/ResourceTable.jsx +172 -0
- data/lib/generators/terrazzo/views/templates/components/SearchBar.jsx +14 -6
- data/lib/generators/terrazzo/views/templates/components/SortableHeader.jsx +7 -5
- data/lib/generators/terrazzo/views/templates/components/app-sidebar.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/components/site-header.jsx +2 -2
- data/lib/generators/terrazzo/views/templates/fields/asset/FormField.jsx +15 -0
- data/lib/generators/terrazzo/views/templates/fields/asset/IndexField.jsx +5 -0
- data/lib/generators/terrazzo/views/templates/fields/asset/ShowField.jsx +13 -0
- data/lib/generators/terrazzo/views/templates/fields/belongs_to/FormField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/boolean/FormField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/boolean/IndexField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/has_many/FormField.jsx +3 -3
- data/lib/generators/terrazzo/views/templates/fields/has_many/IndexField.jsx +4 -3
- data/lib/generators/terrazzo/views/templates/fields/has_many/ShowField.jsx +21 -35
- data/lib/generators/terrazzo/views/templates/fields/has_one/FormField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/hstore/FormField.jsx +5 -5
- data/lib/generators/terrazzo/views/templates/fields/hstore/IndexField.jsx +0 -2
- data/lib/generators/terrazzo/views/templates/fields/hstore/ShowField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/number/IndexField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/number/ShowField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/polymorphic/FormField.jsx +3 -2
- data/lib/generators/terrazzo/views/templates/fields/rich_text/FormField.jsx +2 -2
- data/lib/generators/terrazzo/views/templates/fields/select/FormField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/select/IndexField.jsx +1 -1
- data/lib/generators/terrazzo/views/templates/fields/shared/TextInputFormField.jsx +2 -2
- data/lib/generators/terrazzo/views/templates/fields/text/FormField.jsx +2 -2
- data/lib/generators/terrazzo/views/templates/pages/_collection.jsx +5 -3
- data/lib/generators/terrazzo/views/templates/pages/_form.jsx +37 -30
- data/lib/generators/terrazzo/views/templates/pages/_navigation.json.props +14 -4
- data/lib/generators/terrazzo/views/templates/pages/edit.jsx +6 -4
- data/lib/generators/terrazzo/views/templates/pages/index.jsx +20 -8
- data/lib/generators/terrazzo/views/templates/pages/new.jsx +8 -4
- data/lib/generators/terrazzo/views/templates/pages/show.jsx +30 -32
- data/lib/generators/terrazzo/views/views_generator.rb +9 -5
- data/lib/terrazzo/base_dashboard.rb +167 -5
- data/lib/terrazzo/csv_export.rb +38 -0
- data/lib/terrazzo/field/associative.rb +16 -4
- data/lib/terrazzo/field/base.rb +4 -0
- data/lib/terrazzo/field/belongs_to.rb +1 -2
- data/lib/terrazzo/field/deferred.rb +4 -0
- data/lib/terrazzo/field/has_many.rb +79 -11
- data/lib/terrazzo/field/password.rb +6 -0
- data/lib/terrazzo/field/rich_text.rb +13 -0
- data/lib/terrazzo/generator_helpers.rb +1 -1
- data/lib/terrazzo/has_many_pagination.rb +9 -1
- data/lib/terrazzo/namespace/resource.rb +30 -0
- data/lib/terrazzo/namespace.rb +26 -1
- data/lib/terrazzo/search.rb +29 -9
- data/lib/terrazzo/version.rb +1 -1
- data/lib/terrazzo.rb +1 -0
- data/terrazzo.gemspec +11 -1
- metadata +40 -6
- data/lib/generators/terrazzo/install/templates/application.json.props.erb +0 -17
- data/lib/generators/terrazzo/views/templates/fields/FieldRenderer.jsx +0 -103
- data/lib/generators/terrazzo/views/templates/fields/index.js +0 -81
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { IndexField as StringIndex } from "./string/IndexField";
|
|
4
|
-
import { ShowField as StringShow } from "./string/ShowField";
|
|
5
|
-
import { FormField as StringForm } from "./string/FormField";
|
|
6
|
-
|
|
7
|
-
import { IndexField as TextIndex } from "./text/IndexField";
|
|
8
|
-
import { ShowField as TextShow } from "./text/ShowField";
|
|
9
|
-
import { FormField as TextForm } from "./text/FormField";
|
|
10
|
-
|
|
11
|
-
import { IndexField as NumberIndex } from "./number/IndexField";
|
|
12
|
-
import { ShowField as NumberShow } from "./number/ShowField";
|
|
13
|
-
import { FormField as NumberForm } from "./number/FormField";
|
|
14
|
-
|
|
15
|
-
import { IndexField as BooleanIndex } from "./boolean/IndexField";
|
|
16
|
-
import { ShowField as BooleanShow } from "./boolean/ShowField";
|
|
17
|
-
import { FormField as BooleanForm } from "./boolean/FormField";
|
|
18
|
-
|
|
19
|
-
import { IndexField as DateIndex } from "./date/IndexField";
|
|
20
|
-
import { ShowField as DateShow } from "./date/ShowField";
|
|
21
|
-
import { FormField as DateForm } from "./date/FormField";
|
|
22
|
-
|
|
23
|
-
import { IndexField as DateTimeIndex } from "./date_time/IndexField";
|
|
24
|
-
import { ShowField as DateTimeShow } from "./date_time/ShowField";
|
|
25
|
-
import { FormField as DateTimeForm } from "./date_time/FormField";
|
|
26
|
-
|
|
27
|
-
import { IndexField as TimeIndex } from "./time/IndexField";
|
|
28
|
-
import { ShowField as TimeShow } from "./time/ShowField";
|
|
29
|
-
import { FormField as TimeForm } from "./time/FormField";
|
|
30
|
-
|
|
31
|
-
import { IndexField as EmailIndex } from "./email/IndexField";
|
|
32
|
-
import { ShowField as EmailShow } from "./email/ShowField";
|
|
33
|
-
import { FormField as EmailForm } from "./email/FormField";
|
|
34
|
-
|
|
35
|
-
import { IndexField as UrlIndex } from "./url/IndexField";
|
|
36
|
-
import { ShowField as UrlShow } from "./url/ShowField";
|
|
37
|
-
import { FormField as UrlForm } from "./url/FormField";
|
|
38
|
-
|
|
39
|
-
import { IndexField as PasswordIndex } from "./password/IndexField";
|
|
40
|
-
import { ShowField as PasswordShow } from "./password/ShowField";
|
|
41
|
-
import { FormField as PasswordForm } from "./password/FormField";
|
|
42
|
-
|
|
43
|
-
import { IndexField as SelectIndex } from "./select/IndexField";
|
|
44
|
-
import { ShowField as SelectShow } from "./select/ShowField";
|
|
45
|
-
import { FormField as SelectForm } from "./select/FormField";
|
|
46
|
-
|
|
47
|
-
import { IndexField as HstoreIndex } from "./hstore/IndexField";
|
|
48
|
-
import { ShowField as HstoreShow } from "./hstore/ShowField";
|
|
49
|
-
import { FormField as HstoreForm } from "./hstore/FormField";
|
|
50
|
-
|
|
51
|
-
import { IndexField as RichTextIndex } from "./rich_text/IndexField";
|
|
52
|
-
import { ShowField as RichTextShow } from "./rich_text/ShowField";
|
|
53
|
-
import { FormField as RichTextForm } from "./rich_text/FormField";
|
|
54
|
-
|
|
55
|
-
import { IndexField as BelongsToIndex } from "./belongs_to/IndexField";
|
|
56
|
-
import { ShowField as BelongsToShow } from "./belongs_to/ShowField";
|
|
57
|
-
import { FormField as BelongsToForm } from "./belongs_to/FormField";
|
|
58
|
-
|
|
59
|
-
import { IndexField as HasManyIndex } from "./has_many/IndexField";
|
|
60
|
-
import { ShowField as HasManyShow } from "./has_many/ShowField";
|
|
61
|
-
import { FormField as HasManyForm } from "./has_many/FormField";
|
|
62
|
-
|
|
63
|
-
import { IndexField as HasOneIndex } from "./has_one/IndexField";
|
|
64
|
-
import { ShowField as HasOneShow } from "./has_one/ShowField";
|
|
65
|
-
import { FormField as HasOneForm } from "./has_one/FormField";
|
|
66
|
-
|
|
67
|
-
import { IndexField as PolymorphicIndex } from "./polymorphic/IndexField";
|
|
68
|
-
import { ShowField as PolymorphicShow } from "./polymorphic/ShowField";
|
|
69
|
-
import { FormField as PolymorphicForm } from "./polymorphic/FormField";
|
|
70
|
-
|
|
71
|
-
const fieldMap = {
|
|
72
|
-
string: { index: StringIndex, show: StringShow, form: StringForm },
|
|
73
|
-
text: { index: TextIndex, show: TextShow, form: TextForm },
|
|
74
|
-
number: { index: NumberIndex, show: NumberShow, form: NumberForm },
|
|
75
|
-
boolean: { index: BooleanIndex, show: BooleanShow, form: BooleanForm },
|
|
76
|
-
date: { index: DateIndex, show: DateShow, form: DateForm },
|
|
77
|
-
date_time: { index: DateTimeIndex, show: DateTimeShow, form: DateTimeForm },
|
|
78
|
-
time: { index: TimeIndex, show: TimeShow, form: TimeForm },
|
|
79
|
-
email: { index: EmailIndex, show: EmailShow, form: EmailForm },
|
|
80
|
-
url: { index: UrlIndex, show: UrlShow, form: UrlForm },
|
|
81
|
-
password: { index: PasswordIndex, show: PasswordShow, form: PasswordForm },
|
|
82
|
-
select: { index: SelectIndex, show: SelectShow, form: SelectForm },
|
|
83
|
-
hstore: { index: HstoreIndex, show: HstoreShow, form: HstoreForm },
|
|
84
|
-
rich_text: { index: RichTextIndex, show: RichTextShow, form: RichTextForm },
|
|
85
|
-
belongs_to: { index: BelongsToIndex, show: BelongsToShow, form: BelongsToForm },
|
|
86
|
-
has_many: { index: HasManyIndex, show: HasManyShow, form: HasManyForm },
|
|
87
|
-
has_one: { index: HasOneIndex, show: HasOneShow, form: HasOneForm },
|
|
88
|
-
polymorphic: { index: PolymorphicIndex, show: PolymorphicShow, form: PolymorphicForm }
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// Allow consumers to register custom field components
|
|
92
|
-
export function registerFieldType(
|
|
93
|
-
fieldType,
|
|
94
|
-
components)
|
|
95
|
-
{
|
|
96
|
-
fieldMap[fieldType] = { ...fieldMap[fieldType], ...components };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function FieldRenderer({ mode, fieldType, ...rest }) {
|
|
100
|
-
const Component = fieldMap[fieldType]?.[mode];
|
|
101
|
-
if (!Component) return <span>{String(rest.value ?? "")}</span>;
|
|
102
|
-
return <Component {...rest} />;
|
|
103
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export { FieldRenderer, registerFieldType } from "./FieldRenderer";
|
|
2
|
-
|
|
3
|
-
// String
|
|
4
|
-
export { IndexField as StringIndexField } from "./string/IndexField";
|
|
5
|
-
export { ShowField as StringShowField } from "./string/ShowField";
|
|
6
|
-
export { FormField as StringFormField } from "./string/FormField";
|
|
7
|
-
|
|
8
|
-
// Text
|
|
9
|
-
export { IndexField as TextIndexField } from "./text/IndexField";
|
|
10
|
-
export { ShowField as TextShowField } from "./text/ShowField";
|
|
11
|
-
export { FormField as TextFormField } from "./text/FormField";
|
|
12
|
-
|
|
13
|
-
// Number
|
|
14
|
-
export { IndexField as NumberIndexField } from "./number/IndexField";
|
|
15
|
-
export { ShowField as NumberShowField } from "./number/ShowField";
|
|
16
|
-
export { FormField as NumberFormField } from "./number/FormField";
|
|
17
|
-
|
|
18
|
-
// Boolean
|
|
19
|
-
export { IndexField as BooleanIndexField } from "./boolean/IndexField";
|
|
20
|
-
export { ShowField as BooleanShowField } from "./boolean/ShowField";
|
|
21
|
-
export { FormField as BooleanFormField } from "./boolean/FormField";
|
|
22
|
-
|
|
23
|
-
// Date
|
|
24
|
-
export { IndexField as DateIndexField } from "./date/IndexField";
|
|
25
|
-
export { ShowField as DateShowField } from "./date/ShowField";
|
|
26
|
-
export { FormField as DateFormField } from "./date/FormField";
|
|
27
|
-
|
|
28
|
-
// DateTime
|
|
29
|
-
export { IndexField as DateTimeIndexField } from "./date_time/IndexField";
|
|
30
|
-
export { ShowField as DateTimeShowField } from "./date_time/ShowField";
|
|
31
|
-
export { FormField as DateTimeFormField } from "./date_time/FormField";
|
|
32
|
-
|
|
33
|
-
// Time
|
|
34
|
-
export { IndexField as TimeIndexField } from "./time/IndexField";
|
|
35
|
-
export { ShowField as TimeShowField } from "./time/ShowField";
|
|
36
|
-
export { FormField as TimeFormField } from "./time/FormField";
|
|
37
|
-
|
|
38
|
-
// Email
|
|
39
|
-
export { IndexField as EmailIndexField } from "./email/IndexField";
|
|
40
|
-
export { ShowField as EmailShowField } from "./email/ShowField";
|
|
41
|
-
export { FormField as EmailFormField } from "./email/FormField";
|
|
42
|
-
|
|
43
|
-
// URL
|
|
44
|
-
export { IndexField as UrlIndexField } from "./url/IndexField";
|
|
45
|
-
export { ShowField as UrlShowField } from "./url/ShowField";
|
|
46
|
-
export { FormField as UrlFormField } from "./url/FormField";
|
|
47
|
-
|
|
48
|
-
// Password
|
|
49
|
-
export { IndexField as PasswordIndexField } from "./password/IndexField";
|
|
50
|
-
export { ShowField as PasswordShowField } from "./password/ShowField";
|
|
51
|
-
export { FormField as PasswordFormField } from "./password/FormField";
|
|
52
|
-
|
|
53
|
-
// Select
|
|
54
|
-
export { IndexField as SelectIndexField } from "./select/IndexField";
|
|
55
|
-
export { ShowField as SelectShowField } from "./select/ShowField";
|
|
56
|
-
export { FormField as SelectFormField } from "./select/FormField";
|
|
57
|
-
|
|
58
|
-
// Rich Text
|
|
59
|
-
export { IndexField as RichTextIndexField } from "./rich_text/IndexField";
|
|
60
|
-
export { ShowField as RichTextShowField } from "./rich_text/ShowField";
|
|
61
|
-
export { FormField as RichTextFormField } from "./rich_text/FormField";
|
|
62
|
-
|
|
63
|
-
// BelongsTo
|
|
64
|
-
export { IndexField as BelongsToIndexField } from "./belongs_to/IndexField";
|
|
65
|
-
export { ShowField as BelongsToShowField } from "./belongs_to/ShowField";
|
|
66
|
-
export { FormField as BelongsToFormField } from "./belongs_to/FormField";
|
|
67
|
-
|
|
68
|
-
// HasMany
|
|
69
|
-
export { IndexField as HasManyIndexField } from "./has_many/IndexField";
|
|
70
|
-
export { ShowField as HasManyShowField } from "./has_many/ShowField";
|
|
71
|
-
export { FormField as HasManyFormField } from "./has_many/FormField";
|
|
72
|
-
|
|
73
|
-
// HasOne
|
|
74
|
-
export { IndexField as HasOneIndexField } from "./has_one/IndexField";
|
|
75
|
-
export { ShowField as HasOneShowField } from "./has_one/ShowField";
|
|
76
|
-
export { FormField as HasOneFormField } from "./has_one/FormField";
|
|
77
|
-
|
|
78
|
-
// Polymorphic
|
|
79
|
-
export { IndexField as PolymorphicIndexField } from "./polymorphic/IndexField";
|
|
80
|
-
export { ShowField as PolymorphicShowField } from "./polymorphic/ShowField";
|
|
81
|
-
export { FormField as PolymorphicFormField } from "./polymorphic/FormField";
|