campfire_logic 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -9,6 +9,7 @@ class DirectoryController < ApplicationController
9
9
 
10
10
  def show
11
11
  @locale = find_locale || Locale.init_root
12
+ @location = @locale.location
12
13
  Rails.logger.info "Found a #{@locale.kind} locale: #{@locale.name}"
13
14
  end
14
15
 
@@ -91,6 +91,10 @@ class Location
91
91
  self[:city] = value
92
92
  end
93
93
 
94
+ def phone= value
95
+ self[:phone] = value.gsub /[a-z\.\(\) -]+/,'' if value.present?
96
+ end
97
+
94
98
  def state=(value)
95
99
  clear_geocoding if self.state != value
96
100
  self[:state] = value
@@ -113,7 +117,7 @@ class Location
113
117
  # Geocodes this location.
114
118
  def call_geocode
115
119
  return :new if self.geocoding_address.blank?
116
- geocode
120
+ geocode unless geocoded?
117
121
  return :new unless Geocoder::Configuration.lookup == :google
118
122
  audit_address
119
123
  self.geocoder_result.try(:partial_match?) ? :partial_match : :validated
@@ -129,14 +133,10 @@ class Location
129
133
  geocoder_result.blank? || self.send(attribute) == geocoder_result.send(GOOGLE_MAPS_GEOCODER_FIELDS_BY_LOCATION_FIELD[attribute])
130
134
  end
131
135
 
132
- # Returns the n nearest locations.
133
- def nearby_locations(n = 5)
134
- Location.near(:coordinates => self.coordinates).limit(n + 1).select{ |l| l != self }
135
- end
136
-
137
136
  # Instance methods: Locales ======================================================================
138
137
 
139
138
  def localize
139
+ return if geocoding_address.blank?
140
140
  self.save
141
141
  self.locale ? update_locales : create_locales
142
142
  self.save
@@ -1,4 +1,4 @@
1
- <%= form_tag "/#{CampfireLogic.directory_slug}/search", :method => :get, :id => 'search-form' do -%>
2
- <%= text_field_tag 'criteria', params[:criteria], :id => 'search-input', :maxlength => 40 -%>
3
- <%= submit_tag 'Search' -%>
4
- <%- end -%>
1
+ <%= form_tag "/#{CampfireLogic.directory_slug}/search", :method => :get, :id => 'search-form' do %>
2
+ <%= text_field_tag 'criteria', params[:criteria], :id => 'search-input', :maxlength => 40 %>
3
+ <%= submit_tag 'Search' %>
4
+ <% end %>
@@ -1,29 +1,29 @@
1
- <%-
1
+ <%
2
2
  subtitle = " - #{@locale.location ? @locale.location.name : @locale.name}" unless @locale.planet?
3
3
  set_title "Location Directory#{subtitle}"
4
- -%>
4
+ %>
5
5
 
6
6
  <br style="clear: both;" />
7
7
  <br style="clear: both;" />
8
8
 
9
- <%- unless @locale.children.blank? -%>
10
- <%- if @locale.root? -%>
9
+ <% unless @locale.children.blank? %>
10
+ <% if @locale.root? %>
11
11
  <h2>Select a State/Province</h2>
12
- <%- elsif @locale.country? -%>
12
+ <% elsif @locale.country? %>
13
13
  <h2>Select a State</h2>
14
- <%- elsif @locale.state? -%>
14
+ <% elsif @locale.state? %>
15
15
  <h2>Select a City</h2>
16
- <%- else -%>
16
+ <% else %>
17
17
  <h2>Select a Location</h2>
18
- <%- end -%>
18
+ <% end %>
19
19
 
20
20
  <div>
21
- <%- @locale.sorted_children.in_groups(2, false).each do |group| -%>
21
+ <% @locale.sorted_children.in_groups(2, false).each do |group| %>
22
22
  <ul style="float: left; margin-right: 1em; width: 40%;">
23
- <%- group.each do |_child| -%>
24
- <li><%= link_to _child.name, _child.to_param -%></li>
25
- <%- end -%>
23
+ <% group.each do |_child| %>
24
+ <li><%= link_to _child.name, _child.to_param %></li>
25
+ <% end %>
26
26
  </ul>
27
- <%- end -%>
27
+ <% end %>
28
28
  </div><br style="clear: both;" />
29
- <%- end -%>
29
+ <% end %>
@@ -1,14 +1,12 @@
1
- <%- set_title "Location Directory - #{ (@location || @locale).name }" -%>
1
+ <% set_title "Location Directory - #{ @location.name }" %>
2
2
 
3
- <%= render 'shared/location' -%><br style="clear: both;" />
3
+ <%= render 'shared/location' %><br style="clear: both;" />
4
4
  <br style="clear: both;" />
5
5
 
6
6
  <h2>Nearby Locations</h2>
7
7
 
