Add mobile version in site settings

This commit is contained in:
chris 2013-01-07 03:57:36 +08:00
parent 37740adb24
commit 6c6bda988d
5 changed files with 20 additions and 4 deletions

View File

@ -250,8 +250,10 @@ class ApplicationController < ActionController::Base
end end
def prepare_for_mobile def prepare_for_mobile
session[:mobile_param] = params[:mobile] if params[:mobile] if @site.mobile_on
request.format = :mobile if mobile_device? session[:mobile_param] = params[:mobile] if params[:mobile]
request.format = :mobile if mobile_device?
end
end end
end end

View File

@ -26,6 +26,8 @@ class Site
field :footer, localize: true field :footer, localize: true
field :sub_menu, localize: true field :sub_menu, localize: true
field :mobile_on, :type => Boolean, :default => false
belongs_to :design belongs_to :design
has_many :site_metas, :autosave => true, :dependent => :destroy has_many :site_metas, :autosave => true, :dependent => :destroy

View File

@ -94,13 +94,23 @@
<% end %> <% end %>
<br> <br>
<% if @site.default_image.file %> <% if @site.default_image.file %>
<%= f.check_box :remove_default_image %> <label class="checkbox">
<%= t('刪除已上傳檔案') %> <%= check_box_tag 'site[remove_default_image]' %>
<%= t('delete') %>
</label>
<% end %> <% end %>
</div> </div>
</div> </div>
<% end %> <% end %>
<% 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> </div>
</div> </div>

View File

@ -333,6 +333,7 @@ en:
keywords: Site keywords keywords: Site keywords
keywords_help: '' keywords_help: ''
language: Site language language: Site language
mobile_version: Mobile version
search: Site Search search: Site Search
search_help: Please Enter the search argument for Google search. search_help: Please Enter the search argument for Google search.
settings: Site setting settings: Site setting

View File

@ -333,6 +333,7 @@ zh_tw:
keywords: 搜尋關鍵字 keywords: 搜尋關鍵字
keywords_help: '' keywords_help: ''
language: 網站語言 language: 網站語言
mobile_version: 手機版
search: 網站搜尋 search: 網站搜尋
search_help: 請輸入送交Google搜尋的參數 search_help: 請輸入送交Google搜尋的參數
settings: 基本設定 settings: 基本設定