fix some error

This commit is contained in:
chiu 2021-09-01 19:50:43 +08:00
parent 5c1e50eba7
commit 17f67c0f01
3 changed files with 11 additions and 17 deletions

View File

@ -7,24 +7,18 @@ class SiteMenuWidgetsController < ApplicationController
if page.child_page.size > 0 if page.child_page.size > 0
item["page_name"] = page.name item["page_name"] = page.name
item["children"] = create_json(page.sorted_published_child_pages) item["children"] = create_json(page.sorted_published_child_pages)
if page.page_type == "page" or page.page_type == "link"
item["url"] = (page.page_type == "link") ? "/#{locale.to_s}" + page.external_url : "/#{locale.to_s}" + page.url
item["target"] = "_self"
else
item["url"] = "/#{locale.to_s}" + page.url
item["target"] = "_blank"
end
else else
item["page_name"] = page.name item["page_name"] = page.name
item["children"] = [] item["children"] = []
if page.page_type == "page" end
item["url"] = "/#{locale.to_s}" + page.url if page.page_type == "link"
item["target"] = "_self"
else
item["url"] = page.external_url item["url"] = page.external_url
item["target"] = (is_internal_url?(page.external_url) ? "_self" : "_blank") rescue "_blank" item["target"] = (is_internal_url?(page.external_url) ? "_self" : "_blank") rescue "_blank"
else
item["url"] = "/#{locale.to_s}" + page.url
item["target"] = "_self"
end end
end item['active_class'] = (@page_id==page.id ? 'active' : '')
items << item items << item
end end
items items
@ -55,7 +49,7 @@ class SiteMenuWidgetsController < ApplicationController
subpart = OrbitHelper.get_current_widget subpart = OrbitHelper.get_current_widget
params = OrbitHelper.params params = OrbitHelper.params
page = Page.where(:page_id => params[:page_id]).first page = Page.where(:page_id => params[:page_id]).first
@page_id = page.id @page_id = page.id rescie nil
@expand_layer = false @expand_layer = false
@expand_next_layer = false @expand_next_layer = false
@expand_current_layer = false @expand_current_layer = false

View File

@ -3,7 +3,7 @@
<a id="accesskey_sitemenu" accesskey="S" href="/<%= "#{locale.to_s}" %>/accesskey" title="Sitemenu">:::</a> <a id="accesskey_sitemenu" accesskey="S" href="/<%= "#{locale.to_s}" %>/accesskey" title="Sitemenu">:::</a>
<h3 class="sitemenu-title">{{widget_title}}</h3> <h3 class="sitemenu-title">{{widget_title}}</h3>
<ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0"> <ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0">
<li class="sitemenu-item level-1"> <li class="sitemenu-item level-1 {{active_class}}">
<a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a> <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"> <ul class="sitemenu-list level-2" data-list="children" data-level="1">
<li class="sitemenu-item level-2" style="position: relative;"> <li class="sitemenu-item level-2" style="position: relative;">

View File

@ -3,7 +3,7 @@
<a id="accesskey_sitemenu" accesskey="S" href="/<%= "#{locale.to_s}" %>/accesskey" title="Sitemenu">:::</a> <a id="accesskey_sitemenu" accesskey="S" href="/<%= "#{locale.to_s}" %>/accesskey" title="Sitemenu">:::</a>
<h3 class="sitemenu-title">{{widget_title}}</h3> <h3 class="sitemenu-title">{{widget_title}}</h3>
<ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0"> <ul data-list="pages" class="sitemenu-list level-1 list-unstyled" data-level="0">
<li class="sitemenu-item level-1"> <li class="sitemenu-item level-1 {{active_class}}">
<a class="sitemenu-link level-1" href="{{url}}" target="{{target}}">{{page_name}}</a> <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"> <ul class="sitemenu-list level-2" data-list="children" data-level="1">
<li class="sitemenu-item level-2" style="position: relative;"> <li class="sitemenu-item level-2" style="position: relative;">