aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorstephenbroyer <stephen.broyer@sonarsource.com>2013-10-11 16:15:11 +0200
committerstephenbroyer <stephen.broyer@sonarsource.com>2013-10-18 09:57:34 +0200
commitf5c07dede36832bfb401b4f805d4a38bb9221511 (patch)
treed6d5aaea1930aaf753184ddad8db8a4839fdde90 /sonar-server
parentb0333039ef7ff91584bac05464e17e8cb44f8799 (diff)
downloadsonarqube-f5c07dede36832bfb401b4f805d4a38bb9221511.tar.gz
sonarqube-f5c07dede36832bfb401b4f805d4a38bb9221511.zip
SONAR-4759 Use modal windows in Groups pages
(remove yellow form)
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/groups_controller.rb30
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/groups/_create_form.html.erb (renamed from sonar-server/src/main/webapp/WEB-INF/app/views/groups/_create_modal_form.html.erb)10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/groups/_edit_form.html.erb (renamed from sonar-server/src/main/webapp/WEB-INF/app/views/groups/_edit_modal_form.html.erb)10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb42
4 files changed, 14 insertions, 78 deletions
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 3960b8aad5e..2d3d5f8f4c0 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
@@ -31,35 +31,26 @@ class GroupsController < ApplicationController
end
end
- def create_modal_form
+ def create_form
@groups = Group.find(:all, :order => 'name')
if params[:id]
@group = Group.find(params[:id])
else
@group = Group.new
end
- render :partial => 'groups/create_modal_form'
+ render :partial => 'groups/create_form'
end
- def edit_modal_form
+ def edit_form
if params[:id]
@group = Group.find(params[:id])
else
@group = Group.new
end
- render :partial => 'groups/edit_modal_form'
+ render :partial => 'groups/edit_form'
end
def create
- group = Group.new(params[:group])
- if group.save
- flash[:notice] = 'Group is created.'
- end
-
- to_index(group.errors, nil)
- end
-
- def create_modal
group = Group.new(params[:group])
if group.save
flash[:notice] = 'The new group is created.'
@@ -68,7 +59,7 @@ class GroupsController < ApplicationController
@group = group
@errors = []
group.errors.full_messages.each{|msg| @errors<<msg}
- render :partial => 'groups/create_modal_form', :status => 400
+ render :partial => 'groups/create_form', :status => 400
end
end
@@ -76,21 +67,12 @@ class GroupsController < ApplicationController
group = Group.find(params[:id])
if group.update_attributes(params[:group])
flash[:notice] = 'Group is updated.'
- end
-
- to_index(group.errors, nil)
- end
-
- def update_modal
- group = Group.find(params[:id])
- if group.update_attributes(params[:group])
- flash[:notice] = 'Group is updated.'
render :text => 'ok', :status => 200
else
@group = group
@errors = []
group.errors.full_messages.each{|msg| @errors<<msg}
- render :partial => 'groups/edit_modal_form', :status => 400
+ render :partial => 'groups/edit_form', :status => 400
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_create_modal_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_create_form.html.erb
index 4584b5e297c..1e4036728b9 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_create_modal_form.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_create_form.html.erb
@@ -1,11 +1,7 @@
-<%
- action_name = 'create_modal'
- title="Add new group"
-%>
-<% form_for :group, @group, :url => { :action => action_name, :id => @group.id}, :html => { :id =>'group_modal_form'} do |f| %>
+<% form_for :group, @group, :url => { :action => 'create', :id => @group.id}, :html => { :id =>'group_form'} do |f| %>
<fieldset>
<div class="modal-head">
- <h2><%= title %></h2>
+ <h2>Add new group</h2>
</div>
<div class="modal-body">
@@ -34,5 +30,5 @@
</fieldset>
<% end %>
<script>
- $j("#group_modal_form").modalForm();
+ $j("#group_form").modalForm();
</script> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_edit_modal_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_edit_form.html.erb
index 3e7297757b9..83304d66087 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_edit_modal_form.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/_edit_form.html.erb
@@ -1,11 +1,7 @@
-<%
- action_name = 'update_modal'
- title='Edit group'
-%>
-<% form_for :group, @group, :url => { :action => action_name, :id => @group.id}, :html => { :id =>'group_modal_form'} do |f| %>
+<% form_for :group, @group, :url => { :action => 'update', :id => @group.id}, :html => { :id =>'group_form'} do |f| %>
<fieldset>
<div class="modal-head">
- <h2><%= title %>&nbsp;<%= @group.name -%></h2>
+ <h2>Edit group&nbsp;<%= @group.name -%></h2>
</div>
<div class="modal-body">
@@ -34,5 +30,5 @@
</fieldset>
<% end %>
<script>
- $j("#group_modal_form").modalForm();
+ $j("#group_form").modalForm();
</script> \ 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 c5d889a6cdf..f797b77db48 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
@@ -2,7 +2,7 @@
<% if profiles_administrator? %>
<ul style="float: right" class="horizontal">
<li class="marginleft10 add">
- <a href="<%=ApplicationController.root_context-%>/groups/create_modal_form" class="open-modal link-action">Add new group</a>
+ <a href="<%=ApplicationController.root_context-%>/groups/create_form" class="open-modal link-action">Add new group</a>
</li>
</ul>
<% end %>
@@ -32,10 +32,7 @@
<span id="count-<%= u group.name -%>"><%= group.users.count %></span> (<%= link_to "select", { :action => 'select_user', :id => group.id}, {:id => "select-#{u group.name}", :class => 'link-action'} %>)
</td>
<td class="operations" style="text-align: right">
- <%= link_to "Edit", { :action => 'index', :id => group.id},
- { :method => :get, :id => "edit-#{u group.name}", :class => 'link-action'} %>
- &nbsp;
- <a id='edit-<%= h group.name %>' method='get' class='open-modal link-action' href="<%=ApplicationController.root_context-%>/groups/edit_modal_form/<%= h group.id %>">Edit_modal</a>
+ <a id='edit-<%= h group.name %>' method='get' class='open-modal link-action' href="<%=ApplicationController.root_context-%>/groups/edit_form/<%= h group.id %>">Edit</a>
&nbsp;
<%= 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}"} %>
@@ -46,40 +43,5 @@
</table>
<script>TableKit.Sortable.init('groups');</script>
</td>
- <td class="sep"> </td>
- <td valign="top" align="right" width="210">
- <%
- action_name = 'create'
- title="Add new group"
- if @group.id
- action_name = 'update'
- title='Edit group'
- end
- %>
- <table class="admintable left" width="100%">
- <% form_for :group, @group, :url => { :action => action_name, :id => @group.id} do |f| %>
- <tbody>
- <tr>
- <td><h1><%= title %></h1></td>
- </tr>
- <tr>
- <td class="left">
- Name:<br/>
- <%= f.text_field :name, :size => 25 %><br/>
- <span class="desc">Ex: my-group</span></td>
- </tr>
- <tr>
- <td class="left" valign="top">Description:<br/><%= f.text_area :description, :rows => 3, :cols => 25 %></td>
- </tr>
- <tr>
- <td class="left" nowrap="nowrap" valign="top" colspan="2">
- <%= submit_tag @group.id.nil? ? 'Create':'Update' %>
- <%= link_to 'Cancel', { :controller => 'groups', :action => 'index', :id => nil}, { :class => 'action' } %><br/>
- </td>
- </tr>
- </tbody>
- <% end %>
- </table>
- </td>
</tr>
</table>