Skip to content

Commit

Permalink
Fix UI, processing for users imports
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed Dec 10, 2019
1 parent 5ec28f4 commit 2768d36
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ public function mapAction()
$form = $this->getForm(MappingForm::class, $mappingOptions);
$form->setData($post);
if ($form->isValid()) {
// Flatten basic and advanced settings back into single level
$post = array_merge($post, $post['basic-settings'], $post['advanced-settings']);
unset($post['basic-settings'], $post['advanced-settings']);
if (isset($post['basic-settings']) || isset($post['advanced-settings'])) {
// Flatten basic and advanced settings back into single level
$post = array_merge($post, $post['basic-settings'], $post['advanced-settings']);
unset($post['basic-settings'], $post['advanced-settings']);
}

$args = $this->cleanArgs($post);
$this->saveUserSettings($args);
Expand Down
19 changes: 17 additions & 2 deletions view/csv-import/index/map.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ $pageTitle = isset($resourceTypeLabels[$resourceType])
<nav class="section-nav">
<ul>
<li class="active"><a href="#mapping-data"><?php echo $this->translate('Map to Omeka S data'); ?></a></li>
<?php if ($resourceType !== 'users'): ?>
<li><a href="#csv-import-basics-fieldset"><?php echo $this->translate('Basic Settings'); ?></a></li>
<li><a href="#csv-import-advanced-fieldset"><?php echo $this->translate('Advanced Settings'); ?></a></li>
<?php endif; ?>
</ul>
</nav>
<input type="hidden" name="filename" value="<?php echo $filename; ?>" />
Expand All @@ -53,13 +55,20 @@ $pageTitle = isset($resourceTypeLabels[$resourceType])
</div>
</div>
<?php endif; ?>
<?php if ($resourceType !== 'users'): ?>
<div class="batch-inputs">
<a class="inactive button" data-sidebar-selector="#column-options" id="batch-edit-options"><?php echo $this->translate('Batch edit options'); ?></a>
</div>
<?php endif; ?>
<table class="batch-edit tablesaw tablesaw-stack" data-tablesaw-mode="stack">
<thead>
<tr>
<th><input type="checkbox" class="select-all" aria-label="<?php echo $this->translate('Select all'); ?>"><?php echo $this->translate("Column"); ?></th>
<th>
<?php if ($resourceType !== 'users'): ?>
<input type="checkbox" class="select-all" aria-label="<?php echo $this->translate('Select all'); ?>">
<?php endif; ?>
<?php echo $this->translate("Column"); ?>
</th>
<th><?php echo $this->translate("Mappings"); ?></th>
<th><?php echo $this->translate("Options"); ?></th>
</tr>
Expand All @@ -68,11 +77,15 @@ $pageTitle = isset($resourceTypeLabels[$resourceType])
<?php foreach ($columns as $index=>$column): ?>
<tr class="element mappable" data-element-id="<?php echo $index; ?>" data-column="<?php echo $escapeHtml($column); ?>">
<td>
<input type="checkbox" name="column[<?php echo $index; ?>]" class="column-select" value="<?php echo $this->escapeHtml($column); ?>" aria-label="<?php echo $this->translate('Select column'); ?>">
<?php if ($resourceType !== 'users'): ?>
<input type="checkbox" name="column[<?php echo $index; ?>]" class="column-select" value="<?php echo $this->escapeHtml($column); ?>" aria-label="<?php echo $this->translate('Select column'); ?>">
<?php endif; ?>
<span class="column-header"><?php echo $escapeHtml($column); ?></span>
<ul class="actions">
<li><a href="#" class="o-icon-add sidebar-content" data-sidebar-selector="#add-mapping" aria-label="<?php echo $this->translate('Add mapping'); ?>" title="<?php echo $this->translate('Add mapping'); ?>"></a></li>
<?php if ($resourceType !== 'users'): ?>
<li><a href="#" class="o-icon-configure sidebar-content" aria-label="<?php echo $this->translate('Configure'); ?>" title="<?php echo $this->translate('Configure'); ?>" data-sidebar-selector="#column-options"></a></li>
<?php endif; ?>
</ul>
</td>
<td class="mapping element">
Expand Down Expand Up @@ -112,6 +125,8 @@ $pageTitle = isset($resourceTypeLabels[$resourceType])
</tbody>
</table>
<?php echo $this->partial('common/mapping-sidebar'); ?>
<?php if ($resourceType !== 'users'): ?>
<?php echo $this->partial('common/options-sidebar', ['dataTypes' => $dataTypes]); ?>
<?php endif; ?>
</fieldset>
<?php echo $this->form()->closeTag($form); ?>
2 changes: 1 addition & 1 deletion view/csv-import/mapping-sidebar/user.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4><?php echo $this->translate('Users info'); ?></h4>
</a>
<div class="collapsible">
<select data-flag-class="user-data" data-flag-label="">
<select data-flag-class="user-data" data-flag-label="<?php echo $this->translate('Users info'); ?>">
<option value="default"><?php echo $this->translate('Select below'); ?></option>
<option value="1" data-flag-name="column-user_email"><?php echo $this->translate('Email'); ?></option>
<option value="1" data-flag-name="column-user_name"><?php echo $this->translate('Display name'); ?></option>
Expand Down

0 comments on commit 2768d36

Please sign in to comment.