Add phone number and address, dynamic map to mobile site

This commit is contained in:
saurabhbhatia 2013-12-05 17:25:45 +08:00
parent 947c907f73
commit 0eb8e1a305
7 changed files with 30 additions and 3 deletions

View File

@ -19,6 +19,7 @@ gem 'time_difference'
gem "acts_as_unvlogable" gem "acts_as_unvlogable"
gem 'youtube_it' gem 'youtube_it'
gem 'gotcha' gem 'gotcha'
gem "geocoder"
# gem "memcached", "~> 1.4.3" # gem "memcached", "~> 1.4.3"
# gem "memcache-client" # gem "memcache-client"

View File

@ -3,4 +3,5 @@
//= require lib/all-list //= require lib/all-list
//= require lib/jquery.fastLiveFilter.js //= require lib/jquery.fastLiveFilter.js
//= require lib/checkbox.card.js //= require lib/checkbox.card.js
//= require lib/jquery.form.js //= require lib/jquery.form.js
//= require jquery_nested_form

View File

@ -27,6 +27,7 @@ class MobileController < ApplicationController
end end
def dialog_contact def dialog_contact
@site = Site.first
@no_menu = @no_footer = true @no_menu = @no_footer = true
@page_title = t('mobile.contact') @page_title = t('mobile.contact')
end end
@ -42,6 +43,8 @@ class MobileController < ApplicationController
end end
def map def map
site = Site.first
@coordinates = Geocoder.coordinates("#{site.address}")
@no_menu = @no_footer = true @no_menu = @no_footer = true
@page_title = t('mobile.location') @page_title = t('mobile.location')
end end

View File

@ -42,6 +42,8 @@ class Site
field :sub_menu, localize: true field :sub_menu, localize: true
field :terms_of_use, localize: true field :terms_of_use, localize: true
field :google_analytics field :google_analytics
field :address
field :phone_number, :type => Hash,:default=>{}
field :mobile_on, :type => Boolean, :default => false field :mobile_on, :type => Boolean, :default => false

View File

@ -35,6 +35,26 @@
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label muted">Phone Number</label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :phone_number do |p| %>
<%= p.text_field :number, :value => @site.phone_number["title"], :placeholder => "title" %>
<%= p.text_field :number, :value => @site.phone_number["number"], :placeholder => "number" %>
<% end %>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label muted">Address</label>
<div class="controls">
<div class="textarea">
<%= f.text_area :address, :class => "ckeditor input-block-level", :value => (@site.address rescue nil) %>
</div>
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label> <label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label>

View File

@ -5,7 +5,7 @@
<ul> <ul>
<li>總機電話:<a href="tel:+886229393091">02-29393091</a></li> <li>總機電話:<a href="tel:+886229393091">02-29393091</a></li>
<li>傳真02-29379611</li> <li>傳真02-29379611</li>
<li>緊急重大事件通聯窗口:校內分機 66119、66110</li> <li><%= @site.address.html_safe %></li>
<li>總值日室:<a href="tel:+88229387132">02-29387132</a></li> <li>總值日室:<a href="tel:+88229387132">02-29387132</a></li>
<li>駐警衛室:<a href="tel:+88229387129">02-29387129</a></li> <li>駐警衛室:<a href="tel:+88229387129">02-29387129</a></li>
</ul> </ul>

View File

@ -5,6 +5,6 @@
<div id='map_canvas'></div> <div id='map_canvas'></div>
<script type='text/javascript'> <script type='text/javascript'>
var $map_center = "24.987449, 121.576117" var $map_center = "<%= @coordinates.first %>, <%= @coordinates.second %>"
var $map_zoom = 17 var $map_zoom = 17
</script> </script>