123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="uex_config_panel" style="display: block;">
  <input id="count_field" type="hidden" value="0">
  <div class="uex_panel uex_options_input">
    <h3>Tipos de campos permitidos a adicionar</h3>
    <a id="text" class="uex_add_option">Add text</a>
    <a id="date" class="uex_add_option">Add date</a>
    <a id="select" class="uex_add_option">Add select</a>
    <a id="email" class="uex_add_option">Add email</a>
    <a id="password" class="uex_add_option">Add password</a>
  </div>
  <div class="uex_panel uex_set_input">
    <h3>Configurar campo extra</h3>
    <div id="config_field"></div>
    <a id="add_input" class="uex_set_option">Add</a>
  </div>
  <div class="uex_panel uex_view_inputs">
    <h3>Campos Extras</h3>
    <table class="form-table">
      <tbody id="fields">
        <tr class="saved">
          <th><label>Address</label></th>
          <td><input type="text"></td>
          <td><a id="remove_input" class="uex_remove_option">X</a></td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
            
          
!
            
              /**
 * All of the CSS for your admin-specific functionality should be
 * included in this file.
 */

a{
  color: blue;
}

a.uex_config {
  cursor: hand !important;
  margin-left: 20px;
}

.uex_config_panel {
  width: 100%;
  min-height: 100px;
  border: 1px dotted black;
  display: none;
}

.uex_config_panel a {
  position: relative;
  margin: 0 5px;
  height: 30px;
  border-radius: 10px;
  padding: 5px;
  white-space: nowrap;
  cursor: hand !important;
  line-height: 35px;
}

a.uex_add_option {
  background: black;
}

a.uex_add_option:hover {
  background: rgb(47, 45, 45);
}

a.uex_set_option {
  background: green;
  color: white;
  width: 100%;
}

a.uex_set_option:hover {
  background: #36D036;
}

a.uex_remove_option {
  color: white;
  border-radius: 0;
}

tr.remove a.uex_remove_option {
  background: red;
}

tr.saved a.uex_remove_option {
  background: green;
}

tr.pending a.uex_remove_option {
  background: blue;
}

a.uex_remove_option:hover {
  background: red !important;
}

div.uex_panel {
  display: inline-block;
  padding: 15px;
  width: 27%;
  margin: 1%;
  min-height: 100px;
  vertical-align: top;
}
            
          
!
            
              $(function() {
  $('.uex_config').click(function() {
    if ($(this).hasClass('uex_config_hide')) {
      $('.uex_config_panel').hide('slow');
      $(this).html('Config extra fields').removeClass('uex_config_hide');
    } else {
      $('.uex_config_panel').show('slow');
      $(this).html('hide').addClass('uex_config_hide');
    }
  });

  $('.uex_add_option').click(function() {
    var id = $(this).attr('id');
    var div = "Botão não implementado";
    if (id == 'text') {
      div = "<label>Name Field: </label><input id='name_field' type='text'/><br><label>Label Field: </label><input id='label_field' type='text'/><br><input id='type_field' type='hidden' value='text'>";
    }
    $('#config_field').append(div);
  });

  $('#add_input').click(function() {
    var count_field = $('#count_field').val();
    var type = $('#type_field').val();
    var field = '';
    if (type == 'text') {
      var label = $('#label_field').val();
      var name = $('#name_field').val();
      field = "<tr class='pending'><input id='field_name_" + count_field + "' type='hidden' value='" + name + "'><input id='field_label_" + count_field + "' type='hidden' value='" + label + "'><input id='field_type_" + count_field + "' type='hidden' value='" + type + "'><th><label>" + label + "</label></th><td><input class='field_type' type='text'/></td><td><a id='remove_input' class='uex_remove_option'>X</a></td></tr>";
      count_field++;
      $('#count_field').val(count_field);
      $('#config_field').html('');
    }
    $('#fields').append(field);

    $('#remove_input').on("click", function() {
      var count_field = $('#count_field').val();
      var parent_class = $(this).parents('tr');
      if (parent_class.hasClass('pending')) {
        parent_class.remove();
        count_field--;
      } else if (parent_class.hasClass('saved')) {
        parent_class.removeClass('saved').addClass('remove');
      }
      $('#count_field').val(count_field);
    });
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console