From 0eb8e1a305d51c1be0198aaf4bdcc929048cc7cc Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Thu, 5 Dec 2013 17:25:45 +0800 Subject: [PATCH] Add phone number and address, dynamic map to mobile site --- Gemfile | 1 + app/assets/javascripts/back_end.js | 3 ++- app/controllers/mobile_controller.rb | 3 +++ app/models/site.rb | 2 ++ .../admin/sites/responsive_setting.html.erb | 20 +++++++++++++++++++ app/views/mobile/dialog_contact.mobile.erb | 2 +- app/views/mobile/map.mobile.erb | 2 +- 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 54f32939..08fec358 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ gem 'time_difference' gem "acts_as_unvlogable" gem 'youtube_it' gem 'gotcha' +gem "geocoder" # gem "memcached", "~> 1.4.3" # gem "memcache-client" diff --git a/app/assets/javascripts/back_end.js b/app/assets/javascripts/back_end.js index 0b2af80e..0cc02e49 100644 --- a/app/assets/javascripts/back_end.js +++ b/app/assets/javascripts/back_end.js @@ -3,4 +3,5 @@ //= require lib/all-list //= require lib/jquery.fastLiveFilter.js //= require lib/checkbox.card.js -//= require lib/jquery.form.js \ No newline at end of file +//= require lib/jquery.form.js +//= require jquery_nested_form \ No newline at end of file diff --git a/app/controllers/mobile_controller.rb b/app/controllers/mobile_controller.rb index 163f3143..39aeab10 100644 --- a/app/controllers/mobile_controller.rb +++ b/app/controllers/mobile_controller.rb @@ -27,6 +27,7 @@ class MobileController < ApplicationController end def dialog_contact + @site = Site.first @no_menu = @no_footer = true @page_title = t('mobile.contact') end @@ -42,6 +43,8 @@ class MobileController < ApplicationController end def map + site = Site.first + @coordinates = Geocoder.coordinates("#{site.address}") @no_menu = @no_footer = true @page_title = t('mobile.location') end diff --git a/app/models/site.rb b/app/models/site.rb index 81006454..95ba2d98 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -42,6 +42,8 @@ class Site field :sub_menu, localize: true field :terms_of_use, localize: true field :google_analytics + field :address + field :phone_number, :type => Hash,:default=>{} field :mobile_on, :type => Boolean, :default => false diff --git a/app/views/admin/sites/responsive_setting.html.erb b/app/views/admin/sites/responsive_setting.html.erb index 14e70822..6e424f22 100644 --- a/app/views/admin/sites/responsive_setting.html.erb +++ b/app/views/admin/sites/responsive_setting.html.erb @@ -35,6 +35,26 @@ +
+ +
+
+ <%= 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 %> +
+
+
+ +
+ +
+
+ <%= f.text_area :address, :class => "ckeditor input-block-level", :value => (@site.address rescue nil) %> +
+
+
diff --git a/app/views/mobile/dialog_contact.mobile.erb b/app/views/mobile/dialog_contact.mobile.erb index 9f208a97..eb5830f0 100644 --- a/app/views/mobile/dialog_contact.mobile.erb +++ b/app/views/mobile/dialog_contact.mobile.erb @@ -5,7 +5,7 @@ diff --git a/app/views/mobile/map.mobile.erb b/app/views/mobile/map.mobile.erb index 51e69dbf..1d1b4f09 100644 --- a/app/views/mobile/map.mobile.erb +++ b/app/views/mobile/map.mobile.erb @@ -5,6 +5,6 @@
\ No newline at end of file