Commit 679fe9c9 authored by David F.'s avatar David F.
Browse files

Merge branch...

Merge branch '69-probleme-de-reedition-d-informations-apres-une-premiere-mise-a-jour-d-edition-d-un-membre' into 'master'

Resolve "Problème de réédition d'informations après une première mise à jour d'édition d'un membre"

See merge request CDSA33/OLIGAA!89
parents da45ee41 b08a7579
......@@ -261,10 +261,9 @@ function display_selected_contacts_in ($container) {
/* Members management */
function expand_path (e) {
path = $(e).attr('data-expand');
tab = path.split("|")[0]
mg = path.split("|")[1]
$('#tabs').tabs('select',tab);
toggle_fields(mg);
tab = path.split("|")[0].slice(1);
mg = path.split("|")[1].slice(0, -1);
fetch_or_toggle_members(mg);
}
function fetch_or_toggle_members (mg) {
......
......@@ -43,8 +43,11 @@ class MemberGroupsController < ApplicationController
Member.by_name.admins
when "blocked"
Member.by_name.blocked
else MemberGroup.find(params[:id]).members.by_name
else
member_group = MemberGroup.find(params[:id])
member_group.members.by_name
end
@mg_id = member_group.try(:id) || params[:id]
end
end
end
......
......@@ -28,7 +28,7 @@ class MembersController < ApplicationController
respond_to do |format|
format.html do
@path_to_expand = if params[:mg_id] && params[:mg_id] != "0"
"#groups_management|" << (params[:mg_id] == "ungrouped_members" ? "#ungrouped_members" : "#mg-#{params[:mg_id]}")
"#groups_management|" << (params[:mg_id] == "ungrouped" ? "#ungrouped" : "#mg-#{params[:mg_id]}")
end
@member_groups = MemberGroup.by_title
end
......@@ -153,7 +153,8 @@ class MembersController < ApplicationController
render :action => "edit"
else
if admin?
redirect_to members_url(:mg_id => params[:selected_mg])
redirect = (params[:selected_mg].present? ? members_url(mg_id: params[:selected_mg]) : @member)
redirect_to redirect
else
redirect_to @member
end
......
......@@ -21,7 +21,7 @@
# along with OLIGAA. If not, see <http://www.gnu.org/licenses/>.
%>
<% unless @members.empty? %>
<%= render @members %>
<%= render @members, mg_id: @mg_id%>
<% else %>
<li>Aucun</li>
<% end %>
......@@ -124,14 +124,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link "Membres sans groupe"
pending "works in UI, AJAX :("
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
end
visit members_path
click_link "Membres sans groupe"
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
expect(current_path).to eq(member_path(@member))
......@@ -152,14 +153,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link "Membres sans groupe"
pending "works in UI, AJAX :("
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
end
visit members_path
click_link "Membres sans groupe"
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
expect(current_path).to eq(member_path(@member))
......@@ -184,14 +186,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link "Membres sans groupe"
pending "works in UI, AJAX :("
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
end
visit members_path
click_link "Membres sans groupe"
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
expect(current_path).to eq(member_path(@member))
......@@ -218,7 +221,7 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
expect(page).to have_content "Compte mis à jour avec succès."
visit member_path @member
......@@ -244,7 +247,7 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
expect(page).to have_content "Compte mis à jour avec succès."
visit member_path @member
......@@ -273,7 +276,7 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
expect(page).to have_content "Compte mis à jour avec succès."
visit member_path @member
......@@ -335,13 +338,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link mg.title
pending "works in UI, AJAX :("
expect(page).to have_selector("li", text: @member.name)
end
visit members_path
click_link mg.title
expect(page).to have_selector("li", text: @member.name)
end
scenario "I can set its registry date" do
......@@ -352,12 +357,9 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
end
visit member_path @member.reload
within "section#content" do
expect(page).to have_content registry_date
end
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment