pattana 0.1.11 → 0.1.12

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/pattana/api/v1/cities_controller.rb +4 -4
  3. data/app/controllers/pattana/api/v1/countries_controller.rb +5 -2
  4. data/app/controllers/pattana/api/v1/regions_controller.rb +2 -2
  5. data/app/controllers/pattana/application_controller.rb +10 -0
  6. data/app/controllers/pattana/cities_controller.rb +1 -1
  7. data/app/controllers/pattana/countries_controller.rb +59 -3
  8. data/app/controllers/pattana/dashboard_controller.rb +1 -1
  9. data/app/controllers/pattana/regions_controller.rb +55 -3
  10. data/app/models/city.rb +2 -2
  11. data/app/models/country.rb +2 -2
  12. data/app/models/region.rb +2 -2
  13. data/app/serializers/city_preview_serializer.rb +1 -1
  14. data/app/serializers/country_preview_serializer.rb +1 -1
  15. data/app/serializers/region_preview_serializer.rb +1 -1
  16. data/app/views/pattana/api/v1/docs/cities_in_a_country/_pos_case_1.html.erb +12 -4
  17. data/app/views/pattana/api/v1/docs/cities_in_a_country/_pos_case_2.html.erb +12 -4
  18. data/app/views/pattana/api/v1/docs/cities_in_a_country/_pos_case_3.html.erb +12 -4
  19. data/app/views/pattana/api/v1/docs/cities_in_a_country/_pos_case_4.html.erb +12 -4
  20. data/app/views/pattana/api/v1/docs/cities_in_a_region/_pos_case_1.html.erb +12 -4
  21. data/app/views/pattana/api/v1/docs/cities_in_a_region/_pos_case_2.html.erb +12 -4
  22. data/app/views/pattana/api/v1/docs/cities_in_a_region/_pos_case_3.html.erb +11 -4
  23. data/app/views/pattana/api/v1/docs/cities_in_a_region/_pos_case_4.html.erb +12 -4
  24. data/app/views/pattana/api/v1/docs/countries/_pos_case_1.html.erb +11 -4
  25. data/app/views/pattana/api/v1/docs/countries/_pos_case_2.html.erb +12 -17
  26. data/app/views/pattana/api/v1/docs/countries/_pos_case_3.html.erb +19 -15
  27. data/app/views/pattana/api/v1/docs/countries/_pos_case_4.html.erb +6 -20
  28. data/app/views/pattana/api/v1/docs/regions/_pos_case_1.html.erb +12 -3
  29. data/app/views/pattana/api/v1/docs/regions/_pos_case_2.html.erb +14 -5
  30. data/app/views/pattana/api/v1/docs/regions/_pos_case_3.html.erb +12 -3
  31. data/app/views/pattana/api/v1/docs/regions/_pos_case_4.html.erb +13 -4
  32. data/app/views/pattana/cities/_show.html.erb +31 -0
  33. data/app/views/pattana/countries/_show.html.erb +106 -39
  34. data/app/views/pattana/countries/cities.js.erb +5 -2
  35. data/app/views/pattana/countries/index.html.erb +10 -2
  36. data/app/views/pattana/countries/regions.js.erb +5 -2
  37. data/app/views/pattana/country_cities/_action_buttons.html.erb +17 -0
  38. data/app/views/pattana/country_regions/_action_buttons.html.erb +17 -0
  39. data/app/views/pattana/dashboard/index.html.erb +3 -3
  40. data/app/views/pattana/region_cities/_action_buttons.html.erb +17 -0
  41. data/app/views/pattana/regions/_show.html.erb +68 -22
  42. data/app/views/pattana/regions/cities.js.erb +5 -2
  43. data/lib/pattana/version.rb +1 -1
  44. metadata +7 -4
@@ -17,17 +17,21 @@ api_output = <<-eos
17
17
  "id": 21,
18
18
  "name": "Abu Dhabi",
19
19
  "priority": 1000,
20
+ "operational": true,
20
21
  "country": {
21
22
  "id": 235,
22
23
  "name": "United Arab Emirates",
23
24
  "iso_name": "UNITED ARAB EMIRATES",
25
+ "iso_alpha_2": "AE",
24
26
  "dialing_prefix": "971",
25
- "priority": 1000
27
+ "priority": 1000,
28
+ "operational": true
26
29
  },
