Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin forms layout fills screen width #2108

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

- Feat #2100: Admin forms layout fills screen width
- Feat #2066: Update file attribute values form layout and add expand button for long values
- Feat #2102: Delete outdated apidocs files
- Feat #1667: Add log entry when minting DOI
Expand Down
11 changes: 11 additions & 0 deletions less/modules/buttons.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
}
}

.btn-min-width {
min-width: 120px;
display: flex;
justify-content: center;
align-items: center;
@media (min-width: 768px) {
min-width: 150px;
}
}


.danger-btn {
color: @color-true-white;
background-color: @color-brand-danger-650;
Expand Down
4 changes: 4 additions & 0 deletions less/modules/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ input:not([type="submit"]):not([type="button"]), select, textarea, .form-control
}
}

textarea.form-control {
resize: vertical;
}

// Base checkbox styles
input[type="checkbox"] {
width: auto;
Expand Down
225 changes: 125 additions & 100 deletions protected/views/adminAuthor/_form.php
Original file line number Diff line number Diff line change
@@ -1,118 +1,143 @@
<div class="section form row">
<div class="section form">
<?php $form = $this->beginWidget('CActiveForm', array(
'id' => 'author-form',
'enableAjaxValidation' => false,
'htmlOptions' => [
'class' => 'row'
]
)); ?>

<div class="col-md-offset-3 col-md-6">
<?php $form = $this->beginWidget('CActiveForm', array(
'id' => 'author-form',
'enableAjaxValidation' => false,
)); ?>
<div class="col-md-12">
<p class="note">Fields with <span class="required">*</span> are required.</p>

<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php if ($model->hasErrors()): ?>
<div class="alert alert-danger">
<?php echo $form->errorSummary($model); ?>
</div>
<?php endif; ?>
</div>

<?php if ($model->hasErrors()) : ?>
<div class="alert alert-danger">
<?php echo $form->errorSummary($model); ?>
</div>
<?php endif; ?>
<?php
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'surname',
'inputOptions' => [
'required' => true,
'maxlength' => 255
],
'groupOptions' => [
'class' => 'col-md-4'
],
]);

<?php
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'surname',
'inputOptions' => [
'required' => true,
'maxlength' => 255
],
]);
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'first_name',
'inputOptions' => [
'maxlength' => 255
],
'groupOptions' => [
'class' => 'col-md-4'
],
]);

$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'first_name',
'inputOptions' => [
'maxlength' => 255
],
]);
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'middle_name',
'inputOptions' => [
'maxlength' => 255
],
]);
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'custom_name',
'inputOptions' => [
'maxlength' => 255
],
]);
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'orcid',
'inputOptions' => [
'maxlength' => 128
],
]);
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'gigadb_user_id',
'inputOptions' => [
'maxlength' => 128
],
]);
?>
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'middle_name',
'inputOptions' => [
'maxlength' => 255
],
'groupOptions' => [
'class' => 'col-md-4'
],
]);

<div class="merge-author-info">
<?php
$identical_authors = $model->getIdenticalAuthors();
if (!empty($identical_authors)) {
?>
<div class="alert alert-gigadb-info">
this author is merged with author(s):
<ul class="list-unstyled">
<?php
foreach ($identical_authors as $author_id) {
$author = Author::model()->findByPk($author_id);
echo "<li>" . $author->getAuthorDetails() . "</li>";
}
?>
</ul>
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'custom_name',
'inputOptions' => [
'maxlength' => 255
],
'groupOptions' => [
'class' => 'col-md-12'
],
]);

</div>
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'orcid',
'inputOptions' => [
'maxlength' => 128
],
'groupOptions' => [
'class' => 'col-md-6'
],
]);

<?php } ?>
$this->widget('application.components.controls.TextField', [
'form' => $form,
'model' => $model,
'attributeName' => 'gigadb_user_id',
'inputOptions' => [
'maxlength' => 128
],
'groupOptions' => [
'class' => 'col-md-6'
],
]);
?>

<?php
if (!empty($identical_authors)) {
echo CHtml::link(
'Unmerge author from those authors',
array('adminAuthor/unmerge', 'id' => $model->id),
array('class' => 'btn btn-link')
);
}
?>
</div>
<div class="col-md-12">
<div class="merge-author-info">
<?php
$identical_authors = $model->getIdenticalAuthors();
if (!empty($identical_authors)) {
?>
<div class="alert alert-gigadb-info">
this author is merged with author(s):
<ul class="list-unstyled">
<?php
foreach ($identical_authors as $author_id) {
$author = Author::model()->findByPk($author_id);
echo "<li>" . $author->getAuthorDetails() . "</li>";
}
?>
</ul>
</div>
<?php } ?>

<div class="pull-right btns-row">
<?php
<?php
if (!empty($identical_authors)) {
echo CHtml::link(
'Unmerge author from those authors',
array('adminAuthor/unmerge', 'id' => $model->id),
array('class' => 'btn btn-link')
);
}
?>
</div>
</div>

<div class="col-md-12">
<div class="pull-right btns-row">
<?php
if ($model->id) {
echo CHtml::link(
'Merge with an author',
array('adminAuthor/prepareAuthorMerge', 'origin_author_id' => $model->id),
array('class' => 'btn background-btn-o')
array('class' => 'btn background-btn-o btn-min-width')
);
}
?>
<a href="/adminAuthor/admin" class="btn background-btn-o">Cancel</a>
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn background-btn')); ?>
</div>

<?php $this->endWidget(); ?>
</div>
?>
<a href="/adminAuthor/admin" class="btn background-btn-o btn-min-width">Cancel</a>
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn background-btn btn-min-width')); ?>
</div>
</div>

<?php $this->endWidget(); ?>
</div>
Loading