Yii2 - DetailView widget float left - css

I'm trying to override the disposal of the DetailView widget by applying new css class but with no luck. I want all the records shown in the several instances of a DetailView widget to appear side by side. I create a class in app\web\css called detail1-view and apply it to the detaiview.php in vendor folder. The class has float:left, or display:inline-block in it, but none of the attributes work.
My Detailview is:
<?= DetailView::widget([
'model' => $model,
'attributes' => [
//'titulo',
'noticia',
// cria um array com a fotografia, em que
// carrega a path no campo fieldName da bd
[
'attribute'=>'fotodir',
'value'=>$model->fotodir,
'format' => ['image', ['width'=>'230','height'=>'200']],
],
],
]) ?>
and my detailview.php in folder vendor/yiisoft/yii2/widgets/... has in it the detail1-view class in the right place:
public $options = ['class' => 'detail1-view'];
My CSS:
.detail1-view {
display: inline-block;
width: 30%;
border:1px solid #000;
}
The DetailView continues to display one in top of another and not side by side.
Anybody has a solution for this issue ?

I solved it by myself.
The trick was to create another class with position:relative; and put the detailview widget inside it.
Here's the code for the view:
<div class="detail-disposal">
<?= DetailView::widget([
'model' => $model,
'options' => ['class' => 'detail1-view'],
'attributes' => [
//'titulo',
'noticia',
// cria um array com a fotografia, em que carrega a path no campo fieldName da bd
[
'attribute'=>'fotodir',
'value'=>$model->fotodir,
'format' => ['image',['width'=>'230','height'=>'200']],
],
],
]) ?>
and the css style used in app/web/css:
.detail-disposal{
position:relative;
width:100%;
}
DetailView CSS:
.detail1-view {
margin-left:20px;
margin-bottom:20px;
float:left;
width: 300px;
border:1px solid #000;
}
Now the detailview widget appears side by side every time a model is called.

Related

mPDF CSS class for text color of <i> nested in <li> overridden by parent's color

relevant HTML looks like:
<li class="lineEntry t1" title="Right-Click for Options" style="">
<span id="job_111095">
<i class="ic-p-appr"></i> 111095
</span> Foo/Bar, Some Text </span>
</li>
... and the relevant CSS looks like ( file = icomoon's foo.css ) ...
/* this is an icomoon icon, that should be green */
.ic-p-appr:before {
content: "\e905";
color: #0f8040 !important;
}
... and ( file = bar.css ) ...
.t1{color:#B92426;}
/* .line-entry never defines a color */
I have added !important AND loaded the foo.css After the bar.css in an effort to make the icon green (#0f8040), but the icon nested within the .t1 class always inherits that parent's font color ONLY when mpfd converts the HTML to a pdf doc. (the nested icon in HTML works as expect)
When I look at the mPDF documentation for supported CSS, I see nothing there or in SO that suggests why this occurs. My mPDF is 7, and here is the configuration:
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs, [
'../vendor/resources/fonts',
]),
'fontdata' => $fontData + [
'icomoon' => [
'R' => 'icomoon.ttf',
],
],
'format' => 'A4-L',
'orientation' => 'L',
'debug' => true,
]);
see:
enter image description here
Help with this issue is appreciated.
Fixed: I discovered that because mPDF ver7 does not support CSS pseudo class :before, it was necessary to declare the font-color independently with the class name. So for my HTML output, this worked, .ic-p-appr:before { color: #0f8040 !important; } but I had to declare it again, minus the ':before' to register that style in the PDF document.
Summary: mPDF7 ignores CSS style attributes declared under a pseudo-class.

Bootstrap Alerts color saturation

Is there a way that I could edit the saturation of bootstrap alert saturation? I'm using Yii framework and I've used the alerts I've noticed the green wasn't green enough I tried looking at the css of the Yii framework, do I add something like this?
.alert {
}
In my form code I have something like this that indicates the alert:
if($model->request_status == 'On Going!')
{
return ['class' => 'info'];
} else if($model->request_status == 'Done!')
{
return ['class' => 'success'];
} else if($model->request_status == 'Cancelled!')
{
return ['class' => 'danger'];
} else if($model->request_status == 'High Priority!')
{
return ['class' => 'warning'];
}
You need to override Bootstrap's CSS for .alert-success class with your own style.
The default is:
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
Or you can create your own CSS class like .alert-greener and use it in your PHP code by replacing success with greener.

Yii2 Gridview Actioncolumn Layout

It is related to the style. When there are more columns in the gridview, the layout of the actioncolumn will become vertical (see attached pic). How can I change it to be horizontal? I cannot find out why it became vertical in the Bootstrap css.
Thanks!
vertical layout of actioncolumn
Try to force style width:
[
'class' => ActionColumn::className(),
'contentOptions' => function ($model, $key, $index, $column) {
return ['style' => 'min-width:150px'];
}
]
Change the width as you need.

Kendo window change scrolling to have static update/cancel buttons

I'm using ASP MVC and a current release of Kendo. If I add too much information to a Kendo window, it scrolls vertically. This hides the cancel/update buttons that get generated at the bottom. I need these shown. The user should not need to scroll to hit cancel. How can I make the "form-horizontal" scroll and the "k-window" not scroll?
Full Window:
Window with scrolling:
Code:
#(Html.Kendo().Grid(Model.CompanyList)
.Name("grid")
.Columns(columns => {
columns.Bound(o => o.Company.Name);
columns.Bound(o => o.Company.DealerId);
columns.Bound(o => o.Company.CityState).Title("City, " + stateTitle);
columns.Bound(o => o.Company.CountryCode);
columns.Bound(o => o.Company.Phone);
columns.Bound(o => o.CompanyStatus).Title("Status");
columns.Command(com => { com.Edit(); });
})
.Pageable()
.Sortable()
.DataSource(
dataSource => dataSource
.Server()
.Sort(sort => sort.Add("Name").Ascending())
.Model(model => model.Id(m => m.Company.Id))
.Update(up => up.Action("UpdateCompany", "Home"))
)
.Editable(ed => ed
.Mode(GridEditMode.PopUp)
.TemplateName("Company")
.Window(w => w
.Title("Edit company")
.Draggable()
.Resizable()
.Width(436)
.Modal(true)
.Animation(false)
)
)
)
In order to achieve such layout, you need to handle the scrolling in your own element rather than leave it to the window. This involves some customization that may break the grid functionality, so consider this unsupported, as it may break without notice in the future. Suggesting this on UserVoice might get implemented officially, so it would be better in the long term.
So, in order to do that, attach a window open event handler:
var buttonWrapper = $(".k-edit-buttons");
var formContainer = $(".k-edit-form-container");
formContainer.css({
overflow: "auto", // make the container scroll
maxHeight: 300 // maximum height of the window content, sans the chrome
});
buttonWrapper.insertAfter(formContainer);
You will also need to add the styles to the button wrapper:
.k-edit-form-container .k-edit-buttons {
clear: both;
text-align: right;
border-width: 1px 0 0;
border-style: solid;
position: relative;
bottom: -1em;
padding: .6em;
}
Try removing the Resizable() property from the window. I typically don't specify the Height() or Resizable() attributes for my Kendo Windows.

Stylish CakePHP form button

I am trying to assign a class to form end button but when i try to style it by calling the class in css file, it do not make any effect.
Form Button:
echo $this->form->end('Sign Up', array('class' => 'forminput'));
CSS:
.forminput
{
width: 292px;
height: 32px;
}
Use $this->Form->submit() to create your submit button with required options and then use $this->Form->end() without any params to simply close the form tag.

Resources