-
Notifications
You must be signed in to change notification settings - Fork 2
f7_view
Terry Wilson edited this page Sep 17, 2014
·
1 revision
This renders a container for a single view.
If you will be loading these entire views via AJAX, this will effectively be the layout for a controller.
Would be best to us this helper to construct the templates that are populated by AJAX requests, rather than constantly serving bloated views.
f7_view name, &block
f7_view name, html_options, &block
f7_view name, html_options
<%= f7_view 'main' do %>
<!-- Other Content -->
<% end %>
<div class="view view-main">
<!-- Other Content -->
</div>
Whilst not required, you can specify additional html options, such as an id
or additional CSS classes.
<%= f7_view 'main', :id => :test, :class => 'demo' do %>
<!-- Other Content -->
<% end %>
<div id="test" class="view view-main demo">
<!-- Other Content -->
</div>
If you choose not to pass a block along with this helper it will attempt to load a partial as follows:
app/views/<controller>/<view>/<view>
For example, if you have a WelcomeController
view containing the following markup:
<%= f7_view :main %>
It will try and load the partial app/views/welcome/main/main
, obeying the normal rules for file extensions, etc. failing if it cannot be found.