Forums

Home » Alloy UI » English

Combination View Flat View Tree View
Threads [ Previous | Next ]
Showing 1 - 20 of 37 results.
of 2
Bahador Vafadar
AUI().('aui-viewport')
May 24, 2012 9:40 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Hi all,

I have been coding back and forth on trying to get some results with Responsive Design technique in my portal. But nothing happens, however I have tried to use @media screen technique and it works just fine. But I have read in some post in Liferay that the method with media screen is not supported by all browsers. Therefore I ecided to go with the Liferay version.

In my portal_normal.vm I have written:

<script type="text/javascript">
AUI().('aui-viewport');
</script>

Just before the </body> tag. I also added two scripts:

<link rel="stylesheet" href="../../build/aui-skin-classic/css/aui-skin-classic-all-min.css" type="text/css" media="screen" />
<script src="/html/js/aui/aui/aui.js" type="text/javascript"></script>

Just before </head> tag.

Now I should be able to call the yui3-aui-view models right? Well here is my problem nothing works. How should I write the code here?

I have tryied with:
.aui-view-320 html
{
background-color: red;
}

But it doesnt do anything in particular. Actually nothing happens. I have been trying to get this to work and no results in 6 full days of work. Now This problem might be very easy but I can't seem to find what it is. If you know how to solve this please guide me!

I would really appreciate all the help I can get!
Thanks
Bahador
Juan Gonzalez
RE: AUI().('aui-viewport')
May 24, 2012 1:30 PM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1983

Join Date: October 28, 2008

Recent Posts

Bahador Vafadar
RE: AUI().('aui-viewport')
May 25, 2012 12:58 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Juan Gonzalez P:


Thanks so much for your answer Juan Gonzalez. I have been looking at this website you refer to and many other websites regarding this issue. The code Im using is this:

.yui3-aui-view-960 #wrapper
{
background-color: #DA0;
}

I have written the code so it looks as similar as the example demo in the website you referred to. But still I get no results. With Firebug I can see the elements and if I change the background to red for an example it works. Also in addition it works with @media screen and(min-width) etc..
As soon as I rewrite the code into yui3-aui-view it seems that it doesnt read it at all, or just stops executing the code.

My senses tell me that something is wrong with: yui3-aui-view
since it doesn't do what it is supposed to do.
Any idéas here what might be wrong?

Thanks in advance!
Bahadaor
Juan Gonzalez
RE: AUI().('aui-viewport')
May 25, 2012 2:06 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1983

Join Date: October 28, 2008

Recent Posts

Guess you didn't read the article.

I didn't see .yui3-aui-view-960, I only saw .aui-view-960
Bahador Vafadar
RE: AUI().('aui-viewport')
May 25, 2012 2:41 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Juan Gonzalez P:
Guess you didn't read the article.

I didn't see .yui3-aui-view-960, I only saw .aui-view-960


I have read the article about a thousands of times. I got the demo working on my local PC I also tried with both:
.yui3-aui-view-960
.aui-view-960

But I get no results in my Liferay at all, nothing happens.

I will show the files I use maybe you can see something I don't and give me some hints in how to proceed.

portal_normal.vm
 1
 2<!DOCTYPE html>
 3
 4#parse ($init)
 5
 6<html class="#language("lang.dir")" dir="#language("lang.dir")" lang="$w3c_language_id">
 7
 8<head>
 9<script src="/html/js/aui/aui/aui.js" type="text/javascript"></script>
10<link rel="stylesheet" href="../../build/aui-skin-classic/css/aui-skin-classic-all-min.css" type="text/css" media="screen" />
11
12    <title>$the_title - $company_name</title>
13
14    $theme.include($top_head_include)
15</head>
16
17<body class="$css_class">
18
19#if($is_signed_in)
20    #dockbar()
21#end
22
23<div id="wrapper">
24    <a href="#main-content" id="skip-to-content">#language("skip-to-content")</a>
25    <header id="banner" role="banner">
26        <hgroup id="heading">
27            <h1 class="company-title">
28                <a class="$logo_css_class" href="$site_default_url" title="#language("go-to") $site_name">
29                    <img alt="$logo_description" height="$site_logo_height" src="$site_logo" width="$site_logo_width" />
30                </a>
31            </h1>
32
33            <h2 class="community-title">
34                <a href="$community_default_url" title="#language("go-to") $community_name">
35                    <span>$community_name</span>
36                </a>
37            </h2>
38
39            <h3 class="page-title">
40                <span>$the_title</span>
41            </h3>
42        </hgroup>
43
44        #if(!$is_signed_in)
45            <a href="$sign_in_url" id="sign-in" rel="nofollow">$sign_in_text</a>
46        #end
47
48        <div id="site-banner">
49        </div>
50
51        #if ($has_navigation)
52            #parse ("$full_templates_path/navigation.vm")
53        #end
54    </header>
55    <div class="content">
56          <div class="title" id="title">
57        <nav class="site-breadcrumbs" id="breadcrumbs">
58            <h1>
59                <span>#language("breadcrumbs")</span>
60            </h1>
61
62            #breadcrumbs()
63        </nav>
64
65        #if ($selectable)
66            $theme.include($content_include)
67        #else
68            $portletDisplay.recycle()
69
70            $portletDisplay.setTitle($the_title)
71
72            $theme.wrapPortlet("portlet.vm", $content_include)
73        #end
74          </div>
75    </div>
76    <footer id="footer" role="contentinfo">
77        <p class="powered-by">
78            #language("powered-by") <a href="http://www.liferay.com" rel="external">Liferay</a>
79        </p>
80    </footer>
81</div>
82<script type="text/javascript">
83AUI().use('viewport');
84</script>
85</body>
86$theme.include($bottom_include)
87</html>


And here is the custom.css:
 1
 2#wrapper {
 3    /*background: #FFF;
 4    color: #000000;*/
 5    font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
 6    font-size: 100%;
 7    margin: 20px auto;
 8    padding: 30px 20px 0;
 9    position: relative;
10    width: 940px;
11}
12
13.aui-view-960 #wrapper
14{
15  background: green;
16  color: yellow;
17}
18/*
19.yui3-aui-view-960 #wrapper
20{
21  background: green;
22  color: yellow;
23}
24*/


The background and color is commented out so these should be changed by the aui right? Or is something missing or not good enough to actually work properly?
Bahador Vafadar
RE: AUI().('aui-viewport')
May 25, 2012 5:44 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Bahador Vafadar:
Juan Gonzalez P:
Guess you didn't read the article.

I didn't see .yui3-aui-view-960, I only saw .aui-view-960


I have read the article about a thousands of times. I got the demo working on my local PC I also tried with both:
.yui3-aui-view-960
.aui-view-960

But I get no results in my Liferay at all, nothing happens.

I will show the files I use maybe you can see something I don't and give me some hints in how to proceed.

portal_normal.vm
 1
 2<!DOCTYPE html>
 3
 4#parse ($init)
 5
 6<html class="#language("lang.dir")" dir="#language("lang.dir")" lang="$w3c_language_id">
 7
 8<head>
 9<script src="/html/js/aui/aui/aui.js" type="text/javascript"></script>
10<link rel="stylesheet" href="../../build/aui-skin-classic/css/aui-skin-classic-all-min.css" type="text/css" media="screen" />
11
12    <title>$the_title - $company_name</title>
13
14    $theme.include($top_head_include)
15</head>
16
17<body class="$css_class">
18
19#if($is_signed_in)
20    #dockbar()
21#end
22
23<div id="wrapper">
24    <a href="#main-content" id="skip-to-content">#language("skip-to-content")</a>
25    <header id="banner" role="banner">
26        <hgroup id="heading">
27            <h1 class="company-title">
28                <a class="$logo_css_class" href="$site_default_url" title="#language("go-to") $site_name">
29                    <img alt="$logo_description" height="$site_logo_height" src="$site_logo" width="$site_logo_width" />
30                </a>
31            </h1>
32
33            <h2 class="community-title">
34                <a href="$community_default_url" title="#language("go-to") $community_name">
35                    <span>$community_name</span>
36                </a>
37            </h2>
38
39            <h3 class="page-title">
40                <span>$the_title</span>
41            </h3>
42        </hgroup>
43
44        #if(!$is_signed_in)
45            <a href="$sign_in_url" id="sign-in" rel="nofollow">$sign_in_text</a>
46        #end
47
48        <div id="site-banner">
49        </div>
50
51        #if ($has_navigation)
52            #parse ("$full_templates_path/navigation.vm")
53        #end
54    </header>
55    <div class="content">
56          <div class="title" id="title">
57        <nav class="site-breadcrumbs" id="breadcrumbs">
58            <h1>
59                <span>#language("breadcrumbs")</span>
60            </h1>
61
62            #breadcrumbs()
63        </nav>
64
65        #if ($selectable)
66            $theme.include($content_include)
67        #else
68            $portletDisplay.recycle()
69
70            $portletDisplay.setTitle($the_title)
71
72            $theme.wrapPortlet("portlet.vm", $content_include)
73        #end
74          </div>
75    </div>
76    <footer id="footer" role="contentinfo">
77        <p class="powered-by">
78            #language("powered-by") <a href="http://www.liferay.com" rel="external">Liferay</a>
79        </p>
80    </footer>
81</div>
82<script type="text/javascript">
83AUI().use('viewport');
84</script>
85</body>
86$theme.include($bottom_include)
87</html>


