留言板

fragment for javascript files

thumbnail
Fernando Garcia,修改在7 年前。

fragment for javascript files

New Member 帖子: 13 加入日期: 11-4-12 最近的帖子
I have created a liferay fragment for the calendar web portlet. For JSP files the fragment is working ok, but when I want to modify a javascript file, the fragment is not possible.

In liferay 6.2 you can modify javascript files with hooks and since fragments are the new way to modify liferay modules jsp I thought this was posible. Any ideas? Thanks
thumbnail
David H Nebinger,修改在7 年前。

RE: fragment for javascript files

Liferay Legend 帖子: 14915 加入日期: 06-9-2 最近的帖子
Not sure whether these will help, but...

  • Have you tried clearing browser cache? Could you have the older copy of the JS cached?
  • Have you tried restarting the portal? Does it start serving the new JS?
  • Have you tried purging the temp and work directories to ensure you're not getting some older artifact?







Come meet me at the NAS!
thumbnail
Fernando Garcia,修改在7 年前。

RE: fragment for javascript files

New Member 帖子: 13 加入日期: 11-4-12 最近的帖子
Thank you for your quick response.

I already have tried the first two points you mention. The third one I just tried and still I don't see my js changes.
Just to make sure I deleted the temp and work folders under tomcat folder. Just saying because there is a work folder under liferayHome folder and I assume you referred the way purging is done in liferay 6.

Thanks
thumbnail
David H Nebinger,修改在7 年前。

RE: fragment for javascript files

Liferay Legend 帖子: 14915 加入日期: 06-9-2 最近的帖子
Under 7, you want to purge both work folders. The tomcat one is the regular tomcat folder, the work folder in $LIFERAY_HOME is the one used by Liferay to compile the JSP files from the OSGi bundles.

Honestly I don't know if it is possible to use a bundle fragment to replace a JS file. I don't know if they actually go through the same mechanisms or not, just trying to help...






Come meet me at the NAS!
thumbnail
Fernando Garcia,修改在7 年前。

RE: fragment for javascript files

New Member 帖子: 13 加入日期: 11-4-12 最近的帖子
Just tried purging both works directories and same result. I don't see any js change.

Since in liferay 6 you are able to hook js/css files, I thought a bundle fragment was going to be the way under liferay 7.

I have looked liferay 7 dev documentation and the liferay blade examples and there is not mention on how this can be done...
Thanks for your help David.
Marek Hornak,修改在7 年前。

RE: fragment for javascript files

New Member 发布: 1 加入日期: 15-8-14 最近的帖子
I'm refreshing this thread as it seems to be forgotten. The fragment module works flawlessly for JSPs, but Javascript files stay unaltered. Is there a way we can override Javascript files of Liferay 7 modules?
thumbnail
Chema Balsas,修改在7 年前。

RE: fragment for javascript files (答复)

Regular Member 帖子: 127 加入日期: 13-2-25 最近的帖子
Hi Marek, Fernando!

As far as I can tell, overriding js files using a fragment is not a supported feature. The bundle entry resolution works that way for jsps, but not for other types of files.

There is still a fair share of techniques to accomplish it. I assume that the most common case would be to override YUI/AlloyUI default modules. To do this, one possible solution is to create an additional module (not a fragment) with your module implementations and a config.js file like the following:

;(function() {
	AUI().applyConfig(
		{
			groups: {
				mymodulesoverride: {
					base: MODULE_PATH + '/js/',
					combine: Liferay.AUI.getCombine(),
					filter: Liferay.AUI.getFilterConfig(),
					modules: {
						'my-module-override': {
							path: 'my-module.js',
							condition: {
								name: 'my-module-override',
								trigger: 'the-module-to-override',
								when: 'instead'
							}
						}
					},
					root: MODULE_PATH + '/js/'
				}
			}
		}
	);
})();


In order for the system to pick up the module configuration, you should specify it using the Liferay-JS-Config header. For example, if you're using bnd, you could add the following to your bnd.bnd file

Liferay-JS-Config: /META-INF/resources/my-module-override/js/config.js


Hope this helps, but please, let me know otherwise with some extra context to figure out what else could be done.

Thanks!
thumbnail
Chenna Yon,修改在6 年前。

RE: fragment for javascript files

New Member 帖子: 7 加入日期: 15-1-8 最近的帖子
Thanks, Chema Balsas for your sharing.
It's really helping me a lot.
thumbnail
Gaurav Jain,修改在6 年前。

RE: fragment for javascript files

Junior Member 帖子: 85 加入日期: 16-7-12 最近的帖子
Hi Chema Balsas
Can you please explain it bit more. As I am not able to locate the path(name) of js module to be overridden, in the above example. FYI I am trying to override \portal-master\modules\apps\foundation\frontend-editor\frontend-editor-ckeditor-web\src\main\resources\META-INF\resources\_diffs\plugins\itemselector\plugin.js

Thanks in advance
Gaurav
Shubhankit Roy,修改在5 年前。

RE: fragment for javascript files

New Member 帖子: 8 加入日期: 15-4-27 最近的帖子

Hi Chema and David!

I have a situation where I need to change some of the default values that are shown in the dialog box that opens on clicking the 'table' icon from the icons available in the ckEditor. Is there a way to achieve this?

 

 

 

 

komeil bitaraf,修改在7 年前。

RE: fragment for javascript files

New Member 帖子: 7 加入日期: 16-5-21 最近的帖子
hi
i am using liferay 7
i want to override my input_date taglib in html/taglib/ui/input_date/page.jsp
and add different datepicker
my page.jsp completely change in overriding core jsp but i can't add datepicker.js and show TypeError: $(...).datepicker is not a function
tnx
komeil bitaraf,修改在7 年前。

RE: fragment for javascript files

New Member 帖子: 7 加入日期: 16-5-21 最近的帖子
hi
i am using liferay 7
i want to override my input_date taglib in html/taglib/ui/input_date/page.jsp
and add different datepicker
my page.jsp completely change in overriding core jsp but i can't add datepicker.js and show TypeError: $(...).datepicker is not a function
tnx