8
- <%- @location.nearby_locations.in_groups(2, false).each do |group| -%>
9
- <ul style="float: left; margin-right: 1em; width: 40%;">
10
- <% group.each do |@location| %>
11
- <li><%= render 'shared/location' -%></li>
12
- <% end %>
13
- </ul>
14
- <%- end -%>
8
+ <ul style="float: left; margin-right: 1em; width: 40%;">
9
+ <% @location.nearbys(100).limit(5).each do |@location| %>
10
+ <li><%= render 'shared/location' %></li>
11
+ <% end %>
12
+ </ul>
@@ -1,31 +1,31 @@
1
- <%- set_title 'Location Directory - Search' -%>
1
+ <% set_title 'Location Directory - Search' %>
2
2
 
3
3
  <div id="map_canvas" style="border: solid black 1px; width: 100%; height: 300px"></div><br />
4
4
 
5
- <%= render 'search_form' -%><br style="clear: both;" />
5
+ <%= render 'search_form' %><br style="clear: both;" />
6
6
  <br style="clear: both;" />
7
7
 
8
8
  <div id="directions_panel"></div>
9
9
 
10
- <%- if @locations.empty? -%>
10
+ <% if @locations.empty? %>
11
11
  <p>No matching locations found. Please try again.</p>
12
12
  </em></p>
13
- <%- else -%>
14
- <h2><%= controller.searching_by_zip? ? 'Locations nearest' : "#{@locations.size} locations match" -%> "<%= params[:criteria] -%>"</h2>
13
+ <% else %>
14
+ <h2><%= controller.searching_by_zip? ? 'Locations nearest' : "#{@locations.size} locations match" %> "<%= params[:criteria] %>"</h2>
15
15
 
16
- <%- for @location in @locations -%>
17
- <%= render 'shared/location' -%>
18
- <%- end -%>
19
- <%- end -%>
16
+ <% for @location in @locations %>
17
+ <%= render 'shared/location' %>
18
+ <% end %>
19
+ <% end %>
20
20
 
21
21
  <br style="clear: both;" />
22
22
 
23
- <%= render :partial => 'shared/map', :locals => {:locations => @locations, :place => Locale.us.first} -%>
23
+ <%= render :partial => 'shared/map', :locals => {:locations => @locations, :place => Locale.us.first} %>
24
24
 
25
25
  <script type="text/javascript">
26
26
  initializeMap();
27
27
 
28
28
  $('#search-form')[0].addEventListener('submit', function (e) {
29
- window.location = '<%= directory_search_root_url -%>/' + $('#search-input')[0].value;
29
+ window.location = '<%= directory_search_root_url %>/' + $('#search-input')[0].value;
30
30
  }, false);
31
31
  </script>
@@ -1,24 +1,24 @@
1
1
  <div id="map_canvas" style="border: solid black 1px; width: 100%; height: 300px"></div><br />
2
2
 
3
- <%= render 'search_form' -%>
3
+ <%= render 'search_form' %>
4
4
 
5
5
  <div id="directions_panel" style="margin-bottom: 1em;"></div>
6
6
 
7
- <%- if Locale.count <= 1 -%>
8
- <%- set_title 'Location Directory' -%>
7
+ <% if Locale.count <= 1 %>
8
+ <% set_title 'Location Directory' %>
9
9
 
10
- <p>No locations found. Why don't you <%= link_to 'import', import_locations_path -%> some?</p>
11
- <%- else -%>
12
- <%- if @locale.location? -%>
13
- <%= render :partial => 'show_location' -%>
14
- <%- else -%>
15
- <%= render :partial => 'show_children' -%>
16
- <%- end -%>
17
- <%- end -%>
10
+ <p>No locations found. Why don't you <%= link_to 'import', import_locations_path %> some?</p>
11
+ <% else %>
12
+ <% if @locale.location? %>
13
+ <%= render :partial => 'show_location' %>
14
+ <% else %>
15
+ <%= render :partial => 'show_children' %>
16
+ <% end %>
17
+ <% end %>
18
18
 
19
19
  <br style="clear: both;" />
20
20
 
21
- <%= render :partial => 'shared/map', :locals => {:locations => @locale.locations, :place => @locale.root? ? Locale.us.first : @locale} -%>
21
+ <%= render :partial => 'shared/map', :locals => {:locations => @locale.locations, :place => @locale.root? ? Locale.us.first : @locale} %>
22
22
 
23
23
  <script type="text/javascript">
24
24
  initializeMap();
@@ -27,6 +27,6 @@
27
27
  $('#search-form')[0].action = 'javascript:return(false);';
28
28
 
29
29
  $('#search-form')[0].addEventListener('submit', function (e) {
30
- window.location = '<%= directory_search_root_url -%>/' + $('#search-input')[0].value;
30
+ window.location = '<%= directory_search_root_url %>/' + $('#search-input')[0].value;
31
31
  }, false);
32
32
  </script>
@@ -1,48 +1,48 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
3
  <head>
4
- <title><%= yield(:title) -%></title>
4
+ <title><%= yield(:title) %></title>
5
5
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6
6
  <meta name="description" content="" />
7
7
  <meta name="keywords" content="" />
8
- <link rel="canonical" href="<%= request.url -%>" />
8
+ <link rel="canonical" href="<%= request.url %>" />
9
9
  <link rel="shortcut icon" href="/favicon.ico" />
10
- <%= stylesheet_link_tag 'core', 'application', :cache => true -%>
10
+ <%= stylesheet_link_tag 'core', 'application', :cache => true %>
11
11
  <!--[if IE]>
12
- <%= stylesheet_link_tag 'core_ie', :media => :all -%>
12
+ <%= stylesheet_link_tag 'core_ie', :media => :all %>
13
13
  <![endif]-->
14
- <%= csrf_meta_tag -%>
14
+ <%= csrf_meta_tag %>
15
15
  </head>
16
16
  <body>
17
17
  <div id="container">
18
18
  <div id="header">
19
19
  <div id="branding"></div>
20
- <div id="navigation"><%= render :partial => 'shared/nav_tabs' -%></div>
20
+ <div id="navigation"><%= render :partial => 'shared/nav_tabs' %></div>
21
21
  </div>
22
22
  <div id="page_header">
23
- <h1><%= yield(:page_title) -%></h1>
24
- <div id="breadcrumbs"><%= breadcrumbs -%></div>
23
+ <h1><%= yield(:page_title) %></h1>
24
+ <div id="breadcrumbs"><%= breadcrumbs %></div>
25
25
  </div>
26
26
  <div id="content_area">
27
27
  <div id="washout" style="display:none;"></div>
28
28
 
29
- <%- flash.each do |name, msg| -%>
30
- <%- if name == :notice -%>
31
- <%= content_tag :div, msg, :id => "flash_#{name}", :class => "flash_#{name}", :style => "display:none;" -%>
29
+ <% flash.each do |name, msg| %>
30
+ <% if name == :notice %>
31
+ <%= content_tag :div, msg, :id => "flash_#{name}", :class => "flash_#{name}", :style => "display:none;" %>
32
32
  <script type="text/javascript">
33
33
  $('washout').toggle();
34
34
  $('flash_notice').toggle();
35
- <%= visual_effect(:fade, 'flash_notice', :duration => 1.0, :delay => 1.0).html_safe -%>
36
- <%= visual_effect(:fade, 'washout', :duration => 1.0, :delay => 1.0).html_safe -%>
35
+ <%= visual_effect(:fade, 'flash_notice', :duration => 1.0, :delay => 1.0).html_safe %>
36
+ <%= visual_effect(:fade, 'washout', :duration => 1.0, :delay => 1.0).html_safe %>
37
37
  </script>
38
- <%- else -%>
39
- <%= content_tag :div, msg, :id => "flash_#{name}", :class => "flash_#{name}" -%>
40
- <%- end -%>
41
- <%- end -%>
42
- <%= yield -%>
38
+ <% else %>
39
+ <%= content_tag :div, msg, :id => "flash_#{name}", :class => "flash_#{name}" %>
40
+ <% end %>
41
+ <% end %>
42
+ <%= yield %>
43
43
  <br style="clear: both;" />
44
44
  </div>
45
- <div id="footer"><p>&copy; <%= Time.zone.now.year -%> SEO Logic. All rights reserved.</p></div>
45
+ <div id="footer"><p>&copy; <%= Time.zone.now.year %> SEO Logic. All rights reserved.</p></div>
46
46
  </div>
47
47
  </body>
48
48
  </html>
@@ -1,24 +1,24 @@
1
- <%= form_for(@location) do |f| -%>
2
- <%- if @location.errors.any? -%>
1
+ <%= form_for(@location) do |f| %>
2
+ <% if @location.errors.any? %>
3
3
  <div id="error_explanation">
4
4
  <h2>Please correct the following errors:</h2>
5
- <%- @location.errors.to_a.in_groups(2, false).each do |group| -%>
5
+ <% @location.errors.to_a.in_groups(2, false).each do |group| %>
6
6
  <ul>
7
- <%- group.each do |msg| -%>
8
- <li><%= msg -%></li>
9
- <%- end -%>
7
+ <% group.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
10
  </ul>
11
- <%- end -%>
11
+ <% end %>
12
12
  <br style="clear: both;" />
13
13
  </div>
14
14
  <br style="clear: both;" />
15
- <%- end -%>
15
+ <% end %>
16
16
 
17
17
  <fieldset class="form_container">
18
- <%= legend_tag 'About This Location' -%>
18
+ <%= legend_tag 'About This Location' %>
19
19
  <div class="form_column">
20
- <%= f.text_field :name -%>
21
- <%= f.check_box :active, :inline_label => 'Yes' -%>
20
+ <%= f.text_field :name %>
21
+ <%= f.check_box :active, :inline_label => 'Yes' %>
22
22
  </div>
23
23
 
24
24
  <div class="form_column">
@@ -27,42 +27,42 @@
27
27
  </fieldset>
28
28
 
29
29
  <fieldset class="form_container">
30
- <%= legend_tag 'Address' -%>
30
+ <%= legend_tag 'Address' %>
31
31
  <div class="form_column">
32
- <%= f.text_field :address1 -%>
33
- <%= f.text_field :address2 -%>
34
- <%= f.text_field :city -%>
35
- <%= f.text_field :state -%>
36
- <%= f.text_field :zip -%>
32
+ <%= f.text_field :address1 %>
33
+ <%= f.text_field :address2 %>
34
+ <%= f.text_field :city %>
35
+ <%= f.text_field :state %>
36
+ <%= f.text_field :zip %>
37
37
  </div>
38
38
  <div class="form_column">
39
- <%= f.text_field :phone -%>
40
- <%= f.text_field :fax -%>
41
- <%= f.text_field :email -%>
39
+ <%= f.text_field :phone %>
40
+ <%= f.text_field :fax %>
41
+ <%= f.text_field :email %>
42
42
  </div>
43
43
  </fieldset>
44
44
 
45
45
  <fieldset class="form_container">
46
- <%= legend_tag 'Services Offered' -%>
47
- <%- i = 0 -%>
48
- <%- Service.all.to_a.in_groups(2, false) do |column| -%>
46
+ <%= legend_tag 'Services Offered' %>
47
+ <% i = 0 %>
48
+ <% Service.all.to_a.in_groups(2, false) do |column| %>
49
49
  <div class="form_column">
50
- <%- column.each do |service| -%>
50
+ <% column.each do |service| %>
51
51
  <fieldset>
52
- <%= check_box_tag 'location[service_ids][]', service.id, @location.services.include?(service), :id => "service_#{i}" -%>
53
- <%= service.name -%>
52
+ <%= check_box_tag 'location[service_ids][]', service.id, @location.services.include?(service), :id => "service_#{i}" %>
53
+ <%= service.name %>
54
54
  </fieldset>
55
- <%- i += 1 -%>
56
- <%- end -%>
55
+ <% i += 1 %>
56
+ <% end %>
57
57
  </div>
58
- <%- end -%>
58
+ <% end %>
59
59
  </fieldset>
60
60
 
61
- <%= f.submit 'Save', :class => 'button' -%>
62
- <%= link_to 'Cancel', @location, :class => 'button' -%>
63
- <%- end -%>
61
+ <%= f.submit 'Save', :class => 'button' %>
62
+ <%= link_to 'Cancel', @location, :class => 'button' %>
63
+ <% end %>
64
64
 
65
- <%= render :partial => 'shared/map', :locals => {:place => @location.locale} -%>
65
+ <%= render :partial => 'shared/map', :locals => {:place => @location.locale} %>
66
66
 
67
67
  <script type="text/javascript">
68
68
  initializeMap();
@@ -1,3 +1,3 @@
1
- <%- set_title "Editing #{@location.name}" -%>
1
+ <% set_title "Editing #{@location.name}" %>
2
2
 
3
- <%= render :partial => 'form' -%>
3
+ <%= render :partial => 'form' %>
@@ -1,4 +1,4 @@
1
1
  Location # Name Address 1 Address 2 City State Postal Code Country Code Phone Email Description
2
- <%- @locations.each do |l| -%>
3
- <%= l.location_number -%> <%= l.name -%> <%= l.address1 -%> <%= l.address2 -%> <%= l.city -%> <%= l.state -%> <%= l.zip -%> <%= l.country -%> <%= l.phone -%> <%= l.email -%> <%= l.meta_description %>
4
- <%- end -%>
2
+ <% @locations.each do |l| %>
3
+ <%= l.location_number %> <%= l.name %> <%= l.address1 %> <%= l.address2 %> <%= l.city %> <%= l.state %> <%= l.zip %> <%= l.country %> <%= l.phone %> <%= l.email %> <%= l.meta_description %>
4
+ <% end %>
@@ -1,13 +1,13 @@
1
- <%- set_title 'Import Locations' -%>
1
+ <% set_title 'Import Locations' %>
2
2
 
3
- <%= form_tag upload_locations_path, :method => :post, :multipart => true do -%>
3
+ <%= form_tag upload_locations_path, :method => :post, :multipart => true do %>
4
4
  <fieldset class="form_container">
5
- <p>To import locations, upload the import file below. Make sure the file follows this <%= link_to 'format', '/sample-locations.xls' -%>: it must be tab-delimited and the column names must match exactly. Otherwise, your data won't be processed correctly.</p>
5
+ <p>To import locations, upload the import file below. Make sure the file follows this <%= link_to 'format', '/sample-locations.xls' %>: it must be tab-delimited and the column names must match exactly. Otherwise, your data won't be processed correctly.</p>
6
6
 
7
7
  <fieldset>
8
- <%= file_field 'upload', 'datafile' -%>
8
+ <%= file_field 'upload', 'datafile' %>
9
9
  </fieldset>
10
10
  </fieldset>
11
11
 
12
- <%= submit_tag 'Upload', :class => 'button' -%>
13
- <%- end -%>
12
+ <%= submit_tag 'Upload', :class => 'button' %>
13
+ <% end %>
@@ -1,37 +1,37 @@
1
- <%- set_title 'Locations' -%>
1
+ <% set_title 'Locations' %>
2
2
 
3
- <%- unless @errors.blank? -%>
4
- <%= @errors * '<br />' -%>
5
- <%- end -%>
3
+ <% unless @errors.blank? %>
4
+ <%= @errors * '<br />' %>
5
+ <% end %>
6
6
 
7
- <%- if @locations.empty? -%>
8
- <p><em>No locations found. Why don't you <%= link_to 'import', import_locations_path -%> some?
7
+ <% if @locations.empty? %>
8
+ <p><em>No locations found. Why don't you <%= link_to 'import', import_locations_path %> some?
9
9
  </em></p>
10
- <%- else -%>
10
+ <% else %>
11
11
  <table class="standard">
12
12
  <tr>
13
- <th><%= sort_link('locations', 'location_number', params) -%></th>
14
- <th><%= sort_link('locations', 'name', params) -%></th>
13
+ <th><%= sort_link('locations', 'location_number', params) %></th>
14
+ <th><%= sort_link('locations', 'name', params) %></th>
15
15
  <th>Address</th>
16
16
  <th>URL</th>
17
17
  <th> </th>
18
18
  </tr>
19
19
 
20
- <%- for location in @locations -%>
21
- <tr class="<%= cycle('odd', 'even') -%>">
22
- <td><%= link_to location.location_number, location -%></td>
23
- <td><%= link_to location.name, location -%></td>
24
- <td><%= location.geocoding_address -%></td>
20
+ <% for location in @locations %>
21
+ <tr class="<%= cycle('odd', 'even') %>">
22
+ <td><%= link_to location.location_number, location %></td>
23
+ <td><%= link_to location.name, location %></td>
24
+ <td><%= location.geocoding_address %></td>
25
25
  <td>
26
- <%- if location.locale -%>
27
- <%= link_to location.locale.to_param, location.locale.to_param -%>
28
- <%- end -%>
26
+ <% if location.locale %>
27
+ <%= link_to location.locale.to_param, location.locale.to_param %>
28
+ <% end %>
29
29
  </td>
30
- <td class="crud_links"><%= crud_links(location, [:show, :edit, :destroy]) -%></td>
30
+ <td class="crud_links"><%= crud_links(location, [:show, :edit, :destroy]) %></td>
31
31
  </tr>
32
- <%- end -%>
32
+ <% end %>
33
33
  </table>
34
- <%- end -%>
34
+ <% end %>
35
35
 
36
- <%= link_to 'Import', import_locations_path, :class => 'button' -%>
37
- <%= link_to 'Export', export_locations_path, :class => 'button' -%>
36
+ <%= link_to 'Import', import_locations_path, :class => 'button' %>
37
+ <%= link_to 'Export', export_locations_path, :class => 'button' %>
@@ -1,3 +1,3 @@
1
- <%- set_title 'Create a New Location' -%>
1
+ <% set_title 'Create a New Location' %>
2
2
 
3
- <%= render :partial => 'form' -%>
3
+ <%= render :partial => 'form' %>
@@ -1,16 +1,16 @@
1
- <%- set_title "Location: #{@location.name}" -%>
1
+ <% set_title "Location: #{@location.name}" %>
2
2
 
3
3
  <fieldset class="form_container">
4
- <%= legend_tag "About This Location" -%>
4
+ <%= legend_tag "About This Location" %>
5
5
 
6
6
  <div class="form_column">
7
7
  <fieldset>
8
8
  <label>Name:</label><br />
9
- <div class="faux_field"><%=h @location.name -%></div>
9
+ <div class="faux_field"><%=h @location.name %></div>
10
10
  </fieldset>
11
11
  <fieldset>
12
12
  <label>Status:</label><br />
13
- <div class="faux_field"><%=h @location.active? ? "Active" : "Inactive" -%></div>
13
+ <div class="faux_field"><%=h @location.active? ? "Active" : "Inactive" %></div>
14
14
  </fieldset>
15
15
  </div>
16
16
 
@@ -20,50 +20,50 @@
20
20
  </fieldset>
21
21
 
22
22
  <fieldset class="form_container">
