forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2daddd
commit 8e6a317
Showing
30 changed files
with
211 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
decidim-assemblies/spec/system/admin/admin_manages_assembly_component_share_tokens_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Admin manages assembly component share tokens" do | ||
include_context "when admin administrating an assembly" | ||
|
||
it_behaves_like "manage component share tokens" do | ||
let(:participatory_space) { assembly } | ||
let(:participatory_space_engine) { decidim_admin_assemblies } | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
decidim-assemblies/spec/system/admin/admin_manages_assembly_share_tokens_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Admin manages assembly share tokens" do | ||
let!(:user) { create(:user, :admin, :confirmed, organization:) } | ||
let(:organization) { create(:organization) } | ||
let!(:assembly) { create(:assembly, organization:, private_space: true) } | ||
|
||
it_behaves_like "manage participatory space share tokens" do | ||
let(:participatory_space) { assembly } | ||
let(:participatory_space_path) { decidim_admin_assemblies.edit_assembly_path(assembly) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...dim-conferences/spec/system/admin/admin_manages_conference_component_share_tokens_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Admin manages conference component share tokens" do | ||
include_context "when admin administrating a conference" | ||
|
||
it_behaves_like "manage conference components" do | ||
let(:participatory_space) { conference } | ||
let(:participatory_space_engine) { decidim_admin_conferences } | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
decidim-conferences/spec/system/admin/admin_manages_conference_share_tokens_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Admin manages conference share tokens" do | ||
include_context "when admin administrating a conference" | ||
|
||
it_behaves_like "manage participatory space share tokens" do | ||
let(:participatory_space) { conference } | ||
let(:participatory_space_path) { decidim_admin_conferences.edit_conference_path(conference) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...lib/decidim/core/test/shared_examples/manage_participatory_space_share_tokens_examples.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.shared_examples "manage participatory space share tokens" do | ||
before do | ||
switch_to_host(organization.host) | ||
login_as user, scope: :user | ||
end | ||
|
||
def visit_share_tokens_path | ||
visit participatory_space_path | ||
click_on "Share tokens" | ||
end | ||
|
||
context "when visiting the share_tokens page for the participatory space" do | ||
let!(:share_token) { create(:share_token, token_for: participatory_space, organization:, user:, registered_only: true) } | ||
|
||
before do | ||
visit participatory_space_path | ||
end | ||
|
||
it "has a share button that opens the share tokens admin" do | ||
click_on "Share" | ||
expect(page).to have_content("Sharing tokens for: #{translated(participatory_space.title)}") | ||
expect(page).to have_css("tbody tr", count: 1) | ||
expect(page).to have_content(share_token.token) | ||
end | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
...nitiatives/app/controllers/decidim/initiatives/admin/component_share_tokens_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Initiatives | ||
module Admin | ||
# This controller allows sharing unpublished things. | ||
# It is targeted for customizations for sharing unpublished things that lives under | ||
# an initiative. | ||
class ComponentShareTokensController < Decidim::Admin::ShareTokensController | ||
include InitiativeAdmin | ||
|
||
def resource | ||
@resource ||= current_participatory_space.components.find(params[:component_id]) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...dim-initiatives/spec/system/admin/admin_manages_initiative_component_share_tokens_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Admin manages initiative component share tokens" do | ||
let(:organization) { create(:organization) } | ||
let(:user) { create(:user, :admin, :confirmed, organization:) } | ||
let!(:participatory_space) do | ||
create(:initiative, organization:) | ||
end | ||
|
||
it_behaves_like "manage component share tokens" do | ||
let(:participatory_space_engine) { decidim_admin_initiatives } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
decidim-initiatives/spec/system/admin/admin_manages_initiative_share_tokens_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe "Admin manages initiative share tokens" do | ||
let(:organization) { create(:organization) } | ||
let(:user) { create(:user, :admin, :confirmed, organization:) } | ||
let!(:participatory_space) do | ||
create(:initiative, organization:) | ||
end | ||
|
||
it_behaves_like "manage participatory space share tokens" do | ||
let(:participatory_space_path) { decidim_admin_initiatives.edit_initiative_path(participatory_space) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.