diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index e508cf813..37a186ff1 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -29,7 +29,7 @@ module AdminHelper end def menu_profiles? - ["administrators", "organizations", "officials", "moderators", "valuators", "managers", "users"].include? controller_name + ["administrators", "organizations", "officials", "moderators", "valuators", "managers", "users", "activity"].include? controller_name end def menu_banners? diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index f3abf04aa..fdc28ec31 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -120,7 +120,7 @@ <%= link_to t("admin.menu.officials"), admin_officials_path %> -
  • > +
  • > <%= link_to t('admin.menu.moderators'), admin_moderators_path%>
  • diff --git a/app/views/admin/activity/show.html.erb b/app/views/admin/activity/show.html.erb index 92ff3e26a..dd4cee125 100644 --- a/app/views/admin/activity/show.html.erb +++ b/app/views/admin/activity/show.html.erb @@ -1,43 +1,56 @@ +<%= back_link_to admin_moderators_path %> +

    <%= t("admin.activity.show.title") %>

    <%= render 'shared/filter_subnav', i18n_namespace: "admin.activity.show" %> -

    <%= page_entries_info @activity %>

    +<% if @activity.any? %> +

    <%= page_entries_info @activity %>

    - - - - - - - - <% @activity.each do |activity| %> - - - - - - - <% end %> -
    <%= t("admin.activity.show.type") %><%= t("admin.activity.show.action") %><%= t("admin.activity.show.content") %><%= t("admin.activity.show.by") %>
    - <%= activity.actionable_type.constantize.model_name.human %>
    - <%= l activity.actionable.created_at.to_date %> -
    - <%= t("admin.activity.show.actions.#{activity.action}") %>
    - <%= l activity.created_at.to_date %> -
    - <% case activity.actionable_type %> - <% when "User" %> - <%= activity.actionable.username %> (<%= activity.actionable.email %>) - <% when "Comment" %> - <%= activity.actionable.body %> - <% else %> - <%= activity.actionable.title %> -
    -
    - <%= activity.actionable.description %> -
    - <% end %> -
    <%= activity.user.name %> (<%= activity.user.email %>)
    + + + + + + + + + + + <% @activity.each do |activity| %> + + + + + + <% end %> + +
    <%= t("admin.activity.show.type") %><%= t("admin.activity.show.action") %><%= t("admin.activity.show.content") %><%= t("admin.activity.show.by") %>
    + <%= activity.actionable_type.constantize.model_name.human %>
    + <%= l activity.actionable.created_at.to_date %> +
    + <%= t("admin.activity.show.actions.#{activity.action}") %>
    + <%= l activity.created_at.to_date %> +
    + <% case activity.actionable_type %> + <% when "User" %> + <%= activity.actionable.username %> (<%= activity.actionable.email %>) + <% when "Comment" %> + <%= activity.actionable.body %> + <% else %> + <%= activity.actionable.title %> +
    +
    + <%= activity.actionable.description %> +
    + <% end %> +
    + <%= activity.user.name %> (<%= activity.user.email %>) +
    -<%= paginate @activity %> + <%= paginate @activity %> +<% else %> +
    + <%= t("admin.activity.show.no_activity") %> +
    +<% end %> diff --git a/app/views/admin/administrators/index.html.erb b/app/views/admin/administrators/index.html.erb index b23a85d61..44b423f39 100644 --- a/app/views/admin/administrators/index.html.erb +++ b/app/views/admin/administrators/index.html.erb @@ -1,31 +1,48 @@ -

    <%= t("admin.administrators.index.title") %>

    +

    <%= t("admin.administrators.index.title") %>

    <%= render 'admin/shared/user_search', url: search_admin_administrators_path %> -

    <%= page_entries_info @administrators %>

    +
    + <% if @administrators.any? %> +

    <%= page_entries_info @administrators %>

    - - <% @administrators.each do |administrator| %> - - - - - +
    <%= administrator.name %><%= administrator.email %> - <% if administrator.persisted? %> - <%= link_to t('admin.administrators.administrator.delete'), - admin_administrator_path(administrator), - method: :delete, - class: "button hollow alert" %> - <% else %> - <%= link_to t('admin.administrators.administrator.add'), - { controller: "admin/administrators", - action: :create, - user_id: administrator.user_id }, - method: :post, - class: "button success" %> - <% end %> -
    + + + + + + <% @administrators.each do |administrator| %> + + + + + + <% end %> +
    <%= t("admin.administrators.index.name") %><%= t("admin.administrators.index.email") %><%= t("admin.shared.actions") %>
    + <%= administrator.name %> + + <%= administrator.email %> + + <% if administrator.persisted? %> + <%= link_to t('admin.administrators.administrator.delete'), + admin_administrator_path(administrator), + method: :delete, + class: "button hollow alert expanded" + %> + <% else %> + <%= link_to t('admin.administrators.administrator.add'), + { controller: "admin/administrators", action: :create, + user_id: administrator.user_id }, + method: :post, + class: "button success expanded" %> + <% end %> +
    + + <%= paginate @administrators %> + <% else %> +
    + <%= t("admin.administrators.index.no_administrators") %> +
    <% end %> - - -<%= paginate @administrators %> +
    diff --git a/app/views/admin/administrators/search.html.erb b/app/views/admin/administrators/search.html.erb index 3f3c269f1..d8ab78511 100644 --- a/app/views/admin/administrators/search.html.erb +++ b/app/views/admin/administrators/search.html.erb @@ -2,28 +2,43 @@ <%= render 'admin/shared/user_search', url: search_admin_administrators_path %> -

    <%= page_entries_info @users %>

    +
    + <% if @users.any? %> +

    <%= page_entries_info @users %>

    - - <% @users.each do |user| %> - - - -
    <%= user.name %><%= user.email %> - <% if user.administrator? && user.administrator.persisted? %> - <%= link_to t('admin.administrators.administrator.delete'), - admin_administrator_path(user), - method: :delete, - class: "button hollow alert" %> - <% else %> - <%= link_to t('admin.administrators.administrator.add'), - { controller: "admin/administrators", - action: :create, - user_id: user }, - method: :post, - class: "button success" %> + + + + + + + + <% @users.each do |user| %> + + + + + <% end %> - - + +
    <%= t("admin.administrators.index.name") %><%= t("admin.administrators.index.email") %><%= t("admin.shared.actions") %>
    <%= user.name %><%= user.email %> + <% if user.administrator? && user.administrator.persisted? %> + <%= link_to t('admin.administrators.administrator.delete'), + admin_administrator_path(user), + method: :delete, + class: "button hollow alert expanded" %> + <% else %> + <%= link_to t('admin.administrators.administrator.add'), + { controller: "admin/administrators", + action: :create, + user_id: user }, + method: :post, + class: "button success expanded" %> + <% end %> +
    + <% else %> +
    + <%= t("admin.shared.no_search_results") %> +
    <% end %> -
    +
    diff --git a/app/views/admin/managers/index.html.erb b/app/views/admin/managers/index.html.erb index 2291f8384..2077c6a6b 100644 --- a/app/views/admin/managers/index.html.erb +++ b/app/views/admin/managers/index.html.erb @@ -2,30 +2,50 @@ <%= render 'admin/shared/user_search', url: search_admin_managers_path %> -

    <%= page_entries_info @managers %>

    +
    + <% if @managers.any? %> +

    <%= page_entries_info @managers %>

    - - <% @managers.each do |manager| %> - - - - +
    <%= manager.name %><%= manager.email %> - <% if manager.persisted? %> - <%= link_to t('admin.managers.manager.delete'), - admin_manager_path(manager), - method: :delete, - class: "button hollow alert" %> - <% else %> - <%= link_to t('admin.managers.manager.add'), - { controller: "admin/managers", - action: :create, - user_id: manager.user_id }, - method: :post, - class: "button success" %> + + + + + + + + <% @managers.each do |manager| %> + + + + + <% end %> - - - <% end %> -
    <%= t("admin.managers.index.name") %><%= t("admin.managers.index.email") %><%= t("admin.shared.actions") %>
    + <%= manager.name %> + + <%= manager.email %> + + <% if manager.persisted? %> + <%= link_to t('admin.managers.manager.delete'), + admin_manager_path(manager), + method: :delete, + class: "button hollow alert expanded" + %> + <% else %> + <%= link_to t('admin.managers.manager.add'), + { controller: "admin/managers", + action: :create, + user_id: manager.user_id }, + method: :post, + class: "button success expanded" %> + <% end %> +
    +
    -<%= paginate @managers %> + <%= paginate @managers %> + <% else %> +
    + <%= t("admin.managers.index.no_managers") %> +
    + <% end %> +
    diff --git a/app/views/admin/managers/search.html.erb b/app/views/admin/managers/search.html.erb index c6ea3c2cd..cad2c7100 100644 --- a/app/views/admin/managers/search.html.erb +++ b/app/views/admin/managers/search.html.erb @@ -2,28 +2,43 @@ <%= render 'admin/shared/user_search', url: search_admin_managers_path %> -

    <%= page_entries_info @users %>

    +
    + <% if @users.any? %> +

    <%= page_entries_info @users %>

    - - <% @users.each do |user| %> - - - - - +
    <%= user.name %><%= user.email %> - <% if user.manager? && user.manager.persisted? %> - <%= link_to t('admin.managers.manager.delete'), - admin_manager_path(user), - method: :delete, - class: "button hollow alert" %> - <% else %> - <%= link_to t('admin.managers.manager.add'), - { controller: "admin/managers", - action: :create, - user_id: user }, - method: :post, - class: "button success" %> - <% end %> -
    + + + + + + + <% @users.each do |user| %> + + + + + + <% end %> + +
    <%= t("admin.managers.index.name") %><%= t("admin.managers.index.email") %><%= t("admin.shared.actions") %>
    <%= user.name %><%= user.email %> + <% if user.manager? && user.manager.persisted? %> + <%= link_to t('admin.managers.manager.delete'), + admin_manager_path(user), + method: :delete, + class: "button hollow alert expanded" %> + <% else %> + <%= link_to t('admin.managers.manager.add'), + { controller: "admin/managers", + action: :create, + user_id: user }, + method: :post, + class: "button success expanded" %> + <% end %> +
    + <% else %> +
    + <%= t("admin.shared.no_search_results") %> +
    <% end %> - +
    diff --git a/app/views/admin/moderators/index.html.erb b/app/views/admin/moderators/index.html.erb index 735a193ff..be067d73d 100644 --- a/app/views/admin/moderators/index.html.erb +++ b/app/views/admin/moderators/index.html.erb @@ -4,31 +4,49 @@ <%= render 'admin/shared/user_search', url: search_admin_moderators_path %> -

    <%= page_entries_info @moderators %>

    +
    + <% if @moderators.any? %> +

    <%= page_entries_info @moderators %>

    - - <% @moderators.each do |moderator| %> - - - - +
    <%= moderator.name %><%= moderator.email %> - <% if moderator.persisted? %> - <%= link_to t('admin.moderators.moderator.delete'), - admin_moderator_path(moderator), - method: :delete, - class: "button hollow alert" - %> - <% else %> - <%= link_to t('admin.moderators.moderator.add'), - { controller: "admin/moderators", - action: :create, - user_id: moderator.user_id }, - method: :post, - class: "button success" %> + + + + + + + + <% @moderators.each do |moderator| %> + + + + + <% end %> - - - <% end %> -
    <%= t("admin.moderators.index.name") %><%= t("admin.moderators.index.email") %><%= t("admin.shared.actions") %>
    + <%= moderator.name %> + + <%= moderator.email %> + + <% if moderator.persisted? %> + <%= link_to t('admin.moderators.moderator.delete'), + admin_moderator_path(moderator), + method: :delete, + class: "button hollow alert expanded" + %> + <% else %> + <%= link_to t('admin.moderators.moderator.add'), + { controller: "admin/moderators", action: :create, + user_id: moderator.user_id }, + method: :post, + class: "button success expanded" %> + <% end %> +
    +
    -<%= paginate @moderators %> + <%= paginate @moderators %> + <% else %> +
    + <%= t("admin.moderators.index.no_moderators") %> +
    + <% end %> +
    diff --git a/app/views/admin/moderators/search.html.erb b/app/views/admin/moderators/search.html.erb index 89e9dc9a7..7fc479b8a 100644 --- a/app/views/admin/moderators/search.html.erb +++ b/app/views/admin/moderators/search.html.erb @@ -2,28 +2,42 @@ <%= render 'admin/shared/user_search', url: search_admin_moderators_path %> -

    <%= page_entries_info @users %>

    +
    + <% if @users.any? %> +

    <%= page_entries_info @users %>

    - - <% @users.each do |user| %> - - - - - +
    <%= user.name %><%= user.email %> - <% if user.moderator? && user.moderator.persisted? %> - <%= link_to t('admin.moderators.moderator.delete'), - admin_moderator_path(user), - method: :delete, - class: "button hollow alert" %> - <% else %> - <%= link_to t('admin.moderators.moderator.add'), - { controller: "admin/moderators", - action: :create, - user_id: user }, - method: :post, - class: "button success" %> - <% end %> -
    + + + + + + + <% @users.each do |user| %> + + + + + + <% end %> +
    <%= t("admin.moderators.index.name") %><%= t("admin.moderators.index.email") %><%= t("admin.shared.actions") %>
    <%= user.name %><%= user.email %> + <% if user.moderator? && user.moderator.persisted? %> + <%= link_to t('admin.moderators.moderator.delete'), + admin_moderator_path(user), + method: :delete, + class: "button hollow alert expanded" %> + <% else %> + <%= link_to t('admin.moderators.moderator.add'), + { controller: "admin/moderators", + action: :create, + user_id: user }, + method: :post, + class: "button success expanded" %> + <% end %> +
    + <% else %> +
    + <%= t("admin.shared.no_search_results") %> +
    <% end %> - +
    diff --git a/app/views/admin/officials/edit.html.erb b/app/views/admin/officials/edit.html.erb index 4696ea4de..5a17d2445 100644 --- a/app/views/admin/officials/edit.html.erb +++ b/app/views/admin/officials/edit.html.erb @@ -1,20 +1,22 @@ -<%= back_link_to %> +<%= back_link_to admin_officials_path %>
    -
    <%= @user.name %> (<%= @user.email %>)
    -

    <%= t("admin.officials.edit.title") %>

    -
    -
    +
    + <%= @user.name %>
    + <%= @user.email %> +
    + +
    <%= form_for @user, url: admin_official_path(@user) do |f| %> <%= f.text_field :official_position %> <%= f.select :official_level, official_level_options %> + <%= f.submit class: "button" %> <% if @user.official? %> - <%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'button hollow alert' %> +
    + <%= link_to t("admin.officials.edit.destroy"), admin_official_path(@user), method: :delete, class: 'delete' %> <% end %> - <%= f.submit class: "button hollow" %> <% end %> -
    diff --git a/app/views/admin/officials/index.html.erb b/app/views/admin/officials/index.html.erb index 078d5bbbc..f4cbdd06c 100644 --- a/app/views/admin/officials/index.html.erb +++ b/app/views/admin/officials/index.html.erb @@ -2,26 +2,42 @@ <%= render 'admin/shared/user_search', url: search_admin_officials_path %> -

    <%= page_entries_info @officials %>

    +<% if @officials.any? %> +

    <%= page_entries_info @officials %>

    - - <% @officials.each do |official| %> - - - - - - <% end %> -
    - <%= link_to official.name, edit_admin_official_path(official) %> - - - <%= official.official_position %> - - (<%= t("admin.officials.level_#{official.official_level}") %>) - - <%= link_to official.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), - edit_admin_official_path(official), class: "button hollow" %> -
    + + + + + + + + + <% @officials.each do |official| %> + + + + + + + <% end %> + +
    <%= t("admin.officials.index.name") %><%= t("admin.officials.index.official_position") %><%= t("admin.officials.index.official_level") %><%= t("admin.shared.actions") %>
    + <%= link_to official.name, edit_admin_official_path(official) %> + + + <%= official.official_position %> + + + <%= t("admin.officials.level_#{official.official_level}") %> + + <%= link_to official.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), + edit_admin_official_path(official), class: "button hollow expanded" %> +
    -<%= paginate @officials %> + <%= paginate @officials %> +<% else %> +
    + <%= t("admin.officials.index.no_officials") %> +
    +<% end %> diff --git a/app/views/admin/officials/search.html.erb b/app/views/admin/officials/search.html.erb index f2d90c143..e2a067c9d 100644 --- a/app/views/admin/officials/search.html.erb +++ b/app/views/admin/officials/search.html.erb @@ -2,24 +2,52 @@ <%= render 'admin/shared/user_search', url: search_admin_officials_path %> -

    <%= page_entries_info @users %>

    +<% if @users.any? %> - - <% @users.each do |user| %> - - - - - - <% end %> -
    - <%= link_to user.name, edit_admin_official_path(user) %> - - - <%= user.official_position %> - - (<%= t("admin.officials.level_#{user.official_level}") %>) - - <%= link_to user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official"), - edit_admin_official_path(user), class: "button hollow" %> -
    +

    <%= page_entries_info @users %>

    + + + + + + + + + + <% @users.each do |user| %> + + + + + + + <% end %> + +
    <%= t("admin.officials.index.name") %><%= t("admin.officials.index.official_position") %><%= t("admin.officials.index.official_level") %><%= t("admin.shared.actions") %>
    + <%= link_to user.name, edit_admin_official_path(user) %> + + <% if user.official? %> + + <%= user.official_position %> + + <% else %> + <%= t("admin.officials.level_0") %> + <% end %> + + <%= t("admin.officials.level_#{user.official_level}") %> + + <% if user.official? %> + <%= link_to t("admin.officials.search.edit_official"), + edit_admin_official_path(user), + class: "button hollow expanded" %> + <% else %> + <%= link_to t("admin.officials.search.make_official"), + edit_admin_official_path(user), + class: "button expanded" %> + <% end %> +
    +<% else %> +
    + <%= t("admin.officials.search.no_results") %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index 0ddee4247..f69b1448e 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -1,67 +1,79 @@

    <%= t("admin.organizations.index.title") %>

    - -<%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %> -
    -
    +
    + <%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %> +
    <%= text_field_tag :term, "", placeholder: t("admin.organizations.index.search_placeholder") %> + +
    + <%= f.submit t("admin.organizations.index.search"), class: "button" %> +
    -
    - <%= f.submit t("admin.organizations.index.search"), class: "button success" %> -
    -
    -<% end %> - + <% end %> +
    <%= render 'shared/filter_subnav', i18n_namespace: "admin.organizations.index" %> -

    <%= page_entries_info @organizations %>

    +<% if @organizations.any? %> +

    <%= page_entries_info @organizations %>

    - - <% hidden = 0 %> - <% @organizations.each do |organization| %> - <% hidden += 1 and next if organization.user.nil? || organization.user.hidden? %> - - - - - - <% if organization.verified? %> - - <% end %> - <% if can? :verify, organization %> +

    <%= organization.name %>

    <%= organization.email %>

    <%= organization.phone_number %>

    <%= organization.responsible_name %>

    - - <%= t("admin.organizations.index.verified") %> -
    + <% hidden = 0 %> + + + + + + + + + + <% @organizations.each do |organization| %> + <% hidden += 1 and next if organization.user.nil? || organization.user.hidden? %> + + + + + - <% end %> - <% if organization.rejected? %> - - <% end %> - <% if can? :reject, organization %> - <% end %> - -<% end %> -
    <%= t("admin.organizations.index.name") %><%= t("admin.organizations.index.email") %><%= t("admin.organizations.index.phone_number") %><%= t("admin.organizations.index.responsible_name") %><%= t("admin.organizations.index.status") %><%= t("admin.shared.actions") %>
    <%= organization.name %><%= organization.email %><%= organization.phone_number %><%= organization.responsible_name %> - <%= link_to t("admin.organizations.index.verify"), - verify_admin_organization_path(organization, request.query_parameters), - method: :put, class: "button success expanded" - %> + <% if organization.verified? %> + + <%= t("admin.organizations.index.verified") %> + <% elsif organization.rejected? %> + + <%= t("admin.organizations.index.rejected") %> + <% else %> + + <%= t("admin.organizations.index.pending") %> + <% end %> - - <%= t("admin.organizations.index.rejected") %> - - <%= link_to t("admin.organizations.index.reject"), - reject_admin_organization_path(organization, request.query_parameters), - method: :put, class: "button hollow alert expanded" - %> -
    + <% if can? :verify, organization %> + <%= link_to t("admin.organizations.index.verify"), + verify_admin_organization_path(organization, request.query_parameters), + method: :put, class: "button success small-5" %> + <% end %> -<% if hidden > 0 %> + <% if can? :reject, organization %> + <%= link_to t("admin.organizations.index.reject"), + reject_admin_organization_path(organization, request.query_parameters), + method: :put, class: "button hollow alert small-5"%> + <% end %> + + + <% end %> + + + + <% if hidden > 0 %> +
    + <%= t("admin.organizations.index.hidden_count_html", count: hidden) %> +
    + <% end %> + + <%= paginate @organizations %> +<% else %>
    - <%= t("admin.organizations.index.hidden_count_html", count: hidden) %> + <%= t("admin.organizations.index.no_organizations") %>
    <% end %> - -<%= paginate @organizations %> diff --git a/app/views/admin/organizations/search.html.erb b/app/views/admin/organizations/search.html.erb index 5b5071c5b..e3d0564cf 100644 --- a/app/views/admin/organizations/search.html.erb +++ b/app/views/admin/organizations/search.html.erb @@ -1,56 +1,70 @@

    <%= t("admin.organizations.search.title") %>

    - -<%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %> -
    -
    +
    + <%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %> +
    <%= text_field_tag :term, "", placeholder: t("admin.organizations.index.search_placeholder") %> +
    + <%= f.submit t("admin.organizations.index.search"), class: "button" %> +
    -
    - <%= f.submit t("admin.organizations.index.search"), class: "button success" %> + <% end %> +
    + +
    + <% if @organizations.any? %> +

    <%= page_entries_info @organizations %>

    + + + + + + + + + + + + <% @organizations.each do |organization| %> + + + + + + + + + <% end %> + +
    <%= t("admin.organizations.index.name") %><%= t("admin.organizations.index.email") %><%= t("admin.organizations.index.phone_number") %><%= t("admin.organizations.index.responsible_name") %><%= t("admin.organizations.index.status") %><%= t("admin.shared.actions") %>
    <%= organization.name %><%= organization.email %><%= organization.phone_number %><%= organization.responsible_name %> + <% if organization.verified? %> + + <%= t("admin.organizations.index.verified") %> + <% elsif organization.rejected? %> + + <%= t("admin.organizations.index.rejected") %> + <% else %> + + <%= t("admin.organizations.index.pending") %> + <% end %> + + <% if can? :verify, organization %> + <%= link_to t("admin.organizations.index.verify"), + verify_admin_organization_path(organization, request.query_parameters), + method: :put, class: "button success small-5" %> + <% end %> + + <% if can? :reject, organization %> + <%= link_to t("admin.organizations.index.reject"), + reject_admin_organization_path(organization, request.query_parameters), + method: :put, class: "button hollow alert small-5" %> + <% end %> +
    + + <%= paginate @organizations %> + <% else %> +
    + <%= t("admin.organizations.search.no_results") %>
    -
    -<% end %> - - -

    <%= page_entries_info @organizations %>

    - - - <% @organizations.each do |organization| %> - - - - - - <% if organization.verified? %> - - <% end %> - <% if can? :verify, organization %> - - <% end %> - <% if organization.rejected? %> - - <% end %> - <% if can? :reject, organization %> - - <% end %> - -<% end %> -

    <%= organization.name %>

    <%= organization.email %>

    <%= organization.phone_number %>

    <%= organization.responsible_name %>

    - - <%= t("admin.organizations.index.verified") %> - - <%= link_to t("admin.organizations.index.verify"), - verify_admin_organization_path(organization, request.query_parameters), - method: :put, class: "button success expanded" - %> - - - <%= t("admin.organizations.index.rejected") %> - <%= link_to t("admin.organizations.index.reject"), - reject_admin_organization_path(organization, request.query_parameters), - method: :put, class: "button hollow alert expanded" - %> -
    - -<%= paginate @organizations %> \ No newline at end of file + <% end %> +
    diff --git a/app/views/admin/shared/_user_search.html.erb b/app/views/admin/shared/_user_search.html.erb index a964ce549..c553052c2 100644 --- a/app/views/admin/shared/_user_search.html.erb +++ b/app/views/admin/shared/_user_search.html.erb @@ -1,10 +1,10 @@ -<%= form_for(User.new, url: url, as: :user, method: :get) do |f| %> -
    -
    - <%= text_field_tag :name_or_email, "", placeholder: t("admin.shared.user_search.placeholder") %> +
    + <%= form_for(User.new, url: url, as: :user, method: :get) do |f| %> +
    + <%= text_field_tag :name_or_email, "", placeholder: t("admin.shared.user_search.placeholder") %> +
    + <%= f.submit t("admin.shared.user_search.button"), class: "button" %> +
    -
    - <%= f.submit t("admin.shared.user_search.button"), class: "button success" %> -
    -
    -<% end %> \ No newline at end of file + <% end %> +
    diff --git a/app/views/admin/users/_users.html.erb b/app/views/admin/users/_users.html.erb index f3c6af0fa..2c4c4db2e 100644 --- a/app/views/admin/users/_users.html.erb +++ b/app/views/admin/users/_users.html.erb @@ -1,24 +1,32 @@ -

    <%= page_entries_info @users %>

    +<% if @users.any? %> +

    <%= page_entries_info @users %>

    - - - - - + + + + + - <% @users.each do |user| %> - - - - - - - - <% end %> + + <% @users.each do |user| %> + + + + + + + + <% end %> +
    <%= t('admin.users.columns.name') %><%= t('admin.users.columns.email') %><%= t('admin.users.columns.document_number') %><%= t('admin.users.columns.roles') %><%= t('admin.users.columns.verification_level') %><%= t("admin.users.columns.name") %><%= t("admin.users.columns.email") %><%= t("admin.users.columns.document_number") %><%= t("admin.users.columns.roles") %><%= t("admin.users.columns.verification_level") %>
    <%= user.name %><%= user.email %><%= user.document_number %><%= display_user_roles(user) %><%= user.user_type %>
    <%= user.name %><%= user.email %><%= user.document_number %><%= display_user_roles(user) %><%= user.user_type %>
    -<%= paginate @users %> + <%= paginate @users %> +<% else %> +
    + <%= t("admin.users.index.no_users") %> +
    +<% end %> diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 2713399ed..ceee64394 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -1,16 +1,17 @@

    <%= t("admin.users.index.title") %>

    -
    +
    <%= form_tag admin_users_path, method: :get, remote: true do %> -
    +
    <%= text_field_tag :search, '', placeholder: t('admin.users.search.placeholder') %> -
    -
    - <%= submit_tag t('admin.users.search.search'), class: 'button' %> +
    + <%= submit_tag t('admin.users.search.search'), class: 'button' %> +
    <% end %>
    -
    + +
    <%= render "users" %>
    diff --git a/app/views/admin/valuators/index.html.erb b/app/views/admin/valuators/index.html.erb index d496b1ecd..622d01307 100644 --- a/app/views/admin/valuators/index.html.erb +++ b/app/views/admin/valuators/index.html.erb @@ -2,16 +2,41 @@ <%= render 'admin/shared/user_search', url: search_admin_valuators_path %> -

    <%= page_entries_info @valuators %>

    +
    + <% if @valuators.any? %> +

    <%= page_entries_info @valuators %>

    - - <% @valuators.each do |valuator| %> - - - - - +
    <%= valuator.name %><%= valuator.email %><%= valuator.description if valuator.description.present? %>
    + + + + + + + <% @valuators.each do |valuator| %> + + + + + + <% end %> + +
    <%= t("admin.valuators.index.name") %><%= t("admin.valuators.index.email") %><%= t("admin.valuators.index.description") %>
    + <%= valuator.name %> + + <%= valuator.email %> + + <% if valuator.description.present? %> + <%= valuator.description %> + <% else %> + <%= t("admin.valuators.index.no_description") %> + <% end %> +
    + + <%= paginate @valuators %> + <% else %> +
    + <%= t("admin.valuators.index.no_valuators") %> +
    <% end %> - - -<%= paginate @valuators %> +
    diff --git a/app/views/admin/valuators/search.html.erb b/app/views/admin/valuators/search.html.erb index 4663a944b..2710cb44d 100644 --- a/app/views/admin/valuators/search.html.erb +++ b/app/views/admin/valuators/search.html.erb @@ -2,26 +2,50 @@ <%= render 'admin/shared/user_search', url: search_admin_valuators_path %> -

    <%= page_entries_info @users %>

    +
    + <% if @users.any? %> +

    <%= page_entries_info @users %>

    - - <% @users.each do |user| %> - - - -
    <%= user.name %><%= user.email %> - <% if user.valuator? && user.valuator.description.present? %> - <%= user.valuator.description %> - <% else %> - <%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %> - <%= f.text_field :description, - label: false, - placeholder: t("admin.valuators.valuator.description_placeholder") %> - <%= f.hidden_field :user_id %> - <%= f.submit t("admin.valuators.valuator.add"), class: "button success float-left" %> - <% end %> + + + + + + + + + <% @users.each do |user| %> + + + + + <% end %> - - + +
    <%= t("admin.valuators.index.name") %><%= t("admin.valuators.index.email") %><%= t("admin.valuators.index.description") %><%= t("admin.shared.actions") %>
    <%= user.name %><%= user.email %> + <% if user.valuator? %> + <% if user.valuator.description.present? %> + <%= user.valuator.description %> + <% else %> + <%= t("admin.valuators.index.no_description") %> + <% end %> + <% else %> + <%= t("admin.valuators.index.no_description") %> + <% end %> + + <% unless user.valuator? %> + <%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %> + <%= f.text_field :description, + label: false, + placeholder: t("admin.valuators.valuator.description_placeholder") %> + <%= f.hidden_field :user_id %> + <%= f.submit t("admin.valuators.valuator.add"), class: "button success expanded" %> + <% end %> + <% end %> +
    + <% else %> +
    + <%= t("admin.shared.no_search_results") %> +
    <% end %> -
    +
    diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index 8ef98b4d1..20c497417 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -31,6 +31,12 @@ en: administrator: one: "Administrator" other: "Administrators" + valuator: + one: "Evaluador" + other: "Evaluadores" + manager: + one: "Manager" + other: "Managers" vote: one: "Vote" other: "Votes" diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index b44179ab2..a2062f8ce 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -62,6 +62,7 @@ en: on_users: Users title: Moderator activity type: Type + no_activity: There ares no moderators activity. budgets: index: title: Participatory budgets @@ -382,6 +383,9 @@ en: managers: index: title: Managers + name: Name + email: Email + no_managers: There are no managers. manager: add: Add delete: Delete @@ -431,15 +435,21 @@ en: administrators: index: title: Administrators + name: Name + email: Email + no_administrators: There are no administrators. administrator: add: Add delete: Delete restricted_removal: "Sorry, you can't remove yourself from the administrators" search: - title: 'Administrators: User search' + title: "Administrators: User search" moderators: index: title: Moderators + name: Name + email: Email + no_moderators: There are no moderators. moderator: add: Add delete: Delete @@ -452,6 +462,11 @@ en: valuators: index: title: Valuators + name: Name + email: Email + description: Description + no_description: No description + no_valuators: There are no valuators. valuator: description_placeholder: 'Description (optional)' add: Add to valuators @@ -694,6 +709,10 @@ en: official_updated: Details of official saved index: title: Officials + no_officials: There are no officials. + name: Nombre + official_position: Official position + official_level: Level level_0: Not official level_1: Level 1 level_2: Level 2 @@ -704,6 +723,7 @@ en: edit_official: Edit official make_official: Make official title: 'Official positions: User search' + no_results: Official positions not found. organizations: index: filter: Filter @@ -715,6 +735,12 @@ en: hidden_count_html: one: There is also one organisation with no users or with a hidden user. other: There are %{count} organisations with no users or with a hidden user. + name: Name + email: Email + phone_number: Phone + responsible_name: Responsible + status: Status + no_organizations: There are no organizations. reject: Reject rejected: Rejected search: Search @@ -722,8 +748,10 @@ en: title: Organisations verified: Verified verify: Verify + pending: Pending search: title: Search Organisations + no_results: No organizations found. proposals: index: filter: Filter @@ -939,6 +967,7 @@ en: verification_level: Verification level index: title: User + no_users: There are no users. search: placeholder: Search user by email, name or document number search: Search diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml index 03de3965d..a29157431 100644 --- a/config/locales/es/activerecord.yml +++ b/config/locales/es/activerecord.yml @@ -31,6 +31,12 @@ es: administrator: one: "Administrador" other: "Administradores" + valuator: + one: "Evaluador" + other: "Evaluadores" + manager: + one: "Gestor" + other: "Gestores" vote: one: "Voto" other: "Votos" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 53e01b38b..1c7d0fa74 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -60,8 +60,9 @@ es: on_debates: Debates on_proposals: Propuestas on_users: Usuarios - title: Actividad de los Moderadores + title: Actividad de Moderadores type: Tipo + no_activity: No hay actividad de moderadores. budgets: index: title: Presupuestos participativos @@ -382,15 +383,21 @@ es: administrators: index: title: Administradores + name: Nombre + email: Email + no_administrators: No hay administradores. administrator: add: Añadir como Administrador delete: Borrar restricted_removal: "Lo sentimos, no puedes eliminarte a ti mismo de la lista" search: - title: 'Administradores: Búsqueda de usuarios' + title: "Administradores: Búsqueda de usuarios" managers: index: title: Gestores + name: Nombre + email: Email + no_managers: No hay gestores. manager: add: Añadir como Gestor delete: Borrar @@ -440,6 +447,9 @@ es: moderators: index: title: Moderadores + name: Nombre + email: Email + no_moderators: No hay moderadores. moderator: add: Añadir como Moderador delete: Borrar @@ -452,6 +462,11 @@ es: valuators: index: title: Evaluadores + name: Nombre + email: Email + description: Descripción + no_description: Sin descripción + no_valuators: No hay evaluadores. valuator: description_placeholder: "Descripción (opcional)" add: Añadir como evaluador @@ -696,6 +711,10 @@ es: official_updated: Datos del cargo público guardados index: title: Cargos Públicos + no_officials: No hay cargos públicos. + name: Nombre + official_position: Cargo público + official_level: Nivel level_0: No es cargo público level_1: Nivel 1 level_2: Nivel 2 @@ -706,6 +725,7 @@ es: edit_official: Editar cargo público make_official: Convertir en cargo público title: 'Cargos Públicos: Búsqueda de usuarios' + no_results: No se han encontrado cargos públicos. organizations: index: filter: Filtro @@ -717,6 +737,12 @@ es: hidden_count_html: one: Hay además una organización sin usuario o con el usuario bloqueado. other: Hay %{count} organizaciones sin usuario o con el usuario bloqueado. + name: Nombre + email: Email + phone_number: Teléfono + responsible_name: Responsable + status: Estado + no_organizations: No hay organizaciones. reject: Rechazar rejected: Rechazada search: Buscar @@ -724,8 +750,10 @@ es: title: Organizaciones verified: Verificada verify: Verificar + pending: Pendiente search: title: Buscar Organizaciones + no_results: No se han encontrado organizaciones. proposals: index: filter: Filtro @@ -941,6 +969,7 @@ es: verification_level: Nivel de verficación index: title: Usuarios + no_users: No hay usuarios. search: placeholder: Buscar usuario por email, nombre o DNI search: Buscar diff --git a/spec/features/admin/administrators_spec.rb b/spec/features/admin/administrators_spec.rb index 4e2091d11..c39d5ade5 100644 --- a/spec/features/admin/administrators_spec.rb +++ b/spec/features/admin/administrators_spec.rb @@ -60,7 +60,7 @@ feature 'Admin administrators' do click_button 'Search' expect(page).to have_content('Administrators: User search') - expect(page).to have_content('users cannot be found') + expect(page).to have_content('No results found') expect(page).to_not have_content(@administrator1.name) expect(page).to_not have_content(@administrator2.name) end diff --git a/spec/features/admin/managers_spec.rb b/spec/features/admin/managers_spec.rb index 5fe1b3892..e59b1da4c 100644 --- a/spec/features/admin/managers_spec.rb +++ b/spec/features/admin/managers_spec.rb @@ -52,7 +52,7 @@ feature 'Admin managers' do click_button 'Search' expect(page).to have_content('Managers: User search') - expect(page).to have_content('users cannot be found') + expect(page).to have_content('No results found') expect(page).to_not have_content(@manager1.name) expect(page).to_not have_content(@manager2.name) end diff --git a/spec/features/admin/moderators_spec.rb b/spec/features/admin/moderators_spec.rb index 2c2994d62..8a32762f1 100644 --- a/spec/features/admin/moderators_spec.rb +++ b/spec/features/admin/moderators_spec.rb @@ -52,7 +52,7 @@ feature 'Admin moderators' do click_button 'Search' expect(page).to have_content('Moderators: User search') - expect(page).to have_content('users cannot be found') + expect(page).to have_content('No results found') expect(page).to_not have_content(@moderator1.name) expect(page).to_not have_content(@moderator2.name) end diff --git a/spec/features/admin/valuators_spec.rb b/spec/features/admin/valuators_spec.rb index 86f2c89e9..bb631cbc3 100644 --- a/spec/features/admin/valuators_spec.rb +++ b/spec/features/admin/valuators_spec.rb @@ -47,7 +47,7 @@ feature 'Admin valuators' do click_button 'Search' expect(page).to have_content('Valuators: User search') - expect(page).to have_content('users cannot be found') + expect(page).to have_content('No results found') expect(page).to_not have_content(@valuator1.name) expect(page).to_not have_content(@valuator2.name) end