daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. <!-- ajaxtoslug -->
  3. <div @include('crud::inc.field_wrapper_attributes') >
  4. <label>{!! $field['label'] !!}</label>
  5. @include('crud::inc.field_translatable_icon')
  6.  
  7. @if(isset($field['prefix']) || isset($field['suffix'])) <div class="input-group"> @endif
  8.     @if(isset($field['prefix'])) <div class="input-group-addon">{!! $field['prefix'] !!}</div> @endif
  9.     <input
  10.             type="text"
  11.             name="{{ $field['name'] }}"
  12.             value="{{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}"
  13.             onchange="updateInput(this.value)"
  14.             @include('crud::inc.field_attributes')
  15.     >
  16.     @if(isset($field['suffix'])) <div class="input-group-addon">{!! $field['suffix'] !!}</div> @endif
  17.     @if(isset($field['prefix']) || isset($field['suffix'])) </div> @endif
  18.  
  19. {{-- HINT --}}
  20. @if (isset($field['hint']))
  21.     <p class="help-block">{!! $field['hint'] !!}</p>
  22. @endif
  23. </div>
  24.  
  25.    
  26. @if ($crud->checkIfFieldIsFirstOfItsType($field))
  27.     {{-- FIELD EXTRA CSS  --}}
  28.     {{-- push things in the after_styles section --}}
  29.  
  30.     @push('crud_fields_styles')
  31.         <!-- no styles -->
  32.     @endpush
  33.  
  34.     {{-- FIELD EXTRA JS --}}
  35.     {{-- push things in the after_scripts section --}}
  36.  
  37.     @push('crud_fields_scripts')
  38.         <script type="text/javascript">
  39.             var slug = function(str) {
  40.                 str = str.replace(/^\s+|\s+$/g, ''); // trim
  41.                 str = str.toLowerCase();
  42.  
  43.                 // remove accents, swap ñ for n, etc
  44.                 var from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
  45.                 var to   = "aaaaaeeeeeiiiiooooouuuunc------";
  46.                 for (var i=0, l=from.length ; i<l ; i++) {
  47.                     str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
  48.                 }
  49.  
  50.                 str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
  51.                     .replace(/\s+/g, '-') // collapse whitespace and replace by -
  52.                     .replace(/-+/g, '-'); // collapse dashes
  53.  
  54.                 return str;
  55.             };
  56.  
  57.             function updateInput(ish){
  58.                 //document.getElementById("ib").value = ish;
  59.                 $('input[name="{{ $field['to_slug'] }}"]').val(slug(ish));
  60.             }
  61.         </script>
  62.     @endpush
  63. @endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top