What is a must have approach when designing an application with easily distinctive zones? For example, I have 4 zones in my app: "Header", which may contain some static info (app logo, etc), top-level navigator, login information, "Left" which contain low-level navigation, some options, may be tag cloud, or survey, etc "Center" zone, which is for current page content, and "Footer" zone, which may contain static and non-static content.
I'm new to Play, and cannot figure out, how to design controllers and templates, and to compose them so, that I could make one change in, for example, top zone content rendering, including change in types of data which is rendered and would not be forced to change dozens of other views which, for example, render Center zone, etc., passing new parameters to main template which in its turn will include other templates etc.
On Friday, 28 September 2012 19:19:25 UTC+10, YoZH wrote:
> Hello!
> What is a must have approach when designing an application with easily > distinctive zones? > For example, I have 4 zones in my app: "Header", which may contain some > static info (app logo, etc), top-level navigator, login information, "Left" > which contain low-level navigation, some options, may be tag cloud, or > survey, etc > "Center" zone, which is for current page content, and "Footer" zone, which > may contain static and non-static content.
> I'm new to Play, and cannot figure out, how to design controllers and > templates, and to compose them so, that I could make one change in, for > example, top zone content rendering, including change in types of data > which is rendered and would not be forced to change dozens of other views > which, for example, render Center zone, etc., passing new parameters to > main template which in its turn will include other templates etc.
> On Friday, 28 September 2012 19:19:25 UTC+10, YoZH wrote:
>> Hello!
>> What is a must have approach when designing an application with easily >> distinctive zones?
>> For example, I have 4 zones in my app: "Header", which may contain some >> static info (app logo, etc), top-level navigator, login information, "Left" >> which contain low-level navigation, some options, may be tag cloud, or >> survey, etc
>> "Center" zone, which is for current page content, and "Footer" zone, >> which may contain static and non-static content.
>> I'm new to Play, and cannot figure out, how to design controllers and >> templates, and to compose them so, that I could make one change in, for >> example, top zone content rendering, including change in types of data >> which is rendered and would not be forced to change dozens of other views >> which, for example, render Center zone, etc., passing new parameters to >> main template which in its turn will include other templates etc.
Currently there are two "nice" (or not so nice) ways to do this:
1) Have a god object, that you pass into every template, and provides all the data needed by each part. You can change the types of data in that template without changing what gets passed through.
2) Write static methods, that look up the data you need, and call them from the templates.
On Friday, 28 September 2012 20:24:22 UTC+10, YoZH wrote:
> Sorry, Java
> пятница, 28 сентября 2012 г., 14:07:18 UTC+4 пользователь James Roper > написал:
>> Are you using Java or Scala?
>> On Friday, 28 September 2012 19:19:25 UTC+10, YoZH wrote:
>>> Hello!
>>> What is a must have approach when designing an application with easily >>> distinctive zones?
>>> For example, I have 4 zones in my app: "Header", which may contain some >>> static info (app logo, etc), top-level navigator, login information, "Left" >>> which contain low-level navigation, some options, may be tag cloud, or >>> survey, etc
>>> "Center" zone, which is for current page content, and "Footer" zone, >>> which may contain static and non-static content.
>>> I'm new to Play, and cannot figure out, how to design controllers and >>> templates, and to compose them so, that I could make one change in, for >>> example, top zone content rendering, including change in types of data >>> which is rendered and would not be forced to change dozens of other views >>> which, for example, render Center zone, etc., passing new parameters to >>> main template which in its turn will include other templates etc.
> Currently there are two "nice" (or not so nice) ways to do this:
> 1) Have a god object, that you pass into every template, and provides all > the data needed by each part. You can change the types of data in that > template without changing what gets passed through.
> 2) Write static methods, that look up the data you need, and call them > from the templates.
> On Friday, 28 September 2012 20:24:22 UTC+10, YoZH wrote:
>> Sorry, Java
>> пятница, 28 сентября 2012 г., 14:07:18 UTC+4 пользователь James Roper >> написал:
>>> Are you using Java or Scala?
>>> On Friday, 28 September 2012 19:19:25 UTC+10, YoZH wrote:
>>>> Hello!
>>>> What is a must have approach when designing an application with easily >>>> distinctive zones?
>>>> For example, I have 4 zones in my app: "Header", which may contain some >>>> static info (app logo, etc), top-level navigator, login information, "Left" >>>> which contain low-level navigation, some options, may be tag cloud, or >>>> survey, etc
>>>> "Center" zone, which is for current page content, and "Footer" zone, >>>> which may contain static and non-static content.
>>>> I'm new to Play, and cannot figure out, how to design controllers and >>>> templates, and to compose them so, that I could make one change in, for >>>> example, top zone content rendering, including change in types of data >>>> which is rendered and would not be forced to change dozens of other views >>>> which, for example, render Center zone, etc., passing new parameters to >>>> main template which in its turn will include other templates etc.
Create "header", "left" and "footer" each in their own template.
Create a "main" template which will include and set those 3 parts as
well as the page content.
For each page of your website, you can then wrap the content with your
main template like:
@main(/* you can pass your page dependent parameters here */){
<!-- Your page html code -->
}
Same idea as behind the helloworld sample (hello.scala.html and
index.scala.html have their html wrapped by the 'main' template
containing the common layout).
> Kinda non-system approach, imo, but tyvm
> Any more suggestions?
> пятница, 28 сентября 2012 г., 16:07:42 UTC+4 пользователь James Roper
> написал:
>> Currently there are two "nice" (or not so nice) ways to do this:
>> 1) Have a god object, that you pass into every template, and provides all
>> the data needed by each part. You can change the types of data in that
>> template without changing what gets passed through.
>> 2) Write static methods, that look up the data you need, and call them
>> from the templates.
>> On Friday, 28 September 2012 20:24:22 UTC+10, YoZH wrote:
>>> Sorry, Java
>>> пятница, 28 сентября 2012 г., 14:07:18 UTC+4 пользователь James Roper
>>> написал:
>>>> Are you using Java or Scala?
>>>> On Friday, 28 September 2012 19:19:25 UTC+10, YoZH wrote:
>>>>> Hello!
>>>>> What is a must have approach when designing an application with easily
>>>>> distinctive zones?
>>>>> For example, I have 4 zones in my app: "Header", which may contain some
>>>>> static info (app logo, etc), top-level navigator, login information, "Left"
>>>>> which contain low-level navigation, some options, may be tag cloud, or
>>>>> survey, etc
>>>>> "Center" zone, which is for current page content, and "Footer" zone,
>>>>> which may contain static and non-static content.
>>>>> I'm new to Play, and cannot figure out, how to design controllers and
>>>>> templates, and to compose them so, that I could make one change in, for
>>>>> example, top zone content rendering, including change in types of data which
>>>>> is rendered and would not be forced to change dozens of other views which,
>>>>> for example, render Center zone, etc., passing new parameters to main
>>>>> template which in its turn will include other templates etc.
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framework+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.