27
30
  "region": {
28
31
  "id": 14,
29
32
  "name": "Abu Dhabi",
30
- "priority": 1000
33
+ "priority": 1000,
34
+ "operational": true
31
35
  }
32
36
  },
33
37
  .
@@ -41,13 +45,16 @@ api_output = <<-eos
41
45
  "id": 235,
42
46
  "name": "United Arab Emirates",
43
47
  "iso_name": "UNITED ARAB EMIRATES",
48
+ "iso_alpha_2": "AE",
44
49
  "dialing_prefix": "971",
45
- "priority": 1000
50
+ "priority": 1000,
51
+ "operational": true
46
52
  },
47
53
  "region": {
48
54
  "id": 8,
49
55
  "name": "Umm Al Quwain",
50
- "priority": 1000
56
+ "priority": 1000,
57
+ "operational": true
51
58
  }
52
59
  }]
53
60
  }
@@ -17,17 +17,21 @@ api_output = <<-eos
17
17
  "id": 21,
18
18
  "name": "Abu Dhabi",
19
19
  "priority": 1000,
20
+ "operational": true,
20
21
  "country": {
21
22
  "id": 235,
22
23
  "name": "United Arab Emirates",
23
24
  "iso_name": "UNITED ARAB EMIRATES",
25
+ "iso_alpha_2": "AE",
24
26
  "dialing_prefix": "971",
25
- "priority": 1000
27
+ "priority": 1000,
28
+ "operational": true
26
29
  },
27
30
  "region": {
28
31
  "id": 14,
29
32
  "name": "Abu Dhabi",
30
- "priority": 1000
33
+ "priority": 1000,
34
+ "operational": true
31
35
  }
32
36
  },
33
37
  .
@@ -37,17 +41,21 @@ api_output = <<-eos
37
41
  "id": 8,
38
42
  "name": "Umm al Qaywayn",
39
43
  "priority": 1000,
44
+ "operational": true,
40
45
  "country": {
41
46
  "id": 235,
42
47
  "name": "United Arab Emirates",
43
48
  "iso_name": "UNITED ARAB EMIRATES",
49
+ "iso_alpha_2": "AE",
44
50
  "dialing_prefix": "971",
45
- "priority": 1000
51
+ "priority": 1000,
52
+ "operational": true
46
53
  },
47
54
  "region": {
48
55
  "id": 8,
49
56
  "name": "Umm Al Quwain",
50
- "priority": 1000
57
+ "priority": 1000,
58
+ "operational": true
51
59
  }
52
60
  }]
53
61
  }
@@ -16,15 +16,19 @@ api_output = <<-eos
16
16
  "id": 100,
17
17
  "name": "India",
18
18
  "iso_name": "INDIA",
19
+ "iso_alpha_2": "IN",
19
20
  "dialing_prefix": "91",
20
- "priority": 1000
21
+ "priority": 1000,
22
+ "operational": true
21
23
  },
22
24
  {
23
25
  "id": 2,
24
26
  "name": "Albania",
25
27
  "iso_name": "ALBANIA",
28
+ "iso_alpha_2": "AL",
26
29
  "dialing_prefix": "355",
27
- "priority": 1000
30
+ "priority": 1000,
31
+ "operational": false
28
32
  },
29
33
  .
30
34
  .
@@ -33,9 +37,12 @@ api_output = <<-eos
33
37
  "id": 246,
34
38
  "name": "Zimbabwe",
35
39
  "iso_name": "ZIMBABWE",
40
+ "iso_alpha_2": "ZW",
36
41
  "dialing_prefix": "263",
37
- "priority": 1000
38
- }]
42
+ "priority": 1000,
43
+ "operational": false
44
+ }
45
+ ]
39
46
  }
40
47
  eos
41
48
 
@@ -17,26 +17,21 @@ api_output = <<-eos
17
17
  "id": 100,
18
18
  "name": "India",
19
19
  "iso_name": "INDIA",
20
+ "iso_alpha_2": "IN",
20
21
  "dialing_prefix": "91",
21
- "priority": 1000
22
+ "priority": 1000,
23
+ "operational": true
22
24
  },
