Skip to content

Commit 5829b28

Browse files
committed
Rename Community to CommunityIndex.
1 parent f94e76e commit 5829b28

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

app/controllers/site_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def about
108108
end
109109

110110
def communities
111-
@local_chapters = Community.where(:type => "osm-lc").where.not(:id => "OSMF")
111+
@local_chapters = CommunityIndex.where(:type => "osm-lc").where.not(:id => "OSMF")
112112
end
113113

114114
def export; end

app/models/community.rb renamed to app/models/community_index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class Community < FrozenRecord::Base
1+
class CommunityIndex < FrozenRecord::Base
22
self.base_path = Rails.root.join("node_modules/osm-community-index/dist/")
33
self.backend = OsmCommunityIndex::ResourceBackend
44

app/views/layouts/_header.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
<li class="compact-hide nav-item <%= current_page_class(diary_entries_path) %>">
5454
<%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "nav-link" %>
5555
</li>
56-
<li class="compact-hide nav-item <%= current_page_class(communities_path) %>">
57-
<%= link_to t("layouts.communities"), communities_path, :class => "nav-link" %>
56+
<li class="compact-hide nav-item <%= current_page_class(community_index_path) %>">
57+
<%= link_to t("layouts.communities"), community_index_path, :class => "nav-link" %>
5858
</li>
5959
<li class="compact-hide nav-item <%= current_page_class(copyright_path) %>">
6060
<%= link_to t("layouts.copyright"), copyright_path, :class => "nav-link" %>
@@ -79,7 +79,7 @@
7979
<li class="<%= current_page_class(microcosms_path) %>"><%= link_to t("layouts.microcosms"), microcosms_path, :class => "dropdown-item" %></li>
8080
<li class="<%= current_page_class(traces_path) %>"><%= link_to t("layouts.gps_traces"), traces_path, :class => "dropdown-item" %></li>
8181
<li class="<%= current_page_class(diary_entries_path) %>"><%= link_to t("layouts.user_diaries"), diary_entries_path, :class => "dropdown-item" %></li>
82-
<li class="<%= current_page_class(communities_path) %>"><%= link_to t("layouts.communities"), communities_path, :class => "dropdown-item" %></li>
82+
<li class="<%= current_page_class(community_index_path) %>"><%= link_to t("layouts.communities"), community_index_path, :class => "dropdown-item" %></li>
8383
<li class="<%= current_page_class(copyright_path) %>"><%= link_to t("layouts.copyright"), copyright_path, :class => "dropdown-item" %></li>
8484
<li class="<%= current_page_class(help_path) %>"><%= link_to t("layouts.help"), help_path, :class => "dropdown-item" %></li>
8585
<li class="<%= current_page_class(about_path) %>"><%= link_to t("layouts.about"), about_path, :class => "dropdown-item" %></li>

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
get "/help" => "site#help"
148148
get "/about/:about_locale" => "site#about"
149149
get "/about" => "site#about"
150-
get "/communities" => "site#communities"
150+
get "/community_index" => "site#communities"
151151
get "/history" => "changesets#index"
152152
get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
153153
get "/history/comments/feed" => "changeset_comments#index", :as => :changesets_comments_feed, :defaults => { :format => "rss" }

foo

Whitespace-only changes.

lib/osm_community_index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module OsmCommunityIndex
22
def self.add_to_i18n
33
# Filter the communities here to avoid loading excessive numbers of translations
4-
communities = Community.where(:type => "osm-lc").where.not(:id => "OSMF")
4+
communities = CommunityIndex.where(:type => "osm-lc").where.not(:id => "OSMF")
55

66
files = Rails.root.glob("node_modules/osm-community-index/i18n/*.yaml")
77
files.each do |file|

test/lib/osm_community_index_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class CountryTest < ActiveSupport::TestCase
44
def test_community_name_fallback
55
# If there is no translations and no name for the chapter, use the community name
6-
community = Community.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name" } })
6+
community = CommunityIndex.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name" } })
77
community_locale_yaml = {}
88

99
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml)
@@ -12,7 +12,7 @@ def test_community_name_fallback
1212

1313
def test_resource_name_fallback
1414
# If there is a name for the chapter, prefer that to the community name
15-
community = Community.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "name" => "Chapter Name" } })
15+
community = CommunityIndex.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "name" => "Chapter Name" } })
1616
community_locale_yaml = {}
1717

1818
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml)
@@ -21,7 +21,7 @@ def test_resource_name_fallback
2121

2222
def test_i18n_explicit_name
2323
# If there is an explicitly translated name for the chapter, use that
24-
community = Community.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "name" => "Chapter Name" } })
24+
community = CommunityIndex.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "name" => "Chapter Name" } })
2525
community_locale_yaml = { "foo-chapter" => { "name" => "Translated Chapter Name" } }
2626

2727
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml)
@@ -30,7 +30,7 @@ def test_i18n_explicit_name
3030

3131
def test_i18n_fallback_name
3232
# If there's no explicitly translated name for the chapter, use the default name and interpolate the community name if required.
33-
community = Community.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "communityID" => "communityname" } })
33+
community = CommunityIndex.new({ "id" => "foo-chapter", "type" => "osm-lc", "strings" => { "community" => "Community Name", "communityID" => "communityname" } })
3434
community_locale_yaml = { "_communities" => { "communityname" => "Translated Community" }, "_defaults" => { "osm-lc" => { "name" => "{community} Chapter" } } }
3535

3636
name = OsmCommunityIndex.resolve_name(community, community_locale_yaml)

test/system/view_communities_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class ViewCommunitiesTest < ApplicationSystemTestCase
44
def test_lc_links
55
# Check that all the parsing of the chapter information has worked
6-
visit "/communities"
6+
visit "/community_index"
77
assert_link "OpenStreetMap US", :href => "https://www.openstreetmap.us/"
88
assert_link "OpenStreetMap Belgium", :href => "https://openstreetmap.be/"
99
end
@@ -15,7 +15,7 @@ def test_translated_links
1515
fill_in "Preferred Languages", :with => "fr"
1616
click_on "Update Preferences"
1717

18-
visit "/communities"
18+
visit "/community_index"
1919
assert_link "OpenStreetMap États-Unis", :href => "https://www.openstreetmap.us/"
2020
assert_link "OpenStreetMap Belgique", :href => "https://openstreetmap.be/"
2121
end

0 commit comments

Comments
 (0)