Feature #2518

Allow views and partials to be dynamically overridden

Added by Phil Hodgson almost 6 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Phil Hodgson
Category:
-
Start date:
04/01/2014
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
-

Description

Make it possible to put a view or partial into a certain folder and have it effectively override the default, so that installations can non-destructively but easily customize Tapestry's pages.


Subtasks

Task #2527: review view/partial override codeResolvedWard Vandewege

Task #2529: Allow views and partials to be overridden by putting files in a specific location on the serverResolvedPhil Hodgson

Associated revisions

Revision 8ee7d7e2 (diff)
Added by Phil Hodgson almost 6 years ago

Move the "override views" folder outside of views but still under apps in the Rails.root (refs #2518)

Revision ed117efa (diff)
Added by Phil Hodgson almost 6 years ago

Move site_specific views folder right to Rails.root, and allow this itself to be overridden with an environment variable (refs #2518)

Revision 452c4d69 (diff)
Added by Phil Hodgson almost 6 years ago

Put the so-called override path into a Rails.configuration variable so can be accessed from initializers (refs #2535, #2518)

History

#1 Updated by Phil Hodgson almost 6 years ago

  • Status changed from New to Resolved
  • Remaining (hours) set to 0.0

#2 Updated by Ward Vandewege almost 6 years ago

  • Estimated time set to 0.00 h
  • Parent task deleted (#2501)

#3 Updated by Ward Vandewege almost 6 years ago

  • Tracker changed from Task to Feature

#4 Updated by Ward Vandewege almost 6 years ago

  • Status changed from Resolved to In Progress

#5 Updated by Ward Vandewege almost 6 years ago

  • Target version changed from Tapestry - Next sprint to Testing and Upgrading + PGP.ca features

#7 Updated by Ward Vandewege almost 6 years ago

Since this code is not on a separate branch, I reviewed:

c0a650c06acc7e3734603b9d25a89d0feddedc3a

Comments:

  • This should be documented in a new 'Customization' section on the wiki, cf. my comments in #2501
  • I would prefer to have the site_specific directory to be outside of Rails.root, in a directory that is configurable via the config.yml file. It should mimic the entire Rails.root structure, though it's totally fine to only support overloading of files under app/views like you are doing in this patch. This is the way RT does it, and it makes it super easy to upgrade the codebase - there are no site specific modifications in the tree that comes from upstream.

Otherwise, good to merge!

#8 Updated by Phil Hodgson almost 6 years ago

I've added a new Customization section to the wiki. I agree that it would be a good idea to reorganize a bit and I'll do that as we go.

As for the directory outside of Rails.root, in principal we could do it (I tried locally and it certainly works without complaint), but the trouble is with configuring this via the config.yml files. In order to do this, we have to change when and the way the config.yml files are read. This should be done in another feature as this is certain a mini-project unto itself: I would also make the yml files interpreted for erb and rename them accordingly. And then with that we would be able to keep string literals completely DRY. We would consider switching to using ENV as well. Therefore pretty much everything using APP_CONFIG would be influenced. At the same time, I could eliminate the old Tapestry system of evaluating these config keys as CAPITALIZED CONSTANTS.

Until then I've compromised and pointed this configuration at "#{Rails.root}/site_specific/app/views". The "#{Rails.root}/site_specific" part can be overridden with an environment variable called TAPESTRY_OVERRIDE_PATH. With this latter addition we can effectively accomplish exactly what you're requesting, even without refactoring how and when the configs are read.

(I've created what I hope is a proper branch for this according to my new understanding of the development process at Curoverse. It is called "2518-can-override-views".)

#9 Updated by Phil Hodgson almost 6 years ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF