From 441279e4a9a7282602e9a17dd4c9d248f5d06673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 10 May 2017 15:10:50 +0200 Subject: [PATCH] Fix icons in member rows --- app/cells/members/row_cell.rb | 28 ++++++++++++-------------- app/views/groups/_memberships.html.erb | 4 +++- app/views/users/_memberships.html.erb | 8 ++++---- features/support/env.rb | 5 ----- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/app/cells/members/row_cell.rb b/app/cells/members/row_cell.rb index f1a36e7f0a..c8f16199cd 100644 --- a/app/cells/members/row_cell.rb +++ b/app/cells/members/row_cell.rb @@ -85,9 +85,8 @@ module Members def edit_link link_to_function( - '', + op_icon('icon icon-edit'), edit_javascript, - class: 'icon icon-edit', title: t(:button_edit) ) end @@ -105,23 +104,22 @@ module Members end def delete_link - delete_class, delete_title = delete_link_class_and_title - - link_to( - '', - { controller: '/members', action: 'destroy', id: model, page: params[:page] }, - method: :delete, - data: { confirm: delete_link_confirmation }, - title: delete_title, - class: delete_class - ) if model.deletable? + if model.deletable? + link_to( + op_icon('icon icon-delete'), + { controller: '/members', action: 'destroy', id: model, page: params[:page] }, + method: :delete, + data: { confirm: delete_link_confirmation }, + title: delete_title + ) + end end - def delete_link_class_and_title + def delete_title if model.disposable? - ['icon icon-delete', I18n.t(:title_remove_and_delete_user)] + I18n.t(:title_remove_and_delete_user) else - ['icon icon-remove', I18n.t(:button_remove)] + I18n.t(:button_remove) end end diff --git a/app/views/groups/_memberships.html.erb b/app/views/groups/_memberships.html.erb index d3ab978fa4..f13ca115d5 100644 --- a/app/views/groups/_memberships.html.erb +++ b/app/views/groups/_memberships.html.erb @@ -86,7 +86,9 @@ See doc/COPYRIGHT.rdoc for more details. <% end %> - <%= link_to_function l(:button_edit), "jQuery('#member-#{membership.id}-roles').hide(); jQuery('#member-#{membership.id}-roles-form').show();", class: 'icon icon-edit' %> + <%= link_to_function icon_wrapper('icon icon-edit', t(:button_edit)), + "jQuery('#member-#{membership.id}-roles').hide(); jQuery('#member-#{membership.id}-roles-form').show();" do %> + <% end %> <%= link_to l(:button_remove), membership_of_group_path(@group, membership), method: :delete, remote: true, diff --git a/app/views/users/_memberships.html.erb b/app/views/users/_memberships.html.erb index e199812fe7..61cf4b67cd 100644 --- a/app/views/users/_memberships.html.erb +++ b/app/views/users/_memberships.html.erb @@ -96,12 +96,12 @@ See doc/COPYRIGHT.rdoc for more details. <%= call_hook(:view_users_memberships_table_row, user: @user, membership: membership, roles: roles, projects: projects )%> - <%= link_to_function l(:button_edit), "jQuery('#member-#{membership.id}-roles').hide(); jQuery('#member-#{membership.id}-roles-form').show();", class: 'icon icon-edit' %> - <%= link_to(l(:button_remove), + <%= link_to_function icon_wrapper('icon icon-edit', t(:button_edit)), + "jQuery('#member-#{membership.id}-roles').hide(); jQuery('#member-#{membership.id}-roles-form').show();" %> + <%= link_to(icon_wrapper('icon icon-remove', t(:button_remove)), user_membership_path(user_id: @user, id: membership), remote: true, - method: :delete, - class: 'icon icon-remove') if membership.deletable? %> + method: :delete) if membership.deletable? %> <% end %> diff --git a/features/support/env.rb b/features/support/env.rb index 604a0bc681..6b4565b2f5 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -89,11 +89,6 @@ end Capybara.javascript_driver = :selenium -Capybara.server do |app, port| - require 'rack/handler/thin' - Rack::Handler::Thin.run(app, Port: port) -end - # By default, any exception happening in your Rails application will bubble up # to Cucumber so that your scenario will fail. This is a different from how # your application behaves in the production environment, where an error page will