I'm using Yii2 Redactor box, extension from: https://github.com/yiidoc/yii2-redactor
I want to change size of the textarea but I don't know how, it not mention in their document. I've tried to edit their css but it didn't work.
Please help me with this. Thank you
Here's the way you can control the height of the text area:
echo $form->field($curriculum,'text')->widget(Widget::className(),[
'settings' => [
'lang' => 'en',
'minHeight' => 500,
'plugins' => [
'fullscreen', 'fontfamily','fontcolor','fontsize','imagemanager',
],
'buttons' => [
'formatting', '|', 'bold', 'italic', 'deleted', '|',
'unorderedlist', 'orderedlist', 'outdent', 'indent', '|',
'image', 'table', 'link', '|',
'alignment', '|', 'horizontalrule',
'|', 'underline', '|', 'alignleft', 'aligncenter', 'alignright', 'justify'
],
'imageUpload'=>\Yii::$app->urlManager->createUrl('program/uploadcurriculumart'),
'clipboardUpload'=>true,
'clipboardUploadUrl'=>\Yii::$app->urlManager->createUrl('program/uploadcurriculumart'),
'imageManagerJson'=>\Yii::$app->urlManager->createUrl('program/getallcurriculumart')
]
],['style' => 'height:500px;'])->label(false);
Notice the two arguments: minHeight and also I set the style for the control to have a height of 500px; Works perfectly.
Related
In my Django project, I am using markdownify to convert my markdown to HTML.
I have a problem while rendering the HTML content to my template.
some tags like <em>, <strong> are not getting reflected.
I have tried using the safe filter as suggested in this stackoverflow post but I find no changes!
Is there any other filter I can use or any method to render correctly
in settings.py
MARKDOWNIFY = {
"default": {
"STRIP": True,
"BLEACH": True,
"MARKDOWNIFY_LINKIFY_TEXT": True,
"WHITELIST_TAGS": [
'a',
'abbr',
'acronym',
'b',
'blockquote',
'em',
'i',
'li',
'ol',
'p',
'strong',
'ul'
],
"WHITELIST_ATTRS": [
'href',
'src',
'alt',
],
"WHITELIST_STYLES": [
'color',
'font-weight',
],
"LINKIFY_TEXT": {
"PARSE_URLS": True,
"PARSE_EMAIL": True,
"CALLBACKS": [],
"SKIP_TAGS": ['pre', 'code',],
},
"WHITELIST_PROTOCOLS": [
'http',
'https',
],
"MARKDOWN_EXTENSIONS": [
'markdown.extensions.fenced_code',
'markdown.extensions.extra',
]
},
}
in my template:
<div class="col-8">
{{ entry|markdownify|safe }}
</div>
the content:
#This is the H1 tag for Heading
but these are working
- paragraph
- all the headers
- list tag
things not getting converted
- *Italics not working*
- **And also bold text**
In my template,this is what i get
This is the H1 tag for Heading
but these are working
paragraph
all the headers
list tag
things not getting converted
<em>Italics not working</em>
<strong>And also bold text</strong>
Images for reference:
content to be markdowned
final outcome that I got
I created a code that displays a link to open a modal window.
The problem is that the text comes out of the window.
When I inspect the code of my page, there is an online style style="max-height: 570px;"
If I add the following code to my style sheet, it works. But is there another solution? I make a mistake in my code :
div#drupal-modal--content[style] {
max-height: none !important;
}
How to remove the online style of modal ?
public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
$store_name = $this->order->getStore()->getName();
$store_id = $this->order->getStoreId();
$pane_form['#attached']['library'][] = 'core/drupal.dialog.ajax';
$attributes = [
'attributes' => [
'class' => 'use-ajax',
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => auto,
]),
],
];
Is there any way to set a background color only for the checkbox column?
Thanks.
for styling column properties you can use options
......
'columns' => [
// ...
[
'class' => 'yii\grid\CheckboxColumn',
/ you may configure additional properties here
'options' => ['class'=> 'your_check_box_class' , style =>'background-color: #ff0000;'],
],
],
for checkbox content you can use contentOptions
http://www.yiiframework.com/doc-2.0/yii-grid-checkboxcolumn.html
I am using yii\widgets\DetailView to display some single object informations like this:
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'username',
'email:email',
[
'attribute'=>'status',
'value' => $model->status,
],
'created_at:date',
'updated_at:date',
],
]) ?>
I want to display status in different color. So basically I would like to either add class of .red to the wrapping <td> tag, or even better to wrap the status with <span class="red">{value}</span>
GridView has contentOptions which is really easy to use. But with DetailView I have tried with options and template, but I couldn't make it work. Maybe I did something wrong, or I need to use some other attribute.
So this is not working for me:
[
'attribute'=>'status',
'value' => $model->status,
'template' => '<tr><th>{label}</th><td><span class="red">{value}</span></td></tr>'
],
Can someone explain how to achieve this ?
Thanks in advance.
You should simply try :
[
'attribute'=>'status',
'value' => '<span class="red">'.$model->status.'</span>',
'format' => 'raw',
],
Read more.
I am creating a drop down menu in zend form .
I want to increse the width of the menu but it's failing.
Here is the code for my dropdown
$this->addElement('select', 'user_role_id', array(
'decorators' => array(
'ViewHelper'
),
'required' => true,
'label' => 'Role',
'width' =>'930',
'multioptions' => array(
'1' => 'Admin',
'2' => 'Manager',
'3' => 'User'
),
));
You can use the class attribute to assign a CSS class or add the width to the elements CSS manually:
AddClass
$user_role_id = $this->addElement('select', 'user_role_id');
$user_role_id->class = 'wide-select';
SetAttribs
$user_role_id = $this->addElement('select', 'user_role_id');
$user_role_id->setAttribs(array('style' => 'width: 930px;'));