fronted open switch and backend openness
This commit is contained in:
parent
11067ef34f
commit
5ff7dfbac6
|
@ -5,8 +5,9 @@ class Admin::DashboardsController < OrbitBackendController
|
|||
# before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
|
||||
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
|
||||
check_backend_openness
|
||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
|
||||
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
|
||||
@most_visited = get_most_visited('bulletin', 'page_context')
|
||||
end
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ class Admin::SitesController < OrbitBackendController
|
|||
|
||||
def update
|
||||
@site.update_attributes(params[:site])
|
||||
site_restart
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,15 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
helper_attr :site_valid_locales
|
||||
|
||||
def check_backend_openness
|
||||
if !Me.backend_openness_on
|
||||
redirect_to '/users/sign_in' if not (authenticate_user! and is_member? )
|
||||
end
|
||||
end
|
||||
|
||||
def site_restart
|
||||
Resque.enqueue(RestartServer)
|
||||
end
|
||||
|
||||
def set_current_user
|
||||
User.current = current_or_guest_user
|
||||
|
|
|
@ -15,6 +15,7 @@ class OrbitBackendController < ApplicationController
|
|||
private
|
||||
|
||||
def force_order_for_visitor
|
||||
check_backend_openness
|
||||
setup_vars
|
||||
set_current_user
|
||||
end
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
class PagesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
before_filter :get_item, :only => [:index_from_link, :show_from_link]
|
||||
before_filter :check_frontend_open, :only => [:index,:show]
|
||||
# caches_page :index
|
||||
|
||||
def check_frontend_open
|
||||
if Me.frontend_closed
|
||||
redirect_to '/admin/dashboards'
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@item = Page.find_by_name('home')
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class RestartServer
|
||||
@queue = :high
|
||||
|
||||
def self.perform()
|
||||
temp_directory = "#{Rails.root}/tmp/"
|
||||
%x[touch #{temp_directory}restart.txt ]
|
||||
end
|
||||
end
|
|
@ -11,6 +11,10 @@ class Site
|
|||
field :roaming_id
|
||||
field :private_key, :type => Binary
|
||||
field :public_key, :type => Binary
|
||||
|
||||
field :frontend_closed, :type => Boolean, :default => false
|
||||
field :backend_openness_on, :type => Boolean, :default => false
|
||||
|
||||
field :title_always_on, :type => Boolean, :default => false
|
||||
field :dashbroad_allow_visitor, :type => Boolean, :default => false
|
||||
field :mail_settings, :type => Hash
|
||||
|
|
|
@ -35,6 +35,14 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t 'site.openness' %></label>
|
||||
<div class="controls">
|
||||
<%= f.check_box :frontend_closed %><%= I18n.t('site.frontend_closed') %><br/>
|
||||
<%= f.check_box :backend_openness_on %><%= I18n.t('site.backend_openness_on') %>
|
||||
<p class="help-block"><%= (t 'site.search_help').html_safe %></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t 'site.search' %></label>
|
||||
<div class="controls">
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<a class="brand dropdown-toggle" data-toggle="dropdown" href="#">Orbit</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
|
||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member), admin_users_new_interface_index_path %></li>
|
||||
</ul>
|
||||
<% if Me.backend_openness_on %>
|
||||
<ul class="dropdown-menu">
|
||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
|
||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member), admin_users_new_interface_index_path %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
<li class="dropdown language">
|
||||
<a class="dropdown-toggle orbit-bar-language" href="#" data-toggle="dropdown" data-icons=""></a>
|
||||
<ul class="dropdown-menu language-menu">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% @site_in_use_locales.compact.each do |locale| %>
|
||||
<%= content_tag :li, (link_to t(:_locale, :locale => locale), add_locale(remove_locale((referer rescue request.fullpath)), locale)), :class => (I18n.locale.eql?(locale.to_sym) ? 'active' : nil) %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -76,6 +76,4 @@ module Orbit
|
|||
end
|
||||
end
|
||||
Orbit_Apps = []
|
||||
VALID_LOCALES = ["en", "zh_tw"]
|
||||
|
||||
|
||||
VALID_LOCALES = ["en", "zh_tw"]
|
|
@ -5,3 +5,4 @@ YAML::ENGINE.yamler = 'syck'
|
|||
|
||||
# Initialize the rails application
|
||||
Orbit::Application.initialize!
|
||||
Me = Site.first
|
|
@ -370,17 +370,20 @@ en:
|
|||
summary: Summary
|
||||
thumbnail: Thumbnail
|
||||
site:
|
||||
backend_openness_on: Backend Openness
|
||||
default_image: Site default image
|
||||
description: Site description
|
||||
description_help: Description Guide
|
||||
footer: Site footer
|
||||
footer_help: Footer Guide
|
||||
frontend_closed: Frontend Closed
|
||||
header: Site header
|
||||
info: Site information
|
||||
keywords: Site keywords
|
||||
keywords_help: Keyword Guide
|
||||
language: Site language
|
||||
mobile_version: Mobile version
|
||||
openness: Openness
|
||||
search: Site Search
|
||||
search_help: Please Enter the search argument for Google search.
|
||||
settings: Site setting
|
||||
|
|
|
@ -370,6 +370,8 @@ zh_tw:
|
|||
summary: 摘要
|
||||
thumbnail: 縮圖
|
||||
site:
|
||||
frontend_closed: 前台關閉?
|
||||
backend_openness_on: 開啟開放式後台(訪客可遊覽)
|
||||
default_image: 預設圖像
|
||||
description: 網站描述
|
||||
description_help: 網站描述說明
|
||||
|
@ -381,6 +383,7 @@ zh_tw:
|
|||
keywords_help: 關鍵字說明
|
||||
language: 網站語言
|
||||
mobile_version: 手機版
|
||||
openness: 開放模式
|
||||
search: 網站搜尋
|
||||
search_help: 請輸入送交Google搜尋的參數
|
||||
settings: 基本設定
|
||||
|
|
Reference in New Issue