23
25
  {
24
- "id": 2,
25
- "name": "Albania",
26
- "iso_name": "ALBANIA",
27
- "dialing_prefix": "355",
28
- "priority": 1000
29
- },
30
- .
31
- .
32
- .
33
- {
34
- "id": 246,
35
- "name": "Zimbabwe",
36
- "iso_name": "ZIMBABWE",
37
- "dialing_prefix": "263",
38
- "priority": 1000
39
- }]
26
+ "id": 101,
27
+ "name": "Indonesia",
28
+ "iso_name": "INDONESIA",
29
+ "iso_alpha_2": "ID",
30
+ "dialing_prefix": "62",
31
+ "priority": 1000,
32
+ "operational": false
33
+ }
34
+ ]
40
35
  }
41
36
  eos
42
37
 
@@ -17,26 +17,30 @@ api_output = <<-eos
17
17
  "id": 100,
18
18
  "name": "India",
19
19
  "iso_name": "INDIA",
20
+ "iso_alpha_2": "IN",
20
21
  "dialing_prefix": "91",
21
- "priority": 1000
22
+ "priority": 1000,
23
+ "operational": true
22
24
  },
23
25
  {
24
- "id": 2,
25
- "name": "Albania",
26
- "iso_name": "ALBANIA",
27
- "dialing_prefix": "355",
28
- "priority": 1000
26
+ "id": 64,
27
+ "name": "Egypt",
28
+ "iso_name": "EGYPT",
29
+ "iso_alpha_2": "EG",
30
+ "dialing_prefix": "20",
31
+ "priority": 1000,
32
+ "operational": true
29
33
  },
30
- .
31
- .
32
- .
33
34
  {
34
- "id": 246,
35
- "name": "Zimbabwe",
36
- "iso_name": "ZIMBABWE",
37
- "dialing_prefix": "263",
38
- "priority": 1000
39
- }]
35
+ "id": 111,
36
+ "name": "Jordan",
37
+ "iso_name": "JORDAN",
38
+ "iso_alpha_2": "JO",
39
+ "dialing_prefix": "962",
40
+ "priority": 1000,
41
+ "operational": true
42
+ }
43
+ ]
40
44
  }
41
45
  eos
42
46
 
@@ -17,26 +17,12 @@ api_output = <<-eos
17
17
  "id": 100,
18
18
  "name": "India",
19
19
  "iso_name": "INDIA",
20
+ "iso_alpha_2": "IN",
20
21
  "dialing_prefix": "91",
21
- "priority": 1000
22
- },
23
- {
24
- "id": 2,
25
- "name": "Albania",
26
- "iso_name": "ALBANIA",
27
- "dialing_prefix": "355",
28
- "priority": 1000
29
- },
30
- .
31
- .
32
- .
33
- {
34
- "id": 246,
35
- "name": "Zimbabwe",
36
- "iso_name": "ZIMBABWE",
37
- "dialing_prefix": "263",
38
- "priority": 1000
39
- }]
22
+ "priority": 1000,
23
+ "operational": true
24
+ }
25
+ ]
40
26
  }
41
27
  eos
42
28
 
@@ -44,7 +30,7 @@ eos
44
30
 
45
31
  <%= render partial: "kuppayam/api/docs/example", locals: {
46
32
  negative_case: false,
47
- example_id: "pos_case_2",
33
+ example_id: "pos_case_4",
48
34
  api_title: api_title,
49
35
  api_input: api_input,
50
36
  api_output: api_output
@@ -17,24 +17,30 @@ api_output = <<-eos
17
17
  "id": 1329,
18
18
  "name": "Andaman and Nicobar Islands",
19
19
  "priority": 1000,
20
+ "operational": true,
20
21
  "country": {
21
22
  "id": 100,
22
23
  "name": "India",
23
24
  "iso_name": "INDIA",
25
+ "iso_alpha_2": "IN",
24
26
  "dialing_prefix": "91",
25
- "priority": 1000
27
+ "priority": 1000,
28
+ "operational": true
26
29
  }
27
30
  },
28
31
  {
29
32
  "id": 1328,
30
33
  "name": "Andhra Pradesh",
31
34
  "priority": 1000,
35
+ "operational": true,
32
36
  "country": {
33
37
  "id": 100,
34
38
  "name": "India",
35
39
  "iso_name": "INDIA",
40
+ "iso_alpha_2": "IN",
36
41
  "dialing_prefix": "91",
37
- "priority": 1000
42
+ "priority": 1000,
43
+ "operational": true
38
44
  }
39
45
  },
40
46
  .
@@ -44,12 +50,15 @@ api_output = <<-eos
44
50
  "id": 1332,
