Skip to content

A platform for community discussion. Free, open, simple.

DEV: Minor fixes to json schema editor styling (#16634)

Penar Musaraj749e496a2cda
diff --git a/app/assets/javascripts/discourse/app/components/json-editor.js b/app/assets/javascripts/discourse/app/components/json-editor.js
index 2ac1dcc7349..b693dfc01e8 100644
--- a/app/assets/javascripts/discourse/app/components/json-editor.js
+++ b/app/assets/javascripts/discourse/app/components/json-editor.js
@@ -35,6 +35,7 @@ export default Component.extend({
disable_edit_json: true,
disable_properties: true,
disable_collapse: true,
+ remove_button_labels: true,
show_errors: "never",
startval: this.model.value ? JSON.parse(this.model.value) : null,
});
diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss
index 12489ab12e4..92254d43170 100644
--- a/app/assets/stylesheets/common/admin/admin_base.scss
+++ b/app/assets/stylesheets/common/admin/admin_base.scss
@@ -1003,6 +1003,7 @@ a.inline-editable-field {
@import "common/admin/suspend";
@import "common/admin/badges";
@import "common/admin/emails";
+@import "common/admin/json_schema_editor";
@import "common/admin/staff_logs";
@import "common/admin/customize";
@import "common/admin/customize-install-theme";
diff --git a/app/assets/stylesheets/common/admin/json_schema_editor.scss b/app/assets/stylesheets/common/admin/json_schema_editor.scss
new file mode 100644
index 00000000000..7f24897f1c0
--- /dev/null
+++ b/app/assets/stylesheets/common/admin/json_schema_editor.scss
@@ -0,0 +1,91 @@
+.json-schema-editor-modal {
+ h3.card-title {
+ margin-top: 0;
+
+ label {
+ display: none;
+ }
+ }
+
+ .card .je-object__container {
+ border-bottom: 1px dashed var(--primary-low);
+ padding-bottom: 1em;
+ margin-bottom: 1em;
+ position: relative;
+
+ .card-title label {
+ display: inline-block;
+ font-size: var(--font-down-1);
+ color: var(--primary-medium);
+ }
+
+ .form-group {
+ label {
+ display: inline-block;
+ width: 35%;
+ }
+
+ .form-control {
+ width: 65%;
+ }
+ }
+
+ .btn-group:last-child {
+ position: absolute;
+ right: 0px;
+ top: 0px;
+
+ .btn {
+ font-size: var(--font-down-1);
+ }
+ }
+ }
+
+ .btn-group {
+ margin-top: 0;
+ display: flex;
+ align-items: stretch;
+ gap: 0.25em;
+
+ .btn {
+ .d-icon {
+ margin-right: 0;
+ }
+ }
+ }
+
+ .card-body > .btn-group {
+ // !important needed to override inline style :-(
+ display: block !important;
+ text-align: right;
+ }
+
+ .table {
+ td {
+ vertical-align: top;
+ padding: 1em 0;
+ }
+
+ td.compact {
+ .invalid-feedback {
+ margin: 0;
+ font-size: var(--font-down-1);
+ color: var(--danger);
+ }
+ }
+
+ input[type="text"] {
+ margin-bottom: 0;
+ width: 95%;
+
+ &.is-invalid {
+ border-color: var(--danger);
+ outline: 1px solid var(--danger);
+ }
+ }
+ }
+
+ .desktop-view & #json-editor-holder {
+ min-width: 600px;
+ }
+}
diff --git a/app/assets/stylesheets/common/base/modal.scss b/app/assets/stylesheets/common/base/modal.scss
index f19d70c577f..4beb8b6230f 100644
--- a/app/assets/stylesheets/common/base/modal.scss
+++ b/app/assets/stylesheets/common/base/modal.scss
@@ -707,153 +707,6 @@
}
}
-.json-schema-editor-modal {
- h3.card-title {
- margin-top: 0;
- label {
- display: none;
- }
- }
-
- .card .je-object__container {
- border-bottom: 1px dashed var(--primary-low);
- padding-bottom: 1em;
- margin-bottom: 1em;
- position: relative;
-
- .card-title label {
- display: inline-block;
- font-size: $font-down-1;
- color: var(--primary-medium);
- }
- .form-group {
- label {
- display: inline-block;
- width: 33%;
- }
- .form-control {
- width: 66%;
- }
- }
- .btn-group:last-child {
- position: absolute;
- right: 0px;
- top: 0px;
- .btn {
- font-size: $font-down-2;
- }
- }
- }
-
- .btn-group {
- margin-top: 0;
- display: flex;
- align-items: stretch;
- gap: 0.5em;
-
- .btn {
- padding-block: 0.65em;
-
- .d-icon {
- margin-right: 0;
- }
- }
- }
-
- .json-editor-btn-delete {
- @extend .btn-danger !optional;
- @extend .no-text !optional;
- .d-icon + span {
- display: none;
- }
- }
-
- .card-body > .btn-group {
- // !important needed to override inline style :-(
- display: block !important;
- text-align: right;
- }
-}
-
-.json-schema-editor-modal {
- h3.card-title {
- margin-top: 0;
- label {
- display: none;
- }
- }
-
- .card .je-object__container {
- border-bottom: 1px dashed var(--primary-low);
- padding-bottom: 1em;
- margin-bottom: 1em;
- position: relative;
-
- .card-title label {
- display: inline-block;
- font-size: $font-down-1;
- color: var(--primary-medium);
- }
- .form-group {
- label {
- display: inline-block;
- width: 33%;
- }
- .form-control {
- width: 66%;
- }
- }
- .btn-group:last-child {
- position: absolute;
- right: 0px;
- top: 0px;
- .btn {
- font-size: $font-down-2;
- }
- }
- }
-
- .btn-group {
- margin-top: 0;
- }
-
- .json-editor-btn-delete {
- @extend .btn-danger !optional;
- @extend .no-text !optional;
- .d-icon + span {
- display: none;
- }
- }
-
- .card-body > .btn-group {
- // !important needed to override inline style :-(
- display: block !important;
- text-align: right;
- }
-
- .table {
- td {
- vertical-align: top;
- padding: 1em 0;
- }
- td.compact {
- .invalid-feedback {
- margin: 0;
- font-size: $font-down-1;
- color: var(--danger);
- }
- }
- input[type="text"] {
- margin-bottom: 0;
- width: 95%;
- &.is-invalid {
- border-color: var(--danger);
- outline: 1px solid var(--danger);
- }
- }
- }
-}
-
.group-add-members-modal {
.input-group {
margin-bottom: 0.5em;
diff --git a/app/assets/stylesheets/desktop/modal.scss b/app/assets/stylesheets/desktop/modal.scss
index fc7c89de077..689b01474ce 100644
--- a/app/assets/stylesheets/desktop/modal.scss
+++ b/app/assets/stylesheets/desktop/modal.scss
@@ -102,12 +102,6 @@
}
}
-.json-schema-editor-modal {
- #json-editor-holder {
- min-width: 500px;
- }
-}
-
.create-invite-modal,
.create-invite-bulk-modal,
.share-topic-modal {
@@ -130,3 +124,8 @@
max-width: 100vw; // prevent overflow if user font-size is enourmous
}
}
+
+.json-editor-btn-delete {
+ @extend .btn-danger !optional;
+ @extend .no-text !optional;
+}