From: stephenbroyer Date: Wed, 16 Oct 2013 10:14:22 +0000 (+0200) Subject: SONAR-4759 Use modal windows in groups pages X-Git-Tag: 4.0~58 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=533ebddbb840c50f0278fede3bed31e35d13fc44;p=sonarqube.git SONAR-4759 Use modal windows in groups pages (delete user) --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb index 2d3d5f8f4c0..62be6373df3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb @@ -76,14 +76,27 @@ class GroupsController < ApplicationController end end + def delete_form + group = Group.find(params[:id]) + if group + @group = group + render :partial => 'groups/delete_form' + else + redirect_to(:action => 'index', :id => nil) + end + end + def destroy group = Group.find(params[:id]) if group.destroy flash[:notice] = 'Group is deleted.' + render :text => 'deleted', :status => 200 + else + @errors == [] + @errors << 'Error when deleting this group.' + render :partial => 'groups/delete_form', :status => 400 end - - to_index(group.errors, nil) - end +end def select_user @group = Group.find(params[:id]) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_delete_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_delete_form.html.erb new file mode 100644 index 00000000000..ccd159212d2 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_delete_form.html.erb @@ -0,0 +1,30 @@ +
+
+ + + +
+
+ \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb index f797b77db48..5273ddc663b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb @@ -34,8 +34,7 @@ Edit   - <%= link_to "Delete", { :action => 'destroy', :id => group.id}, - {:confirm => "Are you sure that you want to delete this group? Members will not be deleted.", :class => 'link-action link-red', :method => 'get', :id => "delete-#{u group.name}"} %> + Delete <% end %>