Add mobile version in site settings
This commit is contained in:
parent
37740adb24
commit
6c6bda988d
|
@ -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
|
||||
|
|
|
@ -26,6 +26,8 @@ class Site
|
|||
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
|
||||
|
||||
|
|
|
@ -94,13 +94,23 @@
|
|||
<% end %>
|
||||
<br>
|
||||
<% if @site.default_image.file %>
|
||||
<%= f.check_box :remove_default_image %>
|
||||
<%= t('刪除已上傳檔案') %>
|
||||
<label class="checkbox">
|
||||
<%= check_box_tag 'site[remove_default_image]' %>
|
||||
<%= t('delete') %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="control-group" style="margin-bottom: 0;">
|
||||
<label class="control-label"><%= t 'site.mobile_version' %></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<%= f.check_box :mobile_on %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -333,6 +333,7 @@ zh_tw:
|
|||
keywords: 搜尋關鍵字
|
||||
keywords_help: ''
|
||||
language: 網站語言
|
||||
mobile_version: 手機版
|
||||
search: 網站搜尋
|
||||
search_help: 請輸入送交Google搜尋的參數
|
||||
settings: 基本設定
|
||||
|
|
Reference in New Issue