gdpr_rails 0.1.0 → 0.2.0

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +270 -13
  3. data/app/assets/javascripts/policy_manager/application.js +4 -0
  4. data/app/assets/javascripts/policy_manager/portability_requests.js +2 -0
  5. data/app/assets/javascripts/policy_manager/user_portability_requests.js +2 -0
  6. data/app/assets/stylesheets/policy_manager/portability_requests.css +4 -0
  7. data/app/assets/stylesheets/policy_manager/user_portability_requests.css +4 -0
  8. data/app/controllers/policy_manager/application_controller.rb +22 -0
  9. data/app/controllers/policy_manager/categories_controller.rb +5 -47
  10. data/app/controllers/policy_manager/portability_requests_controller.rb +34 -0
  11. data/app/controllers/policy_manager/terms_controller.rb +16 -13
  12. data/app/controllers/policy_manager/user_portability_requests_controller.rb +41 -0
  13. data/app/controllers/policy_manager/user_terms_controller.rb +68 -28
  14. data/app/helpers/policy_manager/application_helper.rb +28 -0
  15. data/app/helpers/policy_manager/portability_requests_helper.rb +4 -0
  16. data/app/helpers/policy_manager/scripts_helper.rb +11 -0
  17. data/app/helpers/policy_manager/terms_helper.rb +1 -1
  18. data/app/helpers/policy_manager/user_portability_requests_helper.rb +4 -0
  19. data/app/jobs/policy_manager/exporter_job.rb +10 -0
  20. data/app/mailers/policy_manager/application_mailer.rb +20 -2
  21. data/app/mailers/policy_manager/portability_mailer.rb +34 -0
  22. data/app/models/policy_manager/concerns/user_behavior.rb +80 -22
  23. data/app/models/policy_manager/portability_request.rb +65 -0
  24. data/app/models/policy_manager/term.rb +18 -0
  25. data/app/models/policy_manager/user_term.rb +14 -7
  26. data/app/views/layouts/policy_manager/application.html.erb +41 -39
  27. data/app/views/layouts/policy_manager/mailer.html.erb +13 -0
  28. data/app/views/layouts/policy_manager/mailer.text.erb +1 -0
  29. data/app/views/policy_manager/categories/index.html.erb +6 -12
  30. data/app/views/policy_manager/categories/show.html.erb +13 -20
  31. data/app/views/policy_manager/portability_mailer/completed_notification.erb +7 -0
  32. data/app/views/policy_manager/portability_mailer/progress_notification.erb +3 -0
  33. data/app/views/policy_manager/portability_requests/index.html.erb +42 -0
  34. data/app/views/policy_manager/portability_requests/index.json.jbuilder +5 -0
  35. data/app/views/policy_manager/terms/_form.html.erb +12 -11
  36. data/app/views/policy_manager/terms/edit.html.erb +6 -4
  37. data/app/views/policy_manager/terms/index.html.erb +12 -13
  38. data/app/views/policy_manager/terms/new.html.erb +5 -3
  39. data/app/views/policy_manager/terms/show.html.erb +12 -10
  40. data/app/views/policy_manager/user_portability_requests/index.html.erb +42 -0
  41. data/app/views/policy_manager/user_portability_requests/index.json.jbuilder +5 -0
  42. data/app/views/policy_manager/user_terms/pending.html.erb +10 -6
  43. data/app/views/policy_manager/user_terms/show.html.erb +7 -8
  44. data/app/views/policy_manager/user_terms/show.json.jbuilder +15 -8
  45. data/config/locales/en.yml +122 -0
  46. data/config/locales/es.yml +122 -0
  47. data/config/routes.rb +15 -6
  48. data/db/migrate/20180326193825_create_policy_manager_terms.rb +1 -0
  49. data/db/migrate/20180410171354_create_policy_manager_portability_requests.rb +18 -0
  50. data/lib/policy_manager/anonimizer.rb +18 -0
  51. data/lib/policy_manager/config.rb +35 -1
  52. data/lib/policy_manager/exporter/handler.rb +110 -0
  53. data/lib/policy_manager/exporter/paginator_renderer.rb +74 -0
  54. data/lib/policy_manager/exporter/view.rb +108 -0
  55. data/lib/policy_manager/exporter/zip_generator.rb +60 -0
  56. data/lib/policy_manager/exporter.rb +75 -0
  57. data/lib/policy_manager/portability_rule.rb +15 -0
  58. data/lib/policy_manager/rule.rb +21 -4
  59. data/lib/policy_manager/script.rb +56 -0
  60. data/lib/policy_manager/templates/index.html.erb +1 -0
  61. data/lib/policy_manager/version.rb +1 -1
  62. data/lib/policy_manager.rb +10 -0
  63. metadata +160 -19
  64. data/app/controllers/policy_manager/dashboard_controller.rb +0 -6
  65. data/app/helpers/policy_manager/categories_helper.rb +0 -4
  66. data/app/helpers/policy_manager/dashboard_helper.rb +0 -4
  67. data/app/helpers/policy_manager/terms_categories_helper.rb +0 -4
  68. data/app/views/policy_manager/categories/_form.html.erb +0 -22
  69. data/app/views/policy_manager/categories/edit.html.erb +0 -6
  70. data/app/views/policy_manager/categories/new.html.erb +0 -5
  71. data/app/views/policy_manager/dashboard/index.erb +0 -33
  72. data/app/views/policy_manager/terms_categories/_form.html.erb +0 -17
  73. data/app/views/policy_manager/terms_categories/edit.html.erb +0 -6
  74. data/app/views/policy_manager/terms_categories/index.html.erb +0 -24
  75. data/app/views/policy_manager/terms_categories/new.html.erb +0 -5
  76. data/app/views/policy_manager/terms_categories/show.html.erb +0 -4
  77. data/app/views/policy_manager/user_terms/_form.html.erb +0 -17
  78. data/app/views/policy_manager/user_terms/edit.html.erb +0 -6
  79. data/app/views/policy_manager/user_terms/index.html.erb +0 -24
  80. data/app/views/policy_manager/user_terms/new.html.erb +0 -5
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -1,13 +1,14 @@
1
+ <h2><%= I18n.t("terms_app.categories.index.title") %></h2>
1
2
 
2
- <h1>Categories</h1>
3
3
 
4
+ <%= chart ->{PolicyManager::UserTerm.group_by_day(:created_at, format: "%a").count} %>
4
5
 
5
6
  <div class="table-responsive">
6
7
  <table class="table table-striped table-sm">
7
8
  <thead>
8
9
  <tr>
9
- <th>Name</th>
10
- <th>Articles</th>
10
+ <th><%= I18n.t("terms_app.categories.index.table.name") %></th>
11
+ <th><%= I18n.t("terms_app.categories.index.table.terms") %></th>
11
12
  <th colspan="3"></th>
12
13
  </tr>
13
14
  </thead>
@@ -17,16 +18,9 @@
17
18
  <tr>
18
19
  <td><%= category.name %></td>
19
20
  <td><%= category.terms.size %></td>
20
- <td><%= link_to 'Show', category %></td>
21
- <td><%= link_to 'Edit', edit_category_path(category) %></td>
22
- <td><%= link_to 'Destroy', category, method: :delete, data: { confirm: 'Are you sure?' } %></td>
21
+ <td><%= link_to I18n.t("terms_app.categories.index.table.show"), category_path(category.name) %></td>
23
22
  </tr>
24
23
  <% end %>
25
24
  </tbody>
26
25
  </table>
27
-
28
- </div>
29
-
30
- <br>
31
-
32
- <%= link_to 'New Category', new_category_path %>
26
+ </div>
@@ -1,25 +1,19 @@
1
+ <h2><%= I18n.t("terms_app.categories.show.title", name: @category.name) %></h2>
1
2
 
2
- <p>
3
- <strong>Name:</strong>
4
- <%= @category.name %>
5
- </p>
6
-
7
-
8
- <%= link_to 'New Article', new_category_term_path(@category), class: " btn btn-success float-right" %>
9
-
10
- <%= link_to 'Edit', edit_category_path(@category), class: "btn btn-default" %> |
11
- <%= link_to 'Back', categories_path , class: "btn btn-default"%>
12
-
13
-
3
+ <div class="float-right">
4
+ <%= link_to I18n.t("terms_app.misc.back"), categories_path, class: " btn btn-primary" %>
5
+ <%= link_to I18n.t("terms_app.categories.show.new"), new_category_term_path(@category.name), class: " btn btn-success"%>
6
+ </div>
14
7
 
15
8
  <div class="table-responsive">
16
9
  <table class="table table-striped table-sm">
17
10
  <thead>
18
11
  <tr>
19
- <th>ID</th>
20
- <th>content</th>
21
- <th>updated at</th>
22
- <th colspan="3"></th>
12
+ <th><%= I18n.t("terms_app.categories.show.table.id") %></th>
13
+ <th><%= I18n.t("terms_app.categories.show.table.content") %></th>
14
+ <th><%= I18n.t("terms_app.categories.show.table.state") %></th>
15
+ <th><%= I18n.t("terms_app.categories.show.table.updated_at") %></th>
16
+ <th></th>
23
17
  </tr>
24
18
  </thead>
25
19
 
@@ -27,11 +21,10 @@
27
21
  <% @category.terms.each do |term| %>
28
22
  <tr>
29
23
  <td><%= term.id %></td>
30
- <td><%= truncate(term.description, length: 17, separator: " ", omission: '... (more)') %></td>
24
+ <td><%= truncate(term.description, length: 17, separator: " ", omission: '...') %></td>
25
+ <td><%= I18n.t("terms_app.states.#{term.state}") %></td>
31
26
  <td><%= term.updated_at %></td>
32
- <td><%= link_to 'Show', category_term_path(@category, term) %></td>
33
- <td><%= link_to 'Edit', edit_category_term_path(@category, term) %></td>
34
- <td><%= link_to 'Destroy', category_term_path(@category, term), method: :delete, data: { confirm: 'Are you sure?' } %></td>
27
+ <td><%= link_to I18n.t("terms_app.categories.show.table.show"), category_term_path(@category.name, term) %></td>
35
28
  </tr>
36
29
  <% end %>
37
30
  </tbody>
@@ -0,0 +1,7 @@
1
+ <p>Hi , your complete data was processed and can be downloaded at</p>
2
+
3
+ <%= link_to "download file", @portability_request.attachment.expiring_url(PolicyManager::Config.exporter.expiration_link) %>
4
+
5
+
6
+
7
+
@@ -0,0 +1,3 @@
1
+ <p>hello your files are being downloaded</p>
2
+
3
+ best
@@ -0,0 +1,42 @@
1
+ <h2><%= I18n.t("terms_app.portability_requests.index.title") %></h2>
2
+
3
+ <% if @portability_requests.size == 0 %>
4
+ <p><%= I18n.t("terms_app.portability_requests.index.empty") %></p>
5
+ <% else %>
6
+
7
+ <%= chart ->{PolicyManager::PortabilityRequest.group_by_day(:created_at).count} %>
8
+
9
+ <div class="table-responsive">
10
+ <table class="table table-striped table-sm">
11
+ <thead>
12
+ <tr>
13
+ <th><%= I18n.t("terms_app.portability_requests.index.table.user") %></th>
14
+ <th><%= I18n.t("terms_app.portability_requests.index.table.state") %></th>
15
+ <th><%= I18n.t("terms_app.portability_requests.index.table.created_at") %></th>
16
+ <!--<th>Expire at</th>-->
17
+ <th colspan="2"></th>
18
+ </tr>
19
+ </thead>
20
+
21
+ <tbody>
22
+ <% @portability_requests.each do |portability_request| %>
23
+ <tr>
24
+ <td><%= portability_request.user.email %></td>
25
+ <td><%= I18n.t("terms_app.portability_requests.index.states.#{portability_request.state}") %></td>
26
+ <td><%= portability_request.created_at %></td>
27
+ <!--<td><%= portability_request.expire_at %></td>-->
28
+ <td>
29
+ <%= link_to I18n.t("terms_app.portability_requests.index.table.confirm"), confirm_portability_request_path(portability_request), data: { confirm: I18n.t("terms_app.misc.are_you_sure") } if portability_request.pending?
30
+ %>
31
+
32
+ </td>
33
+ <td><%= link_to I18n.t("terms_app.portability_requests.index.table.destroy"), portability_request, method: :delete, data: { confirm: I18n.t("terms_app.misc.are_you_sure") } %></td>
34
+ </tr>
35
+ <% end %>
36
+ </tbody>
37
+ </table>
38
+
39
+ <%= will_paginate @portability_requests, :style => 'letter-spacing: 5px' %>
40
+
41
+ </div>
42
+ <% end %>
@@ -0,0 +1,5 @@
1
+ json.portability_requests @portability_requests do |portability_request|
2
+ json.state portability_request.state
3
+ json.attachment portability_request.attachment
4
+ json.expire_at portability_request.expire_at
5
+ end
@@ -1,10 +1,9 @@
1
-
2
1
  <% path = @term.persisted? ? category_term_path(params[:category_id], @term) : category_terms_path(params[:category_id]) %>
3
2
 
4
3
  <%= form_with(model: term, local: true, url: path ) do |form| %>
5
4
  <% if term.errors.any? %>
6
5
  <div id="error_explanation">
7
- <h2><%= pluralize(term.errors.count, "error") %> prohibited this term from being saved:</h2>
6
+ <h2><%= pluralize(term.errors.count, "error") %> <%= I18n.t("terms_app.terms.new.error") %></h2>
8
7
 
9
8
  <ul>
10
9
  <% term.errors.full_messages.each do |message| %>
@@ -14,17 +13,19 @@
14
13
  </div>
15
14
  <% end %>
16
15
 
17
- <div class="form-group">
18
- <%= form.select :category_id, PolicyManager::Category.all.map{|o| [o.name, o.id]}, :selected => params[:category_id] %>
19
- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
20
- </div>
21
- <div class="form-group">
22
- <%= form.label :description %>
23
- <%= form.text_area :description, id: :term_description, class: "form-control" %>
24
- </div>
16
+ <%= form.hidden_field :rule, value: params[:category_id] %>
17
+
18
+ <div class="form-group">
19
+ <label><%= I18n.t("terms_app.terms.new.state") %></label>
20
+ <%= form.select :state, PolicyManager::Term.aasm.states.collect{ |state| [I18n.t("terms_app.states.#{state}"), state] }%>
21
+ </div>
25
22
 
26
- <%= form.submit class: "btn btn-primary" %>
23
+ <div class="form-group">
24
+ <%= form.label I18n.t("terms_app.terms.new.description") %>
25
+ <%= form.text_area :description, id: :term_description, class: "form-control" %>
26
+ </div>
27
27
 
28
+ <%= form.submit class: "btn btn-success", value: I18n.t("terms_app.misc.save") %>
28
29
  <% end %>
29
30
 
30
31
  <script>
@@ -1,6 +1,8 @@
1
- <h1>Editing Term</h1>
1
+ <h2><%= I18n.t("terms_app.terms.edit.title", name: @term.rule.name) %></h2>
2
2
 
3
- <%= render 'form', term: @term %>
3
+ <div class="float-right">
4
+ <%= link_to I18n.t("terms_app.misc.back"), category_path(@term.rule.name), class: "btn btn-primary" %>
5
+ <%= link_to I18n.t("terms_app.misc.show"), category_term_path(@term.rule.name, @term), class: "btn btn-success" %>
6
+ </div>
4
7
 
5
- <%= link_to 'Show', category_term_path(@term.category, @term) %> |
6
- <%= link_to 'Back', category_terms_path %>
8
+ <%= render 'form', term: @term %>
@@ -1,13 +1,16 @@
1
+ <h2><%= I18n.t("terms_app.terms.index.title") %></h2>
1
2
 
2
- <h2>Terms</h2>
3
+ <div class="float-right">
4
+ <%= link_to I18n.t("terms_app.terms.index.button"), new_category_term_path(params[:category_id]), class: "btn btn-success" %>
5
+ </div>
3
6
 
4
7
  <div class="table-responsive">
5
8
  <table class="table table-striped table-sm">
6
9
  <thead>
7
10
  <tr>
8
- <th>Description</th>
9
- <th>Category</th>
10
- <th>updated at</th>
11
+ <th><%= I18n.t("terms_app.terms.index.table.description") %></th>
12
+ <th><%= I18n.t("terms_app.terms.index.table.category") %></th>
13
+ <th><%= I18n.t("terms_app.terms.index.table.updated_at") %></th>
11
14
  <th colspan="3"></th>
12
15
  </tr>
13
16
  </thead>
@@ -15,19 +18,15 @@
15
18
  <tbody>
16
19
  <% @terms.each do |term| %>
17
20
  <tr>
18
- <td><%= truncate(term.description, length: 170, separator: " ", omission: '... (more)') %></td>
19
- <td><%= term.category.name %></td>
21
+ <td><%= truncate(term.description, length: 170, separator: " ", omission: '...') %></td>
22
+ <td><%= term.rule.name %></td>
20
23
  <td><%= term.updated_at %></td>
21
- <td><%= link_to 'Show', category_term_path(term.category,term) %></td>
22
- <td><%= link_to 'Edit', edit_category_term_path(term.category,term) %></td>
23
- <td><%= link_to 'Destroy', category_term_path(term.category, term), method: :delete, data: { confirm: 'Are you sure?' } %></td>
24
+ <td><%= link_to I18n.t("terms_app.terms.index.table.show"), category_term_path(term.rule.name,term) %></td>
25
+ <td><%= link_to I18n.t("terms_app.terms.index.table.edit"), edit_category_term_path(term.rule.name,term) %></td>
26
+ <td><%= link_to I18n.t("terms_app.terms.index.table.destroy"), category_term_path(term.rule.name, term), method: :delete, data: { confirm: I18n.t("terms_app.misc.are_you_sure") } %></td>
24
27
  </tr>
25
28
  <% end %>
26
29
  </tbody>
27
30
  </table>
28
31
 
29
32
  </div>
30
-
31
- <br>
32
-
33
- <%= link_to 'New Term', new_category_term_path(params[:category_id]) %>
@@ -1,5 +1,7 @@
1
- <h1>New Term</h1>
1
+ <h2><%= I18n.t("terms_app.terms.new.title", name: params[:category_id]) %></h2>
2
2
 
3
- <%= render 'form', term: @term %>
3
+ <div class="float-right">
4
+ <%= link_to I18n.t("terms_app.misc.back"), category_terms_path(params[:category_id]), class: " btn btn-primary" %>
5
+ </div>
4
6
 
5
- <%= link_to 'Back', category_terms_path(params[:category_id]) %>
7
+ <%= render 'form', term: @term %>
@@ -1,16 +1,18 @@
1
+ <h2><%= I18n.t("terms_app.terms.show.title") %> <%= @term.rule.name %></h2>
1
2
 
2
3
  <div class="float-right">
3
- published in
4
+ <%= link_to I18n.t("terms_app.misc.back"), category_path(@term.rule.name), class: "btn btn-primary" %>
5
+ <%= link_to I18n.t("terms_app.misc.edit"), edit_category_term_path(@term.rule.name, @term), class: "btn btn-success" %>
6
+ </div>
7
+
4
8
  <span class="badge badge-pill badge-primary">
5
- <%= @term.category.name %>
9
+ <%= I18n.t("terms_app.states.#{@term.state}") %>
6
10
  </span>
7
- <br/>
8
- <span class="text-muted">
9
- last updated on <%= @term.updated_at %>
10
- </span>
11
- </div>
12
11
 
13
- <%= raw @term.to_html %>
12
+ <span class="text-muted">
13
+ <%= I18n.t("terms_app.terms.show.last_update") %> <%= @term.updated_at %>
14
+ </span>
15
+
16
+ <hr />
14
17
 
15
- <%= link_to 'Edit', edit_category_term_path(@term.category, @term) %> |
16
- <%= link_to 'Back', category_terms_path(@term.category) %>
18
+ <%= raw @term.to_html %>
@@ -0,0 +1,42 @@
1
+ <h2><%= I18n.t("terms_app.user_portability_requests.index.title") %></h2>
2
+
3
+ <% if @user_portability_requests.any? %>
4
+ <div class="table-responsive">
5
+ <table class="table table-striped table-sm">
6
+ <thead>
7
+ <tr>
8
+ <th><%= I18n.t("terms_app.user_portability_requests.index.table.state") %></th>
9
+ <th><%= I18n.t("terms_app.user_portability_requests.index.table.file") %></th>
10
+ <th><%= I18n.t("terms_app.user_portability_requests.index.table.created_at") %></th>
11
+ <!--<th>Expire at</th>-->
12
+ <th></th>
13
+ </tr>
14
+ </thead>
15
+
16
+ <tbody>
17
+ <% @user_portability_requests.each do |portability_request| %>
18
+ <tr>
19
+ <td><%= I18n.t("terms_app.user_portability_requests.index.states.#{portability_request.state}") %></td>
20
+ <% if portability_request.completed? %>
21
+ <td><%= link_to I18n.t("terms_app.misc.download"), portability_request.attachment.expiring_url(60) %></td>
22
+ <% else %>
23
+ <td></td>
24
+ <% end %>
25
+ <td><%= portability_request.created_at %></td>
26
+ <!--<td><%= portability_request.expire_at %></td>-->
27
+ <td><%= link_to I18n.t("terms_app.user_portability_requests.index.table.destroy"), user_portability_request_url(portability_request.id), method: :delete, data: { confirm: I18n.t("terms_app.misc.are_you_sure") } %></td>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
32
+ </div>
33
+
34
+ <%= will_paginate @user_portability_requests, :style => 'letter-spacing: 5px' %>
35
+
36
+ <br/>
37
+
38
+ <% else %>
39
+ <p><%= I18n.t("terms_app.user_portability_requests.index.empty") %></p>
40
+ <% end %>
41
+
42
+ <%= link_to I18n.t("terms_app.user_portability_requests.index.button"), user_portability_requests_path, class: "btn btn-success", method: :post, data: { confirm: I18n.t("terms_app.misc.are_you_sure") } %>
@@ -0,0 +1,5 @@
1
+ json.portability_requests current_user.portability_requests do |portability_request|
2
+ json.state portability_request.state
3
+ json.attachment portability_request.attachment
4
+ json.expire_at portability_request.expire_at
5
+ end
@@ -1,7 +1,11 @@
1
- <h2>Pending Policies </h2>
1
+ <h2><%= I18n.t("terms_app.user_terms.pending.title") %></h2>
2
2
 
3
- <ul>
4
- <% @pending_policies.each do |category| %>
5
- <li><%= link_to category.name, user_term_path(category.id) %></li>
6
- <% end %>
7
- </ul>
3
+ <% if @pending_policies.size == 0 %>
4
+ <p><%= I18n.t("terms_app.user_terms.pending.empty") %></p>
5
+ <% else %>
6
+ <ul>
7
+ <% @pending_policies.each do |category| %>
8
+ <li><%= link_to category.name, user_term_path(category.name) %></li>
9
+ <% end %>
10
+ </ul>
11
+ <% end %>
@@ -1,4 +1,3 @@
1
-
2
1
  <%= raw @term.to_html %>
3
2
 
4
3
  <hr/>
@@ -6,12 +5,12 @@
6
5
  <% if @user_term.persisted? && @user_term.state == "accepted" %>
7
6
 
8
7
  <div>
9
- <strong>THIS POLICY HAS ALREADY BEEN ACCEPTED</strong>
10
- <br/> change your mind ??
8
+ <strong><%= I18n.t("terms_app.user_terms.show.accepted.message") %></strong>
9
+ <br/><%= I18n.t("terms_app.user_terms.show.accepted.question") %>
11
10
 
12
11
  <%= form_with model: @user_term, url: reject_user_term_path(params[:id]), method: :put, local: true do |f| %>
13
- <%= f.submit "reject", class: "btn btn-danger" %>
14
- <a href="" class="btn btn-secondary">not now</a>
12
+ <%= f.submit I18n.t("terms_app.user_terms.show.accepted.reject"), class: "btn btn-danger" %>
13
+ <%= link_to I18n.t("terms_app.user_terms.show.pending.not_now"), pending_user_terms_path, class: "btn btn-secondary" %>
15
14
  <% end %>
16
15
 
17
16
  </div>
@@ -19,13 +18,13 @@
19
18
  <% else %>
20
19
  <strong>
21
20
  <%= current_user.email %>
22
- </strong> please accept terms
21
+ </strong> <%= I18n.t("terms_app.user_terms.show.pending.message") %>
23
22
 
24
23
  <hr/>
25
24
 
26
25
  <%= form_with model: @user_term, url: accept_user_term_path(params[:id]), method: :put, local: true do |f| %>
27
- <%= f.submit "accept", class: "btn btn-success" %>
28
- <a href="" class="btn btn-secondary">not now</a>
26
+ <%= f.submit I18n.t("terms_app.user_terms.show.pending.agree"), class: "btn btn-success" %>
27
+ <%= link_to I18n.t("terms_app.user_terms.show.pending.not_now"), pending_user_terms_path, class: "btn btn-secondary" %>
29
28
  <% end %>
30
29
 
31
30
  <hr/>
@@ -1,11 +1,18 @@
1
- json.body raw( @term.to_html)
1
+ json.body raw(@term.to_html)
2
2
 
3
3
  if @user_term.persisted? && @user_term.state == "accepted"
4
- json.message "THIS POLICY HAS ALREADY BEEN ACCEPTED"
5
- json.url reject_user_term_path(params[:id])
6
- json.method :put
7
- else
8
- json.message "#{current_user.email} please accept terms"
9
- json.url accept_user_term_path(params[:id])
10
- json.method :put
4
+ json.status "accepted"
5
+ json.message "#{I18n.t("terms_app.user_terms.show.accepted.message")}"
6
+ json.url reject_user_term_path(params[:id])
7
+ json.method :put
8
+ elsif current_user.present?
9
+ json.status "pending"
10
+ json.message "#{current_user.email} #{I18n.t("terms_app.user_terms.show.pending.message")}"
11
+ json.url accept_user_term_path(params[:id])
12
+ json.method :put
13
+ else
14
+ json.status @user_term.state
15
+ json.message "#{I18n.t("terms_app.user_terms.show.pending.message")} #{params[:id]}"
16
+ json.url accept_user_term_path(params[:id])
17
+ json.method :put
11
18
  end
@@ -0,0 +1,122 @@
1
+ en:
2
+ terms_app:
3
+ title: PolicyManager
4
+ sub_title: PolicyManager
5
+ sign_out: Logout
6
+ menu:
7
+ policies: Policies
8
+ portability_requests: Portability requests
9
+ user_portability_requests: My Portability requests
10
+ user_pending_policies: My pending policies
11
+ misc:
12
+ back: Back
13
+ edit: Edit
14
+ show: Show
15
+ save: Save
16
+ download: Download
17
+ are_you_sure: Are you sure?
18
+ states:
19
+ draft: Draft
20
+ published: Published
21
+ categories:
22
+ index:
23
+ title: Policies
24
+ table:
25
+ name: Name
26
+ terms: Terms
27
+ show: Show
28
+ show:
29
+ title: "%{name} Policy"
30
+ new: New Term
31
+ table:
32
+ id: Id
33
+ content: Content
34
+ state: State
35
+ updated_at: Updated at
36
+ show: Show
37
+ terms:
38
+ index:
39
+ title: Terms
40
+ button: New Term
41
+ table:
42
+ description: Description
43
+ category: Policy
44
+ updated_at: Updated at
45
+ show: Show
46
+ edit: Edit
47
+ destroy: Delete
48
+ new:
49
+ title: "%{name} new term"
50
+ state: State
51
+ description: Description
52
+ button: Button
53
+ error: error saving term
54
+ created: Successfully created
55
+ updated: Successfully updated
56
+ destroyed: Successfully deleted
57
+ edit:
58
+ title: Edit %{name} term
59
+ state: State
60
+ description: Description
61
+ error: saving term
62
+ show:
63
+ title: Term
64
+ last_update: Last update
65
+ table:
66
+ name: Name
67
+ terms: Terms
68
+ show: Show
69
+ user_terms:
70
+ pending:
71
+ title: My pending policies
72
+ empty: There are no pending policies
73
+ show:
74
+ accepted:
75
+ message: Accepted policy
76
+ question: Change your mind?
77
+ reject: Reject
78
+ not_now: No not now
79
+ pending:
80
+ message: Please accept this policy
81
+ agree: Accept
82
+ not_now: No not now
83
+ user_portability_requests:
84
+ index:
85
+ title: My portability requests
86
+ empty: There are no portability requests
87
+ table:
88
+ state: State
89
+ file: File
90
+ created_at: Created at
91
+ destroy: Delete
92
+ button: New portability request
93
+ states:
94
+ pending: Pending
95
+ progress: In progress
96
+ completed: Completed
97
+ has_pending: You have one pending information request, you can't create another one yet.
98
+ created: Information Request Submitted!
99
+ portability_requests:
100
+ index:
101
+ title: Pending requests
102
+ destroyed: Successfully deleted
103
+ empty: There is no requests
104
+ table:
105
+ user: User
106
+ state: State
107
+ created_at: Created at
108
+ destroy: Delete
109
+ confirm: Confirm
110
+ states:
111
+ pending: Pending
112
+ progress: In Progress
113
+ completed: Completed
114
+ mails:
115
+ progress:
116
+ subject: Your data is being handled
117
+ completed:
118
+ subject: Your data is available
119
+ will_paginate:
120
+ previous_label: "&lt;"
121
+ next_label: "&gt;"
122
+ page_gap: "&hellip;"