Merge branch 'master' into 'master'
fix error and let level-2's and level-3's position show on correct place See merge request !2
This commit is contained in:
commit
bf2edc94c2
|
@ -35,9 +35,9 @@ class SiteMenuWidgetsController < ApplicationController
|
|||
#item = []
|
||||
@count += 1
|
||||
if (!item1["children"].nil? && item1["children"].length!=0)
|
||||
@li_index << @count
|
||||
if children_is_current(item1['obj'])
|
||||
@ul_index << ( @li_index.length - 1 )
|
||||
@count1 += 1
|
||||
if (@expand_current_layer && children_is_current(item1['obj'])) || (@expand_next_layer && item1['obj'].id == @page_id)
|
||||
@ul_index << [@count1, @count]
|
||||
end
|
||||
create_menu_bool_object(item1['children'])
|
||||
#item = [children_is_current(item1['obj']),item1['obj'].id==@page_id,create_menu_bool_object(item1['children'])]
|
||||
|
@ -57,6 +57,8 @@ class SiteMenuWidgetsController < ApplicationController
|
|||
page = Page.where(:page_id => params[:page_id]).first
|
||||
@page_id = page.id
|
||||
@expand_layer = false
|
||||
@expand_next_layer = false
|
||||
@expand_current_layer = false
|
||||
if page.parent_page == Page.root
|
||||
@pages = page.sorted_published_child_pages
|
||||
else
|
||||
|
@ -66,7 +68,6 @@ class SiteMenuWidgetsController < ApplicationController
|
|||
@show_options = orbit_widget.show_options rescue nil
|
||||
end
|
||||
subpart.select_options.each do |select_option|
|
||||
puts ['show',@show_options]
|
||||
if !(@show_options.nil?) && select_option.field_name == @show_options.keys.first.to_s
|
||||
value = YAML.load(select_option.value)
|
||||
if value[I18n.locale] == t('site_menu.yes')
|
||||
|
@ -80,25 +81,32 @@ class SiteMenuWidgetsController < ApplicationController
|
|||
value = YAML.load(select_option.value)
|
||||
if value[I18n.locale] == t('site_menu.yes')
|
||||
@expand_layer = true
|
||||
@expand_current_layer = true
|
||||
end
|
||||
elsif !(@show_options.nil?) && select_option.field_name == @show_options.keys[2].to_s
|
||||
value = YAML.load(select_option.value)
|
||||
if value[I18n.locale] == t('site_menu.yes')
|
||||
@expand_layer = true
|
||||
@expand_next_layer = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ul_index=[]
|
||||
@li_index= []
|
||||
@count = -1
|
||||
@count1 = -1
|
||||
@li_index = []
|
||||
title = subpart.title
|
||||
items = create_json(@pages)
|
||||
create_menu_bool_object(items)
|
||||
if @expand_layer
|
||||
if @expand_layer
|
||||
create_menu_bool_object(items)
|
||||
temp = @ul_index.reverse.collect do |ul_index|
|
||||
tp = @li_index[ul_index] + 1
|
||||
"var ul_tp = $('div[data-subpart-id=#{subpart.id}]').find('ul').eq(#{tp})
|
||||
ul_tp.removeClass('dropdown-menu')
|
||||
$('div[data-subpart-id=#{subpart.id}]').find('li').eq(#{@li_index[ul_index]}).find('span').eq(0).remove()
|
||||
"
|
||||
end
|
||||
"var ul_tp = $('div[data-subpart-id=#{subpart.id}]').find('ul.dropdown-menu').eq(#{ul_index[0]})
|
||||
ul_tp.removeClass('dropdown-menu')
|
||||
$('div[data-subpart-id=#{subpart.id}]').find('li').eq(#{ul_index[1]}).find('span').eq(0).remove()
|
||||
"
|
||||
end
|
||||
if temp.length != 0
|
||||
temp = temp.join(' ')
|
||||
expand_script = "<script type='text/javascript'>" +
|
||||
|
|
|
@ -2,5 +2,6 @@ en:
|
|||
site_menu:
|
||||
show_previous_layer: Show Previous Layer
|
||||
expand_current_layer: Expand Current Layer
|
||||
expand_next_layer: Expand Next Layer
|
||||
'yes': 'Yes'
|
||||
'no': 'No'
|
||||
|
|
|
@ -2,5 +2,6 @@ zh_tw:
|
|||
site_menu:
|
||||
show_previous_layer: 顯示上一層
|
||||
expand_current_layer: 展開所在的那層
|
||||
expand_next_layer: 展開下一層
|
||||
'yes': 是
|
||||
'no': 否
|
|
@ -5,16 +5,19 @@ module SiteMenuWidget
|
|||
data = {}
|
||||
key1 = {}
|
||||
key2 = {}
|
||||
key3 = {}
|
||||
value1 = {}
|
||||
value2 = {}
|
||||
translate_data.each do |t_data|
|
||||
key1[t_data.keys[0]] = t_data.values[0]['site_menu']['show_previous_layer']
|
||||
key2[t_data.keys[0]] = t_data.values[0]['site_menu']['expand_current_layer']
|
||||
key3[t_data.keys[0]] = t_data.values[0]['site_menu']['expand_next_layer']
|
||||
value2[t_data.keys[0]] = t_data.values[0]['site_menu']['no']
|
||||
value1[t_data.keys[0]] = t_data.values[0]['site_menu']['yes']
|
||||
end
|
||||
data[key1] = [value2,value1]
|
||||
data[key2] = [value2,value1]
|
||||
data[key3] = [value2,value1]
|
||||
OrbitApp.registration "SiteMenuWidget", :type => "OrbitWidget" do
|
||||
widget_label "SiteMenu"
|
||||
widget_methods ["widget"]
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
<li class="sitemenu-item level-1">
|
||||
<a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a>
|
||||
<ul class="sitemenu-list level-2" data-list="children" data-level="1">
|
||||
<li class="sitemenu-item level-2">
|
||||
<li class="sitemenu-item level-2" style="position: relative;">
|
||||
<a class="sitemenu-link level-2" href="{{url}}" target="{{target}}">{{page_name}}</a>
|
||||
<ul class="sitemenu-list level-2" data-list="children" data-level="2">
|
||||
<li class="sitemenu-item level-3">
|
||||
<li class="sitemenu-item level-3" style="position: relative;">
|
||||
<a class="sitemenu-link level-3" href="{{url}}" target="{{target}}">{{page_name}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
<li class="sitemenu-item level-1">
|
||||
<a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a>
|
||||
<ul class="sitemenu-list level-2" data-list="children" data-level="1">
|
||||
<li class="sitemenu-item level-2">
|
||||
<li class="sitemenu-item level-2" style="position: relative;">
|
||||
<a class="sitemenu-link level-2" href="{{url}}" target="{{target}}">{{page_name}}</a>
|
||||
<ul class="sitemenu-list level-2" data-list="children" data-level="2">
|
||||
<li class="sitemenu-item level-3">
|
||||
<li class="sitemenu-item level-3" style="position: relative;">
|
||||
<a class="sitemenu-link level-3" href="{{url}}" target="{{target}}">{{page_name}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue