ExtJs View with multiple style (scss) for each language - extjs

My ExtJs application has to be multilingual.
On the login page, I asked the user to select the language from a dropdown list.
the current structure of my application files as the following
[app]
[classic]
[src]
[view]
[customers]
customerController.js
customerView.js
customerView.scss
How can I have multiple scss files for the same view ?
For example customerView.scss to be a general file loaded all the time, customerView.en.scss to be English specific, only when the user selects English on the login page, and customerView.es.scss only when the user selects Spanish on the login page
Or is there any better idea?

The easeiest way might be to add a class to the viewport:
Ext.getBody().addCls('language-en')
Inside your scss files you add:
.language-en {
.customer-view {
}
}
.language-de {
.customer-view {
}
}
Otherwise you have to get into the build.xml and into the fashion builder.
In the fashion builder you have to rearrange the build.

Related

Is there a way to rename automatically generated routes JSON file in Next.js?

I have a problem, when I click to go to the /analytics page on my site, adblockers block the analytics.json file that's being requested by Next.js as they think it's an analytics tracker (it's not, it's a page listing analytics products).
Is there a way to rename the route files Next.js uses when navigating to server-side rendered pages on the client-side?
I want to either obfuscate the names so they're not machine readable, or have a way to rename them all.
Any help appreciated.
With thanks to #gaston-flores I've managed to get something working.
In my instance /analytics is a dynamic page for a category, so I moved my pages/[category]/index.tsx file to pages/[category]/category.tsx and added the following rewrite:
// next.config.js
module.exports = {
async rewrites() {
return [
{
source: "/:category",
destination: "/:category/category",
},
];
},
};
This now gets the category.json file rather than analytics.json, which passes the adblockers checks and renders as expected.
Note that due to having a dynamic file name in the pages/[category] directory (pages/[category]/[product].tsx), I had to move that to pages/[category]/product/[product].tsx as I was seeing the /analytics page redirected to /analytics/category for some reason without this tweak.

Joomla 3.9.1 publish/unpublish no longer working (custom components)

I've recently upgraded my joomla site to 3.9.1, and now my custom components publish/unpublish buttons aren't working and I can't figure out why. The database column is called "state" and this is the code which was working up until the upgrade:
JToolbarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);
These buttons used to work and they would publish / unpublish the items, now I get this message:
0 items successfully published
I'm not sure where exactly the code is which tells it to update the status of the item, but for some reason it's not working anymore.
Try to add following line to the __construct function within "table" file:
$this->setColumnAlias('published', 'state');
so it looks like
public function __construct(&$db)
{
parent::__construct('#__your_custom_table', 'id', $db);
$this->setColumnAlias('published', 'state');
}
Works for my custom component.

Drupal 7 Maintenance Mode Custom Page Not working

Prelude
Drupal 7
Bootstrap Business (Active Theme)
Turn on Maintenance Mode
Actions that I have already carried out
Copy maintenance-page.tpl.php from modules/system/maintenance-page.tpl.php
Edit to your needs
Paste it on theme's root folder --> /public_html/sites/all/themes/bootstrap-business
Set $conf variable in /public_html/sites/default/settings.php : $conf['maintenance_theme'] = 'bootstrap_business';`
Nonetheless, the site keeps on showing the modules/system/maintenance-page.tpl.php . I don't know why it is not working. I´ve also tried:
Adding a maintenance-page--offline.page.tpl.php
Setting the theme name as bootstrap-business
None of the above work. I don't think spending 45 minutes on such a simple task is adequate. I know I could just edit the modules/system/maintenance-page.tpl.php, but I don´t believe that's the right way to go.
Any suggestions?
Clear/Flush caches (Theme Registry cache) and try again. If you already did that and did not work add a page preprocess function to your default theme template.php:
bootstrap_business_preprocess_maintenance_page(&$variables) {
if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
// Template suggestion for offline site
$variables['theme_hook_suggestion'] = 'maintenance_page__offline';
}
else {
// Template suggestion for live site (in maintenance mode)
$variables['theme_hook_suggestion'] = 'maintenance_page';
}
}
Related question: https://drupal.stackexchange.com/q/76946/12163

Composite C1 - Show different content in Page Template Feature, depending on domain

I have a C1 CMS with 5 domains / sites in it.
I need a Page Template Feature to display different content depending on which site it's on. Or perhaps have a page template embed a different Page Template Feature depending which site it's on.
One way would be to use the domain of the site to differentiate somehow (I don't know how). Are there any other ways to do this - what would be best?
Thanks.
I simply put razor code like this in the MasterLayout.cshtml page to display the appropriate Page Template Feature, depending on the domain:
#{
if (Request.Url.ToString() == "http://Domain1.com")
{
#PageTemplateFeature("Footer Domain1.com Front Page")
}
else if (Request.Url.ToString() == "http://Domain2.com")
{
#PageTemplateFeature("Footer Domain2.com Front Page")
}
else
{
#PageTemplateFeature("Footer All Other")
}
}
It is a shame there isn't a way of doing this within the C1 CMS itself - but this works fine.

Email template not using themed version

I am using CakePHP 1.3 and the built in email features as described in the documentation. I have the html version of the template located in app/views/elements/email/html/reservation.ctp and its working as expected.
$this->Email->template = 'reservation'; // no '.ctp'
I also have a theme setup and most of the themed files are correctly overriding the default files. My problem is the themed email template is not being used when called from the themed site, its still using the email template file in the default path.
The default is at: app/views/elements/email/html/reservation.ctp
The theme is at: app/views/themed/myTheme/elements/email/html/reservation.ctp
Should the email template assignment automatically work with themes without the need for hard coding a path or is there another solution? Anyone else have this issue?
in cakephp when you want to create email template. Lets suppose we want to create an Html email. and email config is configured.
Views[File Structure]:
1) your content email with variables should be located in View/Emails/html [reservation.ctp]
2) your template should be located in View/Layouts/Emails/html [default.ctp OR any new template you have made]
controllers:
Note: some people think when you write an action(in controller) you have to write a view for it. In this case (for sending email) is completely wrong. only if you want to show the result which email sent successfully or not then is fine.
lets say ReserveController ;) and sendReservationEmail
function sendReservationEmail( $to, $from,$subject ,$template, $variables=array()){
$Email = new CakeEmail();
$Email->config('smtp')
->viewVars($variables)
->emailFormat('html')
->template($template['page'], $template['layout']) //'reservation', 'default'
->from($from) //'me#example.com' => 'My Site'
->to($to) //'you#example.com'
->subject($subject) //'Resevation'
->send();
}
Views (View/Emails/html/reservation.ctp):
Dear $this->viewVars['name'];
Welcome to our restaurant .....

Resources