mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 01:03:28 +09:00
Implement default extravar skin to replace hardcoded HTML in ExtraItem class
This commit is contained in:
parent
dd06193a1d
commit
31fa498b19
14 changed files with 604 additions and 590 deletions
50
modules/extravar/skins/default/form.blade.php
Normal file
50
modules/extravar/skins/default/form.blade.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
@switch ($type)
|
||||
@case ('text')
|
||||
@include ('form_types/text')
|
||||
@break
|
||||
@case ('textarea')
|
||||
@include ('form_types/textarea')
|
||||
@break
|
||||
@case ('password')
|
||||
@include ('form_types/password')
|
||||
@break
|
||||
@case ('select')
|
||||
@include ('form_types/select')
|
||||
@break
|
||||
@case ('radio')
|
||||
@case ('checkbox')
|
||||
@include ('form_types/checkbox')
|
||||
@break
|
||||
@case ('tel')
|
||||
@case ('tel_v2')
|
||||
@case ('tel_intl')
|
||||
@case ('tel_intl_v2')
|
||||
@include ('form_types/tel')
|
||||
@break
|
||||
@case ('homepage')
|
||||
@case ('url')
|
||||
@include ('form_types/text')
|
||||
@break
|
||||
@case ('email_address')
|
||||
@case ('email')
|
||||
@include ('form_types/text')
|
||||
@break
|
||||
@case ('kr_zip')
|
||||
@include ('form_types/kr_zip')
|
||||
@break
|
||||
@case ('country')
|
||||
@case ('language')
|
||||
@case ('timezone')
|
||||
@include ('form_types/locale')
|
||||
@break
|
||||
@case ('date')
|
||||
@case ('time')
|
||||
@include ('form_types/datetime')
|
||||
@break
|
||||
@default
|
||||
@include ('form_types/text')
|
||||
@endswitch
|
||||
|
||||
@if ($desc)
|
||||
<p>{{ nl2br(escape(Context::replaceUserLang($definition->desc), false)) }}</p>
|
||||
@endif
|
||||
18
modules/extravar/skins/default/form_types/checkbox.blade.php
Normal file
18
modules/extravar/skins/default/form_types/checkbox.blade.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<ul class="rx_ev_{{ $type }}">
|
||||
@foreach ($default ?? [] as $v)
|
||||
@php
|
||||
$column_suffix = $type === 'checkbox' ? '[]' : '';
|
||||
$tempid = $definition->getNextTempID();
|
||||
$is_checked = is_array($value) && in_array(trim($v), $value);
|
||||
@endphp
|
||||
<li>
|
||||
<input type="{{ $type }}" name="{{ $input_name . $column_suffix }}"
|
||||
id="{{ $tempid }}" class="{{ $type }}" value="{{ $v }}"
|
||||
@checked($is_checked)
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/><label for="{{ $tempid }}">{{ $v }}</label>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
32
modules/extravar/skins/default/form_types/datetime.blade.php
Normal file
32
modules/extravar/skins/default/form_types/datetime.blade.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
@if ($type === 'date')
|
||||
@php
|
||||
$formatted_value = $value ? sprintf('%s-%s-%s', substr($value, 0, 4), substr($value, 4, 2), substr($value, 6, 2)) : '';
|
||||
@endphp
|
||||
<input type="hidden" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="rx_ev_date"
|
||||
value="{{ $value }}"
|
||||
/>
|
||||
<input type="date" class="date" value="{{ $formatted_value }}"
|
||||
pattern="\d{4}-\d{2}-\d{2}" placeholder="YYYY-MM-DD"
|
||||
onchange="jQuery(this).prev('.rx_ev_date').val(this.value.replace(/-/g, ''));"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
<button type="button" class="btn dateRemover"
|
||||
onclick="jQuery(this).prev('.date').val('').trigger('change');return false;">
|
||||
{{ lang('cmd_delete') }}
|
||||
</button>
|
||||
@else
|
||||
<input type="time" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="rx_ev_time"
|
||||
value="{{ $value }}" pattern="\d{2}:\d{2}"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
<button type="button" class="btn timeRemover"
|
||||
onclick="jQuery(this).prev('.rx_ev_time').val('');return false;">
|
||||
{{ lang('cmd_delete') }}
|
||||
</button>
|
||||
@endif
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
@php
|
||||
$oKrzipModel = KrzipModel::getInstance();
|
||||
@endphp
|
||||
|
||||
{!! $oKrzipModel->getKrzipCodeSearchHtml($input_name, $value) !!}
|
||||
53
modules/extravar/skins/default/form_types/locale.blade.php
Normal file
53
modules/extravar/skins/default/form_types/locale.blade.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
@if ($type === 'country')
|
||||
@php
|
||||
$lang_type = Context::getLangType();
|
||||
$lang_sort = $lang_type === 'ko' ? Rhymix\Framework\i18n::SORT_NAME_KOREAN : Rhymix\Framework\i18n::SORT_NAME_ENGLISH;
|
||||
$countries = Rhymix\Framework\i18n::listCountries($lang_sort);
|
||||
@endphp
|
||||
<select name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="select rx_ev_select rx_ev_select_country"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))>
|
||||
@foreach ($countries as $country)
|
||||
@php
|
||||
$country_name = $lang_type === 'ko' ? $country->name_korean : $country->name_english;
|
||||
$is_selected = strval($value) !== '' && $value === $country->iso_3166_1_alpha3;
|
||||
@endphp
|
||||
<option value="{{ $country->iso_3166_1_alpha3 }}" @selected($is_selected)>{{ $country_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif ($type === 'language')
|
||||
@php
|
||||
$enabled_languages = Rhymix\Framework\Config::get('locale.enabled_lang');
|
||||
$supported_languages = Rhymix\Framework\Lang::getSupportedList();
|
||||
@endphp
|
||||
<select name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="select rx_ev_select rx_ev_select_language"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))>
|
||||
@foreach ($enabled_languages as $language)
|
||||
@php
|
||||
$is_selected = strval($value) !== '' && $value === $language;
|
||||
@endphp
|
||||
<option value="{{ $language }}" @selected($is_selected)>{{ $supported_languages[$language]['name'] }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif ($type === 'timezone')
|
||||
@php
|
||||
$timezones = Rhymix\Framework\DateTime::getTimezoneList();
|
||||
@endphp
|
||||
<select name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="select rx_ev_select rx_ev_select_timezone"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))>
|
||||
@foreach ($timezones as $timezone_code => $timezone_name)
|
||||
@php
|
||||
$is_selected = strval($value) !== '' && $value === $timezone_code;
|
||||
@endphp
|
||||
<option value="{{ $timezone_code }}" @selected($is_selected)>{{ $timezone_name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<input type="password" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="password rx_ev_password"
|
||||
value="{{ strval($value) !== '' ? $value : $default }}"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<select name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="select rx_ev_select"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))>
|
||||
@foreach ($default ?: [] as $v)
|
||||
<option value="{{ $v }}" @selected(is_array($value) && in_array(trim($v), $value))>{{ $v }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
30
modules/extravar/skins/default/form_types/tel.blade.php
Normal file
30
modules/extravar/skins/default/form_types/tel.blade.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
@if ($type === 'tel')
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[0] }}" size="4" maxlength="4" class="tel rx_ev_tel1" />
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[1] }}" size="4" maxlength="4" class="tel rx_ev_tel2" />
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[2] }}" size="4" maxlength="4" class="tel rx_ev_tel3" />
|
||||
@elseif ($type === 'tel_v2')
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[0] }}" size="16" maxlength="16" class="rx_ev_tel_v2" />
|
||||
@elseif ($type === 'tel_intl' || $type === 'tel_intl_v2')
|
||||
@php
|
||||
$lang_type = Context::getLangType();
|
||||
$lang_sort = $lang_type === 'ko' ? Rhymix\Framework\i18n::SORT_NAME_KOREAN : Rhymix\Framework\i18n::SORT_NAME_ENGLISH;
|
||||
$countries = Rhymix\Framework\i18n::listCountries($lang_sort);
|
||||
@endphp
|
||||
<select name="{{ $input_name }}[]" class="select rx_ev_select rx_ev_select_country">
|
||||
<option value=""></option>
|
||||
@foreach ($countries as $country)
|
||||
@php
|
||||
$country_name = $lang_type === 'ko' ? $country->name_korean : $country->name_english;
|
||||
$is_selected = strval($value[0] ?? '') !== '' && $value[0] === $country->calling_code;
|
||||
@endphp
|
||||
<option value="{{ $country->calling_code }}" @selected($is_selected)>{{ $country_name }} (+{{ $country->calling_code }})</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@if ($type === 'tel_intl')
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[1] }}" size="4" maxlength="4" class="tel rx_ev_tel1" />
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[2] }}" size="4" maxlength="4" class="tel rx_ev_tel2" />
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[3] }}" size="4" maxlength="4" class="tel rx_ev_tel3" />
|
||||
@else
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[1] }}" size="16" maxlength="16" class="rx_ev_tel_v2" />
|
||||
@endif
|
||||
@endif
|
||||
25
modules/extravar/skins/default/form_types/text.blade.php
Normal file
25
modules/extravar/skins/default/form_types/text.blade.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
@if ($type === 'homepage' || $type === 'url')
|
||||
<input type="url" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="homepage rx_ev_url"
|
||||
value="{{ $value }}"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
@elseif ($type === 'email_address' || $type === 'email')
|
||||
<input type="email" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="email_address rx_ev_email"
|
||||
value="{{ $value }}"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
@else
|
||||
<input type="text" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="text rx_ev_text"
|
||||
value="{{ strval($value) !== '' ? $value : $default }}"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
@endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<textarea name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="rx_ev_textarea"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
rows="8" cols="42">{{ $value }}</textarea>
|
||||
Loading…
Add table
Add a link
Reference in a new issue