Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport Fix issue editing and deleting a specific post #3360

Merged
merged 4 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

**Fixed**:

- **decidim-blog**: Add `params[:id]` when editing/deleting a post from admin site [\#3360](https://github.com/decidim/decidim/pull/3360)
- **decidim-admin**: Fixes the validation uniqueness name of area, scoped with organization and area_type [\#3350](https://github.com/decidim/decidim/pull/3350)

## [0.11.0.pre](https://github.com/decidim/decidim/tree/v0.11.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def destroy
private

def post
@post ||= Blogs::Post.find_by(component: current_component)
@post ||= Blogs::Post.find_by(component: current_component, id: params[:id])
end
end
end
Expand Down
18 changes: 7 additions & 11 deletions decidim-blogs/spec/shared/manage_posts_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

shared_examples "manage posts" do
it "updates a post" do
within find("tr", text: translated(post.title)) do
within find("tr", text: translated(post1.title)) do
click_link "Edit"
end

Expand All @@ -29,6 +29,7 @@

within "table" do
expect(page).to have_content("My new title")
expect(page).to have_content("Post title 2")
end
end

Expand Down Expand Up @@ -59,31 +60,26 @@

within "table" do
expect(page).to have_content("My post")
expect(page).to have_content("Post title 1")
expect(page).to have_content("Post title 2")
end
end

describe "deleting a post" do
let(:title) do
{
en: "This is the title of deleted post",
es: "Este es el t铆tulo del post eliminado",
ca: "Aquest 茅s el t铆tol del post eliminat"
}
end

before do
visit current_path
end

it "deletes a post" do
within find("tr", text: translated(post.title)) do
within find("tr", text: translated(post1.title)) do
accept_confirm { click_link "Delete" }
end

expect(page).to have_admin_callout("successfully")

within "table" do
expect(page).to have_no_content(translated(post.title))
expect(page).to have_no_content(translated(post1.title))
expect(page).to have_content(translated(post2.title))
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion decidim-blogs/spec/system/admin_manages_posts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

describe "Admin manages posts", type: :system do
let(:manifest_name) { "blogs" }
let!(:post) { create :post, component: current_component }
let!(:post1) { create :post, component: current_component, title: { en: "Post title 1" } }
let!(:post2) { create :post, component: current_component, title: { en: "Post title 2" } }

include_context "when managing a component as an admin"

Expand Down
3 changes: 2 additions & 1 deletion decidim-blogs/spec/system/process_admin_manages_post_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

describe "Process admin manages post", type: :system do
let(:manifest_name) { "blogs" }
let!(:post) { create :post, component: current_component }
let!(:post1) { create :post, component: current_component, title: { en: "Post title 1" } }
let!(:post2) { create :post, component: current_component, title: { en: "Post title 2" } }

include_context "when managing a component as a process admin"

Expand Down