diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3b0e421e..dbd906ca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -250,8 +250,10 @@ class ApplicationController < ActionController::Base end def prepare_for_mobile - session[:mobile_param] = params[:mobile] if params[:mobile] - request.format = :mobile if mobile_device? + if @site.mobile_on + session[:mobile_param] = params[:mobile] if params[:mobile] + request.format = :mobile if mobile_device? + end end end diff --git a/app/models/site.rb b/app/models/site.rb index a639bdd0..e2b2f8ed 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -25,6 +25,8 @@ class Site field :title, localize: true field :footer, localize: true field :sub_menu, localize: true + + field :mobile_on, :type => Boolean, :default => false belongs_to :design has_many :site_metas, :autosave => true, :dependent => :destroy diff --git a/app/views/admin/sites/site_info.html.erb b/app/views/admin/sites/site_info.html.erb index 9ae4060a..2ed3c4c0 100644 --- a/app/views/admin/sites/site_info.html.erb +++ b/app/views/admin/sites/site_info.html.erb @@ -94,13 +94,23 @@ <% end %>
<% if @site.default_image.file %> - <%= f.check_box :remove_default_image %> - <%= t('刪除已上傳檔案') %> + <% end %> <% end %> <% end %> +
+ +
+ +
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 17609266..6bbfdc48 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -333,6 +333,7 @@ en: keywords: Site keywords keywords_help: '' language: Site language + mobile_version: Mobile version search: Site Search search_help: Please Enter the search argument for Google search. settings: Site setting diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index f91ea8f2..967300cc 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -333,6 +333,7 @@ zh_tw: keywords: 搜尋關鍵字 keywords_help: '' language: 網站語言 + mobile_version: 手機版 search: 網站搜尋 search_help: 請輸入送交Google搜尋的參數 settings: 基本設定