23
- <%= legend_tag "Address" -%>
23
+ <%= legend_tag "Address" %>
24
24
  <div class="form_column">
25
25
  <fieldset>
26
26
  <label>Address 1:</label><br />
27
- <div class="faux_field"><%=h @location.address1 -%></div>
27
+ <div class="faux_field"><%=h @location.address1 %></div>
28
28
  </fieldset>
29
29
  <fieldset>
30
30
  <label>Address 2:</label><br />
31
- <div class="faux_field"><%=h @location.address2 -%></div>
31
+ <div class="faux_field"><%=h @location.address2 %></div>
32
32
  </fieldset>
33
33
  <fieldset>
34
34
  <label>City:</label><br />
35
- <div class="faux_field"><%=h @location.city -%></div>
35
+ <div class="faux_field"><%=h @location.city %></div>
36
36
  </fieldset>
37
37
  <fieldset>
38
38
  <label>State:</label><br />
39
- <div class="faux_field"><%=h @location.state -%></div>
39
+ <div class="faux_field"><%=h @location.state %></div>
40
40
  </fieldset>
41
41
  <fieldset>
42
42
  <label>Zip:</label><br />
43
- <div class="faux_field"><%=h @location.zip -%></div>
43
+ <div class="faux_field"><%=h @location.zip %></div>
44
44
  </fieldset>
45
45
  </div>
46
46
 
47
47
  <div class="form_column">
48
48
  <fieldset>
49
49
  <label>Phone:</label><br />
50
- <div class="faux_field"><%=h @location.phone -%></div>
50
+ <div class="faux_field"><%=h @location.phone %></div>
51
51
  </fieldset>
52
52
  <fieldset>
53
53
  <label>Fax:</label><br />
54
- <div class="faux_field"><%=h @location.fax -%></div>
54
+ <div class="faux_field"><%=h @location.fax %></div>
55
55
  </fieldset>
56
56
  <fieldset>
57
57
  <label>Email:</label><br />
58
- <div class="faux_field"><%=h @location.email -%></div>
58
+ <div class="faux_field"><%=h @location.email %></div>
59
59
  </fieldset>
60
60
  </div>
61
61
  </fieldset>
62
62
 
63
- <%= link_to 'Edit', edit_location_path(@location), :class => 'button' -%>
64
- <%= link_to 'Back to Locations', locations_path, :class => 'button' -%>
63
+ <%= link_to 'Edit', edit_location_path(@location), :class => 'button' %>
64
+ <%= link_to 'Back to Locations', locations_path, :class => 'button' %>
65
65
 
66
- <%= render :partial => 'shared/map', :locals => {:place => @location.locale} -%>
66
+ <%= render :partial => 'shared/map', :locals => {:place => @location.locale} %>
67
67
 
68
68
  <script type="text/javascript">
69
69
  initializeMap();
@@ -1,29 +1,29 @@
1
- <%= form_for @service do |f| -%>
2
- <%- if @service.errors.any? -%>
1
+ <%= form_for @service do |f| %>
2
+ <% if @service.errors.any? %>
3
3
  <div id="error_explanation">
4
4
  <h2>Please correct the following errors:</h2>
5
- <%- @service.errors.to_a.in_groups(2, false).each do |group| -%>
5
+ <% @service.errors.to_a.in_groups(2, false).each do |group| %>
6
6
  <ul>
7
- <%- group.each do |msg| -%>
8
- <li><%= msg -%></li>
9
- <%- end -%>
7
+ <% group.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
10
  </ul>
11
- <%- end -%>
11
+ <% end %>
12
12
  <br style="clear: both;" />
13
13
  </div>
14
14
  <br style="clear: both;" />
15
- <%- end -%>
15
+ <% end %>
16
16
 
17
17
  <fieldset class="form_container">
18
- <%= legend_tag 'About This Service' -%>
18
+ <%= legend_tag 'About This Service' %>
19
19
 
20
20
  <div class="form_column">
21
- <%= f.text_field :name -%>
22
- <%= f.text_area :description -%>
21
+ <%= f.text_field :name %>
22
+ <%= f.text_area :description %>
23
23
  </div>
24
24
  </fieldset>
25
25
 
26
- <%= f.submit 'Save', :class => 'button' -%>
27
- <%= link_to 'Cancel', services_path, :class => 'button' -%>
26
+ <%= f.submit 'Save', :class => 'button' %>
27
+ <%= link_to 'Cancel', services_path, :class => 'button' %>
28
28
  <br style="clear: both;" />
29
- <%- end -%>
29
+ <% end %>
@@ -1,3 +1,3 @@
1
- <%- set_title 'Edit a Service' -%>
1
+ <% set_title 'Edit a Service' %>
2
2
 
3
- <%= render 'form' -%>
3
+ <%= render 'form' %>
@@ -1,25 +1,25 @@
1
- <%- set_title 'Services' -%>
1
+ <% set_title 'Services' %>
2
2
 
