Skip to content

Commit

Permalink
further cleaning of templates
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Apr 24, 2024
1 parent 810c891 commit 0bedfab
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 266 deletions.
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PATH
decidim-core (>= 0.28, < 0.29)
decidim-participatory_processes (>= 0.28, < 0.29)
decidim-proposals (>= 0.28, < 0.29)
decidim-templates (>= 0.28, < 0.29)
deface (>= 1.9)

GEM
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ And then execute (do also this on upgrades):

```
bundle
bundle exec rails decidim_reporting_proposals:install:migrations
bin/rails decidim:upgrade
bin/rails db:migrate
```

Expand All @@ -52,6 +52,14 @@ bin/rails db:migrate
>
> Alternatively, use any other ENV var to set up the `config.deface.enabled` to `false` during the precompilation phase.
> **EXPERTS ONLY**
>
> Under the hood, when running `bundle exec rails decidim:upgrade` the `decidim-reporting_proposals` gem will run the following (that can also be run manually if you consider):
>
> ```bash
> bin/rails decidim_reporting_proposals:install:migrations
> ```
Depending on your Decidim version, you can choose the corresponding version to ensure compatibility:
| Version | Compatible Decidim versions |
Expand Down Expand Up @@ -89,10 +97,6 @@ This module provides the following features:
7. **Hide proposals without reporting**: Administrators can hide proposals directly, without using the reporting process. Also, authors who's content has been hidden receive a notification.
8. **Proposal answers templates**: Administrators can create templates for the answers to proposals. This is useful to provide a standard answer to proposals that are similar. This feature requires to enable the `decidim-templates` official module.
![Templates for proposals answers](features/templates1.png)
![Applying a template](features/templates2.png)
### Customization
Almost all the features of this module can be customized/disabled through an initializer.
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion app/packs/entrypoints/decidim_templates_admin.js

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions config/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
decidim_reporting_proposals_list_component_admin: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_list_component_admin.js",
decidim_reporting_proposals_geocoding: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_geocoding.js",
decidim_reporting_proposals_camera: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_camera.js",
decidim_reporting_proposals_js_validations: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_js_validations.js",
decidim_templates_admin: "#{base_path}/app/packs/entrypoints/decidim_templates_admin.js"
decidim_reporting_proposals_js_validations: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_js_validations.js"
)
2 changes: 0 additions & 2 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ ca:
proposal:
has_no_address: No té adreça
has_no_image: Sense imatge
template:
scope_for_availability: Limita la disponibilitat al component
decidim:
admin:
hidden_resource_mailer:
Expand Down
32 changes: 0 additions & 32 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ en:
proposal:
has_no_address: Has no address
has_no_image: Has no image
template:
scope_for_availability: Restrict availability to the component
decidim:
admin:
actions:
Expand All @@ -22,10 +20,6 @@ en:
hello: Hello,
reason: 'Reason: %{reason}'
subject: Your proposal has been hidden
templates:
fetch:
error: Couldn't find this template, maybe has been deleted?
missing_resource: "(missing resource)"
application:
geocoding:
unconfigured: Geocoding is not configured!
Expand Down Expand Up @@ -493,29 +487,3 @@ en:
delete_image: Delete image
form:
image: Image/photo
templates:
admin:
proposal_answer_templates:
form:
answer_template: Answer template
hint: "<strong>Hint:</strong> You can use these variables anywhere on
the answer template that will be replaced when using the template"
hint1: "<strong>%{organization}</strong> will be replaced by the organization's
name"
hint2: "<strong>%{name}</strong> will be replaced by the author's name"
hint3: "<strong>%{admin}</strong> will be replaced by the admin's name
(the one answering the proposal)"
save: Save
scope_for_availability_help: Note that only participatory spaces having
components of the type "proposals" will be listed.
template_title: Template information
index:
confirm_delete: Are you sure you want to delete this template?
global_scope: Global (available everywhere)
internal_state: Internal State
scope_for_availability: Scope
title: Proposal answers
template_chooser:
select_template: Select a template answer
template_types:
proposal_answer_templates: Proposal answers

This file was deleted.

13 changes: 0 additions & 13 deletions db/migrate/20230404104741_migrate_templatable.rb

This file was deleted.

1 change: 0 additions & 1 deletion decidim-reporting_proposals.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Gem::Specification.new do |spec|
spec.add_dependency "decidim-core", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
spec.add_dependency "decidim-participatory_processes", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
spec.add_dependency "decidim-proposals", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
spec.add_dependency "decidim-templates", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
spec.add_dependency "deface", ">= 1.9"

spec.add_development_dependency "decidim-accountability", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
Expand Down
Binary file removed features/templates1.png
Binary file not shown.
Binary file removed features/templates2.png
Binary file not shown.
10 changes: 0 additions & 10 deletions lib/decidim/reporting_proposals/test/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,3 @@
valuator_role { association :participatory_process_user_role, role: "valuator" }
end
end

FactoryBot.modify do
factory :template, class: "Decidim::Templates::Template" do
trait :proposal_answer do
templatable { organization }
target { :proposal_answer }
field_values { { internal_state: :accepted } }
end
end
end
5 changes: 5 additions & 0 deletions lib/tasks/reporting_proposals_upgrade.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Rake::Task["decidim:choose_target_plugins"].enhance do
ENV["FROM"] = "#{ENV.fetch("FROM", nil)},decidim_reporting_proposals"
end
11 changes: 5 additions & 6 deletions spec/system/admin/add_proposals_photos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@
page.find(".table__list-title a").click
end

it "has 'Photos' section" do
expect(page).to have_content("Add image")
end

context "when photos are added" do
it "the photos are rendered in the photo section" do
click_link_or_button "Photos"
attach_file("proposal_photo_add_photos", Decidim::Dev.asset("city.jpeg"))
click_link_or_button "Add image"
click_link_or_button "Save images"
click_link_or_button "Photos"

expect(page).to have_css("img[src*=\"city.jpeg\"]", count: 1)

attach_file("proposal_photo_add_photos", Decidim::Dev.asset("city.jpeg"))
click_link_or_button "Add image"
click_link_or_button "Save images"

click_link_or_button "Photos"
expect(page).to have_css("img[src*=\"city.jpeg\"]", count: 2)

expect(page).to have_css(".delete-proposal__button", count: 2)
Expand Down
117 changes: 0 additions & 117 deletions spec/system/admin/admin_manages_answer_templates_spec.rb

This file was deleted.

36 changes: 0 additions & 36 deletions spec/system/admin/answer_form_without_status_spec.rb

This file was deleted.

0 comments on commit 0bedfab

Please sign in to comment.