Changed textarea element to editor
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 21 Jun 2019 15:49:35 +0000 (11:49 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 21 Jun 2019 15:49:35 +0000 (11:49 -0400)
views/adminServerStatsConfig.html
views/ui/f6/editor.html [new file with mode: 0644]
views/ui/f6/f6-editor.html [deleted file]
views/ui/f6/f6-section-name.html [deleted file]
views/ui/f6/f6-text.html [deleted file]
views/ui/f6/textarea.html [deleted file]

index 5f90b66..2f96823 100755 (executable)
                     'rows'          => 5,
                     'maxwidth'      => '900px'
                 ]}
-                {include file="ui/f6/textarea.html"}
+                {include file="ui/f6/editor.html"}
 
 
 
diff --git a/views/ui/f6/editor.html b/views/ui/f6/editor.html
new file mode 100644 (file)
index 0000000..4598d5c
--- /dev/null
@@ -0,0 +1,70 @@
+{*
+    Foundation 6 Text Area Input Field
+    All parameters are required.
+    Do not list parameters if they're false. (We're not checking for false)
+    If supplying field data (formData) from the data abstract, supply a
+    name of that in the "field" parameter. Also then certain parameters like
+    "required" will be supplied by the abstract rather than in a parameter in
+    this array.
+
+    {$fieldData = [
+        'data'          => array    Data from data abstract if using that,
+        'field'         => string   Name of field that holds the data if not using data abstract,
+        'label'         => string   Label text for this field,
+        'placeholder'   => string   Placeholder string,
+        'required'      => boolean  True if required,
+        'maxwidth'      => string   Size of input field using standard style notation ('900px', '15rem', ...),
+
+        'maxlength'     => integer  Maximum number of characters that may be entered,
+        'helptext'      => string   Help text for this input,
+        'errtext'       => string   Error text that appears when the field doesn't validate
+    ]}
+*}
+
+{if (!isset($fieldData.data) && !isset($fieldData.field)) || !isset($fieldData.label)}
+    <div class="grid-x grid-margin-x">
+        <div class="cell small-12">
+            <span class="glm-required">Field Error: Required field information not supplied!</span>
+        </div>
+    </div>
+{else}
+    {if isset(${$fieldData.data})} {* If using data abstract *}
+        <div class="grid-x grid-margin-x">
+            <div class="cell small-12 medium-3">
+                <label for="{$fieldData.field}" class="{if $fieldData['data'].fieldRequired.$field} glm-required{/if}">{$fieldLabel}</label>
+            </div>
+            <div class="cell small-12 medium-9">
+                <input type="text" id="{$field}" name="{$field}" value="{$data.fieldData.$field|escape}" {if $data.fieldRequired.$field}required{/if} placeholder="{$placeholder}" />
+                {if $data.fieldFail.$field}<span class="form-error is-visible">{$data.fieldFail.$field}</span>{/if}
+            </div>
+        </div>
+    {else} {* Using simple field *}
+            <div class="small-12 columns">
+                <label class="{if $fieldData.required} glm-required{/if}">{$fieldData.label}:
+                    <div
+                        {if isset($fieldData.maxwidth)}style="width: {$fieldData.maxwidth} !important;"{/if}
+                    >
+                            {$editorOptions = '
+                                {
+                                "media_buttons":    false,
+                                "quicktags":        false'
+                            }
+                            {if isset($fieldData.height)}{$editorOptions = $editorOptions|cat:',
+                                "editor_height":    '|cat:$fieldData.height}{/if}
+                            {if isset($fieldData.rows)}{$editorOptions = $editorOptions|cat:',
+                                "textarea_rows":    '|cat:$fieldData.rows}{/if}
+                            {$editorOptions = $editorOptions|cat:'
+                                }'}
+                            {wp_editor(
+                                ${$fieldData.field},
+                                $fieldData.field,
+                                json_decode($editorOptions, true)
+                            )}
+
+                        {if isset($fieldData.helptext)}<p class="help-text" id="{$fieldData.field}_HelpText">{$fieldData.helptext}</p>{/if}
+                        {if isset($fieldData.errortext)}<span class="form-error">{$fieldData.errortext}</span>{/if}
+                    </div>
+                </label>
+            </div>
+    {/if}
+{/if}
diff --git a/views/ui/f6/f6-editor.html b/views/ui/f6/f6-editor.html
deleted file mode 100644 (file)
index f1a09b6..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-{* Foundation 6 Editor *}
-{* setup $data *}
-{* setup $field *}
-{* setup $fieldLabel *}
-<div class="grid-x grid-margin-x">
-    <div class="cell small-12 medium-3">
-        <label for="{$field}" class="text-right middle{if $data.fieldRequired.$field} glm-required{/if}">{$fieldLabel}</label>
-    </div>
-    <div class="cell small-12 medium-9">
-        {if isset($data) && $data.fieldData.$field}
-            {assign var="textAreaContent" value=$data.fieldData.$field}
-        {else}
-            {$textAreaContent = ''}
-        {/if}
-        {wp_editor(
-            $textAreaContent,
-            {$field},
-            json_decode('{
-                "media_buttons": true,
-                "quicktags": false,
-                "textarea_name": {$field},
-                "editor_height": 250
-            }', true)
-        )}
-        <br>
-        {if $data.fieldFail.$field}<span class="form-error is-visible">{$data.fieldFail.$field}</span>{/if}
-    </div>
-</div>
diff --git a/views/ui/f6/f6-section-name.html b/views/ui/f6/f6-section-name.html
deleted file mode 100644 (file)
index 56525a3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{*
-    Foundation 6 - Form Section Title
-    All parameters are required.
-*}
-{* $title   Title of Section *}
-
-{if $title==false}
-    <div class="grid-x grid-margin-x">
-        <div class="cell small-12">
-            <span class="glm-required">Field Error: Required field information not supplied!</span>
-        </div>
-    </div>
-{else}
-    <div class="grid-x grid-margin-x">
-        <div class="cell small-12">
-            <div for="{$field}" class="middle{if $required} glm-required{/if}">{$fieldLabel}:</label>
-        </div>
-    </div>
-{/if}
\ No newline at end of file
diff --git a/views/ui/f6/f6-text.html b/views/ui/f6/f6-text.html
deleted file mode 100644 (file)
index 0cece8c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-{*
-    Foundation 6 Text Input Field
-    All parameters are required.
-    One of $data or $field must be false
-    Set parameters to false if not used.
-*}
-{* $data        Data Array from data abstract results - If simple field data, not used *}
-{* $field       Simple data field name - If using data abstract, not used *}
-{* $fieldLabel  Input Label text *}
-{* $placeholder Placeholder text *}
-{* $required    True if field is required, defaults to false *}
-{* $message     Message to be displayed with field *}
-
-{if ($data==false && $field==false) || $fieldLabel==false}
-    <div class="grid-x grid-margin-x">
-        <div class="cell small-12">
-            <span class="glm-required">Field Error: Required field information not supplied!</span>
-        </div>
-    </div>
-{else}
-    {if $data!=false} {* If using data abstract *}
-        <div class="grid-x grid-margin-x">
-            <div class="cell small-12 medium-3">
-                <label for="{$field}" class="{if $data.fieldRequired.$field} glm-required{/if}">{$fieldLabel}</label>
-            </div>
-            <div class="cell small-12 medium-9">
-                <input type="text" id="{$field}" name="{$field}" value="{$data.fieldData.$field|escape}" {if $data.fieldRequired.$field}required{/if} placeholder="{$placeholder}" />
-                {if $data.fieldFail.$field}<span class="form-error is-visible">{$data.fieldFail.$field}</span>{/if}
-            </div>
-        </div>
-    {else} {* Using simple field *}
-            <div class="small-12">
-                <label class="{if $required} glm-required{/if}">{$fieldLabel}:
-                    {if isset($message)}<br><span class="help-text" id="passwordHelpText">{$message}</span>{/if}
-                    <input type="text" id="{$field}" name="{$field}" value="{${$field}}" {if $required}required{/if} placeholder="{$placeholder}"{if ($required && ${$field} == '')} style="border: 1px solid red;"{/if} />
-                </label>
-            </div>
-    {/if}
-{/if}
diff --git a/views/ui/f6/textarea.html b/views/ui/f6/textarea.html
deleted file mode 100644 (file)
index 4598d5c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{*
-    Foundation 6 Text Area Input Field
-    All parameters are required.
-    Do not list parameters if they're false. (We're not checking for false)
-    If supplying field data (formData) from the data abstract, supply a
-    name of that in the "field" parameter. Also then certain parameters like
-    "required" will be supplied by the abstract rather than in a parameter in
-    this array.
-
-    {$fieldData = [
-        'data'          => array    Data from data abstract if using that,
-        'field'         => string   Name of field that holds the data if not using data abstract,
-        'label'         => string   Label text for this field,
-        'placeholder'   => string   Placeholder string,
-        'required'      => boolean  True if required,
-        'maxwidth'      => string   Size of input field using standard style notation ('900px', '15rem', ...),
-
-        'maxlength'     => integer  Maximum number of characters that may be entered,
-        'helptext'      => string   Help text for this input,
-        'errtext'       => string   Error text that appears when the field doesn't validate
-    ]}
-*}
-
-{if (!isset($fieldData.data) && !isset($fieldData.field)) || !isset($fieldData.label)}
-    <div class="grid-x grid-margin-x">
-        <div class="cell small-12">
-            <span class="glm-required">Field Error: Required field information not supplied!</span>
-        </div>
-    </div>
-{else}
-    {if isset(${$fieldData.data})} {* If using data abstract *}
-        <div class="grid-x grid-margin-x">
-            <div class="cell small-12 medium-3">
-                <label for="{$fieldData.field}" class="{if $fieldData['data'].fieldRequired.$field} glm-required{/if}">{$fieldLabel}</label>
-            </div>
-            <div class="cell small-12 medium-9">
-                <input type="text" id="{$field}" name="{$field}" value="{$data.fieldData.$field|escape}" {if $data.fieldRequired.$field}required{/if} placeholder="{$placeholder}" />
-                {if $data.fieldFail.$field}<span class="form-error is-visible">{$data.fieldFail.$field}</span>{/if}
-            </div>
-        </div>
-    {else} {* Using simple field *}
-            <div class="small-12 columns">
-                <label class="{if $fieldData.required} glm-required{/if}">{$fieldData.label}:
-                    <div
-                        {if isset($fieldData.maxwidth)}style="width: {$fieldData.maxwidth} !important;"{/if}
-                    >
-                            {$editorOptions = '
-                                {
-                                "media_buttons":    false,
-                                "quicktags":        false'
-                            }
-                            {if isset($fieldData.height)}{$editorOptions = $editorOptions|cat:',
-                                "editor_height":    '|cat:$fieldData.height}{/if}
-                            {if isset($fieldData.rows)}{$editorOptions = $editorOptions|cat:',
-                                "textarea_rows":    '|cat:$fieldData.rows}{/if}
-                            {$editorOptions = $editorOptions|cat:'
-                                }'}
-                            {wp_editor(
-                                ${$fieldData.field},
-                                $fieldData.field,
-                                json_decode($editorOptions, true)
-                            )}
-
-                        {if isset($fieldData.helptext)}<p class="help-text" id="{$fieldData.field}_HelpText">{$fieldData.helptext}</p>{/if}
-                        {if isset($fieldData.errortext)}<span class="form-error">{$fieldData.errortext}</span>{/if}
-                    </div>
-                </label>
-            </div>
-    {/if}
-{/if}