And here is the custom.css:
 1
 2#wrapper {
 3    /*background: #FFF;
 4    color: #000000;*/
 5    font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
 6    font-size: 100%;
 7    margin: 20px auto;
 8    padding: 30px 20px 0;
 9    position: relative;
10    width: 940px;
11}
12
13.aui-view-960 #wrapper
14{
15  background: green;
16  color: yellow;
17}
18/*
19.yui3-aui-view-960 #wrapper
20{
21  background: green;
22  color: yellow;
23}
24*/


The background and color is commented out so these should be changed by the aui right? Or is something missing or not good enough to actually work properly?


The problem is solved!
There was nothing wrong with my code. The only problem was the import of the additional script and css. The path to script was not right. and the .aui-view-960 was not inside the imported script. Once i fixed them it worked successfully! Thank you Juan for taking your time and helping me out.

Cheers :-)
Bahador
Juan Gonzalez
RE: AUI().('aui-viewport')
May 25, 2012 7:37 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1983

Join Date: October 28, 2008

Recent Posts

Glad it worked. Many times solution is simpler as we can think....
Nate Cavanaugh
RE: AUI().('aui-viewport')
May 25, 2012 11:02 AM
Answer

Nate Cavanaugh

LIFERAY STAFF

Rank: Junior Member

Posts: 67

Join Date: November 27, 2006

Recent Posts

Hi there,
If you're doing this in a theme, then AlloyUI should already be imported for you.

As soon as you put
AUI().use('aui-viewport') either in your main.js or in your portal_normal.vm, it will automatically download and add the JS and css for you (so you shouldn't need to manually link to any files).

Can you describe what path was set wrong?

Thanks!
Bahador Vafadar
RE: AUI().('aui-viewport')
May 27, 2012 4:44 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Nate Cavanaugh:
Hi there,
If you're doing this in a theme, then AlloyUI should already be imported for you.

As soon as you put
AUI().use('aui-viewport') either in your main.js or in your portal_normal.vm, it will automatically download and add the JS and css for you (so you shouldn't need to manually link to any files).

Can you describe what path was set wrong?

Thanks!



The path was set to:
href="../../build/aui-skin-classic/css/aui-skin-classic-all-min.css"
src="/html/js/aui/aui/aui.js"

From there it couldnt read the file(Im refering to the aui.js file!). So basicaly what I did was to change the path name. from the /html/js/aui/aui.js to the map where I copied it. And it worked fine in the other map. So the error landed on the path. But it is very interesting what you say about that it should get linked whitout manually give paths. I will try to write the AUI().use('aui-viewport') in the main.js and see if it works.

Thanks for sharing your tips Nate Appreciate it!
Bahador
Bahador Vafadar
RE: AUI().('aui-viewport')
May 27, 2012 4:45 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Juan Gonzalez P:
Glad it worked. Many times solution is simpler as we can think....



Sure is emoticon but the problem becomes simple as we get new idéas and insperation from others. Keep up the good job emoticonemoticon
Bahador
Armen Danielyan
RE: AUI().('aui-viewport')
June 12, 2012 2:37 PM
Answer

Armen Danielyan

Rank: New Member

Posts: 7

Join Date: March 29, 2012

Recent Posts

Hi Bahador, did you make it work on Liferay 6.0 CE?

I'm trying to make it work on 6.0.6 CE, but it seems there is no 'aui-viewport' support in this version. Does anybody know any workaround which will work on 6.0 CE?
Juan Gonzalez
RE: AUI().('aui-viewport')
June 13, 2012 12:25 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1983

Join Date: October 28, 2008

Recent Posts

Nope. This feature is only available from 6.1.

EDIT: To make this available for 6.0 many changes should be made. Probably better spend that time on upgrading...
Armen Danielyan
RE: AUI().('aui-viewport')
June 13, 2012 9:50 AM
Answer

Armen Danielyan

Rank: New Member

Posts: 7

Join Date: March 29, 2012

Recent Posts

Juan Gonzalez P:
Nope. This feature is only available from 6.1.

EDIT: To make this available for 6.0 many changes should be made. Probably better spend that time on upgrading...



Juan, thank you for responding. Unfortunately we have so many custom plugins developed for 6.0 that upgrading them all is not an option at the moment.

As I understand for having the mentioned functionality the AlloyUI and YUI should be upgraded from 3.2.0 to 3.3.0. Has anybody tried doing this?


EDIT: OK, I figured out how to make the viewport feature work in LR 6.0 CE.

I copied aui-viewport.js and aui-debounce.js files to my theme, then slightly modified aui-viewport.js to simplify a prefix building process (it's a prefix used for css class name):

I replaced
1NAME = 'view',
2
3CSS_PREFIX = getClassName(NAME) + A.config.classNameDelimiter,

with
1NAME = 'aui-view',
2
3CSS_PREFIX = NAME + A.config.classNameDelimiter,


Then I added a dependency in aui-viewport.js by modifying the last line:

from
1}, '1.0.1' ,{skinnable:false, requires:['aui-base']});

to
1}, '1.0.1' ,{skinnable:false, requires:['aui-debounce']});

aui-base was required for building a prefix. As I simplified a prefix building I don't need aui-base anymore in my aui-viewport module.
Juan Gonzalez
RE: AUI().('aui-viewport')
June 13, 2012 10:07 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1983

Join Date: October 28, 2008

Recent Posts

Wow. Good job!
Bahador Vafadar
RE: AUI().('aui-viewport')
June 17, 2012 11:17 PM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

NIcely done. Im glad it still worked out emoticon
Simon Michel
RE: AUI().('aui-viewport')
June 18, 2012 2:17 AM
Answer

Simon Michel

Rank: New Member

Posts: 7

Join Date: May 26, 2012

Recent Posts

Hi all,

i am also using different themes for different devices. When i am surfing with my mobile device, I have noticed that first the desktop version is loaded, before the switch to the mobile version is executed. I don´t think that this is the correct behaviour, isn´t it?

Anyone an idea what can be the reason for this?

Many thanks,
Simon
Bahador Vafadar
RE: AUI().('aui-viewport')
June 18, 2012 3:04 AM
Answer

Bahador Vafadar

Rank: New Member

Posts: 23

Join Date: April 20, 2012

Recent Posts

Hello Simon

I am done with the Responsive Design part of my theme and yes. I have exactly the same results on my phone. It shows the website as normal as if you visit the website on a regular monitor before it starts to scale down. I think this is due to the loading process or something. It loades the website first.. etc.. etc.. and then the CSS that makes the change and due to this there is a delay of a couple of seconds before it starts to apply everything.

As far as I am concerned I don't know if you can do anything about this.
Regards,
Bahador
Simon Michel
RE: AUI().('aui-viewport')
June 18, 2012 2:14 PM
Answer

Simon Michel

Rank: New Member

Posts: 7

Join Date: May 26, 2012

Recent Posts

Hey Bahador,

do you have the same problems when you visit www.liferay.com with your mobile device? In my opinion, liferay.com load first the mobile theme.

Regards,
Simon
Armen Danielyan
RE: AUI().('aui-viewport')
June 19, 2012 10:53 AM
Answer

Armen Danielyan

Rank: New Member

Posts: 7

Join Date: March 29, 2012

Recent Posts

Bahador, I have the same issue here and haven't found a solution yet.

Liferay.com, however, opens in a mobile view without any delay.
Armen Danielyan
RE: AUI().('aui-viewport')
June 21, 2012 1:58 PM
Answer

Armen Danielyan

Rank: New Member

Posts: 7

Join Date: March 29, 2012

Recent Posts

Bahador Vafadar:
Hello Simon

I think this is due to the loading process or something. It loades the website first.. etc.. etc.. and then the CSS that makes the change and due to this there is a delay of a couple of seconds before it starts to apply everything.


Well, I believe switching from desktop layout to mobile layout happens only after the aui-viewport script adds corresponding css classes to <html> tag. This script runs only after the web page is loaded, otherwise it would not work, because it uses core AUI libraries which are loaded by Liferay, usually at the end of page loading process, if I am not mistaken. Therefore the layout changes only after the page with default layout is loaded.

But what is interesting is that Liferay.com doesn't have this issue, and it loads mobile layout first. Can anybody from Liferay please clarify how this behavior is implemented there?
Showing 1 - 20 of 37 results.
of 2