add bitmap element
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 18 Jul 2019 20:53:19 +0000 (16:53 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 18 Jul 2019 20:53:19 +0000 (16:53 -0400)
views/ui/f6/bitmap.html [new file with mode: 0644]
views/ui/f6/checkbox.html
views/ui/f6/text.html

diff --git a/views/ui/f6/bitmap.html b/views/ui/f6/bitmap.html
new file mode 100644 (file)
index 0000000..4f6d0a9
--- /dev/null
@@ -0,0 +1,61 @@
+{*
+    Foundation 6 Bitmap Field
+    All parameters are required.
+    Only 0ne of $data or $field may be used.
+    Do not list fields if they're false. (We're not checking for false)
+
+    {$ui = [
+        'value'         => string   Value of the element
+        'field'         => string   Name of field that holds the data if not using data abstract,
+        'label'         => string   Label text for this field,
+        'active'        => string   Text for active state
+        'inactive'      => string   text for inactive state
+        'required'      => boolean  True if required,
+        'helpText'      => string   Help text for this input,
+        'errortext'     => string   Error text that appears when the field doesn't validate,
+        'dataError'     => string   Error from data Abstract Class
+    ]}
+*}
+<div class="cell small-12 glm-f6-ui-field">
+    <div class="grid-x grid-margin-x">
+        {foreach $ui.value as $item => $v}
+            <div class="cell small-12">
+                <div class="grid-x grid-margin-x">
+                    <div class="cell shrink glm-f6-ui-field-input">
+                        <div class="switch small glm-f6-ui-field-input-switch">
+                            <input class="switch-input" id="{$ui.field}-{$v.value}" type="checkbox" name="{$ui.field}[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}>
+                            <label for="{$ui.field}-{$v.value}" class="switch-paddle">
+                                <span class="show-for-sr">{$v.name}</span>
+                                <span class="switch-active" aria-hidden>{$ui.active|default:'On'}</span>
+                                <span class="switch-inactive" aria-hidden>{$ui.inactive|default:'Off'}</span>
+                            </label>
+                        </div>
+
+                    </div>
+                    <div class="cell auto glm-f6-ui-label-container-right">
+                        <label for="{$ui.field}-{$v.value}" class="glm-f6-ui-field-label">{$v.name}</label>
+                    </div>
+                </div>
+            </div>
+            <div class="cell small-12">
+                &nbsp;
+            </div>
+        {/foreach}
+        <div class="cell small-12">
+            {if isset($ui.dataError) && $ui.dataError}<span class="form-error is-visible glm-f6-ui-field-data-error">{$ui.dataError}</span>{/if}
+            {if isset($ui.errorText)}<span id="{$ui.field}_ErrorText" class="form-error glm-f6-ui-field-error-text" data-form-error-for="{$ui.field}">{$ui.errorText}</span>{/if}
+            {if isset($ui.helpText)}<span class="glm-f6-ui-field-help-text" id="{$ui.field}_HelpText">{$ui.helpText}</span]>{/if}
+        </div>
+    </div>
+</div>
+{*
+    <tr>
+        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.cc_accepts} glm­-required{/if}">Credit Card Accepted:</th>
+        <td {if $regSettings.fieldFail.cc_accepts}class="glm­form­bad­input" data­tabid="glm-reg-cc-accepts"{/if}>
+      {foreach from=$regSettings.fieldData.cc_accepts.bitmap item=v}
+            <input type="checkbox" name="cc_accepts[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}>{$v.name}<br>
+      {/foreach}
+            {if $regSettings.fieldFail.cc_accepts}<p>{$regSettings.fieldFail.cc_accepts}</p>{/if}
+        </td>
+    </tr>
+*}
index 91e01f9..4cbfb31 100644 (file)
@@ -23,8 +23,8 @@
                 <input class="switch-input" id="{$ui.field}" type="checkbox" name="{$ui.field}"{if $ui.value} checked{/if}{if $ui.required} required{/if}>
                 <label for="{$ui.field}" class="switch-paddle">
                     <span class="show-for-sr">{$ui.label}</span>
-                    <span class="switch-active" aria-hidden>{if isset($ui.active)}{$ui.active}{else}On{/if}</span>
-                    <span class="switch-inactive" aria-hidden>{if isset($ui.inactive)}{$ui.inactive}{else}Off{/if}</span>
+                    <span class="switch-active" aria-hidden>{$ui.active|default:'On'}</span>
+                    <span class="switch-inactive" aria-hidden>{$ui.inactive|default:'Off'}</span>
                 </label>
             </div>
 
index 00af318..eca39ae 100644 (file)
@@ -4,21 +4,22 @@
     Do not list parameters if they're false. (We're not checking for false).
 
     {$ui = [
-        'field'         => string   Required    Name of field that holds the data or formData array,
-        'value'         => string   Required    Value of this text element
-        'label'         => string   Required    Label text for this field,
-        'pattern'       => string               Pattern attribute ( number, etc. )
-        '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,
-        'errorText'     => string               Error text that appears when the field doesn't validate,
-        'dataError'     => string               Error from data Abstract Class
-        'tip'           => string               String to display when hover over question mark on right
+        'field'       => string  Required   Name of field that holds the data or formData array,
+        'value'       => string  Required   Value of this text element
+        'label'       => string  Required   Label text for this field,
+        'pattern'     => string             Pattern attribute ( number, etc. )
+        '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,
+        'errorText'   => string             Error text that appears when the field doesn't validate,
+        'dataError'   => string             Error from data Abstract Class
+        'tip'         => string             String to display when hover over question mark on right
+        'class'       => string             Additional Classes for the main cell div
     ]}
 *}
-<div class="cell small-12 glm-f6-ui-field">
+<div class="cell small-12 glm-f6-ui-field {$ui.class|default:''}">
     {if (!isset($ui.value) && !isset($ui.field)) || !isset($ui.label)}
         <span class="glm-required">Field Error: Required field information not supplied!</span>
     {else}