1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-17 20:11:46 +02:00

Fix issue processwire/processwire-issues#586 unnecessary "clone_field" property in field settings after a field is cloned. Unrelated: this commit also converts InputfieldPageAutocomplete to use an scss file.

This commit is contained in:
Ryan Cramer
2018-05-08 08:03:41 -04:00
parent a3d2a447a9
commit 211cf78403
3 changed files with 206 additions and 112 deletions

View File

@@ -1,119 +1,84 @@
.pw-content .InputfieldPageAutocomplete p {
margin: 0;
}
margin: 0; }
.pw-content .InputfieldPageAutocomplete ol {
margin: 0;
list-style: none;
}
.pw-content .InputfieldPageAutocomplete ol li {
/* li item from the html list above */
position: relative;
margin: 0 0 1px 0;
padding-left: 0;
list-style: none;
width: 100%;
line-height: 1em;
display: block;
cursor: move;
}
.InputfieldPageAutocomplete ol li i.fa-sort {
display: inline;
float: left;
margin-right: 7px;
position: relative;
top: 3px;
left: 3px;
opacity: 0.7;
}
.pw-content .InputfieldPageAutocomplete ol li:last-child {
margin-bottom: 0.5em;
}
.InputfieldPageAutocomplete ol li .ui-icon-arrowthick-2-n-s {
float: left;
margin-top: 1px;
}
.InputfieldPageAutocomplete ol li .itemLabel {
/* this is a span that surrounds the text in the item, except for the remove link */
display: block;
padding: 3px 0 3px 5px;
cursor: move;
}
.InputfieldPageAutocomplete ol li .itemRemove {
/* the remove link in each list item */
position: absolute;
right: 3px;
top: 0;
}
.InputfieldPageAutocomplete ol li i.fa-trash {
position: relative;
top: 2px;
right: 3px;
}
.InputfieldPageAutocomplete ol li .itemValue {
display: none;
}
.InputfieldPageAutocomplete ol li.itemTemplate {
display: none !important;
}
margin: 0;
list-style: none; }
.pw-content .InputfieldPageAutocomplete ol li {
/* li item from the html list above */
position: relative;
margin: 0 0 1px 0;
padding-left: 0;
list-style: none;
width: 100%;
line-height: 1em;
display: block;
cursor: move; }
.pw-content .InputfieldPageAutocomplete ol li i.fa-sort {
display: inline;
float: left;
margin-right: 7px;
position: relative;
top: 3px;
left: 3px;
opacity: 0.7; }
.pw-content .InputfieldPageAutocomplete ol li .ui-icon-arrowthick-2-n-s {
float: left;
margin-top: 1px; }
.pw-content .InputfieldPageAutocomplete ol li:last-child {
margin-bottom: 0.5em; }
.pw-content .InputfieldPageAutocomplete input.no_list {
/* some right padding for remove icon placement */
padding-right: 22px; }
.InputfieldPageAutocomplete ol li .itemLabel {
/* this is a span that surrounds the text in the item, except for the remove link */
display: block;
padding: 3px 0 3px 5px;
cursor: move; }
.InputfieldPageAutocomplete ol li .itemRemove {
/* the remove link in each list item */
position: absolute;
right: 3px;
top: 0; }
.InputfieldPageAutocomplete ol li .itemValue {
display: none; }
.InputfieldPageAutocomplete ol li i.fa-trash {
position: relative;
top: 2px;
right: 3px; }
.InputfieldPageAutocomplete ol li.itemTemplate {
display: none !important; }
.InputfieldPageAutocomplete input[type=text] {
/* some left padding for icon placement */
width: 100%;
padding-left: 18px;
}
.InputfieldPageAutocomplete input.no_list {
/* some right padding for remove icon placement */
padding-right: 22px;
}
/* some left padding for icon placement */
width: 100%;
padding-left: 18px; }
.InputfieldPageAutocomplete p {
position: relative;
margin-bottom: 0;
}
.InputfieldPageAutocomplete p i.fa {
/* icon placement */
position: absolute;
top: 0.5em;
left: 1px;
opacity: 0.5;
}
.InputfieldPageAutocomplete p i.fa.InputfieldPageAutocompleteRemove {
/* remove icon, for no_list mode */
left: auto;
right: 3px;
cursor: pointer;
}
.InputfieldPageAutocomplete p i.fa.InputfieldPageAutocompleteRemove:hover {
opacity: 1.0;
}
position: relative;
margin-bottom: 0; }
.InputfieldPageAutocomplete p i.fa {
/* icon placement */
position: absolute;
top: 0.5em;
left: 1px;
opacity: 0.5; }
.InputfieldPageAutocomplete p i.fa.InputfieldPageAutocompleteRemove {
/* remove icon, for no_list mode */
left: auto;
right: 3px;
cursor: pointer; }
.InputfieldPageAutocomplete p i.fa.InputfieldPageAutocompleteRemove:hover {
opacity: 1.0; }
.InputfieldPageAutocomplete .InputfieldPageAdd {
/* hide .InputfieldPageAdd since autocomplete uses it's own input for this */
display: none; }
.ui-autocomplete {
/* enforce scrolling, plus add a little shadow for better distinction from background */
max-height: 230px;
overflow-y: auto;
overflow-x: hidden;
box-shadow: 0 1px 3px 3px rgba(0,0,0,0.3);
}
.InputfieldPageAutocomplete .InputfieldPageAdd {
/* hide .InputfieldPageAdd since autocomplete uses it's own input for this */
display: none;
}
/* enforce scrolling, plus add a little shadow for better distinction from background */
max-height: 230px;
overflow-y: auto;
overflow-x: hidden;
box-shadow: 0 1px 2px 2px rgba(0, 0, 0, 0.2); }
.InputfieldPageAutocompleteNote {
/* Optional note with contextual helper tips */
display: none;
}
/* Optional note with contextual helper tips */
display: none; }

View File

@@ -0,0 +1,129 @@
.pw-content .InputfieldPageAutocomplete {
p {
margin: 0;
}
ol {
margin: 0;
list-style: none;
li {
/* li item from the html list above */
position: relative;
margin: 0 0 1px 0;
padding-left: 0;
list-style: none;
width: 100%;
line-height: 1em;
display: block;
cursor: move;
i.fa-sort {
display: inline;
float: left;
margin-right: 7px;
position: relative;
top: 3px;
left: 3px;
opacity: 0.7;
}
.ui-icon-arrowthick-2-n-s {
float: left;
margin-top: 1px;
}
}
li:last-child {
margin-bottom: 0.5em;
}
}
input.no_list {
/* some right padding for remove icon placement */
padding-right: 22px;
}
}
.InputfieldPageAutocomplete {
ol {
li {
.itemLabel {
/* this is a span that surrounds the text in the item, except for the remove link */
display: block;
padding: 3px 0 3px 5px;
cursor: move;
}
.itemRemove {
/* the remove link in each list item */
position: absolute;
right: 3px;
top: 0;
}
.itemValue {
display: none;
}
i.fa-trash {
position: relative;
top: 2px;
right: 3px;
}
}
li.itemTemplate {
display: none !important;
}
}
input[type=text] {
/* some left padding for icon placement */
width: 100%;
padding-left: 18px;
}
p {
position: relative;
margin-bottom: 0;
i.fa {
/* icon placement */
position: absolute;
top: 0.5em;
left: 1px;
opacity: 0.5;
}
i.fa.InputfieldPageAutocompleteRemove {
/* remove icon, for no_list mode */
left: auto;
right: 3px;
cursor: pointer;
&:hover {
opacity: 1.0;
}
}
}
.InputfieldPageAdd {
/* hide .InputfieldPageAdd since autocomplete uses it's own input for this */
display: none;
}
}
.ui-autocomplete {
/* enforce scrolling, plus add a little shadow for better distinction from background */
max-height: 230px;
overflow-y: auto;
overflow-x: hidden;
box-shadow: 0 1px 2px 2px rgba(0,0,0,0.2);
}
.InputfieldPageAutocompleteNote {
/* Optional note with contextual helper tips */
display: none;
}

View File

@@ -1362,7 +1362,7 @@ class ProcessField extends Process implements ConfigurableModule {
/** @var InputfieldText $field */
$field = $this->modules->get("InputfieldText");
$field->attr('id+name', 'clone_field');
$field->attr('id+name', '_clone_field');
$field->attr('value', '');
$field->label = $this->_('Duplicate/clone this field?');
$field->icon = 'copy';
@@ -1643,7 +1643,7 @@ class ProcessField extends Process implements ConfigurableModule {
$this->error($e->getMessage());
}
$cloneField = $this->form->get('clone_field');
$cloneField = $this->form->get('_clone_field');
$cloneName = $cloneField ? $cloneField->attr('value') : '';
if($cloneName && $this->isAllowedName($cloneName)) {
$clone = $this->fields->clone($this->field);