Yii Modal Size reset - yii2

I have changed the modal size to large in yii to modal popup window using ajax crud extension by following code.
<?php Modal::begin([
"id"=>"ajaxCrudModal",
"footer"=>"",// always need it for jquery plugin
'options' => [
'class' => 'slide',
'tabindex' => false, // important for Select2 to work properly
],
'size'=>Modal::SIZE_LARGE
])?>
When i click delete button it shows modal in small size and after that size of create modal window previously made large is reset to small. How can i set delete modal to large also. So that is should not reset to small.

Related

Some HTML elements are not showing when displayed using an ngIf?

I have two buttons with varying routerlinks. Each should appear differently based on the outcome of an ngIf. However, what happens is that on loading the page for the first time, neither of these buttons load until the page is refreshed (despite having loading for the page - to wait for the data to load):
<ng-container *ngIf="moduleList">
...
<button *ngIf="!item.TrainingModuleCompleted" mat-stroked-button [routerLink]="['training-modules-content-view', item.TrainingModuleId]" class="module-view">Select</button>
<button *ngIf="item.TrainingModuleCompleted" mat-stroked-button [routerLink]="['training-modules-content-view', item.TrainingModuleId]" class="module-view">View</button>
...
</ng-container>
As can be seen above, a different button will be shown depending on whether item.TrainingModuleCompleted is true or not. This variable is loaded with moduleList.
This is the buttons before being loaded in (on initial load):
This is the buttons after being loaded (after refreshing the page):
The ngIf is obviously being hit before the data is loaded in.. Is there a workaround to this?
I'm guessing that if you looked in the console you would see an error during the initial load. Is it possible that item is null or undefined when the page loads? If so, you should add a null check on item like this.
*ngIf="item?.TrainingModuleCompleted"
Also, if all you swapping out is the button text, I would just do that rather than have two buttons...
{{ item?.TrainingModuleCompleted ? 'View' : 'Select' }}
If you load your datas after a "subscribe", you can do sth like this:
dataWS.subscribe(
(data) => {
//Called when success
},
(error) => {
//Called when error
}
).add(() => {
//load the variable you want after
});

Kartik Gridview conflict with my templates menu

I have a template that i was using for my project.
Look at the picture below:
This is when i am not using the kartikGrid. the dropdown menu running as well as the template want.
look at the image below:
this is when i use kartik, the dropdown menu not running anymore.
can some body tell me why it happen.
The template using different bootsrap version with kartik.
thaks.
Hope some body help me.
Imaginaroom, that did the trick for me thank you.
My top menu wasn't responding (direct link, or drop down menu) after kartik was used. I added an id to my menu widget and it did the trick.
echo Nav::widget([
'id' => 'topMenuID',
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
]);
Manually assign different ids to all widgets, so there won't be any conflicts.
If you don't assign ids to widgets, yii gives them one automatically, but the problem occures when loading data with ajax or pjax, then Yii cannot know which ids are already used in the page.
Every widget in Yii2 has a property 'id' that you can assign in configuration array when calling a widget.
Add this code in layout or page that has problem:
$this->registerJs( "$(document).ready(function() { $('.dropdown-toggle').dropdown(); });", View::POS_END, 'ecommerceProductJs' );

Submit 'links' with CakePHP formHelper

Is it possible to create a submit 'link' with CakePHP 2.4's FormHelper? I'm trying to put some less-used submit buttons from my POST form into a Bootstrap dropdown and am running into trouble since they only seem to be able to create a button, which won't work in a dropdown.
Since this is inside a form already, clearly this isn't what I want a postLink for- but is there any good Cake way around this? postLink just makes a plain link, but it won't play well inside another form.
echo $this->Form->button('Download Excel CSV', array(
'type' => 'submit',
'class' => '',
'formaction' => '/posts/csv',
));
Just use the HtmlHelper's url() method:
<button type="button" formaction="<?php echo $this->Html->url('/posts/csv'); ?>">
Click Here
</button>
(I realize you don't want it in a button element, but - showing the concept).
Side note: you should really be using an array instead of a hard-coded formaction:
$this->Html->url(array('controller'=>'posts', 'action'=>'csv'));

How to use only one child theme but have custom text for each site

I am using wordpress multisite for 5 websites. I created a child theme off of the parent so all sites have the same theme, but we have a need for slightly different introduction text at the top of the home pages.
The theme I am using has 3 columns but only has widget-able functionality in column 2 and 3, but the main content area does not have a widget area. Otherwise i would have dropped in a text widget for what i want here.
My question is what is the best way to add this text?
1.) Would I do this in functions.txt? Something like if(site1) echo, elsif(site2) echo, or is there an easier way than this?
2.) Is there a way to do this by editing the theme files and using some short of shortcode? But then where would i define what text to place in there based on the site thats loading?
Please provide a simple example in code if possible. Thanks in advance!
step 1, add to your function.php
<?php
/**
* Register our sidebars and widgetized areas.
*
*/
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Column 1',
'id' => 'column_1',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
step 2, now you will find the widget area in your dashboard Appearance/Widgets, add your content to it.
step 3 add <?php dynamic_sidebar( 'column_1' ); ?> in your template where you want to have column 1
Beside coding the theme there are also other way maybe easier ...
Use this plugin to create widget zone inside a page:
Widgets on Pages
Versione 0.0.12 | by Todd Halfpenny
Use this plugin so you can display or not the widget deending on what page you are:
Dynamic Widgets
Versione 1.5.6 | by Qurl

How do I close a popup window, and open the next page in the main window in ROR?

I have a popup window containing a form which gathers data for a report.
When I click submit in that window, I want it to close the popup, and open the report in the original window that called the popup.
I think I can open the report in the correct window by using
{ :target => <name of window> }
in the form_tag, but I don't know how to determine or set the name of the originating window.
I also don't know how to close the popup window.
:target => adds the html attribute target to the link. This opens up a new window and names the new window the target.
You have to use javascript or Ajax to redirect the old page,
window.opener.location.href="http://new_url";
and then close the old window.
window.close();
This can be done either through the rjs file or directly in the javascript.
The popup window can be closed using the onClick html event as follows:
<%= submit_tag "Go!", {:onClick => "window.close()"} %>
Try this:
function fclosepopup(){
window.opener.location.replace="URL";
window.close();
}
It will close the current window and bring you to the next page in the parent window.
How is this for starters?
# The submit button in your child window's view:
<%= button_to_function 'Save', "$('my_form').submit(); window.opener.location.reload(); window.close();" %>