mecha-cms / x.panel

Control panel feature.
Other
6 stars 0 forks source link

TODO: Refactor Tab UI as Radio Inputs #22

Closed taufik-nurrohman closed 3 years ago

taufik-nurrohman commented 3 years ago

This allows us to capture the currently selected tab natively simply by submitting the form. The tab namespace should be free from the reserved file CRUD input prefix (e.g. file and page):

<form method="post">
  <div class="tabs">
    <div class="tab">
      <label>
        <input name="tab[0]" type="radio" value="file">
        <span>File</span>
      </label>
      <p>Content for file tab goes here…</p>
    </div>
    <!-- … -->
  </div>
</form>

This way, JavaScript becomes optional and can be used simply to convert the radio elements into a tab bar. To make nesting tabs should be easy.

taufik-nurrohman commented 3 years ago

Appending hidden input via JavaScript with value that changes on every tab click event should be enough. No need to do a refactor in the markup.