45
51
  "name": "Uttaranchal",
46
52
  "priority": 1000,
53
+ "operational": true,
47
54
  "country": {
48
55
  "id": 100,
49
56
  "name": "India",
50
57
  "iso_name": "INDIA",
58
+ "iso_alpha_2": "IN",
51
59
  "dialing_prefix": "91",
52
- "priority": 1000
60
+ "priority": 1000,
61
+ "operational": true
53
62
  }
54
63
  }]
55
64
  }
@@ -5,8 +5,8 @@ api_title = "Positive Case - 2 - should return search regions in a country"
5
5
  api_input = <<-eos
6
6
  Example:
7
7
 
8
- GET #{request.base_url}/api/v1/235/regions?q=Dub
9
- This will search for regions in the country with id 235 for the keyword 'Dub' and will return matching results
8
+ GET #{request.base_url}/api/v1/235/regions?q=Ind
9
+ This will search for regions in the country with id 235 for the keyword 'Ind' and will return matching results
10
10
  eos
11
11
 
12
12
  api_output = <<-eos
@@ -17,24 +17,30 @@ api_output = <<-eos
17
17
  "id": 1329,
18
18
  "name": "Andaman and Nicobar Islands",
19
19
  "priority": 1000,
20
+ "operational": true,
20
21
  "country": {
21
22
  "id": 100,
22
23
  "name": "India",
23
24
  "iso_name": "INDIA",
25
+ "iso_alpha_2": "IN",
24
26
  "dialing_prefix": "91",
25
- "priority": 1000
27
+ "priority": 1000,
28
+ "operational": true
26
29
  }
27
30
  },
28
31
  {
29
32
  "id": 1328,
30
33
  "name": "Andhra Pradesh",
31
34
  "priority": 1000,
35
+ "operational": true,
32
36
  "country": {
33
37
  "id": 100,
34
38
  "name": "India",
35
39
  "iso_name": "INDIA",
40
+ "iso_alpha_2": "IN",
36
41
  "dialing_prefix": "91",
37
- "priority": 1000
42
+ "priority": 1000,
43
+ "operational": true
38
44
  }
39
45
  },
40
46
  .
@@ -44,12 +50,15 @@ api_output = <<-eos
44
50
  "id": 1332,
45
51
  "name": "Uttaranchal",
46
52
  "priority": 1000,
53
+ "operational": true,
47
54
  "country": {
48
55
  "id": 100,
49
56
  "name": "India",
50
57
  "iso_name": "INDIA",
58
+ "iso_alpha_2": "IN",
51
59
  "dialing_prefix": "91",
52
- "priority": 1000
60
+ "priority": 1000,
61
+ "operational": true
53
62
  }
54
63
  }]
55
64
  }
@@ -17,24 +17,30 @@ api_output = <<-eos
17
17
  "id": 1329,
18
18
  "name": "Andaman and Nicobar Islands",
19
19
  "priority": 1000,
20
+ "operational": true,
20
21
  "country": {
21
22
  "id": 100,
22
23
  "name": "India",
23
24
  "iso_name": "INDIA",
25
+ "iso_alpha_2": "IN",
24
26
  "dialing_prefix": "91",
25
- "priority": 1000
27
+ "priority": 1000,
28
+ "operational": true
26
29
  }
27
30
  },
28
31
  {
29
32
  "id": 1328,
30
33
  "name": "Andhra Pradesh",
31
34
  "priority": 1000,
35
+ "operational": true,
32
36
  "country": {
33
37
  "id": 100,
34
38
  "name": "India",
35
39
  "iso_name": "INDIA",
40
+ "iso_alpha_2": "IN",
36
41
  "dialing_prefix": "91",
37
- "priority": 1000
42
+ "priority": 1000,
43
+ "operational": true
38
44
  }
39
45
  },
40
46
  .
@@ -44,12 +50,15 @@ api_output = <<-eos
44
50
  "id": 1332,
45
51
  "name": "Uttaranchal",
46
52
  "priority": 1000,
53
+ "operational": true,
47
54
  "country": {
48
55
  "id": 100,
49
56
  "name": "India",
50
57
  "iso_name": "INDIA",
58
+ "iso_alpha_2": "IN",
51
59
  "dialing_prefix": "91",
52
- "priority": 1000
60
+ "priority": 1000,
61
+ "operational": true
53
62
  }
54
63
  }]
55
64
  }
@@ -17,24 +17,30 @@ api_output = <<-eos
17
17
  "id": 1329,
18
18
  "name": "Andaman and Nicobar Islands",
19
19
  "priority": 1000,
20
+ "operational": true,
20
21
  "country": {
21
22
  "id": 100,
22
23
  "name": "India",
23
24
  "iso_name": "INDIA",
25
+ "iso_alpha_2": "IN",
24
26
  "dialing_prefix": "91",
25
- "priority": 1000
27
+ "priority": 1000,
28
+ "operational": true
26
29
  }
27
30
  },
28
31
  {
29
32
  "id": 1328,
30
33
  "name": "Andhra Pradesh",
31
34
  "priority": 1000,
35
+ "operational": true,
32
36
  "country": {
33
37
  "id": 100,
34
38
  "name": "India",
35
39
  "iso_name": "INDIA",
40
+ "iso_alpha_2": "IN",
36
41
  "dialing_prefix": "91",
37
- "priority": 1000
42
+ "priority": 1000,
43
+ "operational": true
38
44
  }
39
45
  },
40
46
  .
@@ -44,12 +50,15 @@ api_output = <<-eos
44
50
  "id": 1332,
45
51
  "name": "Uttaranchal",
46
52
  "priority": 1000,
53
+ "operational": true,
47
54
  "country": {
48
55
  "id": 100,
49
56
  "name": "India",
50
57
  "iso_name": "INDIA",
58
+ \"iso_alpha_2": "IN",
51
59
  "dialing_prefix": "91",
52
- "priority": 1000
60
+ "priority": 1000,
61
+ "operational": true
53
62
  }
54
63
  }]
55
64
  }
@@ -59,7 +68,7 @@ eos
59
68
 
60
69
  <%= render partial: "kuppayam/api/docs/example", locals: {
61
70
  negative_case: false,
62
- example_id: "pos_case_2",
71
+ example_id: "pos_case_4",
63
72
  api_title: api_title,
64
73
  api_input: api_input,
65
74
  api_output: api_output
@@ -26,6 +26,37 @@
26
26
 
27
27
  </div>
28
28
 
29
+ <div class="col-md-3 col-sm-6 col-xs-12">
30
+
31
+ <% edit_link = edit_city_path(id: @city.id) %>
32
+ <% delete_link = city_path(id: @city.id) %>
33
+
34
+ <% if @city.show_in_api? %>
35
+ <!-- Hide in API -->
36
+ <%= link_to raw("<i class=\"fa fa-cloud mr-5\"></i> Hide in API"), hide_in_api_city_path(:id => @city.id), :remote=>true, class: "btn btn-block btn-danger btn-only-hover" %>
37
+ <% else %>
38
+ <!-- Show in API -->
39
+ <%= link_to raw("<i class=\"fa fa-cloud-download mr-5\"></i> Show in API"), show_in_api_city_path(:id => @city.id), :remote=>true, class: "btn btn-block btn-success btn-only-hover" %>
40
+ <% end %>
41
+
42
+ <% if @city.operational? %>
43
+ <!-- Hide in API -->
44
+ <%= link_to raw("<i class=\"fa fa-toggle-off mr-5\"></i> Hide in API"), remove_operational_city_path(:id => @city.id), :remote=>true, class: "btn btn-block btn-danger btn-only-hover" %>
45
+ <% else %>
46
+ <!-- Show in API -->
47
+ <%= link_to raw("<i class=\"fa fa-toggle-on mr-5\"></i> Show in API"), mark_as_operational_city_path(:id => @city.id), :remote=>true, class: "btn btn-block btn-success btn-only-hover" %>
48
+ <% end %>
49
+
50
+ <!-- Edit -->
51
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Edit"), edit_link, :remote=>true, class: "btn btn-block btn-white btn-only-hover" %>
52
+
53
+ <!-- Delete -->
54
+ <%= link_to raw("<i class=\"linecons-trash mr-5\"></i> Delete"), delete_link, method: :delete, :remote=>true, data: { confirm: 'Are you sure?' }, class: "btn btn-block btn-danger btn-only-hover" %>
55
+
56
+ <div class="visible-sm visible-xs mb-50"></div>
57
+
58
+ </div>
59
+
29
60
  </div>
30
61
 
31
62
  <%= clear_tag(50) %>