-
-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation to "Download my data" page (#13711)
Co-authored-by: Tom Greenwood <101816158+greenwoodt@users.noreply.github.com> Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro> Co-authored-by: Alejandro Rueda López <alejandro.rueda@nazaries.com> Co-authored-by: MariaDascaluPublicis <166501615+MariaDascaluPublicis@users.noreply.github.com>
- Loading branch information
1 parent
e45e59b
commit b759937
Showing
27 changed files
with
587 additions
and
124 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
24 changes: 24 additions & 0 deletions
24
decidim-budgets/spec/services/decidim/download_your_data_exporter_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,24 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
require "decidim/core/test/shared_examples/download_your_data_shared_examples" | ||
|
||
module Decidim | ||
describe DownloadYourDataExporter do | ||
subject { DownloadYourDataExporter.new(user, "download-your-data", "CSV") } | ||
|
||
let(:organization) { create(:organization) } | ||
let(:user) { create(:user, organization:) } | ||
let(:component) { create(:budgets_component, organization:) } | ||
let(:budget) { create(:budget, component:) } | ||
|
||
describe "#readme" do | ||
context "when the user has a budgets' order" do | ||
let!(:order) { create(:order, budget:, user:) } | ||
let(:help_definition_string) { "The projects that the order has voted on" } | ||
|
||
it_behaves_like "a download your data entity" | ||
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
64 changes: 64 additions & 0 deletions
64
decidim-comments/spec/services/decidim/download_your_data_exporter_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,64 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
require "decidim/core/test/shared_examples/download_your_data_shared_examples" | ||
|
||
module Decidim | ||
describe DownloadYourDataExporter do | ||
subject { DownloadYourDataExporter.new(user, "download-your-data", "CSV") } | ||
|
||
let(:user) { create(:user, organization:) } | ||
let(:organization) { create(:organization) } | ||
let(:expected_files) do | ||
# this are the prefixes for the files that could have user generated content | ||
%w( | ||
decidim-comments-comments- | ||
decidim-comments-commentvotes- | ||
) | ||
end | ||
|
||
describe "#data_and_attachments_for_user" do | ||
context "when the user has a comment" do | ||
let(:participatory_space) { create(:participatory_process, organization:) } | ||
let(:component) { create(:component, participatory_space:) } | ||
let(:commentable) { create(:dummy_resource, component:) } | ||
|
||
let!(:comment) { create(:comment, commentable:, author: user) } | ||
|
||
it "returns the comment data" do | ||
user_data, = subject.send(:data_and_attachments_for_user) | ||
|
||
user_data.find { |entity, _| entity == "decidim-comments-comments" }.tap do |_, exporter_data| | ||
csv_comments = exporter_data.read.split("\n") | ||
expect(csv_comments.count).to eq 2 | ||
expect(csv_comments.first).to start_with "id;created_at;body;locale;author/id;author/name;alignment;depth;" | ||
expect(csv_comments.second).to start_with "#{comment.id};" | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe "#readme" do | ||
context "when the user has a comment" do | ||
let(:participatory_space) { create(:participatory_process, organization:) } | ||
let(:component) { create(:component, participatory_space:) } | ||
let(:commentable) { create(:dummy_resource, component:) } | ||
let!(:comment) { create(:comment, commentable:, author: user) } | ||
let(:help_definition_string) { "If this comment was a favour, against or neutral" } | ||
|
||
it_behaves_like "a download your data entity" | ||
end | ||
|
||
context "when the user has a comment vote" do | ||
let(:participatory_space) { create(:participatory_process, organization:) } | ||
let(:component) { create(:component, participatory_space:) } | ||
let(:commentable) { create(:dummy_resource, component:) } | ||
let!(:comment) { create(:comment, commentable:) } | ||
let!(:comment_vote) { create(:comment_vote, comment:, author: user) } | ||
let(:help_definition_string) { "The weight of the vote (1 for upvote, -1 for downvote)" } | ||
|
||
it_behaves_like "a download your data entity" | ||
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
29 changes: 29 additions & 0 deletions
29
decidim-conferences/spec/services/decidim/download_your_data_exporter_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,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
require "decidim/core/test/shared_examples/download_your_data_shared_examples" | ||
|
||
module Decidim | ||
describe DownloadYourDataExporter do | ||
subject { DownloadYourDataExporter.new(user, "download-your-data", "CSV") } | ||
|
||
let(:user) { create(:user, organization:) } | ||
let(:organization) { create(:organization) } | ||
|
||
describe "#readme" do | ||
context "when the user has a conference invite" do | ||
let!(:conference_invite) { create(:conference_invite, user:) } | ||
let(:help_definition_string) { "The date when this conference invitation was sent" } | ||
|
||
it_behaves_like "a download your data entity" | ||
end | ||
|
||
context "when the user has a conference registration" do | ||
let!(:conference_registration) { create(:conference_registration, user:) } | ||
let(:help_definition_string) { "The type of registration that this belongs to" } | ||
|
||
it_behaves_like "a download your data entity" | ||
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
31 changes: 0 additions & 31 deletions
31
decidim-core/app/packs/stylesheets/decidim/_open_data.scss
This file was deleted.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
decidim-core/app/views/decidim/application/_accordion_section.html.erb
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 @@ | ||
<div class="card-accordion" data-component="accordion"> | ||
<div class="card-accordion-divider"> | ||
<button class="card-accordion-divider-button" data-open="<%= open_accordion ||= false %>" data-controls="panel-title--<%= panel_id %>" type="button"> | ||
<h2 class="card-accordion-title" id="title"> | ||
<%= title %> | ||
</h2> | ||
<%= icon "arrow-down-s-line", class: "mb-4" %> | ||
</button> | ||
</div> | ||
|
||
<div id="panel-title--<%= panel_id %>" class="card-accordion-section editor-content" aria-hidden="true"> | ||
<%= yield %> | ||
</div> | ||
</div> |
15 changes: 10 additions & 5 deletions
15
decidim-core/app/views/decidim/download_your_data/_export.html.erb
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
<tr> | ||
<td class="text-left py-4 font-bold"><%= t(export.export_type, scope:"decidim.download_your_data.show") %></td> | ||
<td class="text-left p-4"><%= t(export.export_type, scope:"decidim.download_your_data.show") %></td> | ||
<td class="text-center"><%= export.expired? ? t("expired", scope:"decidim.download_your_data.show") : l(export.expires_at, format: :decidim_short) %></td> | ||
<td class="text-left py-4"> | ||
<%= button_to t("download", scope:"decidim.download_your_data.show"), download_download_your_data_path(export), | ||
class: "button button__sm button__secondary ml-auto", | ||
<td class="py-4"> | ||
<%= button_to download_download_your_data_path(export), | ||
class: "button button__sm button__transparent-secondary m-auto block", | ||
disabled: export.expired?, | ||
method: :get %> | ||
aria: { label: t("download", scope:"decidim.download_your_data.show") }, | ||
method: :get do %> | ||
<span class="hidden lg:block"><%= t("download", scope:"decidim.download_your_data.show") %></span> | ||
<span class="lg:hidden"><%= icon "download-line", class: "text-secondary fill-current" %></span> | ||
<% end %> | ||
|
||
</td> | ||
</tr> |
Oops, something went wrong.