updates on array element deleting
This commit is contained in:
		
							parent
							
								
									963708855c
								
							
						
					
					
						commit
						a5254560f5
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -48,7 +48,7 @@ $(document).on('ready pjax:success', function() {
 | 
			
		|||
        console.log(data);
 | 
			
		||||
      });
 | 
			
		||||
    } else {
 | 
			
		||||
      name = button.parent().parent().attr("for") || button.parent().parent().parent().attr("id");
 | 
			
		||||
      name = button.parent().parent().attr("for") || button.parent().parent().attr("id") || button.parent().parent().parent().attr("id");
 | 
			
		||||
      name = name.replace(/\[/, '\\[');
 | 
			
		||||
      name = name.replace(/\]/, '\\]');
 | 
			
		||||
      console.log(name)
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +256,12 @@ $(document).on('ready pjax:success', function() {
 | 
			
		|||
 | 
			
		||||
      if (type == "array") {
 | 
			
		||||
        name = name + "[]";
 | 
			
		||||
        title.after('<input name="' + name + ':auto" id="' + name + '"></input><br>');
 | 
			
		||||
        input = name;
 | 
			
		||||
        input = input.replace(/\[/, '\\[');
 | 
			
		||||
        input = input.replace(/\]/, '\\]');
 | 
			
		||||
        input = '#' + input;
 | 
			
		||||
 | 
			
		||||
        title.after('<div id="' + name + '-' + $(input).length + '" data-type="array-item"><input name="' + name + ':auto" id="' + name + '"></input></div>');
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,6 +111,17 @@ button.delete {
 | 
			
		|||
 | 
			
		||||
label:hover > .actions,
 | 
			
		||||
h1:hover > .actions,
 | 
			
		||||
h3:hover > .actions {
 | 
			
		||||
h3:hover > .actions,
 | 
			
		||||
div[data-type="array-item"]:hover .actions {
 | 
			
		||||
  opacity: .7;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input[data-parent-type="array"] + .actions {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top     : 1em;
 | 
			
		||||
  right   : .5em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div[data-type="array-item"] {
 | 
			
		||||
  position: relative;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -15,5 +15,7 @@
 | 
			
		|||
  </span>
 | 
			
		||||
</label>
 | 
			
		||||
{{ end }}
 | 
			
		||||
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}"></input>
 | 
			
		||||
{{ end }} {{ end }} {{ end }}
 | 
			
		||||
{{ if eq $value.Parent.Type "array" }}<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">{{ end }}
 | 
			
		||||
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" data-parent-type="{{ $value.Parent.Type }}"></input>
 | 
			
		||||
{{ if eq $value.Parent.Type "array" }}
 | 
			
		||||
<div class="actions"><button class="delete"><i class="fa fa-minus"></i></button></div></div>{{ end }} {{ end }} {{ end }} {{ end }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue