decidim-admin 0.4.4 → 0.5.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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/admin/application.js.es6 +3 -0
  3. data/app/assets/javascripts/decidim/admin/participatory_processes.js.es6 +12 -0
  4. data/app/assets/javascripts/decidim/admin/scopes.js.es6 +20 -0
  5. data/app/assets/javascripts/decidim/admin/select2.js.es6 +8 -0
  6. data/app/assets/stylesheets/decidim/admin/_decidim.scss +2 -0
  7. data/app/assets/stylesheets/decidim/admin/extra/_categories.scss +1 -1
  8. data/app/assets/stylesheets/decidim/admin/extra/_login.scss +1 -1
  9. data/app/assets/stylesheets/decidim/admin/extra/_sort.scss +1 -1
  10. data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +3 -0
  11. data/app/assets/stylesheets/decidim/admin/modules/_callouts.scss +0 -1
  12. data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +47 -0
  13. data/app/assets/stylesheets/decidim/admin/modules/_secondary-nav.scss +2 -2
  14. data/app/assets/stylesheets/decidim/admin/modules/_typography.scss +1 -1
  15. data/app/assets/stylesheets/decidim/admin/plugins/_select2.scss +27 -0
  16. data/app/assets/stylesheets/decidim/admin/utils/_toggle-expand.scss +1 -1
  17. data/app/commands/decidim/admin/close_session_managed_user.rb +44 -0
  18. data/app/commands/decidim/admin/create_feature.rb +2 -1
  19. data/app/commands/decidim/admin/create_managed_user.rb +61 -0
  20. data/app/commands/decidim/admin/create_scope.rb +7 -2
  21. data/app/commands/decidim/admin/create_scope_type.rb +40 -0
  22. data/app/commands/decidim/admin/impersonate_managed_user.rb +61 -0
  23. data/app/commands/decidim/admin/promote_managed_user.rb +56 -0
  24. data/app/commands/decidim/admin/update_participatory_process.rb +3 -1
  25. data/app/commands/decidim/admin/update_scope.rb +4 -1
  26. data/app/commands/decidim/admin/update_scope_type.rb +45 -0
  27. data/app/controllers/decidim/admin/application_controller.rb +2 -1
  28. data/app/controllers/decidim/admin/categories_controller.rb +3 -3
  29. data/app/controllers/decidim/admin/exports_controller.rb +1 -1
  30. data/app/controllers/decidim/admin/managed_users/impersonations_controller.rb +78 -0
  31. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +43 -0
  32. data/app/controllers/decidim/admin/managed_users_controller.rb +69 -0
  33. data/app/controllers/decidim/admin/moderations_controller.rb +4 -4
  34. data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
  35. data/app/controllers/decidim/admin/participatory_processes_controller.rb +0 -5
  36. data/app/controllers/decidim/admin/scope_types_controller.rb +79 -0
  37. data/app/controllers/decidim/admin/scopes_controller.rb +22 -7
  38. data/app/controllers/decidim/admin/user_groups_controller.rb +1 -1
  39. data/app/controllers/decidim/admin/users_controller.rb +1 -2
  40. data/app/forms/decidim/admin/impersonate_managed_user_form.rb +20 -0
  41. data/app/forms/decidim/admin/managed_user_form.rb +35 -0
  42. data/app/forms/decidim/admin/managed_user_promotion_form.rb +13 -0
  43. data/app/forms/decidim/admin/participatory_process_form.rb +2 -0
  44. data/app/forms/decidim/admin/scope_form.rb +17 -6
  45. data/app/forms/decidim/admin/scope_type_form.rb +21 -0
  46. data/app/helpers/decidim/admin/scopes_helper.rb +46 -0
  47. data/app/helpers/decidim/admin/settings_helper.rb +12 -1
  48. data/app/jobs/decidim/admin/expire_impersonation_job.rb +16 -0
  49. data/app/models/decidim/admin/abilities/admin_ability.rb +17 -0
  50. data/app/models/decidim/admin/abilities/user_manager_ability.rb +30 -0
  51. data/app/views/decidim/admin/categories/_form.html.erb +1 -1
  52. data/app/views/decidim/admin/categories/edit.html.erb +1 -1
  53. data/app/views/decidim/admin/categories/index.html.erb +7 -7
  54. data/app/views/decidim/admin/categories/new.html.erb +1 -1
  55. data/app/views/decidim/admin/features/_form.html.erb +6 -3
  56. data/app/views/decidim/admin/features/_settings_fields.html.erb +2 -1
  57. data/app/views/decidim/admin/managed_users/_form.html.erb +12 -0
  58. data/app/views/decidim/admin/managed_users/impersonations/_form.html.erb +10 -0
  59. data/app/views/decidim/admin/managed_users/impersonations/index.html.erb +34 -0
  60. data/app/views/decidim/admin/managed_users/impersonations/new.html.erb +15 -0
  61. data/app/views/decidim/admin/managed_users/index.html.erb +44 -0
  62. data/app/views/decidim/admin/managed_users/new.html.erb +47 -0
  63. data/app/views/decidim/admin/managed_users/promotions/_form.html.erb +3 -0
  64. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +21 -0
  65. data/app/views/decidim/admin/moderations/index.html.erb +4 -4
  66. data/app/views/decidim/admin/participatory_process_copies/_form.html.erb +1 -1
  67. data/app/views/decidim/admin/participatory_process_user_roles/edit.html.erb +1 -1
  68. data/app/views/decidim/admin/participatory_processes/_form.html.erb +13 -8
  69. data/app/views/decidim/admin/participatory_processes/index.html.erb +1 -1
  70. data/app/views/decidim/admin/scope_types/_form.html.erb +7 -0
  71. data/app/views/decidim/admin/scope_types/edit.html.erb +13 -0
  72. data/app/views/decidim/admin/scope_types/index.html.erb +40 -0
  73. data/app/views/decidim/admin/scope_types/new.html.erb +13 -0
  74. data/app/views/decidim/admin/scopes/_form.html.erb +12 -2
  75. data/app/views/decidim/admin/scopes/index.html.erb +19 -7
  76. data/app/views/decidim/admin/scopes/new.html.erb +1 -1
  77. data/app/views/decidim/admin/users/_form.html.erb +4 -0
  78. data/app/views/decidim/admin/users/index.html.erb +2 -0
  79. data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
  80. data/app/views/layouts/decidim/admin/pages.html.erb +1 -1
  81. data/app/views/layouts/decidim/admin/participatory_process.html.erb +4 -4
  82. data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +1 -1
  83. data/app/views/layouts/decidim/admin/settings.html.erb +4 -1
  84. data/app/views/layouts/decidim/admin/users.html.erb +8 -3
  85. data/config/i18n-tasks.yml +2 -1
  86. data/config/locales/ca.yml +80 -3
  87. data/config/locales/en.yml +82 -2
  88. data/config/locales/es.yml +80 -3
  89. data/config/locales/eu.yml +44 -7
  90. data/config/locales/fi.yml +0 -7
  91. data/config/locales/fr.yml +21 -6
  92. data/config/locales/it.yml +0 -10
  93. data/config/locales/nl.yml +1 -1
  94. data/config/locales/pl.yml +7 -0
  95. data/config/routes.rb +24 -11
  96. data/lib/decidim/admin/engine.rb +6 -3
  97. data/lib/decidim/admin/test/manage_attachments_examples.rb +77 -79
  98. metadata +56 -9
  99. data/app/views/decidim/admin/participatory_processes/show.html.erb +0 -54
@@ -1,4 +1,4 @@
1
- <%= decidim_form_for(@form, url: participatory_process_categories_path(current_participatory_process), html: { class: "form new_participatory_process_category" }) do |f| %>
1
+ <%= decidim_form_for(@form, url: categories_path(current_participatory_process), html: { class: "form new_participatory_process_category" }) do |f| %>
2
2
  <%= render partial: 'form', object: f, locals: { title: t('.title') } %>
3
3
 
4
4
  <div class="button--double form-general-submit">
@@ -20,7 +20,8 @@
20
20
  locals: {
21
21
  form: settings_fields,
22
22
  feature: @feature,
23
- settings_name: "global"
23
+ settings_name: "global",
24
+ tabs_prefix: "global-settings"
24
25
  } %>
25
26
  <% end %>
26
27
  </div>
@@ -46,7 +47,8 @@
46
47
  locals: {
47
48
  form: settings_fields,
48
49
  feature: feature,
49
- settings_name: "step"
50
+ settings_name: "step",
51
+ tabs_prefix: "step-#{step.id}-settings"
50
52
  } %>
51
53
  <% end %>
52
54
  <% end %>
@@ -67,7 +69,8 @@
67
69
  locals: {
68
70
  form: settings_fields,
69
71
  feature: @feature,
70
- settings_name: "step"
72
+ settings_name: "step",
73
+ tabs_prefix: "default-step-settings"
71
74
  } %>
72
75
  <% end %>
73
76
  </div>
@@ -3,6 +3,7 @@
3
3
  form,
4
4
  attribute,
5
5
  name,
6
- label: t("decidim.features.#{feature.manifest.name}.settings.#{settings_name}.#{name}")
6
+ label: t("decidim.features.#{feature.manifest.name}.settings.#{settings_name}.#{name}"),
7
+ tabs_prefix: tabs_prefix
7
8
  )%>
8
9
  <% end %>
@@ -0,0 +1,12 @@
1
+ <div class="row column">
2
+ <%= form.text_field :name, label: t('.name') %>
3
+
4
+ <%= form.fields_for :authorization, form.object.authorization, builder: Decidim::AuthorizationFormBuilder do |f| %>
5
+ <% if lookup_context.exists?(form.object.authorization.to_partial_path, [], true) %>
6
+ <%= render partial: form.object.authorization.to_partial_path, locals: { handler: form.object.authorization, form: f } %>
7
+ <% else %>
8
+ <%= f.all_fields %>
9
+ <% end %>
10
+ <%= f.hidden_field :handler_name %>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,10 @@
1
+ <div class="row column">
2
+ <%= form.fields_for :authorization, form.object.authorization, builder: Decidim::AuthorizationFormBuilder do |f| %>
3
+ <% if lookup_context.exists?(form.object.authorization.to_partial_path, [], true) %>
4
+ <%= render partial: form.object.authorization.to_partial_path, locals: { handler: form.object.authorization, form: f } %>
5
+ <% else %>
6
+ <%= f.all_fields %>
7
+ <% end %>
8
+ <%= f.hidden_field :handler_name %>
9
+ <% end %>
10
+ </div>
@@ -0,0 +1,34 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t "decidim.admin.titles.impersonations" %>
5
+ </h2>
6
+ </div>
7
+ <div class="card-section">
8
+ <div class="table-scroll">
9
+ <table class="table-list">
10
+ <thead>
11
+ <tr>
12
+ <th><%= t("models.impersonation_log.fields.admin", scope: "decidim.admin") %></th>
13
+ <th><%= t("models.impersonation_log.fields.user", scope: "decidim.admin") %></th>
14
+ <th><%= t("models.impersonation_log.fields.started_at", scope: "decidim.admin") %></th>
15
+ <th><%= t("models.impersonation_log.fields.ended_at", scope: "decidim.admin") %></th>
16
+ <th><%= t("models.impersonation_log.fields.expired_at", scope: "decidim.admin") %></th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <% @impersonation_logs.each do |impersonation_log| %>
21
+ <tr>
22
+ <td><%= impersonation_log.admin.name %></td>
23
+ <td><%= impersonation_log.user.name %></td>
24
+ <td><%= impersonation_log.started_at ? l(impersonation_log.started_at, format: :long) : nil %></td>
25
+ <td><%= impersonation_log.ended_at ? l(impersonation_log.ended_at, format: :long) : nil %></td>
26
+ <td><%= impersonation_log.expired_at ? l(impersonation_log.expired_at, format: :long) : nil %></td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+ <%= paginate @impersonation_logs, theme: "decidim" %>
32
+ </div>
33
+ </div>
34
+ </div>
@@ -0,0 +1,15 @@
1
+ <h2 class="process-title-summary">
2
+ <%= t('.new_managed_user_impersonation') %>
3
+ </h2>
4
+
5
+ <%= decidim_form_for(@form, url: managed_user_impersonations_path, html: { class: "form new_managed_user_impersonation" }) do |f| %>
6
+ <div class="card">
7
+ <div class="card-section">
8
+ <%= render partial: 'form', object: f %>
9
+ </div>
10
+ </div>
11
+
12
+ <div class="button--double form-general-submit">
13
+ <%= f.submit t(".impersonate") %>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,44 @@
1
+ <% if current_organization.available_authorizations.empty? %>
2
+ <div class="section">
3
+ <div class="callout warning">
4
+ <p><%= t('.needs_authoriation_warning') %></p>
5
+ </div>
6
+ </div>
7
+ <% end %>
8
+ <div class="card">
9
+ <div class="card-divider">
10
+ <h2 class="card-title">
11
+ <%= t "decidim.admin.titles.managed_users" %>
12
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.managed_user.name", scope: "decidim.admin")), ['new', 'managed_user'], class: "button tiny button--title #{'disabled' if current_organization.available_authorizations.empty?}" %>
13
+ </h2>
14
+ </div>
15
+ <div class="card-section">
16
+ <div class="table-scroll">
17
+ <table class="table-list">
18
+ <thead>
19
+ <tr>
20
+ <th><%= t("models.user.fields.name", scope: "decidim.admin") %></th>
21
+ <th></th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <% @managed_users.each do |user| %>
26
+ <tr>
27
+ <td><%= user.name %></td>
28
+ <td class="table-list__actions">
29
+ <% if can? :impersonate, user %>
30
+ <%= icon_link_to "account-login", new_managed_user_impersonation_path(user), t(".impersonate"), class: "action-icon--impersonate" %>
31
+ <% end %>
32
+ <%= icon_link_to "clock", managed_user_impersonations_path(user), t(".view_logs"), class: "action-icon--view-logs" %>
33
+ <% if can? :promote, user %>
34
+ <%= icon_link_to "badge", new_managed_user_promotion_path(user), t(".promote"), class: "action-icon--promote" %>
35
+ <% end %>
36
+ </td
37
+ </tr>
38
+ <% end %>
39
+ </tbody>
40
+ </table>
41
+ <%= paginate @managed_users, theme: "decidim" %>
42
+ </div>
43
+ </div>
44
+ </div>
@@ -0,0 +1,47 @@
1
+ <h2 class="process-title-summary">
2
+ <%= t('.new_managed_user') %>
3
+ <% if more_than_one_authorization? %>
4
+ <span class="text-muted float-right"><%= t('.step', current: params[:handler_name].present? ? 2 : 1, total: 2) %></span>
5
+ <% end %>
6
+ </h2>
7
+
8
+ <% if more_than_one_authorization? && params[:handler_name].nil? %>
9
+ <div class="card card--list">
10
+ <div class="card-divider">
11
+ <h2 class="card-title"><%= t ".select_authorization_method" %></h2>
12
+ </div>
13
+ <div class="card-section">
14
+ <% available_authorizations.each do |handler_name| %>
15
+ <div class="card--list__item">
16
+ <div class="card--list__text">
17
+ <a href="#">
18
+ <%= icon "lock-locked", class: "card--list__icon" %>
19
+ </a>
20
+ <div>
21
+ <h5 class="card--list__heading">
22
+ <%= link_to t("#{handler_name}.name", scope: "decidim.authorization_handlers"), new_managed_user_path(handler_name: handler_name) %>
23
+ </h5>
24
+ </div>
25
+ </div>
26
+ <div class="card--list__data">
27
+ <%= link_to new_managed_user_path(handler_name: handler_name), class: "card--list__data__icon" do %>
28
+ <%= icon "chevron-right" %>
29
+ <% end %>
30
+ </div>
31
+ </div>
32
+ <% end %>
33
+ </div>
34
+ </div>
35
+ <% else %>
36
+ <%= decidim_form_for(@form, html: { class: "form new_managed_user" }) do |f| %>
37
+ <div class="card">
38
+ <div class="card-section">
39
+ <%= render partial: 'form', object: f %>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="button--double form-general-submit">
44
+ <%= f.submit t(".create") %>
45
+ </div>
46
+ <% end %>
47
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="row column">
2
+ <%= form.text_field :email %>
3
+ </div>
@@ -0,0 +1,21 @@
1
+ <h2 class="process-title-summary">
2
+ <%= t('.new_managed_user_promotion') %>
3
+ </h2>
4
+
5
+ <div class="section">
6
+ <div class="callout warning">
7
+ <p><%= t('.explanation') %></p>
8
+ </div>
9
+ </div>
10
+
11
+ <%= decidim_form_for(@form, url: managed_user_promotions_path, html: { class: "form new_managed_user_promotion" }) do |f| %>
12
+ <div class="card">
13
+ <div class="card-section">
14
+ <%= render partial: 'form', object: f %>
15
+ </div>
16
+ </div>
17
+
18
+ <div class="button--double form-general-submit">
19
+ <%= f.submit t(".promote") %>
20
+ </div>
21
+ <% end %>
@@ -4,9 +4,9 @@
4
4
  <%= t(".title") %>
5
5
 
6
6
  <div class="card__filter">
7
- <%= link_to t("actions.not_hidden", scope: "decidim.moderations"), decidim_admin.participatory_process_moderations_path %>
7
+ <%= link_to t("actions.not_hidden", scope: "decidim.moderations"), moderations_path %>
8
8
  |
9
- <%= link_to t("actions.hidden", scope: "decidim.moderations"), decidim_admin.participatory_process_moderations_path(hidden: true) %>
9
+ <%= link_to t("actions.hidden", scope: "decidim.moderations"), moderations_path(hidden: true) %>
10
10
  </div>
11
11
  </h2>
12
12
  </div>
@@ -55,14 +55,14 @@
55
55
 
56
56
  <% if can? :unreport, moderation %>
57
57
  <%= icon_link_to "action-undo",
58
- decidim_admin.unreport_participatory_process_moderation_path(id: moderation),
58
+ decidim_admin.unreport_moderation_path(id: moderation),
59
59
  t("actions.unreport", scope: "decidim.moderations"),
60
60
  class: "action-icon--unreport",
61
61
  method: :put %>
62
62
  <% end %>
63
63
  <% if !moderation.reportable.hidden? && can?(:hide, moderation) %>
64
64
  <%= icon_link_to "eye",
65
- decidim_admin.hide_participatory_process_moderation_path(id: moderation),
65
+ decidim_admin.hide_moderation_path(id: moderation),
66
66
  t("actions.hide", scope: "decidim.moderations"),
67
67
  class: "action-icon--hide",
68
68
  method: :put %>
@@ -35,4 +35,4 @@
35
35
  </div>
36
36
  </div>
37
37
  </div>
38
- </div>
38
+ </div>
@@ -4,4 +4,4 @@
4
4
  <div class="button--double form-general-submit">
5
5
  <%= f.submit t(".update") %>
6
6
  </div>
7
- <% end %>
7
+ <% end %>
@@ -44,7 +44,6 @@
44
44
  </div>
45
45
  </div>
46
46
 
47
-
48
47
  <div class="row">
49
48
  <div class="columns xlarge-6">
50
49
  <%= form.date_field :end_date %>
@@ -65,14 +64,16 @@
65
64
  </div>
66
65
  </div>
67
66
 
68
- <div class="row">
69
- <div class="columns xlarge-6">
70
- <%= form.translated :text_field, :target %>
71
- </div>
67
+ <div class="row column">
68
+ <%= form.translated :text_field, :target %>
69
+ </div>
72
70
 
73
- <div class="columns xlarge-6">
74
- <%= form.collection_select :scope_id, organization_scopes, :id, :name %>
75
- </div>
71
+ <div class="row column">
72
+ <%= form.check_box :scopes_enabled %>
73
+ </div>
74
+
75
+ <div class="row column">
76
+ <%= form.scopes_select :scope_id, prompt: t("decidim.scopes.global"), remote_path: decidim.scopes_search_path %>
76
77
  </div>
77
78
 
78
79
  <div class="row column">
@@ -92,5 +93,9 @@
92
93
  <div class="row column">
93
94
  <%= form.check_box :show_statistics %>
94
95
  </div>
96
+
97
+ <div class="row column">
98
+ <%= form.translated :editor, :announcement %>
99
+ </div>
95
100
  </div>
96
101
  </div>
@@ -29,7 +29,7 @@
29
29
  <% elsif can? :preview, process %>
30
30
  <%= link_to translated_attribute(process.title), decidim.participatory_process_path(process) %><br />
31
31
  <% elsif can? :read, Decidim::Moderation %>
32
- <%= link_to translated_attribute(process.title), decidim_admin.participatory_process_moderations_path(process) %><br />
32
+ <%= link_to translated_attribute(process.title), moderations_path(process) %><br />
33
33
  <% else %>
34
34
  <%= translated_attribute(process.title) %>
35
35
  <% end %>
@@ -0,0 +1,7 @@
1
+
2
+ <div class="row column">
3
+ <%= form.translated :text_field, :name %>
4
+ </div>
5
+ <div class="row column">
6
+ <%= form.translated :text_field, :plural %>
7
+ </div>
@@ -0,0 +1,13 @@
1
+ <%= decidim_form_for(@form) do |f| %>
2
+ <div class="card">
3
+ <div class="card-divider">
4
+ <h2 class="card-title"><%= t ".title" %></h2>
5
+ </div>
6
+ <div class="card-section">
7
+ <%= render partial: 'form', object: f %>
8
+ </div>
9
+ </div>
10
+ <div class="button--double form-general-submit">
11
+ <%= f.submit t(".update") %>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= t "decidim.admin.titles.scope_types" %> <%= link_to t("actions.add", scope: "decidim.admin"), ['new', 'scope_type'], class: 'button tiny button--title' %></h2>
4
+ </div>
5
+ <div class="card-section">
6
+ <div class="table-scroll">
7
+ <table class="table-list">
8
+ <thead>
9
+ <tr>
10
+ <th><%= t("models.scope_type.fields.name", scope: "decidim.admin") %></th>
11
+ <th><%= t("models.scope_type.fields.plural", scope: "decidim.admin") %></th>
12
+ <th></th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% scope_types.each do |scope_type| %>
17
+ <tr>
18
+ <td>
19
+ <%= translated_attribute(scope_type.name) %>
20
+ </td>
21
+ <td>
22
+ <%= translated_attribute(scope_type.plural) %>
23
+ </td>
24
+ <td class="table-list__actions">
25
+
26
+ <% if can? :update, scope_type %>
27
+ <%= icon_link_to "pencil", ['edit', scope_type], t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit", method: :get, data: {} %>
28
+ <% end %>
29
+
30
+ <% if can? :destroy, scope_type %>
31
+ <%= icon_link_to "circle-x", scope_type, t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
32
+ <% end %>
33
+ </td>
34
+ </tr>
35
+ <% end %>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+ </div>
40
+ </div>
@@ -0,0 +1,13 @@
1
+ <%= decidim_form_for(@form) do |f| %>
2
+ <div class="card">
3
+ <div class="card-divider">
4
+ <h2 class="card-title"><%= t ".title" %></h2>
5
+ </div>
6
+ <div class="card-section">
7
+ <%= render partial: 'form', object: f %>
8
+ </div>
9
+ </div>
10
+ <div class="button--double form-general-submit">
11
+ <%= f.submit t(".create") %>
12
+ </div>
13
+ <% end %>
@@ -1,3 +1,13 @@
1
- <div class="field">
2
- <%= form.text_field :name %>
1
+
2
+ <div class="row column">
3
+ <%= form.translated :text_field, :name %>
4
+ </div>
5
+
6
+ <div class="row">
7
+ <div class="columns xlarge-6">
8
+ <%= form.text_field :code %>
9
+ </div>
10
+ <div class="columns xlarge-6">
11
+ <%= form.collection_select :scope_type_id, organization_scope_types, :id, :name %>
12
+ </div>
3
13
  </div>
@@ -1,14 +1,21 @@
1
1
  <div class="card">
2
2
  <div class="card-divider">
3
- <h2 class="card-title"><%= t "decidim.admin.titles.scopes" %> <%= link_to t("actions.add", scope: "decidim.admin"), ['new', 'scope'], class: 'button tiny button--title' %></h2>
3
+ <h2 class="card-title">
4
+ <% if parent_scope %>
5
+ <%= scope_breadcrumbs(parent_scope).join(" - ").html_safe %> <%= link_to t("actions.add", scope: "decidim.admin"), new_scope_scope_path(parent_scope), class: 'button tiny button--title' %><%= link_to t("actions.edit", scope: "decidim.admin"), edit_scope_path(parent_scope), class: 'button tiny button--title' %>
6
+ <% else %>
7
+ <%= t "decidim.admin.titles.scopes" %> <%= link_to t("actions.add", scope: "decidim.admin"), new_scope_path, class: 'button tiny button--title' %>
8
+ <% end %>
9
+ </h2>
4
10
  </div>
5
11
  <div class="card-section">
6
- <div class="table-scroll">
12
+ <% if @scopes.any? %>
13
+ <div class="table-scroll">
7
14
  <table class="table-list">
8
15
  <thead>
9
16
  <tr>
10
17
  <th><%= t("models.scope.fields.name", scope: "decidim.admin") %></th>
11
- <th><%= t("models.scope.fields.created_at", scope: "decidim.admin") %></th>
18
+ <th><%= t("models.scope.fields.scope_type", scope: "decidim.admin") %></th>
12
19
  <th></th>
13
20
  </tr>
14
21
  </thead>
@@ -16,12 +23,14 @@
16
23
  <% @scopes.each do |scope| %>
17
24
  <tr>
18
25
  <td>
19
- <%= scope.name %><br />
26
+ <%= link_to translated_attribute(scope.name), scope_scopes_path(scope) %>
20
27
  </td>
21
28
  <td>
22
- <%= l scope.created_at, format: :short %>
29
+ <%= scope.scope_type ? translated_attribute(scope.scope_type.name) : "-" %>
23
30
  </td>
24
31
  <td class="table-list__actions">
32
+ <%= icon_link_to "zoom-in", scope_scopes_path(scope), t("actions.browse", scope: "decidim.admin"), class: "action-icon--browse", method: :get, data: {} %>
33
+
25
34
  <% if can? :update, scope %>
26
35
  <%= icon_link_to "pencil", ['edit', scope], t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit", method: :get, data: {} %>
27
36
  <% end %>
@@ -33,7 +42,10 @@
33
42
  </tr>
34
43
  <% end %>
35
44
  </tbody>
36
- </table>
37
- </div>
45
+ </table>
46
+ </div>
47
+ <% else %>
48
+ <p><%= t("decidim.admin.scopes.no_scopes") %></p>
49
+ <% end %>
38
50
  </div>
39
51
  </div>