magic_addresses 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8f5ed8ea03f84f14c31f3d8d66532419850e9d6
4
- data.tar.gz: 58849e03242403c9de574a8a9a580a286e98a209
3
+ metadata.gz: dcfaf30ed453d7f3828434fe0e2b86a3ffbac067
4
+ data.tar.gz: f7fa1bf88688dd9ea5730a91ee00cc5f6478715c
5
5
  SHA512:
6
- metadata.gz: 5671e96c5f9d0e1ca93de276d76a969000166671984ebbd913222c7c3ec7e4bbd699c4340a2f767f05ccc7b3be142d2d707dea57eb8c4769f7aa67f5594dde6b
7
- data.tar.gz: 782376a2c3b7ae2b899526b9695b277beb8da0a7321269f46b7f8e9ee5e9482509112f0951d78fd1175bef92e01f88753f0c9f3a3d5c3c61d2a77aff6822235e
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
- <strong><%= address.city ? address.city : "- - -" %></strong>
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
- <strong><%= address.postalcode %></strong>
44
+ <%= address.postalcode %>
39
45
  </td>
40
46
 
41
47
  <td>
42
- <strong><%= address.street %></strong>
48
+ <%= address.street %>
43
49
  </td>
44
50
 
45
51
  <td>
46
- <strong><%= address.street_number %></strong>
52
+ <%= address.street_number %>
47
53
  </td>
48
54
 
49
55
 
50
56
  <td>
51
- <strong><%= address.state ? address.state : "-" %></strong>
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
- <strong><%= address.country ? address.country : "-" %></strong>
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><%= address.district ? address.district : "-" %></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><%= address.subdistrict ? address.subdistrict : "-" %></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
- <strong><%= address.addressibles.count %></strong>
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
- <th>FSM-State</th>
18
- <th>Triggers</th>
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.name if city.country %>
36
+ <%= city.country.iso_code if city.country %>
33
37
  </td>
34
38
 
35
39
  <td><%= city.default_name %></td>
36
- <td><%= city.fsm_state %></td>
37
- <td>
38
- <%# %w(activate deactivate).each do |state| %>
39
- <%# if city.machine.trigger?(state.to_sym) %>
40
- <%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
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
- <%# end %>
43
- </td>
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
- <th><%= t("helpers.label.magic_addresses_country.fsm_state") %></th>
19
-
20
- <th>Triggers</th>
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
- <td><%= country.fsm_state %></td>
43
- <td>
44
- <%# %w(activate deactivate).each do |state| %>
45
- <%# if city.machine.trigger?(state.to_sym) %>
46
- <%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
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
- <%# end %>
49
- </td>
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
- <th>FSM-State</th>
18
- <th>Triggers</th>
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
- <td><%= scity.fsm_state %></td>
32
- <td>
33
- <%# %w(activate deactivate).each do |state| %>
34
- <%# if city.machine.trigger?(state.to_sym) %>
35
- <%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
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
- <%# end %>
38
- </td>
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
- <th>FSM-State</th>
18
- <th>Triggers</th>
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><%= state.country.name if state.country %></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
- <td><%= state.fsm_state %></td>
32
- <td>
33
- <%# %w(activate deactivate).each do |state| %>
34
- <%# if city.machine.trigger?(state.to_sym) %>
35
- <%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
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
- <%# end %>
38
- </td>
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
- <th>FSM-State</th>
19
- <th>Triggers</th>
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
- <td><%= scity.fsm_state %></td>
34
- <td>
35
- <%# %w(activate deactivate).each do |state| %>
36
- <%# if city.machine.trigger?(state.to_sym) %>
37
- <%#= link_to state.to_s.titleize, trigger_wizard_city_path(city, state), class: "btn btn-default btn-sm" %>
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
- <%# end %>
40
- </td>
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
@@ -1,3 +1,3 @@
1
1
  module MagicAddresses
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.33"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torsten Wetzel