Commit Graph

54 Commits

Author SHA1 Message Date
Tj Holowaychuk
1c360a89ba added views.compile(view, cache, cid, options)
private for now
2011-05-16 15:17:06 -07:00
Tj Holowaychuk
8636dee13e docs 2011-05-16 14:28:11 -07:00
Tj Holowaychuk
eeb77541cd Updated jade submodule 2011-05-14 11:53:26 -07:00
Tj Holowaychuk
3043672448 added exports.lookup(view, options) to view.js
private for now
2011-05-13 19:37:11 -07:00
Tj Holowaychuk
ae1078944c Fixed view hints
populate attempts on new View
2011-04-27 09:07:56 -07:00
Tj Holowaychuk
470774cfba Fixed template caching collision issue. Closes #644
the parent view is resolved first so we always have the absolute path
available, so this should prevent collisions.
2011-04-26 15:24:31 -07:00
Tj Holowaychuk
3d242a607e Fixed caching of views when using several apps. Closes #637
simple fix :)
2011-04-25 09:25:23 -07:00
Tj Holowaychuk
bc68e5e7a3 misc 2011-04-25 09:20:31 -07:00
Tj Holowaychuk
eac666574e viewHelpers -> _locals 2011-04-21 08:26:30 -07:00
Tj Holowaychuk
ccc39e5aa2 Fixed partial lookup precedence. Closes #631 2011-04-19 10:23:16 -07:00
Tj Holowaychuk
d9e7153fc9 Renamed "cache views" to "view cache". Closes #628 2011-04-17 16:42:03 -07:00
Tj Holowaychuk
f4487343df Fixed filename option passing to template engine 2011-04-12 02:43:03 -07:00
Tj Holowaychuk
89383ecc57 misc refactoring 2011-04-03 14:27:40 -07:00
Tj Holowaychuk
08046f7692 Added better partial() object collection support
only respecting .length is fine in some cases, but
if the object has a length and has holes, it will likely
produce an unexpected result, or an undefined local in the
render call, which may some times be ideal, but most likely not.

this change allows arbitrary objects to be passed to "collection: ",
however unfortunately there is no way to arbitrarily assume the object
is a collection without passing it as the option
2011-04-03 14:27:05 -07:00
Tj Holowaychuk
371d66ba2a Added layout(path) helper to change the layout within a view. Closes #610 2011-04-01 17:47:03 -07:00
Tj Holowaychuk
11250d22c9 misc refactoring 2011-03-30 21:44:21 -07:00
Tj Holowaychuk
4b4de29725 Performance improved with better view caching
the entire View object is now cached in-memory, along with the lookup
logic as well. This increases rendering (with jade at least) by about 260 rps
2011-03-30 21:40:05 -07:00
Tj Holowaychuk
28ba9e8ac5 Fixed res.partial(); next(err) when no callback is given [reported by aheckmann] 2011-03-29 09:56:58 -07:00
Tj Holowaychuk
7888cb0506 docs 2011-03-29 09:51:38 -07:00
Tj Holowaychuk
e71696cf34 expose err.view when failing to locate a view
allows for:

   err.view.path

etc
2011-03-28 14:44:12 -07:00
Tj Holowaychuk
5d6ce251ca Added <root>/_<name> partial lookup support 2011-03-24 13:33:52 -07:00
Tj Holowaychuk
92c04cee1d Added; partial lookup relative to view root. Closes #447
for example when nested deep, if you have a
partial located at ./views/messages.jade

partial("messages");

will still work
2011-03-24 13:26:32 -07:00
Tj Holowaychuk
cf26cf7afc wrap try/catch around render() 2011-03-18 11:44:48 -07:00
Tj Holowaychuk
220d88d654 Fixed up index view path alternative
previously was doing ../index, which was not intended
now doing ../VIEW/index
2011-03-17 15:36:44 -07:00
Tj Holowaychuk
bd1ab7ab96 pass the function 2011-03-17 12:48:06 -07:00
Tj Holowaychuk
2ff991bfcf refactored res.render() 2011-03-17 12:45:11 -07:00
Tj Holowaychuk
0b1378a539 Added res.locals(obj) 2011-03-17 12:13:59 -07:00
Tj Holowaychuk
723c908bd7 Added res.partial() callback support 2011-03-17 12:10:32 -07:00
Tj Holowaychuk
a6fdc1bfd2 Fixed .filename view engine option [reported by drudge] 2011-03-16 16:58:02 -07:00
Tj Holowaychuk
909914f7af Changed; partial() "locals" are now optional
this means that:

   partial("user", { name: "tj" })

with the intent of receiving "user" instead of "name" in this
case is invalid, "name" here is a local, however passing a non-plain
object such as a User object is fine:

    partial("user", new User("tj"));
2011-03-16 15:37:05 -07:00
Tj Holowaychuk
f327455d9d Added charset option for render() 2011-03-09 10:31:10 -08:00
Tj Holowaychuk
57b035cd94 hinting at fully resolved paths 2011-03-08 12:58:16 -08:00
Tj Holowaychuk
f1f126171c Added view resolution hints when in development 2011-03-08 12:51:40 -08:00
Tj Holowaychuk
b5579b6307 Added layout lookup support relative to the page view
for example if you render ./views/forum/thread and
./views/forum/thread/layout.jade exists, it will be used,
falling back on ./views/layout.jade.
2011-03-08 12:01:45 -08:00
Tj Holowaychuk
110b0fe14a misc refactor 2011-03-08 11:47:03 -08:00
Tj Holowaychuk
d7488bbb62 Removed Partial constructor (not used) 2011-03-08 11:42:03 -08:00
Tj Holowaychuk
2007407e7b docs 2011-03-08 09:56:24 -08:00
Tj Holowaychuk
d152e7e780 Added res.render() status support back
useful for error templates that display the status _and_
set the status code
2011-03-08 09:56:05 -08:00
Tj Holowaychuk
07d06adf86 Added res.render() .locals support back to aid in migration process 2011-03-07 09:15:36 -08:00
Tj Holowaychuk
1fc520b45a Fixed partial() issue where the parent locals clobber those given directly 2011-03-03 12:44:37 -08:00
Tj Holowaychuk
65c8a956f1 do not try ../index when rendering a layout 2011-03-03 11:23:16 -08:00
Tj Holowaychuk
2b907e9a8c fixing tests 2011-03-03 11:21:57 -08:00
Tj Holowaychuk
25e520c243 misc 2011-03-03 11:11:08 -08:00
Tj Holowaychuk
a49e1f4f3d Changed default view scope to a plain object
easier to debug, and kinda useless to use "this" anyway
2011-03-03 10:59:00 -08:00
Tj Holowaychuk
32be4a7812 Added View#upIndexPath 2011-03-03 10:54:54 -08:00
Tj Holowaychuk
aaa8415169 Removed partial() / render() status and header options 2011-03-02 16:11:02 -08:00
Tj Holowaychuk
51e964498c docs 2011-03-02 16:08:39 -08:00
Tj Holowaychuk
dd9406cd52 Added res.partial(), using the same interface as partial() within a view. Closes #539 2011-03-02 14:27:07 -08:00
Tj Holowaychuk
42d2758c36 Added union() util, taking place of merge(clone()) combo 2011-03-02 13:41:36 -08:00
Tj Holowaychuk
334604de5d utilizing app.set() 2011-03-02 12:03:05 -08:00