3
- <%- if @services.empty? -%>
3
+ <% if @services.empty? %>
4
4
  <p><em>No services have been created yet.</em></p>
5
- <%- else -%>
5
+ <% else %>
6
6
  <table class="standard">
7
7
  <tr>
8
- <th><%= sort_link('services', 'name', params) -%></th>
9
- <th><%= sort_link('services', 'description', params) -%></th>
8
+ <th><%= sort_link('services', 'name', params) %></th>
9
+ <th><%= sort_link('services', 'description', params) %></th>
10
10
  <th> </th>
11
11
  </tr>
12
12
 
13
- <%- @services.each do |service| -%>
14
- <tr class="<%= cycle('odd', 'even') -%>">
15
- <td><%= service.name -%></td>
16
- <td><%= service.description -%></td>
17
- <td class="crud_links"><%= crud_links(service, [:show, :edit, :destroy]) -%></td>
13
+ <% @services.each do |service| %>
14
+ <tr class="<%= cycle('odd', 'even') %>">
15
+ <td><%= service.name %></td>
16
+ <td><%= service.description %></td>
17
+ <td class="crud_links"><%= crud_links(service, [:show, :edit, :destroy]) %></td>
18
18
  </tr>
19
- <%- end -%>
19
+ <% end %>
20
20
  </table>
21
- <%- end -%>
21
+ <% end %>
22
22
 
23
23
  <br />
24
24
 
25
- <%= link_to 'New Service', new_service_path, :class => 'button' -%>
25
+ <%= link_to 'New Service', new_service_path, :class => 'button' %>
@@ -1,3 +1,3 @@
1
- <%- set_title 'Create a Service' -%>
1
+ <% set_title 'Create a Service' %>
2
2
 
3
- <%= render 'form' -%>
3
+ <%= render 'form' %>
@@ -1,15 +1,15 @@
1
- <%- set_title 'Service Details' -%>
1
+ <% set_title 'Service Details' %>
2
2
 
3
3
  <fieldset class="form_container">
4
- <%= legend_tag 'About This Service' -%>
4
+ <%= legend_tag 'About This Service' %>
5
5
 
6
6
  <div class="form_column">
7
- <%= faux_field 'Name', @service.name -%>
7
+ <%= faux_field 'Name', @service.name %>
8
8
  </div>
9
9
  <div class="form_column">
10
- <%= faux_field 'Description', @service.description -%>
10
+ <%= faux_field 'Description', @service.description %>
11
11
  </div>
12
12
  </fieldset>
13
13
 
14
- <%= link_to 'Edit', edit_service_path(@service), :class => 'button' -%>
15
- <%= link_to 'Back', services_path, :class => 'button' -%>
14
+ <%= link_to 'Edit', edit_service_path(@service), :class => 'button' %>
15
+ <%= link_to 'Back', services_path, :class => 'button' %>
@@ -1,18 +1,18 @@
1
1
  <div class=vcard>
2
- <div class="fn org"><%= link_to @location.name, @location.locale.to_param -%></div>
2
+ <div class="fn org"><%= link_to @location.name, @location.locale.to_param %></div>
3
3
  <p class=adr>
4
- <span class=street-address><%= h @location.street_address('<br/>') -%></span><br />
5
- <span class=locality><%= h @location.city -%></span>,
6
- <span class=region><%= h @location.state.upcase -%></span>
7
- <span class=postal-code><%= h @location.zip -%></span><br />
4
+ <span class=street-address><%= h @location.street_address('<br/>') %></span><br />
5
+ <span class=locality><%= h @location.city %></span>,
6
+ <span class=region><%= h @location.state.upcase %></span>
7
+ <span class=postal-code><%= h @location.zip %></span><br />
8
8
  <span class=tel>Phone
9
9
  <span class=type style="display: none;">Work</span>
10
- <span class=value><%= h @location.phone -%></span>
10
+ <span class=value><%= h @location.phone %></span>
11
11
  </span><br />
12
- <%- if @location.fax && @location.fax.size > 3 -%>
12
+ <% if @location.fax && @location.fax.size > 3 %>
13
13
  <span class=tel>Fax
14
- <span class=value><%= h @location.fax -%></span>
14
+ <span class=value><%= h @location.fax %></span>
15
15
  </span><br />
16
- <%- end -%>
16
+ <% end %>
17
17
  </p>
18
18
  </div>
@@ -1,14 +1,19 @@
1
- <%# requires local variables: locations AND place (but latter can be nil); Adapted from http://code.google.com/apis/maps/documentation/javascript/examples/icon-complex.html -%>
2
- <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
3
- <script>
1
+ <%#
2
+ requires:
3
+
4
+ * local variables: locations AND place (but latter can be nil)
5
+ * <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
6
+
7
+ Adapted from http://code.google.com/apis/maps/documentation/javascript/examples/icon-complex.html
8
+ %><script>
4
9
  var directionsDisplay = new google.maps.DirectionsRenderer();
