consistency when not all partial views of a child are present
Closed this issue · 2 comments
scenario
Consider this case:
-
I have two themes:
root_theme
with'extends' => null,
and
experimental_theme
with'extends' => 'root_theme',
-
in both the
experimental_theme
and theroot_theme
I have a navbar this view:navs._toolbar
two blade files areviews/navs/_toolbar.blade.php
andviews/theme_experimental/navs/_toolbar.blade.php
-
The navbars are referenced in various view files. For instance, content of my form to create a new event looks like this:
// file
views/theme_experimental/events/create.blade.php
@extends(layouts.master_experimental) @section('content') @include('navs._toolbar') @stop
and// file
views/events/show.blade.php
@extends(layouts.master_root) @section('content') @include('navs._toolbar') @stop
Problem:
- not all views in my experimental theme exists. For instance, I have a view for creating an Event, but I don't have a
show
template. - The CSS frameworks in my two themes are different
- When I switch to
experimental theme
and want to display the abovecreate
form, everything is fine! - When I switch to
show
, then - since I have no view file in the theme, your package picks blade file from the root folderviews/events/show.blade.php
, but.... **it takes the included sub-templates from the child themeviews/theme_experimental/events/show.blade.php
.
The result is a mashup which destroys views. Current file-choosing policy in your package allows this.
My solution is away from usual structure of an app as I use your theme system to offer users a choice of radically different UI - so that they are able to pick the one they prefer: based on Twitter Bootstrap, Semantic UI, etc.
my feature suggestion
consistent inheriting of sub-files
Would that be possible to modify your package so that in case a parent template file is inherited from a parent theme, all the included sub-files are ALSO inherited from the same theme as the parent file?
Thx
@UnrulyNatives I'm not sure that's going to be possible as at the highest level this package basically just prepends the themes paths to the top of the view directories array and let's Laravel's engine deal with finding the best-match for a file matching said path. What you're asking for would require modifying that array each time we load a view from a different theme/the root views folder.
Given the above situation it sounds like you simply need to override the partials that your theme doesn't have with ones that are compatible with your theme since why would the partials that the root show template include (which for the sake of this we will say have been coded to bootstraps standards) be compatible with your experimental theme in the semantic-ui standards?
Exactly, picking the correct view is a Laravel feature. This packages just
configures the search array with the paths of the themes and leaves it to
Laravel to pick the correct file. I don't think that it is a good idea to
reimplement/alter the default functionality as it may confuse many
developers...
On Sun, May 29, 2016 at 2:42 PM, Matthew Hailwood notifications@github.com
wrote:
@UnrulyNatives https://github.com/UnrulyNatives I'm not sure that's
going to be possible as at the highest level this package basically just
prepends the themes paths to the top of the view directories array and
let's Laravel's engine deal with finding the best-match for a file matching
said path. What you're asking for would require modifying that array each
time we load a view from a different theme/the root views folder.Given the above situation it sounds like you simply need to override the
partials that your theme doesn't have with ones that are compatible with
your theme since why would the partials that the root show template include
(which for the sake of this we will say have been coded to bootstraps
standards) be compatible with your experimental theme in the semantic-ui
standards?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#29 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AEX7TxOs43ibD-7UWqJUKbIPOVF-tvbZks5qGXusgaJpZM4IjkJx
.