about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-08-28 17:15:50 +0200
committerThibG <thib@sitedethib.com>2018-08-31 18:35:03 +0200
commit5c400a28422121df01fc5ae73bc201f3b9aa5288 (patch)
tree1e5f7e643339d4683784d394a007764ac91fcc10 /app
parent9d2739d74da26b725f03eb5a19a93c6041714be7 (diff)
Allow text inputs in local settings dialog
Diffstat (limited to 'app')
-rw-r--r--app/javascript/flavours/glitch/features/local_settings/page/item/index.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/local_settings/page/item/index.js b/app/javascript/flavours/glitch/features/local_settings/page/item/index.js
index 66e84dfe1..fe237f11e 100644
--- a/app/javascript/flavours/glitch/features/local_settings/page/item/index.js
+++ b/app/javascript/flavours/glitch/features/local_settings/page/item/index.js
@@ -19,18 +19,20 @@ export default class LocalSettingsPageItem extends React.PureComponent {
       message: PropTypes.string.isRequired,
     })),
     settings: ImmutablePropTypes.map.isRequired,
+    placeholder: PropTypes.string,
   };
 
   handleChange = e => {
     const { target } = e;
-    const { item, onChange, options } = this.props;
+    const { item, onChange, options, placeholder } = this.props;
     if (options && options.length > 0) onChange(item, target.value);
+    else if (placeholder) onChange(item, target.value);
     else onChange(item, target.checked);
   }
 
   render () {
     const { handleChange } = this;
-    const { settings, item, id, options, children, dependsOn, dependsOnNot } = this.props;
+    const { settings, item, id, options, children, dependsOn, dependsOnNot, placeholder } = this.props;
     let enabled = true;
 
     if (dependsOn) {
@@ -70,6 +72,22 @@ export default class LocalSettingsPageItem extends React.PureComponent {
           </p>
         </label>
       );
+    } else if (placeholder) {
+      return (
+        <label className='glitch local-settings__page__item' htmlFor={id}>
+          <p>{children}</p>
+          <p>
+            <input
+              id={id}
+              type='text'
+              value={settings.getIn(item)}
+              placeholder={placeholder}
+              onChange={handleChange}
+              disabled={!enabled}
+            />
+          </p>
+        </label>
+      );
     } else return (
       <label className='glitch local-settings__page__item' htmlFor={id}>
         <input