forked from refinery/refinerycms
/
_tabbed_fields.html.erb
42 lines (40 loc) · 1.46 KB
/
_tabbed_fields.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<div class='field'>
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
<ul id='page_parts'>
<% tabbed_fields.each_with_index do |field, index| %>
<li class="ui-state-default <%= 'ui-state-active' if index == 0 %>">
<%= link_to "#{field.to_s.humanize}", "\##{field}" %>
</li>
<% end %>
<% pages_tabs = ::Refinery::Pages.tabs
tabs_to_show = (refinery_pages_tabs ||= []).map!(&:to_s)
pages_tabs.reject!{|t| refinery_pages_tabs.exclude?(t.name.to_s) } unless tabs_to_show.include?('all')
pages_tabs.each_with_index do |tab, tab_index| %>
<li class='ui-state-default' id="custom_<%= tab.name %>_tab">
<%= link_to tab.name.titleize, "#custom_tab_#{tab_index}" %>
</li>
<% end %>
</ul>
<div id='page_part_editors'>
<% tabbed_fields.each do |field| %>
<div class='page_part' id="<%= field %>">
<%= f.text_area field, :rows => 20, :class => 'wymeditor widest' -%>
</div>
<% end %>
<% pages_tabs.each_with_index do |tab, tab_index| %>
<div class='page_part' id='<%= "custom_tab_#{tab_index}" %>'>
<%= render tab.partial, :f => f %>
</div>
<% end %>
</div>
</div>
</div>
<% content_for :javascripts do %>
<script>
$(document).ready(function(){
if (!page_options.initialised) {
page_options.init(false, '', '');
}
});
</script>
<% end %>