magic_addresses 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/magic_addresses/addresses/index.html.erb +48 -12
- data/app/views/magic_addresses/cities/index.html.erb +20 -12
- data/app/views/magic_addresses/countries/index.html.erb +24 -13
- data/app/views/magic_addresses/districts/index.html.erb +20 -12
- data/app/views/magic_addresses/states/index.html.erb +24 -13
- data/app/views/magic_addresses/subdistricts/index.html.erb +20 -12
- data/lib/generators/magic_addresses/templates/magic_initializer.rb +19 -0
- data/lib/magic_addresses/configuration.rb +9 -0
- data/lib/magic_addresses/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcfaf30ed453d7f3828434fe0e2b86a3ffbac067
|
4
|
+
data.tar.gz: f7fa1bf88688dd9ea5730a91ee00cc5f6478715c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d9634e904ba2ad7e3afa176b67119be46ba9e4b32acbce0ef8772ea1874217d1cd6400fcb9e6724a34c160b5f43c8b80a8684264bc647449f2b9ae94ecfa950
|
7
|
+
data.tar.gz: c48af56a786dbed7e9700f009914ef6e5288f44b8cb0665189e5e238862d3dcfe5c5c9983e3fa7b61ee863bf466c8a1890e5ec5d4dee3cdae3fca41e3480b454
|
@@ -22,49 +22,85 @@
|
|
22
22
|
<th>Uses</th>
|
23
23
|
</tr>
|
24
24
|
</thead>
|
25
|
-
<tbody>
|
25
|
+
<tbody class="wizard_table_body">
|
26
26
|
<% @addresses.each do |address| %>
|
27
|
-
<tr>
|
28
|
-
|
27
|
+
<tr data-id="<%= address.id %>" data-street="<%= address.street %>" data-postalcode="<%= address.postalcode %>" data-number="<%= address.street_number %>" data-city="<%= address.city %>" data-country="<%= address.country %>" data-district="<%= address.district %>" data-subdistrict="<%= address.subdistrict %>" data-owners="<%= address.owners.to_json %>" data-longitude="<%= address.longitude %>" data-latitude="<%= address.latitude %>">
|
28
|
+
|
29
29
|
<td>
|
30
30
|
<%= country_flag( address.magic_country.iso_code, "medium" ) if address.magic_country %>
|
31
31
|
</td>
|
32
32
|
|
33
33
|
<td>
|
34
|
-
|
34
|
+
<% if address.magic_city %>
|
35
|
+
<span title="<%= "#{address.magic_city.id} => #{address.magic_city.default_name}" %>">
|
36
|
+
<%= address.magic_city.name %>
|
37
|
+
</span>
|
38
|
+
<% else %>
|
39
|
+
<em><%= address.city || "- -" %></em>
|
40
|
+
<% end %>
|
35
41
|
</td>
|
36
42
|
|
37
43
|
<td>
|
38
|
-
|
44
|
+
<%= address.postalcode %>
|
39
45
|
</td>
|
40
46
|
|
41
47
|
<td>
|
42
|
-
|
48
|
+
<%= address.street %>
|
43
49
|
</td>
|
44
50
|
|
45
51
|
<td>
|
46
|
-
|
52
|
+
<%= address.street_number %>
|
47
53
|
</td>
|
48
54
|
|
49
55
|
|
50
56
|
<td>
|
51
|
-
|
57
|
+
<% if address.magic_state %>
|
58
|
+
<span title="<%= "#{address.magic_state.id} => #{address.magic_state.default_name}" %>">
|
59
|
+
<%= address.magic_state.name %>
|
60
|
+
</span>
|
61
|
+
<% else %>
|
62
|
+
<em><%= address.state || "- -" %></em>
|
63
|
+
<% end %>
|
52
64
|
</td>
|
53
65
|
|
54
66
|
<td>
|
55
|
-
|
67
|
+
<% if address.magic_country %>
|
68
|
+
<span title="<%= "#{address.magic_country.id} => #{address.magic_country.default_name}" %>">
|
69
|
+
<%= address.magic_country.name %>
|
70
|
+
</span>
|
71
|
+
<% else %>
|
72
|
+
<em><%= address.country || "- -" %></em>
|
73
|
+
<% end %>
|
56
74
|
</td>
|
57
75
|
|
58
76
|
<td>
|
59
|
-
<small
|
77
|
+
<small>
|
78
|
+
<% if address.magic_district %>
|
79
|
+
<span title="<%= "#{address.magic_district.id} => #{address.magic_district.default_name}" %>">
|
80
|
+
<%= address.magic_district.name %>
|
81
|
+
</span>
|
82
|
+
<% else %>
|
83
|
+
<em><%= address.district || "- -" %></em>
|
84
|
+
<% end %>
|
85
|
+
</small>
|
60
86
|
</td>
|
61
87
|
|
62
88
|
<td>
|
63
|
-
<small
|
89
|
+
<small>
|
90
|
+
<% if address.magic_subdistrict %>
|
91
|
+
<span title="<%= "#{address.magic_subdistrict.id} => #{address.magic_subdistrict.default_name}" %>">
|
92
|
+
<%= address.magic_subdistrict.name %>
|
93
|
+
</span>
|
94
|
+
<% else %>
|
95
|
+
<em><%= address.subdistrict || "- -" %></em>
|
96
|
+
<% end %>
|
97
|
+
</small>
|
64
98
|
</td>
|
65
99
|
|
66
100
|
<td>
|
67
|
-
<
|
101
|
+
<span title="<%= address.owners.to_yaml %>">
|
102
|
+
<%= address.addressibles.count %>
|
103
|
+
</span>
|
68
104
|
</td>
|
69
105
|
|
70
106
|
</tr>
|
@@ -14,13 +14,17 @@
|
|
14
14
|
<th><%= t("activerecord.attributes.magic_addresses_country.one") %></th>
|
15
15
|
|
16
16
|
<th><%= t("helpers.label.magic_addresses_city.default_name") %></th>
|
17
|
-
|
18
|
-
|
17
|
+
<% if MagicAddresses.configuration.show_states %>
|
18
|
+
<th>FSM-State</th>
|
19
|
+
<% end %>
|
20
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
21
|
+
<th>Triggers</th>
|
22
|
+
<% end %>
|
19
23
|
</tr>
|
20
24
|
</thead>
|
21
|
-
<tbody>
|
25
|
+
<tbody class="wizard_table_body">
|
22
26
|
<% @cities.each do |city| %>
|
23
|
-
<tr>
|
27
|
+
<tr data-id="<%= city.id %>" data-name="<%= city.name %>" data-default-name="<%= city.default_name %>" data-short-name="<%= city.short_name %>" data-state="<%= city.fsm_city %>">
|
24
28
|
|
25
29
|
<td><strong><%= city.name %></strong></td>
|
26
30
|
|
@@ -29,18 +33,22 @@
|
|
29
33
|
<td><%= city.state.name if city.state %></td>
|
30
34
|
<td>
|
31
35
|
<%= country_flag( city.country.iso_code, "small" ) if city.country %>
|
32
|
-
<%= city.country.
|
36
|
+
<%= city.country.iso_code if city.country %>
|
33
37
|
</td>
|
34
38
|
|
35
39
|
<td><%= city.default_name %></td>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
<% if MagicAddresses.configuration.show_states %>
|
41
|
+
<td><%= city.fsm_state %></td>
|
42
|
+
<% end %>
|
43
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
44
|
+
<td>
|
45
|
+
<%# %w(activate deactivate).each do |state| %>
|
46
|
+
<%# if city.machine.trigger?(state.to_sym) %>
|
47
|
+
<%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
|
48
|
+
<%# end %>
|
41
49
|
<%# end %>
|
42
|
-
|
43
|
-
|
50
|
+
</td>
|
51
|
+
<% end %>
|
44
52
|
</tr>
|
45
53
|
<% end %>
|
46
54
|
</tbody>
|
@@ -7,6 +7,7 @@
|
|
7
7
|
<table class="table table-striped">
|
8
8
|
<thead>
|
9
9
|
<tr>
|
10
|
+
<th> </th>
|
10
11
|
<th><%= t("helpers.label.magic_addresses_country.name") %></th>
|
11
12
|
|
12
13
|
<th><%= t("activerecord.attributes.magic_addresses_address.other") %></th>
|
@@ -14,18 +15,24 @@
|
|
14
15
|
<th><%= t("helpers.label.magic_addresses_country.default_name") %></th>
|
15
16
|
|
16
17
|
<th><%= t("helpers.label.magic_addresses_country.dial_code") %></th>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
<% if MagicAddresses.configuration.show_states %>
|
20
|
+
<th><%= t("helpers.label.magic_addresses_country.fsm_state") %></th>
|
21
|
+
<% end %>
|
22
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
23
|
+
<th>Triggers</th>
|
24
|
+
<% end %>
|
21
25
|
</tr>
|
22
26
|
</thead>
|
23
|
-
<tbody>
|
27
|
+
<tbody class="wizard_table_body">
|
24
28
|
<% @countries.each do |country| %>
|
25
|
-
<tr>
|
29
|
+
<tr data-id="<%= country.id %>" data-name="<%= country.name %>" data-dial-code="<%= country.dial_code %>" data-default-name="<%= country.default_name %>" data-state="<%= country.fsm_state %>">
|
26
30
|
|
27
31
|
<td>
|
28
32
|
<%= country_flag( country.iso_code, "small" ) %>
|
33
|
+
</td>
|
34
|
+
|
35
|
+
<td>
|
29
36
|
<strong><%= country.name %></strong>
|
30
37
|
</td>
|
31
38
|
|
@@ -39,14 +46,18 @@
|
|
39
46
|
|
40
47
|
<td><%= country.default_name %></td>
|
41
48
|
<td><%= country.dial_code %></td>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
<% if MagicAddresses.configuration.show_states %>
|
50
|
+
<td><%= country.fsm_state %></td>
|
51
|
+
<% end %>
|
52
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
53
|
+
<td>
|
54
|
+
<%# %w(activate deactivate).each do |state| %>
|
55
|
+
<%# if city.machine.trigger?(state.to_sym) %>
|
56
|
+
<%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
|
57
|
+
<%# end %>
|
47
58
|
<%# end %>
|
48
|
-
|
49
|
-
|
59
|
+
</td>
|
60
|
+
<% end %>
|
50
61
|
</tr>
|
51
62
|
<% end %>
|
52
63
|
</tbody>
|
@@ -13,14 +13,18 @@
|
|
13
13
|
<th><%= t("activerecord.attributes.magic_addresses_city.one") %></th>
|
14
14
|
|
15
15
|
<th><%= t("helpers.label.magic_addresses_district.default_name") %></th>
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
<% if MagicAddresses.configuration.show_states %>
|
18
|
+
<th>FSM-State</th>
|
19
|
+
<% end %>
|
20
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
21
|
+
<th>Triggers</th>
|
22
|
+
<% end %>
|
19
23
|
</tr>
|
20
24
|
</thead>
|
21
|
-
<tbody>
|
25
|
+
<tbody class="wizard_table_body">
|
22
26
|
<% @districts.each do |scity| %>
|
23
|
-
<tr>
|
27
|
+
<tr data-id="<%= district.id %>" data-name="<%= district.name %>" data-default-name="<%= district.default_name %>" data-short-name="<%= district.short_name %>" data-state="<%= district.fsm_district %>">
|
24
28
|
|
25
29
|
<td><strong><%= scity.name %></strong></td>
|
26
30
|
<td><%= scity.addresses.count %></td>
|
@@ -28,14 +32,18 @@
|
|
28
32
|
<td><%= scity.city.name if scity.city %></td>
|
29
33
|
|
30
34
|
<td><%= scity.default_name %></td>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
<% if MagicAddresses.configuration.show_states %>
|
36
|
+
<td><%= scity.fsm_state %></td>
|
37
|
+
<% end %>
|
38
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
39
|
+
<td>
|
40
|
+
<%# %w(activate deactivate).each do |state| %>
|
41
|
+
<%# if city.machine.trigger?(state.to_sym) %>
|
42
|
+
<%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
|
43
|
+
<%# end %>
|
36
44
|
<%# end %>
|
37
|
-
|
38
|
-
|
45
|
+
</td>
|
46
|
+
<% end %>
|
39
47
|
</tr>
|
40
48
|
<% end %>
|
41
49
|
</tbody>
|
@@ -13,29 +13,40 @@
|
|
13
13
|
<th><%= t("activerecord.attributes.magic_addresses_country.one") %></th>
|
14
14
|
|
15
15
|
<th><%= t("helpers.label.magic_addresses_state.default_name") %></th>
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
<% if MagicAddresses.configuration.show_states %>
|
18
|
+
<th>FSM-State</th>
|
19
|
+
<% end %>
|
20
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
21
|
+
<th>Triggers</th>
|
22
|
+
<% end %>
|
19
23
|
</tr>
|
20
24
|
</thead>
|
21
|
-
<tbody>
|
25
|
+
<tbody class="wizard_table_body">
|
22
26
|
<% @states.each do |state| %>
|
23
|
-
<tr>
|
27
|
+
<tr data-id="<%= state.id %>" data-name="<%= state.name %>" data-default-name="<%= state.default_name %>" data-short-name="<%= state.short_name %>" data-state="<%= state.fsm_state %>">
|
24
28
|
|
25
29
|
<td><strong><%= state.name %></strong></td>
|
26
30
|
<td><%= state.addresses.count %></td>
|
27
31
|
|
28
|
-
<td
|
32
|
+
<td>
|
33
|
+
<%= country_flag( state.country.iso_code, "small" ) if state.country %>
|
34
|
+
<%= state.country.iso_code if state.country %>
|
35
|
+
</td>
|
29
36
|
|
30
37
|
<td><%= state.default_name %></td>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
38
|
+
<% if MagicAddresses.configuration.show_states %>
|
39
|
+
<td><%= state.fsm_state %></td>
|
40
|
+
<% end %>
|
41
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
42
|
+
<td>
|
43
|
+
<%# %w(activate deactivate).each do |state| %>
|
44
|
+
<%# if city.machine.trigger?(state.to_sym) %>
|
45
|
+
<%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
|
46
|
+
<%# end %>
|
36
47
|
<%# end %>
|
37
|
-
|
38
|
-
|
48
|
+
</td>
|
49
|
+
<% end %>
|
39
50
|
</tr>
|
40
51
|
<% end %>
|
41
52
|
</tbody>
|
@@ -14,14 +14,18 @@
|
|
14
14
|
<th><%= t("activerecord.attributes.magic_addresses_city.one") %></th>
|
15
15
|
|
16
16
|
<th><%= t("helpers.label.magic_addresses_subdistrict.default_name") %></th>
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
|
18
|
+
<% if MagicAddresses.configuration.show_states %>
|
19
|
+
<th>FSM-State</th>
|
20
|
+
<% end %>
|
21
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
22
|
+
<th>Triggers</th>
|
23
|
+
<% end %>
|
20
24
|
</tr>
|
21
25
|
</thead>
|
22
|
-
<tbody>
|
26
|
+
<tbody class="wizard_table_body">
|
23
27
|
<% @subdistricts.each do |scity| %>
|
24
|
-
<tr>
|
28
|
+
<tr data-id="<%= subdistrict.id %>" data-name="<%= subdistrict.name %>" data-default-name="<%= subdistrict.default_name %>" data-short-name="<%= subdistrict.short_name %>" data-state="<%= subdistrict.fsm_subdistrict %>">
|
25
29
|
|
26
30
|
<td><strong><%= scity.name %></strong></td>
|
27
31
|
<td><%= scity.addresses.count %></td>
|
@@ -30,14 +34,18 @@
|
|
30
34
|
<td><%= scity.city.name if scity.city %></td>
|
31
35
|
|
32
36
|
<td><%= scity.default_name %></td>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
<% if MagicAddresses.configuration.show_states %>
|
38
|
+
<td><%= scity.fsm_state %></td>
|
39
|
+
<% end %>
|
40
|
+
<% if MagicAddresses.configuration.show_triggers %>
|
41
|
+
<td>
|
42
|
+
<%# %w(activate deactivate).each do |state| %>
|
43
|
+
<%# if city.machine.trigger?(state.to_sym) %>
|
44
|
+
<%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
|
45
|
+
<%# end %>
|
38
46
|
<%# end %>
|
39
|
-
|
40
|
-
|
47
|
+
</td>
|
48
|
+
<% end %>
|
41
49
|
</tr>
|
42
50
|
<% end %>
|
43
51
|
</tbody>
|
@@ -15,4 +15,23 @@ MagicAddresses.configure do |config|
|
|
15
15
|
config.job_backend = :none
|
16
16
|
# use postgres earthdistance for distance calculation
|
17
17
|
config.earthdistance = false
|
18
|
+
# show state in tables ( true | false )
|
19
|
+
config.show_states = false
|
20
|
+
# show triggers in tables ( true | false ) **not available for now!!!
|
21
|
+
config.show_triggers = false
|
22
|
+
|
18
23
|
end
|
24
|
+
|
25
|
+
##
|
26
|
+
## Need authentication for admin routes use this:
|
27
|
+
##
|
28
|
+
# => MagicAddresses::BaseController.class_eval do
|
29
|
+
# => private
|
30
|
+
# => # overwrite authentication method
|
31
|
+
# => def authenticate_visitor
|
32
|
+
# => unless current_user && current_user.is_admin?
|
33
|
+
# => session["user_return_to"] = request.fullpath
|
34
|
+
# => redirect_to new_user_session_path, alert: "Only for admins, dude!"
|
35
|
+
# => end
|
36
|
+
# => end
|
37
|
+
# => end
|
@@ -22,8 +22,15 @@ module MagicAddresses
|
|
22
22
|
# Job backend ( :sidekiq | :none )
|
23
23
|
attr_accessor :job_backend
|
24
24
|
|
25
|
+
# use earthdistance? ( true | false )
|
25
26
|
attr_accessor :earthdistance
|
26
27
|
|
28
|
+
# show state in tables ( true | false )
|
29
|
+
attr_accessor :show_states
|
30
|
+
|
31
|
+
# show triggers in tables ( true | false ) **not available for now!!!
|
32
|
+
attr_accessor :show_triggers
|
33
|
+
|
27
34
|
def initialize
|
28
35
|
@address_owners = {}
|
29
36
|
@active_locales = [:en, :de]
|
@@ -33,6 +40,8 @@ module MagicAddresses
|
|
33
40
|
@uniq_translations = false
|
34
41
|
@job_backend = :none
|
35
42
|
@earthdistance = false
|
43
|
+
@show_states = false
|
44
|
+
@show_triggers = false
|
36
45
|
end
|
37
46
|
|
38
47
|
# Returns a hash of all configurable options
|