5
10
  var directionsService = new google.maps.DirectionsService();
6
11
  var locations = [
7
- <%- if place && place.location? && place.geocoded? -%>
8
- <%= raw "['#{h(escape_javascript place.location.name)}', #{place.coordinates[1]}, #{place.coordinates[0]}, '#{h(escape_javascript place.location.name)}<br />#{h(escape_javascript place.location.address1)}<br />#{h(escape_javascript place.location.city)}, #{h(escape_javascript place.location.state)} #{h(escape_javascript place.location.zip)}<br /><br />Directions: <a href=\"javascript:showDirectionsTo(0)\">To here<\/a> / <a href=\"javascript:showDirectionsFrom(0)\">From here<\/a>']" -%>
9
- <%- else -%>
10
- <%= raw locations.select{ |l| l.geocoded? }.inject([]) { |a, l| i = a.size; a << "['#{h(escape_javascript l.name)}', #{l.coordinates[1]}, #{l.coordinates[0]}, '#{link_to h(escape_javascript l.name), l.locale.to_param}<br />#{h(escape_javascript l.address1)}<br />#{h(escape_javascript l.city)}, #{h(escape_javascript l.state)} #{h(escape_javascript l.zip)}<br /><br />Directions: <a href=\"javascript:showDirectionsTo(#{i})\">To here<\/a> / <a href=\"javascript:showDirectionsFrom(#{i})\">From here<\/a>']"; a } * ",\r" -%>
11
- <%- end -%>
12
+ <% if place && place.location? && place.geocoded? %>
13
+ <%= raw "['#{h(escape_javascript place.location.name)}', #{place.coordinates[1]}, #{place.coordinates[0]}, '#{h(escape_javascript place.location.name)}<br />#{h(escape_javascript place.location.address1)}<br />#{h(escape_javascript place.location.city)}, #{h(escape_javascript place.location.state)} #{h(escape_javascript place.location.zip)}<br /><br />Directions: <a href=\"javascript:showDirectionsTo(0)\">To here<\/a> / <a href=\"javascript:showDirectionsFrom(0)\">From here<\/a>']" %>
14
+ <% else %>
15
+ <%= raw locations.select{ |l| l.geocoded? }.inject([]) { |a, l| i = a.size; a << "['#{h(escape_javascript l.name)}', #{l.coordinates[1]}, #{l.coordinates[0]}, '#{link_to h(escape_javascript l.name), l.locale.to_param}<br />#{h(escape_javascript l.address1)}<br />#{h(escape_javascript l.city)}, #{h(escape_javascript l.state)} #{h(escape_javascript l.zip)}<br /><br />Directions: <a href=\"javascript:showDirectionsTo(#{i})\">To here<\/a> / <a href=\"javascript:showDirectionsFrom(#{i})\">From here<\/a>']"; a } * ",\r" %>
16
+ <% end %>
12
17
  ];
13
18
  var map;
14
19
  var markers = [];
@@ -1,5 +1,5 @@
1
1
  <ul>
2
- <%= tab_for( root_path, 'Home', 'home' ).html_safe -%>
3
- <%= tab_for( locations_path, 'Locations', 'locations' ).html_safe -%>
4
- <%= tab_for( services_path, 'Services', 'services' ).html_safe -%>
2
+ <%= tab_for( root_path, 'Home', 'home' ).html_safe %>
3
+ <%= tab_for( locations_path, 'Locations', 'locations' ).html_safe %>
4
+ <%= tab_for( services_path, 'Services', 'services' ).html_safe %>
5
5
  </ul>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "campfire_logic"
8
- s.version = "2.0.0"
8
+ s.version = "2.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roderick Monje"]
12
- s.date = "2012-01-31"
12
+ s.date = "2012-02-18"
13
13
  s.description = "Users can browse locations by country, city, and state and search locations by string or zip code. Administrators can manage locations and the services they offer."
14
14
  s.email = "rod@seologic.com"
15
15
  s.extra_rdoc_files = [
@@ -23,7 +23,7 @@ describe LocationImport do
23
23
  @location.city.should == 'Commack'
24
24
  @location.state_long_name.should == 'New York'
25
25
  @location.zip.should == '11725'
26
- @location.phone.should == '(877) 300-0059'
26
+ @location.phone.should == '8773000059'
27
27
  @location.email.should == 'sales@mobilemini.com'
28
28
  @location.meta_description.should == 'Long Island portable storage rentals. Secure mobile storage units or pods, shipping container rentals, and custom mobile office trailers shipped to your home or construction site.'
29
29
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campfire_logic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 0
10
- version: 2.0.0
9
+ - 1
10
+ version: 2.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roderick Monje
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-31 00:00:00 Z
18
+ date: 2012-02-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bson_ext