Added Enable and disable terms of use, sitemap
This commit is contained in:
parent
5c8a57e700
commit
55fa1cef4f
|
@ -12,17 +12,34 @@ class FrontController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_footer
|
def show_footer
|
||||||
|
@page = Page.find(:all, :conditions => {:name => /terms/i})
|
||||||
|
@name = @page.first.name
|
||||||
|
@url = "/#{@name}"
|
||||||
|
|
||||||
|
if @site.enable_terms_of_use
|
||||||
|
render :text => (@site.footer + "<a href='#{@url}'>Terms of Use</a>")
|
||||||
|
else
|
||||||
render :text => @site.footer
|
render :text => @site.footer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def show_menu
|
def show_menu
|
||||||
page = Page.find(params[:id]) rescue nil
|
page = Page.find(params[:id]) rescue nil
|
||||||
render :text => menu_level(Page.root, page, 1, page.design.layout.menu) if page
|
render :text => menu_level(Page.root, page, 1, page.design.layout.menu) if page
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_site_sub_menu
|
def show_site_sub_menu
|
||||||
|
@page = Page.find(:all, :conditions => {:name => /sitemap/i})
|
||||||
|
@name = @page.first.name
|
||||||
|
@url = "/#{@name}"
|
||||||
|
|
||||||
|
if @site.sitemap_menu_in_header
|
||||||
|
render :text => (@site.sub_menu + "<a href='#{@url}'>Sitemap</a>")
|
||||||
|
else
|
||||||
render :text => @site.sub_menu
|
render :text => @site.sub_menu
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def show_sitemap
|
def show_sitemap
|
||||||
@items = get_homepage.children.excludes(sitemap_enabled: false) rescue []
|
@items = get_homepage.children.excludes(sitemap_enabled: false) rescue []
|
||||||
|
@ -43,6 +60,11 @@ class FrontController < ApplicationController
|
||||||
@tags = module_app.sorted_tags_for_cloud
|
@tags = module_app.sorted_tags_for_cloud
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_terms_of_use
|
||||||
|
@site = Site.first rescue nil
|
||||||
|
@terms = @site.terms_of_use
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def menu_level(page, current_page, current, menu)
|
def menu_level(page, current_page, current, menu)
|
||||||
|
|
|
@ -19,6 +19,7 @@ class PagesController < ApplicationController
|
||||||
def show
|
def show
|
||||||
#begin
|
#begin
|
||||||
@item = Item.first(:conditions => {:path => params[:page_name]})
|
@item = Item.first(:conditions => {:path => params[:page_name]})
|
||||||
|
|
||||||
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
||||||
delayed_impressionist(@item)
|
delayed_impressionist(@item)
|
||||||
case @item.class.to_s
|
case @item.class.to_s
|
||||||
|
|
|
@ -15,6 +15,8 @@ class Site
|
||||||
field :frontend_closed, :type => Boolean, :default => false
|
field :frontend_closed, :type => Boolean, :default => false
|
||||||
field :backend_openness_on, :type => Boolean, :default => false
|
field :backend_openness_on, :type => Boolean, :default => false
|
||||||
field :desktop_closed, :type => Boolean, :default => false
|
field :desktop_closed, :type => Boolean, :default => false
|
||||||
|
field :sitemap_menu_in_header, :type => Boolean, :default => false
|
||||||
|
field :enable_terms_of_use, :type => Boolean, :default => true
|
||||||
|
|
||||||
field :title_always_on, :type => Boolean, :default => false
|
field :title_always_on, :type => Boolean, :default => false
|
||||||
field :dashbroad_allow_visitor, :type => Boolean, :default => false
|
field :dashbroad_allow_visitor, :type => Boolean, :default => false
|
||||||
|
@ -34,7 +36,7 @@ class Site
|
||||||
field :title, localize: true
|
field :title, localize: true
|
||||||
field :footer, localize: true
|
field :footer, localize: true
|
||||||
field :sub_menu, localize: true
|
field :sub_menu, localize: true
|
||||||
field :terms_of_user, localize: true
|
field :terms_of_use, localize: true
|
||||||
field :google_analytics
|
field :google_analytics
|
||||||
field :default_locale
|
field :default_locale
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
|
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
|
||||||
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
|
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
|
||||||
<% elsif @r_tag.eql?('sitemap') %>
|
<% elsif @r_tag.eql?('sitemap') %>
|
||||||
|
<% elsif @r_tag.eql?('terms_of_use') %>
|
||||||
<% elsif @r_tag.eql?('breadcrumb') %>
|
<% elsif @r_tag.eql?('breadcrumb') %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
|
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
<!-- Always shoe in the title bar -->
|
<!-- Always shoe in the title bar -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted">Always show in the title bar
|
<label class="control-label muted"><%= t :always_display_title %>
|
||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.check_box :title_always_on, :class => "toggle-check" %>
|
<%= f.check_box :title_always_on, :class => "toggle-check" %>
|
||||||
|
@ -70,12 +70,28 @@
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- CKeditor Site Footer -->
|
||||||
|
<% @site_valid_locales.each do |locale|%>
|
||||||
|
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
|
||||||
|
<label class="control-label muted"><%= t('site.footer')%></label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="textarea">
|
||||||
|
<%= f.fields_for :footer_translations do |f| %>
|
||||||
|
<%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.footer_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
|
||||||
<!-- Sitemap menu in Header -->
|
<!-- Sitemap menu in Header -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted">Sitemap menu in header
|
<label class="control-label muted">Sitemap menu in header
|
||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="checkbox" class="toggle-check" data-disabled="true">
|
<%= f.check_box :sitemap_menu_in_header, :class => "toggle-check" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -86,27 +102,25 @@
|
||||||
<label class="control-label muted">Terms of Use
|
<label class="control-label muted">Terms of Use
|
||||||
</label>
|
</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="checkbox" class="toggle-check terms" data-disabled="true" checked="checked">
|
<%= f.check_box :enable_terms_of_use, :class => "toggle-check" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- CKeditor Default Terms of Use -->
|
<!-- CKeditor Site Footer -->
|
||||||
<div class="control-group input-content hide">
|
|
||||||
<% @site_valid_locales.each do |locale|%>
|
<% @site_valid_locales.each do |locale|%>
|
||||||
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
|
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
|
||||||
<label class="control-label muted">Default Terms of Use</label>
|
<label class="control-label muted"><%= t('site.default_terms_of_use')%></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="textarea">
|
<div class="textarea">
|
||||||
<%= f.fields_for :terms_of_user_translations do |f| %>
|
<%= f.fields_for :terms_of_use_translations do |f| %>
|
||||||
<%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.terms_of_user_translations[locale] rescue nil) %>
|
<%= f.text_area locale, :class => "ckeditor input-block-level", :value => (@site.terms_of_use_translations[locale] rescue nil) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.submit t("submit"), :class => "btn btn-primary" %>
|
<%= f.submit t("submit"), :class => "btn btn-primary" %>
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
<ul id="map-tree-language" class="nav nav-pills">
|
<ul id="map-tree-language" class="nav nav-pills">
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<li <%= ( i == 0 ) ? " class=active" : '' %>><a data-toggle="tab" href="#<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
<li <%= ( i == 0 ) ? " class=active" : '' %>><a data-toggle="tab" href="#<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
|
||||||
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content map-tree-content">
|
<div class="tab-content map-tree-content">
|
||||||
|
@ -61,18 +62,18 @@
|
||||||
}
|
}
|
||||||
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?temp_locale=' + $(this).attr('temp_locale'));
|
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?temp_locale=' + $(this).attr('temp_locale'));
|
||||||
});
|
});
|
||||||
$(document).on('click', 'h4 .onoff', function () {
|
$(document).on('click', 'h6 .onoff', function () {
|
||||||
$(this).parents(".map-block").toggleClass("disabled");
|
$(this).parents(".map-block").toggleClass("disabled");
|
||||||
if($(this).parents("h4").parents("li").attr("class").indexOf("disabled") > 0){
|
if($(this).parents("h6").parents("li").attr("class").indexOf("disabled") > 0){
|
||||||
$(this).text("<%= t('off_upcase') %>")
|
$(this).text("<%= t('off_upcase') %>")
|
||||||
$(this).parents(".map-block").find('li').addClass('disabled')
|
$(this).parents(".map-block").find('li').addClass('disabled')
|
||||||
$(this).parents(".map-block").find('button').text("<%= t('off_upcase') %>")
|
$(this).parents(".map-block").find('checkbox').text("<%= t('off_upcase') %>")
|
||||||
$(this).parents(".map-block").find('li button').attr('disabled', 'disabled')
|
// $(this).parents(".map-block").find('li checkbox').attr('disabled', 'disabled')
|
||||||
} else {
|
} else {
|
||||||
$(this).text("<%= t('on_upcase') %>")
|
$(this).text("<%= t('on_upcase') %>")
|
||||||
$(this).parents(".map-block").find('li').removeClass('disabled')
|
$(this).parents(".map-block").find('li').removeClass('disabled')
|
||||||
$(this).parents(".map-block").find('button').text("<%= t('on_upcase') %>")
|
$(this).parents(".map-block").find('checkbox').text("<%= t('on_upcase') %>")
|
||||||
$(this).parents(".map-block").find('li button').removeAttr("disabled")
|
// $(this).parents(".map-block").find('li checkbox').removeAttr("disabled")
|
||||||
}
|
}
|
||||||
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?parent=true&temp_locale=' + $(this).attr('temp_locale'));
|
$.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?parent=true&temp_locale=' + $(this).attr('temp_locale'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<%= @terms.html_safe %>
|
|
@ -44,6 +44,7 @@ public_r_tags:
|
||||||
- sitemap
|
- sitemap
|
||||||
- breadcrumb
|
- breadcrumb
|
||||||
- tag_cloud
|
- tag_cloud
|
||||||
|
- terms_of_use
|
||||||
|
|
||||||
page_part_kinds:
|
page_part_kinds:
|
||||||
- text
|
- text
|
||||||
|
|
|
@ -328,7 +328,7 @@ Orbit::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
controller_paths :front, %w[show_breadcrumb show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap show_tag_cloud]
|
controller_paths :front, %w[show_breadcrumb show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap show_tag_cloud show_terms_of_use]
|
||||||
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
|
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
|
||||||
|
|
||||||
# scope 'app' do
|
# scope 'app' do
|
||||||
|
|
|
@ -125,6 +125,7 @@ module ParserCommon
|
||||||
def parse_sub_menus_edit(body = nil, page = nil, edit=nil)
|
def parse_sub_menus_edit(body = nil, page = nil, edit=nil)
|
||||||
body.css('sub_menu').each do |sub_menu|
|
body.css('sub_menu').each do |sub_menu|
|
||||||
menu_page = Page.find(sub_menu['id']) rescue nil
|
menu_page = Page.find(sub_menu['id']) rescue nil
|
||||||
|
|
||||||
res = ''
|
res = ''
|
||||||
if menu_page && menu_page.visible_children.size > 0
|
if menu_page && menu_page.visible_children.size > 0
|
||||||
res << "<div class='category_list'>"
|
res << "<div class='category_list'>"
|
||||||
|
@ -245,6 +246,15 @@ module ParserCommon
|
||||||
sitemap.swap(fragment)
|
sitemap.swap(fragment)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# terms_of_use
|
||||||
|
def parse_terms_of_uses_edit(body = nil, page = nil, edit=nil)
|
||||||
|
terms_of_use = body.css('terms_of_use').first
|
||||||
|
url = front_show_terms_of_use_path
|
||||||
|
options = "?inner=true"
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>")
|
||||||
|
terms_of_use.swap(fragment)
|
||||||
|
end
|
||||||
|
|
||||||
# page_contents
|
# page_contents
|
||||||
def parse_contents_edit(body, page, edit=nil)
|
def parse_contents_edit(body, page, edit=nil)
|
||||||
public_r_tags = []
|
public_r_tags = []
|
||||||
|
|
|
@ -222,4 +222,9 @@ module ParserFrontEnd
|
||||||
def generate_tag_clouds(*args)
|
def generate_tag_clouds(*args)
|
||||||
"<div class='dymanic_load' path='#{front_show_tag_cloud_path(args[0])}'></div>"
|
"<div class='dymanic_load' path='#{front_show_tag_cloud_path(args[0])}'></div>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# tag_cloud
|
||||||
|
def generate_terms_of_uses(*args)
|
||||||
|
"<div class='dymanic_load' path='#{front_show_terms_of_use_path}'></div>"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue