pattana 0.1.6 → 0.1.7

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/controllers/pattana/cities_controller.rb +66 -2
  4. data/app/controllers/pattana/countries_controller.rb +79 -1
  5. data/app/controllers/pattana/regions_controller.rb +76 -2
  6. data/app/models/city.rb +21 -2
  7. data/app/models/country.rb +13 -3
  8. data/app/models/region.rb +13 -3
  9. data/app/views/pattana/cities/_form.html.erb +33 -0
  10. data/app/views/pattana/cities/_index.html.erb +18 -10
  11. data/app/views/pattana/cities/_row.html.erb +21 -44
  12. data/app/views/pattana/cities/_show.html.erb +27 -13
  13. data/app/views/pattana/countries/_form.html.erb +49 -0
  14. data/app/views/pattana/countries/_index.html.erb +24 -14
  15. data/app/views/pattana/countries/_row.html.erb +36 -55
  16. data/app/views/pattana/countries/_show.html.erb +97 -5
  17. data/app/views/pattana/countries/cities.js.erb +11 -0
  18. data/app/views/pattana/country_cities/_index.html.erb +44 -0
  19. data/app/views/pattana/country_cities/_row.html.erb +17 -0
  20. data/app/views/pattana/country_regions/_index.html.erb +3 -1
  21. data/app/views/pattana/country_regions/_row.html.erb +6 -8
  22. data/app/views/pattana/region_cities/_index.html.erb +42 -0
  23. data/app/views/pattana/region_cities/_row.html.erb +19 -0
  24. data/app/views/pattana/regions/_form.html.erb +31 -0
  25. data/app/views/pattana/regions/_index.html.erb +23 -12
  26. data/app/views/pattana/regions/_row.html.erb +27 -44
  27. data/app/views/pattana/regions/_show.html.erb +102 -19
  28. data/app/views/pattana/regions/cities.js.erb +11 -0
  29. data/config/locales/pattana/general.ar.yml +40 -0
  30. data/config/locales/pattana/general.en.yml +40 -0
  31. data/config/routes.rb +23 -2
  32. data/lib/pattana/factories.rb +1 -1
  33. data/lib/pattana/version.rb +1 -1
  34. data/spec/dummy/spec/factories/city.rb +1 -0
  35. data/spec/dummy/spec/factories/country.rb +1 -0
  36. data/spec/dummy/spec/factories/region.rb +1 -0
  37. metadata +15 -4
@@ -0,0 +1,49 @@
1
+ <%= form_for(@country, :html => {:id=>"form_country", :class=>"mb-0 form-horizontal", :role => "form", :method => (@country.new_record? ? :post : :put), :remote=>true}) do |f| %>
2
+
3
+ <div id="country_form_error">
4
+ <%= @country.errors[:base].to_sentence %>
5
+ </div>
6
+
7
+ <div class="row">
8
+ <div class="col-md-6 col-sm-6">
9
+ <div class="form-inputs mb-30 mt-30">
10
+
11
+ <%= theme_form_field(@country, :name) %>
12
+
13
+ <%= theme_form_field(@country, :official_name, required: false) %>
14
+ <%= theme_form_field(@country, :iso_name, required: false) %>
15
+ <%= theme_form_field(@country, :fips, required: false) %>
16
+ <%= theme_form_field(@country, :iso_alpha_2, required: false) %>
17
+ <%= theme_form_field(@country, :iso_alpha_3, required: false) %>
18
+ <%= theme_form_field(@country, :itu_code, required: false) %>
19
+ <%= theme_form_field(@country, :dialing_prefix, required: false) %>
20
+ </div>
21
+ </div>
22
+ <div class="col-md-6 col-sm-6">
23
+ <div class="form-inputs mb-30 mt-30">
24
+
25
+ <%= theme_form_field(@country, :tld, required: false) %>
26
+
27
+ <%= theme_form_field(@country, :latitude, required: false) %>
28
+ <%= theme_form_field(@country, :longitude, required: false) %>
29
+
30
+ <%= theme_form_field(@country, :capital, required: false) %>
31
+
32
+ <%= theme_form_field(@country, :priority, required: false, html_options: {type: :number, style: "width:70px;"}) %>
33
+
34
+ <%= theme_form_field(@country, :languages, required: false, html_options: {type: :textarea}) %>
35
+
36
+ </div>
37
+ </div>
38
+ <div>
39
+
40
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
41
+
42
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right ml-10 btn btn-white" %>
43
+
44
+ </div>
45
+ <%= clear_tag(10) %>
46
+ </div>
47
+
48
+ <% end %>
49
+
@@ -4,20 +4,17 @@
4
4
  <tr>
5
5
  <th style="text-align:center;width:5%;">#</th>
6
6
  <th style="text-align:left;width:40%;">Name</th>
7
- <th style="text-align:center;width:10%;">FIPS</th>
8
- <th style="text-align:center;width:10%;">ISO 2</th>
9
- <th style="text-align:center;width:10%;">Priority</th>
10
7
  <th style="text-align:center;width:15%;">Show in API</th>
11
- <th style="text-align:center;width:10%;">Actions</th>
8
+ <th style="text-align:center;width:15%;">Operational</th>
9
+ <th style="text-align:center;width:10%;">Priority</th>
10
+ <th style="text-align:center;width:10%;" colspan="2">Actions</th>
12
11
  </tr>
13
12
  </thead>
14
13
  <tbody>
15
14
  <% @countries.each_with_index do |country, i| %>
16
15
 
17
- <%# edit_link = edit_country_path(id: country.id) %>
18
- <%# delete_link = country_path(id: country.id) %>
19
- <% edit_link = "#" %>
20
- <% delete_link = "#" %>
16
+ <% edit_link = edit_country_path(id: country.id) %>
17
+ <% delete_link = country_path(id: country.id) %>
21
18
 
22
19
  <tr id="tr_country_<%= country.id %>">
23
20
 
@@ -25,17 +22,30 @@
25
22
 
26
23
  <td class="text-align-left"><%= link_to country.name, pattana.country_path(country), remote: true %></td>
27
24
 
28
- <td class="text-align-center"><%= country.fips %></td>
29
- <td class="text-align-center"><%= country.iso_alpha_2 %></td>
25
+ <td class="text-align-center"><%= country.display_operational %></td>
26
+
27
+ <td class="text-align-center"><%= country.display_operational %></td>
28
+
30
29
  <td class="text-align-center"><%= country.priority %></td>
31
- <td class="text-align-center"><%= country.display_show_in_api %></td>
32
30
 
33
- <td class="action-links text-align-center" style="width:10%">
31
+ <td class="action-links text-align-center" style="width:10%">
32
+ <% if country.show_in_api? %>
33
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Hide in API"), hide_in_api_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "delete" %>
34
+ <% else %>
35
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Show in API"), show_in_api_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "edit" %>
36
+ <% end %>
34
37
 
35
- <%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit pull-left ml-15" %>
38
+ <% if country.operational? %>
39
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Remove Operational"), remove_operational_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "delete" %>
40
+ <% else %>
41
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Mark as Operational"), mark_as_operational_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "edit" %>
42
+ <% end %>
43
+ </td>
36
44
 
37
- <%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete pull-left ml-10", style: "margin-top:0px !important;" %>
45
+ <td class="action-links text-align-center" style="width:10%">
46
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote=>true, style: "text-align:left;", class: "edit" %>
38
47
 
48
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete mt-10", style: "text-align:left;" %>
39
49
  </td>
40
50
 
41
51
  </tr>
@@ -1,55 +1,36 @@
1
- <% edit_link = edit_admin_country_path(id: country.id) %>
2
- <% delete_link = admin_country_path(id: country.id) %>
3
-
4
- <tr id="tr_country_<%= country.id %>">
5
-
6
- <td class="country-image">
7
- <%= link_to(admin_country_path(country), remote: true) do %>
8
- <%= display_image(country, "country_image.image.small.url", width: "32", height: "auto", class: "img-rectangle", alt: country.display_name) %>
9
- <% end %>
10
- </td>
11
-
12
- <td class="country-name"><%= link_to country.name, admin_country_path(country), remote: true %></td>
13
-
14
- <td>
15
- <% if country.unpublished? %>
16
- <span class="ml-5 mt-5 label label-default">Un-Published</span>
17
- <% elsif country.published? %>
18
- <span class="ml-5 mt-5 label label-success">Published</span>
19
- <% elsif country.disabled? %>
20
- <span class="ml-5 mt-5 label label-danger">Disabled</span>
21
- <% end %>
22
- </td>
23
-
24
- <td class="action-links" style="width:10%">
25
-
26
- <% case country.status %>
27
- <% when "published" %>
28
- <!-- Un-Publish -->
29
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_admin_country_path(:id =>country.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"country_status" %>
30
-
31
- <!-- Disable -->
32
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Disable"), update_status_admin_country_path(:id =>country.id, :status =>'disabled'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"country_status" %>
33
- <% when "unpublished" %>
34
- <!-- Approve -->
35
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_admin_country_path(:id =>country.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"country_status" %>
36
- <!-- Disable -->
37
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Disable"), update_status_admin_country_path(:id =>country.id, :status =>'disabled'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"country_status" %>
38
- <% when "disabled" %>
39
- <!-- Un-Publish -->
40
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_admin_country_path(:id =>country.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"country_status" %>
41
- <!-- Approve -->
42
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_admin_country_path(:id =>country.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"country_status" %>
43
- <% end %>
44
-
45
- </td>
46
-
47
- <td class="action-links" style="width:10%">
48
-
49
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Country"), edit_link, :remote=>true, class: "edit" %>
50
-
51
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
52
-
53
- </td>
54
-
55
- </tr>
1
+ <% edit_link = edit_country_path(id: country.id) %>
2
+ <% delete_link = country_path(id: country.id) %>
3
+
4
+ <tr id="tr_country_<%= country.id %>">
5
+
6
+ <td class="text-align-center"><%= country.id %></td>
7
+
8
+ <td class="text-align-left"><%= link_to country.name, pattana.country_path(country), remote: true %></td>
9
+
10
+ <td class="text-align-center"><%= country.display_operational %></td>
11
+
12
+ <td class="text-align-center"><%= country.display_operational %></td>
13
+
14
+ <td class="text-align-center"><%= country.priority %></td>
15
+
16
+ <td class="action-links text-align-center" style="width:10%">
17
+ <% if country.show_in_api? %>
18
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Hide in API"), hide_in_api_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "delete" %>
19
+ <% else %>
20
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Show in API"), show_in_api_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "edit" %>
21
+ <% end %>
22
+
23
+ <% if country.operational? %>
24
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Remove Operational"), remove_operational_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "delete" %>
25
+ <% else %>
26
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Mark as Operational"), mark_as_operational_country_path(:id =>country.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "edit" %>
27
+ <% end %>
28
+ </td>
29
+
30
+ <td class="action-links text-align-center" style="width:10%">
31
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote=>true, style: "text-align:left;", class: "edit" %>
32
+
33
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete mt-10", style: "text-align:left;" %>
34
+ </td>
35
+
36
+ </tr>
@@ -9,6 +9,18 @@
9
9
  <%= theme_panel_heading(@country.name) %>
10
10
 
11
11
  <%= theme_panel_sub_heading("ID: #{@country.id}", "#") %><br>
12
+
13
+ <% if @country.show_in_api? %>
14
+ <div class="label label-success">Show In API</div>
15
+ <% else %>
16
+ <div class="label label-danger">Hide In API</div>
17
+ <% end %>
18
+
19
+ <% if @country.operational? %>
20
+ <div class="label label-success">Operational</div>
21
+ <% else %>
22
+ <div class="label label-danger">Non Operational</div>
23
+ <% end %>
12
24
 
13
25
  </div>
14
26
 
@@ -108,17 +120,17 @@
108
120
  </tr>
109
121
 
110
122
  <tr>
123
+ <th>Latitude</th>
124
+ <th>Longitude</th>
111
125
  <th>Created At</th>
112
126
  <th>Updated At</th>
113
- <th></th>
114
- <th></th>
115
127
  </tr>
116
128
 
117
129
  <tr>
130
+ <td class="word-break"><%= @country.latitude %></td>
131
+ <td class="word-break"><%= @country.longitude %></td>
118
132
  <td class="word-break"><%= @country.created_at %></td>
119
133
  <td class="word-break"><%= @country.updated_at %></td>
120
- <td></td>
121
- <td></td>
122
134
  </tr>
123
135
 
124
136
  </tbody>
@@ -204,18 +216,98 @@
204
216
  </div>
205
217
  </div>
206
218
  <div id="div_region_index">
207
- <%= link_to 'Refresh', regions_country_path(@country), remote: true %>
208
219
  <%#= render :partial=>"master_data/admin_regions/index" %>
209
220
  </div>
210
221
  </div>
211
222
 
212
223
  <div class="tab-pane" id="cities" style="border: 1px solid #000;min-height:200px;padding:20px;margin-bottom:20px;max-height: 400px;overflow-y: auto;">
213
224
  <%= clear_tag(20) %>
225
+
226
+ <div id="div_city_action_buttons">
227
+ <div class="row">
228
+ <div class="col-md-6">
229
+
230
+ <%= theme_button('Refresh', 'refresh', cities_country_path(@country), classes: "pull-left", btn_type: "white") %>
231
+
232
+ </div>
233
+ <div class="col-md-6">
234
+ <%= search_form_kuppayam(City, cities_country_path(@country), text: "") %>
235
+ </div>
236
+ </div>
237
+ </div>
238
+ <%= clear_tag(10) %>
239
+
240
+ <div id="div_city_counts">
241
+ <div class="row">
242
+
243
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
244
+
245
+ <div style="border: 1px solid #ddd; margin-bottom: 20px;">
246
+
247
+ <div class="xe-widget xe-counter xe-counter-info"
248
+ data-count=".num"
249
+ data-from="0"
250
+ data-to="99.9"
251
+ data-suffix="%"
252
+ data-duration="2"
253
+ style="margin-bottom: 0px;
254
+ padding: 0px;
255
+ width: 15%;
256
+ margin: 0px auto;">
257
+ <div class="xe-icon">
258
+ <i class="linecons-database"></i>
259
+ </div>
260
+ <div class="xe-label">
261
+ <strong class="num"><%= @country.cities.count %></strong>
262
+ <span>Total</span>
263
+ </div>
264
+ </div>
265
+
266
+ </div>
267
+
268
+ </div>
269
+
270
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
271
+
272
+ <div style="border: 1px solid #ddd; margin-bottom: 20px;">
273
+
274
+ <div class="xe-widget xe-counter"
275
+ data-count=".num"
276
+ data-from="0"
277
+ data-to="99.9"
278
+ data-suffix="%"
279
+ data-duration="2"
280
+ style="margin-bottom: 0px;
281
+ padding: 0px;
282
+ width: 15%;
283
+ margin: 0px auto;">
284
+ <div class="xe-icon">
285
+ <i class="linecons-cloud"></i>
286
+ </div>
287
+ <div class="xe-label">
288
+ <strong class="num"><%= @country.cities.show_in_api.count %></strong>
289
+ <span>Show in API</span>
290
+ </div>
291
+ </div>
292
+
293
+ </div>
294
+
295
+ </div>
296
+
297
+
298
+ </div>
299
+ </div>
300
+ <div id="div_city_index">
301
+ <%#= render :partial=>"master_data/admin_cities/index" %>
302
+ </div>
214
303
  </div>
215
304
 
216
305
  </div>
217
306
 
218
307
  <%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
219
308
 
309
+ <% edit_link = edit_country_path(id: @country.id) %>
310
+ <%= link_to raw("<i class='fa fa-pencil mr-5'></i><span>Edit</span>"), edit_link, remote: true, class: "pull-right mr-10 btn btn-white" %>
311
+
220
312
  <%= clear_tag %>
221
313
  </div>
@@ -0,0 +1,11 @@
1
+ <% if @cities.any? %>
2
+
3
+ // Refresh the list
4
+ $('#div_city_index').html("<%= escape_javascript(render(:partial=>"pattana/country_cities/index")) %>");
5
+
6
+ <% else %>
7
+
8
+ var noResultsText = "<%= escape_javascript(theme_panel_message(I18n.translate('success.no_results_found')))%>";
9
+ $('#div_city_index').html(noResultsText);
10
+
11
+ <% end %>
@@ -0,0 +1,44 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align:center;width:5%;">#</th>
6
+ <th style="text-align:left;width:35%;">Name</th>
7
+ <th style="text-align:center;width:15%;">ISO Code</th>
8
+ <th style="text-align:center;width:15%;">Priority</th>
9
+ <th style="text-align:center;width:15%;">Show in API</th>
10
+ <th style="text-align:center;width:15%;">Operational</th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <tbody>
15
+ <% @cities.each_with_index do |city, i| %>
16
+
17
+ <tr id="tr_city_<%= city.id %>">
18
+
19
+ <th scope="row" class="text-align-center">
20
+ <% if i < 0 %>
21
+ <i class="fa fa-check text-success"></i>
22
+ <% else %>
23
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
24
+ <% end %>
25
+ </th>
26
+
27
+ <td class="text-align-left"><%= city.display_name %></td>
28
+ <td class="text-align-center"><%= city.iso_code %></td>
29
+ <td class="text-align-center"><%= city.priority %></td>
30
+ <td class="text-align-center"><%= city.display_show_in_api %></td>
31
+ <td class="text-align-center"><%= city.display_operational %></td>
32
+
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+
39
+ <div class="row">
40
+ <div class="col-sm-12">
41
+ <%= paginate_kuppayam(@cities) %>
42
+ </div>
43
+ </div>
44
+
@@ -0,0 +1,17 @@
1
+ <tr id="tr_city_<%= city.id %>">
2
+
3
+ <th scope="row" class="text-align-center">
4
+ <% if i < 0 %>
5
+ <i class="fa fa-check text-success"></i>
6
+ <% else %>
7
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
8
+ <% end %>
9
+ </th>
10
+
11
+ <td class="text-align-left"><%= city.display_name %></td>
12
+ <td class="text-align-center"><%= city.iso_code %></td>
13
+ <td class="text-align-center"><%= city.priority %></td>
14
+ <td class="text-align-center"><%= city.display_show_in_api %></td>
15
+ <td class="text-align-center"><%= city.display_operational %></td>
16
+
17
+ </tr>
@@ -3,10 +3,11 @@
3
3
  <thead>
4
4
  <tr>
5
5
  <th style="text-align:center;width:5%;">#</th>
6
- <th style="text-align:left;width:50%;">Name</th>
6
+ <th style="text-align:left;width:35%;">Name</th>
7
7
  <th style="text-align:center;width:15%;">ISO Code</th>
8
8
  <th style="text-align:center;width:15%;">Priority</th>
9
9
  <th style="text-align:center;width:15%;">Show in API</th>
10
+ <th style="text-align:center;width:15%;">Operational</th>
10
11
  </tr>
11
12
  </thead>
12
13
 
@@ -27,6 +28,7 @@
27
28
  <td class="text-align-center"><%= region.iso_code %></td>
28
29
  <td class="text-align-center"><%= region.priority %></td>
29
30
  <td class="text-align-center"><%= region.display_show_in_api %></td>
31
+ <td class="text-align-center"><%= region.display_operational %></td>
30
32
 
31
33
  </tr>
32
34
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <tr id="tr_region_<%= region.id %>">
2
2
 
3
- <th scope="row" style="text-align:center;width:5%;">
3
+ <th scope="row" class="text-align-center">
4
4
  <% if i < 0 %>
5
5
  <i class="fa fa-check text-success"></i>
6
6
  <% else %>
@@ -8,12 +8,10 @@
8
8
  <% end %>
9
9
  </th>
10
10
 
11
- <td class="region-name" style="text-align:center;width:50%;"><%= region.display_name %></td>
12
-
13
- <td class="region-name" style="text-align:center;width:15%;"><%= region.iso_code %></td>
14
-
15
- <td class="region-name" style="text-align:center;width:15%;"><%= region.priority %></td>
16
-
17
- <td class="region-name" style="text-align:center;width:15%;"><%= region.display_show_in_api %></td>
11
+ <td class="text-align-left"><%= region.display_name %></td>
12
+ <td class="text-align-center"><%= region.iso_code %></td>
13
+ <td class="text-align-center"><%= region.priority %></td>
14
+ <td class="text-align-center"><%= region.display_show_in_api %></td>
15
+ <td class="text-align-center"><%= region.display_operational %></td>
18
16
 
19
17
  </tr>
@@ -0,0 +1,42 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align:center;width:5%;">#</th>
6
+ <th style="text-align:left;width:50%;">Name</th>
7
+ <th style="text-align:center;width:15%;">ISO Code</th>
8
+ <th style="text-align:center;width:15%;">Priority</th>
9
+ <th style="text-align:center;width:15%;">Show in API</th>
10
+ </tr>
11
+ </thead>
12
+
13
+ <tbody>
14
+ <% @cities.each_with_index do |city, i| %>
15
+
16
+ <tr id="tr_city_<%= city.id %>">
17
+
18
+ <th scope="row" class="text-align-center">
19
+ <% if i < 0 %>
20
+ <i class="fa fa-check text-success"></i>
21
+ <% else %>
22
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
23
+ <% end %>
24
+ </th>
25
+
26
+ <td class="text-align-left"><%= city.display_name %></td>
27
+ <td class="text-align-center"><%= city.iso_code %></td>
28
+ <td class="text-align-center"><%= city.priority %></td>
29
+ <td class="text-align-center"><%= city.display_show_in_api %></td>
30
+
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+
37
+ <div class="row">
38
+ <div class="col-sm-12">
39
+ <%= paginate_kuppayam(@cities) %>
40
+ </div>
41
+ </div>
42
+
@@ -0,0 +1,19 @@
1
+ <tr id="tr_city_<%= city.id %>">
2
+
3
+ <th scope="row" style="text-align:center;width:5%;">
4
+ <% if i < 0 %>
5
+ <i class="fa fa-check text-success"></i>
6
+ <% else %>
7
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
8
+ <% end %>
9
+ </th>
10
+
11
+ <td class="city-name" style="text-align:center;width:50%;"><%= city.display_name %></td>
12
+
13
+ <td class="city-name" style="text-align:center;width:15%;"><%= city.iso_code %></td>
14
+
15
+ <td class="city-name" style="text-align:center;width:15%;"><%= city.priority %></td>
16
+
17
+ <td class="city-name" style="text-align:center;width:15%;"><%= city.display_show_in_api %></td>
18
+
19
+ </tr>
@@ -0,0 +1,31 @@
1
+ <%= form_for(@region, :html => {:id=>"form_region", :class=>"mb-0 form-horizontal", :role => "form", :method => (@region.new_record? ? :post : :put), :remote=>true}) do |f| %>
2
+
3
+ <div id="region_form_error">
4
+ <%= @region.errors[:base].to_sentence %>
5
+ </div>
6
+
7
+ <div class="row">
8
+ <div class="col-md-12 col-sm-12">
9
+ <div class="form-inputs mb-30 mt-30">
10
+
11
+ <%= theme_form_field(@region, :name) %>
12
+
13
+ <%= theme_form_field(@region, :iso_code, required: false) %>
14
+
15
+ <%= theme_form_field(@region, :latitude, required: false) %>
16
+ <%= theme_form_field(@region, :longitude, required: false) %>
17
+
18
+ </div>
19
+ </div>
20
+ <div>
21
+
22
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
23
+
24
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right ml-10 btn btn-white" %>
25
+
26
+ </div>
27
+ <%= clear_tag(10) %>
28
+ </div>
29
+
30
+ <% end %>
31
+
@@ -5,19 +5,17 @@
5
5
  <th style="text-align:center;width:10%;">#</th>
6
6
  <th style="text-align:left;width:30%;">Name</th>
7
7
  <th style="text-align:left;width:15%;">Country</th>
8
- <th style="text-align:center;width:15%;">ISO Code</th>
9
8
  <th style="text-align:center;width:10%;">Priority</th>
10
9
  <th style="text-align:center;width:15%;">Show In API</th>
11
- <th style="text-align:center;width:10%;">Actions</th>
10
+ <th style="text-align:center;width:15%;">Operational</th>
11
+ <th style="text-align:center;width:10%;" colspan="2">Actions</th>
12
12
  </tr>
13
13
  </thead>
14
14
  <tbody>
15
15
  <% @regions.each_with_index do |region, i| %>
16
16
 
17
- <%# edit_link = edit_region_path(id: region.id) %>
18
- <%# delete_link = region_path(id: region.id) %>
19
- <% edit_link = "#" %>
20
- <% delete_link = "#" %>
17
+ <% edit_link = edit_region_path(id: region.id) %>
18
+ <% delete_link = region_path(id: region.id) %>
21
19
 
22
20
  <tr id="tr_region_<%= region.id %>">
23
21
 
@@ -25,19 +23,32 @@
25
23
 
26
24
  <td class="region-name text-align-left"><%= link_to region.name, pattana.region_path(region), remote: true %></td>
27
25
 
28
- <td class="country-name text-align-left"><%= link_to region.country.name, pattana.country_path(region.country), remote: true %></td>
29
-
30
- <td class="region-name text-align-center"><%= link_to region.iso_code, pattana.region_path(region), remote: true %></td>
26
+ <td class="region-name text-align-left"><%= link_to region.country.name, "#" %></td>
31
27
 
32
28
  <td class="region-name text-align-center"><%= region.priority %></td>
29
+
33
30
  <td class="region-name text-align-center"><%= region.display_show_in_api %></td>
34
31
 
35
- <td class="action-links text-align-right" style="width:10%">
32
+ <td class="region-name text-align-center"><%= region.display_operational %></td>
36
33
 
37
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Region"), edit_link, :remote=>true, class: "edit" %>
34
+ <td class="action-links text-align-center" style="width:10%">
35
+ <% if region.show_in_api? %>
36
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Hide in API"), hide_in_api_region_path(:id =>region.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "delete" %>
37
+ <% else %>
38
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Show in API"), show_in_api_region_path(:id =>region.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "edit" %>
39
+ <% end %>
40
+
41
+ <% if region.operational? %>
42
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Remove Operational"), remove_operational_region_path(:id =>region.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "delete" %>
43
+ <% else %>
44
+ <%= link_to raw("<i class=\"fa fa-square mr-5\"></i> Mark as Operational"), mark_as_operational_region_path(:id =>region.id), :remote=>true, role: "menuitem", tabindex: "-1", style: "text-align:left;", class: "edit" %>
45
+ <% end %>
46
+ </td>
38
47
 
39
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
48
+ <td class="action-links text-align-center" style="width:10%">
49
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote=>true, style: "text-align:left;", class: "edit" %>
40
50
 
51
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete mt-10", style: "text-align:left;" %>
41
52
  </td>
42
53
 
43
54
  </tr>