|
|
| Author |
Message |
|
| dmitriid |
Posted: Wed Jan 16, 2008 8:01 am |
|
|
|
User
Joined: 17 Aug 2006
Posts: 213
|
Can a view be split up in separate small files?
Let's say I have an admin_controller that defines up to 20 methods and
each one needs to be renedered involving lot's of HTML.
What I've seen so far is that you have to put all of your rendering
functions inside the admin_view.et file which can grow really big really
fast.
What would be the easiest way to split the file up?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Jan 16, 2008 8:32 am |
|
|
|
Guest
|
You can always explicitly forward the calls to functions defined in
other view modules.
Also, it would be possible to add a mode to ErlyWeb that changes the
default view mapping for a component to a function-per-file mapping.
It's not a high priority for me right now because I prefer to have few
medium-large view files than a large number of small ones, but you you
want to implement it I'll accept the patch. The way I think it should
work is by adding to a controller the line
-view_module_per_function(true).
and then each function would be mapped to a file of the name
[component]_view_[function].et
Yariv
On Jan 16, 2008 12:01 AM, Dmitrii 'Mamut' Dimandt <dmitriid@gmail.com> wrote:
>
> Can a view be split up in separate small files?
>
> Let's say I have an admin_controller that defines up to 20 methods and
> each one needs to be renedered involving lot's of HTML.
>
>
> What I've seen so far is that you have to put all of your rendering
> functions inside the admin_view.et file which can grow really big really
> fast.
>
> What would be the easiest way to split the file up?
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| dmitriid |
Posted: Wed Jan 16, 2008 9:33 am |
|
|
|
User
Joined: 17 Aug 2006
Posts: 213
|
Yariv Sadan wrote:
> You can always explicitly forward the calls to functions defined in
> other view modules.
>
> Also, it would be possible to add a mode to ErlyWeb that changes the
> default view mapping for a component to a function-per-file mapping.
> It's not a high priority for me right now because I prefer to have few
> medium-large view files than a large number of small ones, but you you
> want to implement it I'll accept the patch. The way I think it should
> work is by adding to a controller the line
>
> -view_module_per_function(true).
>
> and then each function would be mapped to a file of the name
>
> [component]_view_[function].et
>
>
It's not that I'm complaining about the feature I just thought there
would be an easier way right now
The question then is: will it be ok to place, say, an
admin_view_login.et alongside admin_view.et and import it? Since ElryWeb
assumes that everything that is not ending in controller or view is a model
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Jan 16, 2008 11:10 am |
|
|
|
Guest
|
Dmitrii 'Mamut' Dimandt wrote:
> Can a view be split up in separate small files?
>
> Let's say I have an admin_controller that defines up to 20 methods and
> each one needs to be renedered involving lot's of HTML.
>
>
> What I've seen so far is that you have to put all of your rendering
> functions inside the admin_view.et file which can grow really big really
> fast.
>
> What would be the easiest way to split the file up?
I've been doing something wierd, to use your example,
-module(admin_view)
-export([
login/1
]).
login(Data) ->
admin_html:login(Data).
%%%%%%%%%%%%%%%%%% end example
I started doing this with a view of making it easier to add multilingual
support later by having admin_html_en.et, admin_html_se.et,
admin_html_de.et, etc then by adding a parameter and a test or two it
should be relatively easy to switch between html templates in the view
based on the user's preferences. I haven't tried this to date, but in
may give you a couple of ideas.
Jeff.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
| dmitriid |
Posted: Wed Jan 16, 2008 12:10 pm |
|
|
|
User
Joined: 17 Aug 2006
Posts: 213
|
jm wrote: Quote: Dmitrii 'Mamut' Dimandt wrote: [/code] Quote: Can a view be split up in separate small files? Let's say I have an admin_controller that defines up to 20 methods and each one needs to be renedered involving lot's of HTML. What I've seen so far is that you have to put all of your rendering functions inside the admin_view.et file which can grow really big really fast. What would be the easiest way to split the file up? [/code] I've been doing something wierd, to use your example, -module(admin_view) -export([ login/1 ]). login(Data) -> admin_html:login(Data). %%%%%%%%%%%%%%%%%% end example I started doing this with a view of making it easier to add multilingual support later by having admin_html_en.et, admin_html_se.et, admin_html_de.et, etc then by adding a parameter and a test or two it should be relatively easy to switch between html templates in the view based on the user's preferences. I haven't tried this to date, but in may give you a couple of ideas. Jeff. [/code] Thank you! This straightened up my thoughts a bit
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|