diff --git a/.github/workflows/tests-legacy.yml b/.github/workflows/tests-legacy.yml deleted file mode 100644 index 5ab2ab6..0000000 --- a/.github/workflows/tests-legacy.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: "[CI] Tests 0.26" - -on: - push: - branches: - - main - pull_request: - -env: - CI: 1 - SIMPLECOV: 1 - NODE_VERSION: 16.9.1 - RUBY_VERSION: 2.7.7 - BUNDLE_GEMFILE: Gemfile.legacy - -jobs: - tests-legacy: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - rspec: " --exclude-pattern 'spec/system/**/*_spec.rb'" - features: enabled - - rspec: system/*_spec.rb - features: enabled - fail-fast: false - - services: - postgres: - image: postgres:11 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_PASSWORD: postgres - env: - DATABASE_USERNAME: postgres - DATABASE_PASSWORD: postgres - DATABASE_HOST: localhost - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - bundler-cache: true - - - uses: nanasess/setup-chromedriver@v2 - with: - chromedriver-version: 119.0.6045.105 - - - uses: actions/setup-node@master - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Setup Test App - run: bundle exec rake test_app - - - name: General RSpec with config vars ${{ matrix.features }} - run: bundle exec rspec spec/${{ matrix.rspec }} - env: - FEATURES: ${{ matrix.features }} - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - - - uses: actions/upload-artifact@v2-preview - if: always() - with: - name: screenshots - path: ./spec/decidim_dummy_app/tmp/screenshots diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 9e5c299..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,300 +0,0 @@ -CHANGELOG -========= - -v0.10.2 ------- - -Compatibility: - - Decidim v0.27.4 - - Decidim v0.26.8 - -Features: - - Added translations - - Fix deface override updating tag in the admin - -v0.10.1 ------- - -Compatibility: - - Decidim v0.27.4 - - Decidim v0.26.8 - -Features: - - Added translations - - Fix deface override updating tag - - Fix ordering with accents - -v0.10.0 ------- - -Compatibility: - - Decidim v0.27.4 - - Decidim v0.26.8 - -Features: - - Migrate to [Deface](https://github.com/spree/deface) for overrides - - Introduce Weighted Voting with configurable manifests for different types of votings with grades - - Fix wrong behaviour showing proposals on map - - Introduced new sorting options for proposals. Added alphabetical sorting, reverse sorting, sorting by votes first and last. - -v0.9.3 ------- - -Compatibility: - - Decidim v0.27.3 - - Decidim v0.26.7 - -Features: - - Fixes for admin accountability leaking other tenants data - -v0.9.2 ------- - -Compatibility: - - Decidim v0.27.3 - - Decidim v0.26.7 - -Features: - - Fixes for the menu hacker - -v0.9.1 ------- - -Compatibility: - - Decidim v0.27.x - - Decidim v0.26.x - -Features: - - Fixes for the Awesome Map - - Added Admin Accountability feature - -v0.9.0 ------- - -Compatibility: - - Decidim v0.27.x - - Decidim v0.26.x - -Features: - - Upgrade 0.27 version - -v0.8.4 ------- - -Compatibility: - - Decidim v0.26.x - - Decidim v0.25.x - -Features: - - Feature: Override validation rules for title and body in proposals, with constrains available - - Improve loading process to facilitate development - -v0.8.3 ------- - -Compatibility: - - Decidim v0.26.x - - Decidim v0.25.x - -Features: - - Fix error 500 when visiting pages with questionnaires that are not created - - Added German language - -v0.8.2 ------- - -Compatibility: - - Decidim v0.26.x - - Decidim v0.25.x - -Features: - - Fixes in the quill editor - -v0.8.1 ------- - -Compatibility: - - Decidim v0.26.x - - Decidim v0.25.x - -Features: - - Fixes in the 0.26 webpacker compatibility - -v0.8.0 ------- - -Compatibility: - - Decidim v0.26.x - - Decidim v0.25.x - -Features: - - Several bug fixing related to deactivating features (now there's a test for it). - - Now awesome components can be disabled using the `disabled_components` configuration var. - - Feature: Custom redirections editor: Create shorter URL redirections to other places, inside or outside Decidim. - - Update to webpacker compatiblity and Decidim 0.25 - - Added tasks `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave` (also accessible as a backgroundjob from the awesome admin checks) - - REMOVED: SCSS themes are not available anymore (the alternative is to use custom styles). This is mostly because of webpacker. - -v0.7.2 ------- - -Compatibility: - - Decidim v0.24.x - - Decidim v0.23.x - -Features: - - Added custom fields (with admin interface and scopable) to replace normal body in proposals. - - Change Markdown editor behaviour: now it is converted to HTML before storing in the database. This makes the editor compatible with all Rich Text editors. - - Added icons in the awesome config menu - - Fixes scoped admins accessing process groups - -v0.7.1 ------- - -Compatibility: - - Decidim v0.24.x - - Decidim v0.23.x - -Features: - - Fix CSS custom styles when using html characters - - Add Awesome Map content block for the homepage - - Added processes groups constraint for different scoped tweaks - - Added "Never" constraint to deactivated scoped tweaks temporarily - - Change Markdown editor behaviour: now it is converted to HTML before storing in the database. This makes the editor compatible with all Rich Text editors. This also takes this feature out the the "experimental" zone as the resulting edited text is fully compatible with standard Decidim. - - Added scoped admins feature: Any user can be turned into a limited admin and scoped to one or more participatory spaces. - - Fix allowing access to participatory space admins (only full admins can access the module). - - Added `participatory_spaces_routes_context` config variable to specify additional routes correspondences to participatory spaces. - -v0.7.0 ------- - -Compatibility: - - Decidim v0.24 - - Decidim v0.23.x - - Decidim v0.23 - -v0.6.7 ------- - -Compatibility: - - Decidim v0.23.x - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Feature: Truncate description in map popups to configurable character limit - - Add CSS validation and syntax highlighting in CSS boxes editors - - Fix: filter awesome map by hash takes into account the status of categories - -v0.6.6 ------- - -Compatibility: - - Decidim v0.23.3 - - Decidim v0.23.2 - - Decidim v0.23.1 - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Fix: Prevents overrides for menus not specified in awesome config - - Fix: Respect original @if condition for menu presenter for native menus - -v0.6.5 ------- - -Compatibility: - - Decidim v0.23.3 - - Decidim v0.23.2 - - Decidim v0.23.1 - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Allow admins to modify the main Decidim menu - -v0.6.4 ------- - -Compatibility: - - Decidim v0.23.3 - - Decidim v0.23.2 - - Decidim v0.23.1 - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Fixes a 500 error when custom styles is empty - - Fixes removal of existing css boxes when other configuration are changed - -v0.6.3 ------- - -Compatibility: - - Decidim v0.23.3 - - Decidim v0.23.2 - - Decidim v0.23.1 - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Adds custom scoped styles - -v0.6.2 ------- - -Compatibility: - - Decidim release/0.23-stable - - Decidim v0.23.1 - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Fixes compatibility with proposals in branch `release/0.23-stable` - -v0.6.1 ------- - -Compatibility: - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Improve awesome map categories visualization - - Fix image uploader - - Adds announcements for full screen iframes - -v0.6 ----- - -Compatibility: - - Decidim v0.23 - - Decidim v0.22 - -Features: - - Full screen iframe component - - live support chat linked with Telegram - -v0.4, 0.5 ----- - -Compatibility: - - Decidim v0.22 - - Decidim v0.21 - -Features: - - Decidim CSS themes for tenants - -v0.3 ----- - -Compatibility: - - Decidim v0.21 - - Decidim v0.20 - -Features: - - Awesome map - - Images in rich text editors - - Images in textarea editors - - Autosave forms - - Scoped constraints for each feature diff --git a/Gemfile.legacy b/Gemfile.legacy deleted file mode 100644 index 8d7429c..0000000 --- a/Gemfile.legacy +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -ruby RUBY_VERSION -DECIDIM_VERSION = "0.26.8" - -gem "decidim", DECIDIM_VERSION -gem "decidim-iframe", path: "." - -gem "bootsnap", "~> 1.4" - -gem "puma", ">= 5.5.1" -gem "uglifier", "~> 4.1" - -gem "faker", "~> 2.14" - -group :development, :test do - gem "byebug", "~> 11.0", platform: :mri - - gem "decidim-dev", DECIDIM_VERSION -end - -group :development do - gem "letter_opener_web", "~> 1.3" - gem "listen", "~> 3.1" - gem "rubocop-faker" - gem "spring", "~> 2.0" - gem "spring-watcher-listen", "~> 2.0.0" - gem "web-console", "~> 3.5" -end - -group :test do - gem "codecov", require: false -end diff --git a/Gemfile.legacy.lock b/Gemfile.legacy.lock deleted file mode 100644 index b47deec..0000000 --- a/Gemfile.legacy.lock +++ /dev/null @@ -1,811 +0,0 @@ -PATH - remote: . - specs: - decidim-iframe (0.10.2) - decidim-admin (>= 0.26.0, < 0.28) - decidim-core (>= 0.26.0, < 0.28) - deface (>= 1.5) - sassc (~> 2.3) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (6.0.6.1) - actionpack (= 6.0.6.1) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - mail (>= 2.7.1) - actionmailer (6.0.6.1) - actionpack (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.0.6.1) - actionview (= 6.0.6.1) - activesupport (= 6.0.6.1) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.6.1) - actionpack (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - nokogiri (>= 1.8.5) - actionview (6.0.6.1) - activesupport (= 6.0.6.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_link_to (1.0.5) - actionpack - addressable - activejob (6.0.6.1) - activesupport (= 6.0.6.1) - globalid (>= 0.3.6) - activemodel (6.0.6.1) - activesupport (= 6.0.6.1) - activerecord (6.0.6.1) - activemodel (= 6.0.6.1) - activesupport (= 6.0.6.1) - activestorage (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - marcel (~> 1.0) - activesupport (6.0.6.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) - acts_as_list (0.9.19) - activerecord (>= 3.0) - addressable (2.8.5) - public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) - axe-core-api (4.8.0) - dumb_delegator - virtus - axe-core-rspec (4.1.0) - axe-core-api - dumb_delegator - virtus - axiom-types (0.1.1) - descendants_tracker (~> 0.0.4) - ice_nine (~> 0.11.0) - thread_safe (~> 0.3, >= 0.3.1) - base64 (0.2.0) - batch-loader (1.5.0) - bcrypt (3.1.19) - better_html (1.0.16) - actionview (>= 4.0) - activesupport (>= 4.0) - ast (~> 2.0) - erubi (~> 1.4) - html_tokenizer (~> 0.0.6) - parser (>= 2.4) - smart_properties - bindex (0.8.1) - bootsnap (1.17.0) - msgpack (~> 1.2) - browser (2.7.1) - builder (3.2.4) - byebug (11.1.3) - capybara (3.39.2) - addressable - matrix - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) - xpath (~> 3.2) - carrierwave (2.2.4) - activemodel (>= 5.0.0) - activesupport (>= 5.0.0) - addressable (~> 2.6) - image_processing (~> 1.1) - marcel (~> 1.0.0) - mini_mime (>= 0.1.3) - ssrf_filter (~> 1.0) - cells (4.1.7) - declarative-builder (< 0.2.0) - declarative-option (< 0.2.0) - tilt (>= 1.4, < 3) - uber (< 0.2.0) - cells-erb (0.1.0) - cells (~> 4.0) - erbse (>= 0.1.1) - cells-rails (0.1.5) - actionpack (>= 5.0) - cells (>= 4.1.6, < 5.0.0) - charlock_holmes (0.7.7) - chef-utils (18.3.0) - concurrent-ruby - childprocess (3.0.0) - codecov (0.6.0) - simplecov (>= 0.15, < 0.22) - coercible (1.0.0) - descendants_tracker (~> 0.0.1) - coffee-rails (5.0.0) - coffee-script (>= 2.2.0) - railties (>= 5.2.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - concurrent-ruby (1.2.2) - crack (0.4.5) - rexml - crass (1.0.6) - css_parser (1.16.0) - addressable - date (3.3.4) - date_validator (0.9.0) - activemodel - activesupport - db-query-matchers (0.10.0) - activesupport (>= 4.0, < 7) - rspec (~> 3.0) - decidim (0.26.8) - decidim-accountability (= 0.26.8) - decidim-admin (= 0.26.8) - decidim-api (= 0.26.8) - decidim-assemblies (= 0.26.8) - decidim-blogs (= 0.26.8) - decidim-budgets (= 0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - decidim-debates (= 0.26.8) - decidim-forms (= 0.26.8) - decidim-generators (= 0.26.8) - decidim-meetings (= 0.26.8) - decidim-pages (= 0.26.8) - decidim-participatory_processes (= 0.26.8) - decidim-proposals (= 0.26.8) - decidim-sortitions (= 0.26.8) - decidim-surveys (= 0.26.8) - decidim-system (= 0.26.8) - decidim-templates (= 0.26.8) - decidim-verifications (= 0.26.8) - decidim-accountability (0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - decidim-admin (0.26.8) - active_link_to (~> 1.0) - decidim-core (= 0.26.8) - devise (~> 4.7) - devise-i18n (~> 1.2) - devise_invitable (~> 2.0) - decidim-api (0.26.8) - graphql (~> 1.12, < 1.13) - rack-cors (~> 1.0) - redcarpet (~> 3.5, >= 3.5.1) - decidim-assemblies (0.26.8) - decidim-core (= 0.26.8) - decidim-blogs (0.26.8) - decidim-admin (= 0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - decidim-budgets (0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - decidim-comments (0.26.8) - decidim-core (= 0.26.8) - redcarpet (~> 3.5, >= 3.5.1) - decidim-core (0.26.8) - active_link_to (~> 1.0) - acts_as_list (~> 0.9) - batch-loader (~> 1.2) - browser (~> 2.7) - carrierwave (~> 2.2.1) - cells-erb (~> 0.1.0) - cells-rails (~> 0.1.3) - charlock_holmes (~> 0.7) - date_validator (~> 0.9.0) - decidim-api (= 0.26.8) - devise (~> 4.7) - devise-i18n (~> 1.2) - diffy (~> 3.3) - doorkeeper (~> 5.1) - doorkeeper-i18n (~> 4.0) - file_validators (~> 2.1) - fog-local (~> 0.6) - foundation_rails_helper - geocoder (~> 1.7.5) - hashdiff (>= 0.4.0, < 2.0.0) - invisible_captcha (~> 0.12) - kaminari (~> 1.2, >= 1.2.1) - loofah (~> 2.3.1) - mime-types (>= 1.16, < 4.0) - mini_magick (~> 4.9) - mustache (~> 1.1.0) - omniauth (~> 2.0) - omniauth-facebook (~> 5.0) - omniauth-google-oauth2 (~> 1.0) - omniauth-rails_csrf_protection (~> 1.0) - omniauth-twitter (~> 1.4) - paper_trail (~> 12.0) - pg (~> 1.1.4, < 2) - pg_search (~> 2.2) - premailer-rails (~> 1.10) - rack (~> 2.2, >= 2.2.3) - rack-attack (~> 6.0) - rails (~> 6.0.4) - rails-i18n (~> 6.0) - ransack (~> 2.4.1) - rectify (~> 0.13.0) - redis (~> 4.1) - request_store (~> 1.5.0) - rubyXL (~> 3.4) - rubyzip (~> 2.0) - searchlight (~> 4.1) - seven_zip_ruby (~> 1.3) - social-share-button (~> 1.2, >= 1.2.1) - valid_email2 (~> 2.1) - webpacker (= 6.0.0.rc.5) - wisper (~> 2.0) - decidim-debates (0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - decidim-dev (0.26.8) - axe-core-rspec (~> 4.1.0) - byebug (~> 11.0) - capybara (~> 3.24) - db-query-matchers (~> 0.10.0) - decidim (= 0.26.8) - erb_lint (~> 0.0.35) - factory_bot_rails (~> 4.8) - i18n-tasks (~> 0.9.18) - mdl (~> 0.5) - nokogiri (~> 1.12) - puma (~> 5.0) - rails-controller-testing (~> 1.0) - rspec-cells (~> 0.3.4) - rspec-html-matchers (~> 0.9.1) - rspec-rails (~> 4.0) - rspec-retry (~> 0.6.2) - rspec_junit_formatter (~> 0.3.0) - rubocop (~> 0.92.0) - rubocop-rails (~> 2.8) - rubocop-rspec (= 1.43.2) - selenium-webdriver (~> 3.142) - simplecov (~> 0.19.0) - simplecov-cobertura (~> 1.3.1) - system_test_html_screenshots (~> 0.2) - w3c_rspec_validators (~> 0.3.0) - webmock (~> 3.6) - wisper-rspec (~> 1.0) - decidim-forms (0.26.8) - decidim-core (= 0.26.8) - wicked_pdf (~> 2.1) - wkhtmltopdf-binary (~> 0.12) - decidim-generators (0.26.8) - decidim-core (= 0.26.8) - decidim-meetings (0.26.8) - decidim-core (= 0.26.8) - decidim-forms (= 0.26.8) - icalendar (~> 2.5) - decidim-pages (0.26.8) - decidim-core (= 0.26.8) - decidim-participatory_processes (0.26.8) - decidim-core (= 0.26.8) - decidim-proposals (0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - doc2text (~> 0.4.4) - redcarpet (~> 3.5, >= 3.5.1) - decidim-sortitions (0.26.8) - decidim-admin (= 0.26.8) - decidim-comments (= 0.26.8) - decidim-core (= 0.26.8) - decidim-proposals (= 0.26.8) - decidim-surveys (0.26.8) - decidim-core (= 0.26.8) - decidim-forms (= 0.26.8) - decidim-templates (= 0.26.8) - decidim-system (0.26.8) - active_link_to (~> 1.0) - decidim-core (= 0.26.8) - devise (~> 4.7) - devise-i18n (~> 1.2) - devise_invitable (~> 2.0) - decidim-templates (0.26.8) - decidim-core (= 0.26.8) - decidim-forms (= 0.26.8) - decidim-verifications (0.26.8) - decidim-core (= 0.26.8) - declarative-builder (0.1.0) - declarative-option (< 0.2.0) - declarative-option (0.1.0) - deface (1.9.0) - actionview (>= 5.2) - nokogiri (>= 1.6) - polyglot - railties (>= 5.2) - rainbow (>= 2.1.0) - descendants_tracker (0.0.4) - thread_safe (~> 0.3, >= 0.3.1) - devise (4.9.3) - bcrypt (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 4.1.0) - responders - warden (~> 1.2.3) - devise-i18n (1.12.0) - devise (>= 4.9.0) - devise_invitable (2.0.9) - actionmailer (>= 5.0) - devise (>= 4.6) - diff-lcs (1.5.0) - diffy (3.4.2) - doc2text (0.4.6) - nokogiri (>= 1.13.2, < 1.15.0) - rubyzip (~> 2.3.0) - docile (1.4.0) - doorkeeper (5.6.6) - railties (>= 5) - doorkeeper-i18n (4.0.1) - dumb_delegator (1.0.0) - equalizer (0.0.11) - erb_lint (0.0.37) - activesupport - better_html (~> 1.0.7) - html_tokenizer - parser (>= 2.7.1.4) - rainbow - rubocop - smart_properties - erbse (0.1.4) - temple - erubi (1.12.0) - excon (0.104.0) - execjs (2.9.1) - factory_bot (4.11.1) - activesupport (>= 3.0.0) - factory_bot_rails (4.11.1) - factory_bot (~> 4.11.1) - railties (>= 3.0.0) - faker (2.23.0) - i18n (>= 1.8.11, < 2) - faraday (2.7.11) - base64 - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.2) - ffi (1.16.3) - file_validators (2.3.0) - activemodel (>= 3.2) - mime-types (>= 1.0) - fog-core (2.3.0) - builder - excon (~> 0.71) - formatador (>= 0.2, < 2.0) - mime-types - fog-local (0.8.0) - fog-core (>= 1.27, < 3.0) - formatador (1.1.0) - foundation_rails_helper (4.0.1) - actionpack (>= 4.1, < 7.1) - activemodel (>= 4.1, < 7.1) - activesupport (>= 4.1, < 7.1) - railties (>= 4.1, < 7.1) - geocoder (1.7.5) - globalid (1.1.0) - activesupport (>= 5.0) - graphql (1.12.24) - hashdiff (1.0.1) - hashie (5.0.0) - highline (2.1.0) - html_tokenizer (0.0.7) - htmlentities (4.3.4) - i18n (1.14.1) - concurrent-ruby (~> 1.0) - i18n-tasks (0.9.37) - activesupport (>= 4.0.2) - ast (>= 2.1.0) - erubi - highline (>= 2.0.0) - i18n - parser (>= 2.2.3.0) - rails-i18n - rainbow (>= 2.2.2, < 4.0) - terminal-table (>= 1.5.1) - icalendar (2.10.0) - ice_cube (~> 0.16) - ice_cube (0.16.4) - ice_nine (0.11.2) - image_processing (1.12.2) - mini_magick (>= 4.9.5, < 5) - ruby-vips (>= 2.0.17, < 3) - invisible_captcha (0.13.0) - rails (>= 3.2.0) - json (2.6.3) - jwt (2.7.1) - kaminari (1.2.2) - activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.2) - kaminari-activerecord (= 1.2.2) - kaminari-core (= 1.2.2) - kaminari-actionview (1.2.2) - actionview - kaminari-core (= 1.2.2) - kaminari-activerecord (1.2.2) - activerecord - kaminari-core (= 1.2.2) - kaminari-core (1.2.2) - kramdown (2.4.0) - rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) - launchy (2.5.2) - addressable (~> 2.8) - letter_opener (1.8.1) - launchy (>= 2.2, < 3) - letter_opener_web (1.4.1) - actionmailer (>= 3.2) - letter_opener (~> 1.0) - railties (>= 3.2) - listen (3.8.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.3.1) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.8.1) - mini_mime (>= 0.1.1) - net-imap - net-pop - net-smtp - marcel (1.0.2) - matrix (0.4.2) - mdl (0.13.0) - kramdown (~> 2.3) - kramdown-parser-gfm (~> 1.1) - mixlib-cli (~> 2.1, >= 2.1.1) - mixlib-config (>= 2.2.1, < 4) - mixlib-shellout - method_source (1.0.0) - mime-types (3.5.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2023.1003) - mini_magick (4.12.0) - mini_mime (1.1.5) - minitest (5.20.0) - mixlib-cli (2.1.8) - mixlib-config (3.0.27) - tomlrb - mixlib-shellout (3.2.7) - chef-utils - msgpack (1.7.2) - multi_xml (0.6.0) - mustache (1.1.1) - net-imap (0.4.5) - date - net-protocol - net-pop (0.1.2) - net-protocol - net-protocol (0.2.2) - timeout - net-smtp (0.4.0) - net-protocol - nio4r (2.5.9) - nokogiri (1.14.5-x86_64-linux) - racc (~> 1.4) - oauth (1.1.0) - oauth-tty (~> 1.0, >= 1.0.1) - snaky_hash (~> 2.0) - version_gem (~> 1.1) - oauth-tty (1.0.5) - version_gem (~> 1.1, >= 1.1.1) - oauth2 (2.0.9) - faraday (>= 0.17.3, < 3.0) - jwt (>= 1.0, < 3.0) - multi_xml (~> 0.5) - rack (>= 1.2, < 4) - snaky_hash (~> 2.0) - version_gem (~> 1.1) - omniauth (2.1.1) - hashie (>= 3.4.6) - rack (>= 2.2.3) - rack-protection - omniauth-facebook (5.0.0) - omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.1.1) - jwt (>= 2.0) - oauth2 (~> 2.0.6) - omniauth (~> 2.0) - omniauth-oauth2 (~> 1.8.0) - omniauth-oauth (1.2.0) - oauth - omniauth (>= 1.0, < 3) - omniauth-oauth2 (1.8.0) - oauth2 (>= 1.4, < 3) - omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.1) - actionpack (>= 4.2) - omniauth (~> 2.0) - omniauth-twitter (1.4.0) - omniauth-oauth (~> 1.1) - rack - orm_adapter (0.5.0) - paper_trail (12.3.0) - activerecord (>= 5.2) - request_store (~> 1.1) - parallel (1.23.0) - parser (3.2.2.4) - ast (~> 2.4.1) - racc - pg (1.1.4) - pg_search (2.3.6) - activerecord (>= 5.2) - activesupport (>= 5.2) - polyglot (0.3.5) - premailer (1.21.0) - addressable - css_parser (>= 1.12.0) - htmlentities (>= 4.0.0) - premailer-rails (1.12.0) - actionmailer (>= 3) - net-smtp - premailer (~> 1.7, >= 1.7.9) - public_suffix (5.0.3) - puma (5.6.7) - nio4r (~> 2.0) - racc (1.7.3) - rack (2.2.8) - rack-attack (6.7.0) - rack (>= 1.0, < 4) - rack-cors (1.1.1) - rack (>= 2.0.0) - rack-protection (3.1.0) - rack (~> 2.2, >= 2.2.4) - rack-proxy (0.7.7) - rack - rack-test (2.1.0) - rack (>= 1.3) - rails (6.0.6.1) - actioncable (= 6.0.6.1) - actionmailbox (= 6.0.6.1) - actionmailer (= 6.0.6.1) - actionpack (= 6.0.6.1) - actiontext (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) - activemodel (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - bundler (>= 1.3.0) - railties (= 6.0.6.1) - sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.5) - actionpack (>= 5.0.1.rc1) - actionview (>= 5.0.1.rc1) - activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.2.0) - activesupport (>= 5.0.0) - minitest - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - rails-i18n (6.0.0) - i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) - railties (6.0.6.1) - actionpack (= 6.0.6.1) - activesupport (= 6.0.6.1) - method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) - rainbow (3.1.1) - rake (13.1.0) - ransack (2.4.2) - activerecord (>= 5.2.4) - activesupport (>= 5.2.4) - i18n - rb-fsevent (0.11.2) - rb-inotify (0.10.1) - ffi (~> 1.0) - rectify (0.13.0) - activemodel (>= 4.1.0) - activerecord (>= 4.1.0) - activesupport (>= 4.1.0) - virtus (~> 1.0.5) - wisper (>= 1.6.1) - redcarpet (3.6.0) - redis (4.8.1) - regexp_parser (2.8.2) - request_store (1.5.1) - rack (>= 1.4) - responders (3.1.1) - actionpack (>= 5.2) - railties (>= 5.2) - rexml (3.2.6) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-cells (0.3.8) - cells (>= 4.0.0, < 6.0.0) - rspec-rails (>= 3.0.0, < 6.1.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-html-matchers (0.9.4) - nokogiri (~> 1) - rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.12.6) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (4.1.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-retry (0.6.2) - rspec-core (> 3.3) - rspec-support (3.12.1) - rspec_junit_formatter (0.3.0) - rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.92.0) - parallel (~> 1.10) - parser (>= 2.7.1.5) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) - rexml - rubocop-ast (>= 0.5.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) - rubocop-faker (1.1.0) - faker (>= 2.12.0) - rubocop (>= 0.82.0) - rubocop-rails (2.9.1) - activesupport (>= 4.2.0) - rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (1.43.2) - rubocop (~> 0.87) - ruby-progressbar (1.13.0) - ruby-vips (2.2.0) - ffi (~> 1.12) - ruby2_keywords (0.0.5) - rubyXL (3.4.25) - nokogiri (>= 1.10.8) - rubyzip (>= 1.3.0) - rubyzip (2.3.2) - sassc (2.4.0) - ffi (~> 1.9) - searchlight (4.1.0) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - semantic_range (3.0.0) - seven_zip_ruby (1.3.0) - simplecov (0.19.1) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov-cobertura (1.3.1) - simplecov (~> 0.8) - simplecov-html (0.12.3) - smart_properties (1.17.0) - snaky_hash (2.0.1) - hashie - version_gem (~> 1.1, >= 1.1.1) - social-share-button (1.2.4) - coffee-rails - spring (2.1.1) - spring-watcher-listen (2.0.1) - listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) - sprockets (4.2.1) - concurrent-ruby (~> 1.0) - rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) - ssrf_filter (1.1.2) - system_test_html_screenshots (0.2.0) - actionpack (>= 5.2, < 6.1.a) - temple (0.10.3) - terminal-table (3.0.2) - unicode-display_width (>= 1.1.1, < 3) - thor (1.3.0) - thread_safe (0.3.6) - tilt (2.3.0) - timeout (0.4.1) - tomlrb (2.0.3) - tzinfo (1.2.11) - thread_safe (~> 0.1) - uber (0.1.0) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) - unicode-display_width (1.8.0) - valid_email2 (2.3.1) - activemodel (>= 3.2) - mail (~> 2.5) - version_gem (1.1.3) - virtus (1.0.5) - axiom-types (~> 0.1) - coercible (~> 1.0) - descendants_tracker (~> 0.0, >= 0.0.3) - equalizer (~> 0.0, >= 0.0.9) - w3c_rspec_validators (0.3.0) - rails - rspec - w3c_validators - w3c_validators (1.3.7) - json (>= 1.8) - nokogiri (~> 1.6) - rexml (~> 3.2) - warden (1.2.9) - rack (>= 2.0.9) - web-console (3.7.0) - actionview (>= 5.0) - activemodel (>= 5.0) - bindex (>= 0.4.0) - railties (>= 5.0) - webmock (3.19.1) - addressable (>= 2.8.0) - crack (>= 0.3.2) - hashdiff (>= 0.4.0, < 2.0.0) - webpacker (6.0.0.rc.5) - activesupport (>= 5.2) - rack-proxy (>= 0.6.1) - railties (>= 5.2) - semantic_range (>= 2.3.0) - websocket-driver (0.7.6) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - wicked_pdf (2.7.0) - activesupport - wisper (2.0.1) - wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.6) - xpath (3.2.0) - nokogiri (~> 1.8) - zeitwerk (2.6.12) - -PLATFORMS - x86_64-linux - -DEPENDENCIES - bootsnap (~> 1.4) - byebug (~> 11.0) - codecov - decidim (= 0.26.8) - decidim-dev (= 0.26.8) - decidim-iframe! - faker (~> 2.14) - letter_opener_web (~> 1.3) - listen (~> 3.1) - puma (>= 5.5.1) - rubocop-faker - spring (~> 2.0) - spring-watcher-listen (~> 2.0.0) - uglifier (~> 4.1) - web-console (~> 3.5) - -RUBY VERSION - ruby 3.0.4p208 - -BUNDLED WITH - 2.3.20 diff --git a/README.md b/README.md index ddb9ce0..d5ceec8 100644 --- a/README.md +++ b/README.md @@ -1,510 +1,27 @@ # Decidim::Iframe -[![[CI] Tests 0.27](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests.yml) -[![[CI] Tests 0.26](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests-legacy.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests-legacy.yml) -[![[CI] Lint](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/lint.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/lint.yml) -[![[CI] Precompile](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/precompile.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/precompile.yml) -[![Maintainability](https://api.codeclimate.com/v1/badges/2dada53525dd5a944089/maintainability)](https://codeclimate.com/github/decidim-ice/decidim-module-decidim_awesome/maintainability) -[![Test Coverage](https://codecov.io/gh/decidim-ice/decidim-module-decidim_awesome/branch/main/graph/badge.svg?token=TFBMCLLZJG)](https://codecov.io/gh/decidim-ice/decidim-module-decidim_awesome) +This module is a separated feature from the Decidim Awesome -module, made into its own module. -Usability and UX tweaks for Decidim. - -This plugin allows the administrators to expand the possibilities of Decidim beyond some existing limitations. -All tweaks are provided in a optional fashion with granular permissions that let the administrator to choose exactly where to apply those mods. Some tweaks can be applied to any assembly, other in an specific participatory process or even in type of component only. - -**DISCLAIMER: This module is heavily tested and widely used, however we do not accept any responsibility for breaking anything. Feedback is appreciated though.** - -## Why this plugin? - -Decidim is an awesome platform, but it has some limitations that can be annoying for the users or the admins. This plugin tries to solve some of them. See the list of tweaks below. - -## Usage - -Read the [CHANGELOG](CHANGELOG.md) for Decidim compatibility. - -> **TL;DR people**: Jump to the [installation part](#installation) - -DecidimAwesome is a module that hacks Decidim in order to provide more features or improve some aspects of it. - -It generates and admin module that allows to choose what hacks to apply. -Each hack can be scoped to one or more specific participatory spaces or components. - -### Tweaks: - -#### 1. Image support for the Quill editor - -Modifies the WYSIWYG editor in Decidim by adding the possibility to insert images. When uploading images, Drag & Drop is supported. Images will be uploaded to the server and inserted as external resources (it doesn't use base64 in-line encoding). - -This feature allows you use images in newsletters as well. - -![Images in Quill Editor](examples/quill-images.png) - -#### 2. Auto-save for surveys and forms - -With this feature admins can activate (globally or scoped) an auto-save feature for any form in Decidim. - -It works purely in the client side by using LocalStorage capabilities of the browser. Data is store every time any field changes and retrieved automatically if the same user with the same browser returns to it in the future. - -Saving the form removes the stored data. - -![Auto save in forms](examples/auto-save.png) - -#### 3. Images in proposals - -Event if you haven't activated the WYSIWYG editor (Quill) in public views (eg: proposals use a simple textarea if rich text editor has not been activated for users). You can allow users to upload images in them by drag & drop over the text area. - -![Proposal images](examples/proposal-images.png) - -#### 4. Markdown editor for proposals - -Allows to use markdown when creating proposals instead of a bare textarea. - -#### 5. Admin scope configuration - -All tweaks can be configured and scoped to a specific participatory space, a type of participatory space, a type of component or a specific component. - -Many scopes can be defined for every tweak. - -![Admin tweaks for editors](examples/admin-editors.png) - -#### 6. Awesome map component - -This is a component you can add in any participatory space. It retrieves all the geolocated content in that participatory space (meetings or proposals) and displays it in a big map. - -It also provides a simple search by category, each category is assigned to a different color. - -![Awesome map](examples/awesome-map.png) - -#### 7. Fullscreen Iframe component +#### Fullscreen Iframe component Another simple component that can be used to embed and Iframe with any external content in it that fills all the viewport. ![Fullscreen iframe](examples/fullscreen-iframe.png) -#### 8. Live support chat - -With this feature you can have a support chat in Decidim. It is linked to a [Telegram](https://telegram.org/) group or a single user chat using the [[IntergramBot](https://web.telegram.org/#/im?p=@IntergramBot). Just invite the bot to a group or chat with it directly, grab your ID, put it on the Awesome settings and have fun!. For more info or for hosting your own version of the bot check the [Intergram project](https://github.com/idoco/intergram). - -![Intergram screenshot](examples/intergram.png) - -#### 9. Custom CSS applied only according scoped restrictions - -With this feature you can create directly in the admin a CSS snipped that is only applied globally, in a particular assembly or even a single proposal! - -![CSS screenshot](examples/custom_styles.png) - -#### 10. Change the main menu of Decidim entirely! - -Feel free to hide, modify or add items in the Decidim's main menu. You can also change the order, establish some conditions (like showing only for logged users) or open in a new window. - -![Menu hacks screenshot](examples/menu-1.png) -![Menu hacks screenshot](examples/menu-2.png) -![Menu hacks screenshot](examples/menu-3.png) -![Menu hacks screenshot](examples/menu-4.png) - -#### 11. Assign admins to specific scopes and prevent them modify anything else - -Convert any user on the platform (that is not currently an admin) to a limited subset of participatory spaces or event components. Just add users to a box and scope them to some constraints. These users will see the "Edit" button in everywhere they have permissions. Any access to non allowed zones will redirect the user to the admin index page. - -![Scoped admins authorized](examples/scoped_admins_authorized.png) -![Scoped admins unauthorized](examples/scoped_admins_unauthorized.png) -![Scoped admins configuration](examples/scoped_admins_config.png) - -#### 12. Custom fields for proposals - -Now admins can substitute the body of a proposal with a set of form fields. -Edition is make with a Drag & Drop interface in the admin and can (and should) be scoped to apply only to certain proposal components. - -Technically, the content is stored in the database as an XML document compatible with normal HTML (it uses the DL/DT/DD elements). - -![Custom fields screenshot](examples/custom-fields-1.png) -![Custom fields screenshot](examples/custom-fields-2.png) -![Custom fields screenshot](examples/custom-fields-1.gif) - -#### 13. Custom Redirections (or URL shortener feature) - -Admins can create custom paths that redirect to other places. Destinations can be internal absolute paths or external sites. -There's also possible to choose to sanitize (ie: remove) any query string or to maintain it (so you can decide to use). - -For instance you can create a redirection like - -* `/take-me-somewhere` => `/processes/canary-islands` - -Using a link with a query string (ie: `/take-me-somewhere?locale=es`) that will redirect the user to: - -* `/processes/canary-islands` if query string is sanitized -* `/processes/canary-islands?locale=es` if query string is not sanitized - -> Redirections work only after all other routes have been processed, you cannot override an existing route. -> The admin panel comes with a button to check if the redirection works (meaning that no other route is used by the application). -> Non-working routes will simply be ignored. - -![Custom redirections screenshot](examples/custom-redirections.png) - -#### 14. Custom validation rules for title and body in proposals - -Configure as you wish how the fields "title" and "body" are validated in proposals creation. - -Rules available: - -* Minimum title and body length (defaults to 15 chars). -* Maximum percentage of capital letters for title and body (defaults to 25%). -* Maximum number of "marks" (aka: exclamation and interrogation signs) that can be consecutive in the title or the body (defaults to 1). -* Enable/disable forcing to start the title or the body with a capital letter (defaults to "enabled"). - -![Custom validations](examples/custom_validations.png) - -#### 15. Admin accountability - -This feature allows you to list all the users that are, or have been at any point in time, admins, valuators, user managers or any other role in Decidim. Including global admin roles or private admins of a particular participatory space. - -Results can be filtered by role and by time range and also exported as CSV or other formats. - -![Admin accountability](examples/admin_accountability.png) - -#### 16. Additional proposal sortings - -![Proposal sorting](examples/proposal_sorting.png) -![Proposal sorting admin](examples/proposal_sorting-admin.png) - -This feature allows you to add additional sorting options to the proposals component. By default 4 additional sortings are included: - -- `supported_first`: Sort proposals supported by me first. -- `supported_last`: Sort proposals supported by me last. -- `az`: Sort proposals alphabetically. -- `za`: Sort proposals alphabetically (reverse). - -By enabling this feature the user choosed sorting method will be stored in the browser's session. This means that if the user changes the sorting method and then navigates to another page, the same sorting will be applied. - -You can disable or configure the available sorting types by setting the variable `additional_proposal_sortings` configuration in an initializer: - -```ruby -# config/initializers/awesome_defaults.rb -Decidim::DecidimAwesome.configure do |config| - config.additional_proposal_sortings = :disabled -end - -# Or, to disable alphabetical sorting: - -Decidim::DecidimAwesome.configure do |config| - config.additional_proposal_sortings = [:supported_first, :supported_last] -end -``` - -#### 17. Weighted voting - -This feature allows you to configure a proposals component to use a weighted voting system. This means that each vote can have a different weight and the result of the vote is calculated as the sum of all the weights. - -Weighted voting can have different presentations that can be registered in a manifest. Admins can then choose between what type of voting they want for their proposals according to the different manifests registered (classic is always available). - -Some manifests are included by default in Decidim Awesome, if you consider to create (or pay) for a new one, please open a PR or contact us. - -For instance, here is how the 3-flag voting system looks like: - -![Weighted voting](examples/weighted_voting.png) - -##### Creating a new manifest for weighted voting - -A manifest is defined in a initializer in this way: - -```ruby -if Decidim::DecidimAwesome.enabled?(:weighted_proposal_voting) - # register available processors - Decidim::DecidimAwesome.voting_registry.register(:no_admins_vote) do |voting| - voting.show_vote_button_view = "decidim/decidim_awesome/voting/no_admins_vote/show_vote_button" - voting.show_votes_count_view = "decidim/decidim_awesome/voting/no_admins_vote/show_votes_count" - # voting.show_votes_count_view = "" # hide votes count if needed - voting.proposal_m_cell_footer = "decidim/decidim_awesome/voting/no_admins_vote/proposal_m_cell_footer" - # define a weight validator (optional, by default all weights are valid) - voting.weight_validator do |weight, context| - # don't allow admins to vote - next if context[:user].admin? - # don't allow to vote official proposals - next if context[:proposal].official? - - weight.in? [1, 2, 3, 5] - end - - # optionally, define a label generator block - # by default labels are extracted from a I18n key following this rule - # "decidim.decidim_awesome.voting.{MANIFEST_NAME}.weights.weight_{WEIGHT}" - # - # voting.label_generator do |weight, context| - # "Weight #{weight.round}" - # end - end -end -``` - -A manifest must define a vote button view for the main proposal view, a vote count view for the proposal list view, a footer for the proposal cell (used in lists) and a validator for the weight value. - -All views are optional, if set to `nil` they will use the original ones. If set to an empty string `""` they will be hidden. - -The `weight_validator` is a Proc that receives the weight value and the context with the current user and the proposal and returns true or false if the weight is valid or not. - -**Notes for view `show_vote_button_view`** - -When building a new view for the vote button ([see the original](https://github.com/decidim/decidim/blob/release/0.27-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb)) is important to take into account the following situations: - -- If there's a `current_user` logged in -- If votes are blocked `if current_settings.votes_blocked?` -- If the user has already voted `if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user)` -- If maximum votes have already reached `if proposal.maximum_votes_reached?` -- If the proposal can accumulate supports beyond maximum `if proposal.can_accumulate_supports_beyond_threshold` -- If the current component allows the user to participate `if current_component.participatory_space.can_participate?(current_user)` -- Note that the [original view](https://github.com/decidim/decidim/blob/release/0.27-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb) is overridden only inside the tag `
`. You only need to substitute the part inside. - -To cast a vote a `POST` action is needed with the parameters `proposal_id`, `from_proposals_list` and `weight`. The route where to send the vote can be constructed such as: - -```erb -<%= link_to "Vote with weight=3", proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list, weight: 3), remote: true, method: :post %> -``` - -To delete a vote, you just need to change the method to `:delete` - -**Notes for view `show_votes_count_view`** - -This view must implement the number of votes already cast. It requires an HTML tag with the id `proposal-<%= proposal.id %>-votes-count`, this is used by the Ajax vote re-loader feature: It will replace it's content with the new number. - -You can also completely hide this view (using `voting.show_votes_count_view = ""` in the manifest declaration). This is useful if you are using the same `show_vote_button_view` to also display the total counters (or your implementation does not use that). - -**Notes for view `proposal_m_cell_footer`** - -This view is used by the proposal cell in lists. It must implement the vote button and the vote count. The vote button must be a link with the same characteristics as the one explained above for the `show_vote_button_view` (typically you can just render the same view using `<%= render partial: my/path/to/view, { locals: model: proposal, from_proposals_list: true } %>`). - -Note that, it is strongly recommended to add and HTML tag element with the id `proposal-<%= proposal.id %>-votes-count` so the Ajax vote re-loader can work. Even if you don't use (in this case use a `style="display:none"` attribute), this is because the Ajax reloader always look for this element and throw JavaScript errors if not. - - -#### To be continued... - -We're not done! Please check the [issues](/decidim-ice/decidim-module-decidim_awesome/issues) (and participate) to see what's on our mind - -Also feel free to propose something! or even better send a PR! - ## Installation Add this line to your application's Gemfile: ```ruby -gem "decidim-decidim_awesome" +gem "decidim-decidim_iframe" ``` And then execute: ```bash bundle -bundle exec rails decidim_decidim_awesome:install:migrations +bundle exec rails decidim_decidim_iframe:install:migrations bundle exec rails decidim:upgrade bundle exec rails db:migrate ``` -If you are upgrading from a version prior to 0.8, make sure to visit the URL `/admin/decidim_awesome/checks` and run image migrations for the old images: - -![Check image migrations](examples/check_image_migrations.png) - -If you are a system admin, you can also perform this task by executing this rake task in the console: - -``` -RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave -``` - -Or check your migration status with: -``` -RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave -``` - -The correct version of Decidim Awesome should resolved automatically by the Bundler. -However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.10.0"` in the Gemfile. - -Depending on your Decidim version, choose the corresponding Awesome version to ensure compatibility: - -| Awesome version | Compatible Decidim versions | -|---|---| -| 0.10.0 | >= 0.26.7, >= 0.27.3 | -| 0.9.2 | >= 0.26.7, >= 0.27.3 | -| 0.9.x | 0.26.x, 0.27.x | -| 0.8.x | 0.25.x, 0.26.x | -| 0.7.x | 0.23.x, 0.24.x | -| 0.6.x | 0.22.x, 0.23.x | -| 0.5.x | 0.21.x, 0.22.x | - -> *Heads up!* -> * version 0.10.0 requires database migrations! Don't forget the migrations step when updating. -> * version 0.8.0 removes CSS Themes for tenants. If you have been using them you will have to manually migrate them to custom styles. -> * version 0.8.0 uses ActiveStorage, same as Decidim 0.25. 2 new rake task have been introduced to facilitate the migration: `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and -`bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave` -> * version 0.7.1 requires database migrations! Don't forget the migrations step when updating. - -## Configuration - -Each tweak can be enabled or disabled by default. It also can be deactivated so -admins do not even see it. - -In order to personalize default values, create an initializer such as: - -> **NOTE**: this is not necessary unless you want to **disable** some features. All features are enabled by default. - -```ruby -# config/initializers/awesome_defaults.rb - -# Change some variables defaults -Decidim::DecidimAwesome.configure do |config| - # Enabled by default to all scopes, admins can still limit it's scope - config.allow_images_in_full_editor = true - - # Disabled by default to all scopes, admins can enable it and limit it's scope - config.allow_images_in_small_editor = false - - # De-activated, admins don't even see it as an option - config.use_markdown_editor = :disabled - - # Disable scoped admins - config.scoped_admins = :disabled - - # any other config var from lib/decidim/decidim_awesome.rb - ... -end -``` - -For a complete list of options take a look at the [module defaults](lib/decidim/decidim_awesome.rb). - -## Missing something? - -We add new features and maintain them, however we do it according our needs as this is mostly voluntary work. -So if you feel that you can contribute feel free to create a pull request with your idea. We are open to incorporate anything reasonable. - -We do ask some things: -- Each feature has to come with and activation option, same as the already existing (unless is something that do not modify predefined Decidim behavior) -- Try to avoid views or assets overrides. Many times it is just enough to add additional css or scripts that alter existing objects. - -You can also ask for new feature by creating and issue and, if you are ready to provide funds for its development just contact us! - -Thanks! - -## Developing - -To start contributing to this project, first: - -- Install the basic dependencies (such as Ruby and PostgreSQL) -- Clone this repository - -Decidim's main repository also provides a Docker configuration file if you -prefer to use Docker instead of installing the dependencies locally on your -machine. - -You can create the development app by running the following commands after -cloning this project: - -```bash -bundle -DATABASE_USERNAME= DATABASE_PASSWORD= bundle exec rake development_app -``` - -Note that the database user has to have rights to create and drop a database in -order to create the dummy test app database. - -Then to test how the module works in Decidim, start the development server: - -```bash -cd development_app -DATABASE_USERNAME= DATABASE_PASSWORD= bundle exec rails s -``` - -In case you are using [rbenv](https://github.com/rbenv/rbenv) and have the -[rbenv-vars](https://github.com/rbenv/rbenv-vars) plugin installed for it, you -can add the environment variables to the root directory of the project in a file -named `.rbenv-vars`. If these are defined for the environment, you can omit -defining these in the commands shown above. - -### Code Styling - -Please follow the code styling defined by the different linters that ensure we -are all talking with the same language collaborating on the same project. This -project is set to follow the same rules that Decidim itself follows. - -[Rubocop](https://rubocop.readthedocs.io/) linter is used for the Ruby language. - -You can run the code styling checks by running the following commands from the -console: - -``` -bundle exec rubocop -``` - -To ease up following the style guide, you should install the plugin to your -favorite editor, such as: - -- Atom - [linter-rubocop](https://atom.io/packages/linter-rubocop) -- Sublime Text - [Sublime RuboCop](https://github.com/pderichs/sublime_rubocop) -- Visual Studio Code - [Rubocop for Visual Studio Code](https://github.com/misogi/vscode-ruby-rubocop) - -### Testing - -To run the tests run the following in the gem development path: - -```bash -bundle -DATABASE_USERNAME= DATABASE_PASSWORD= bundle exec rake test_app -DATABASE_USERNAME= DATABASE_PASSWORD= bundle exec rspec -``` - -However, this project works with different versions of Decidim. In order to test them all, we maintain two different Gemfiles: `Gemfile` and `Gemfile.legacy`. The first one is used for development and testing the latest Decidim version supported, the second one is used for testing against the old Decidim version. - -You can run run tests against the legacy Decidim versions by using: - -```bash -export DATABASE_USERNAME= -export DATABASE_PASSWORD= -RBENV_VERSION=2.7.6 BUNDLE_GEMFILE=Gemfile.legacy bundle -RBENV_VERSION=2.7.6 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rake test_app -RBENV_VERSION=2.7.6 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rspec -``` - -For convenience, you can use the scripts `bin/rspec` and `bin/rspec-legacy` to run tests against one or the other version: - -```bash -bin/rspec spec/ -bin/rspec-legacy spec/ -``` - -- Rbenv is required for this script to work. - -> **NOTE:** Remember to reset the database when changing between tests: -> ```bash -> bin/rspec --reset -> bin/rspec-legacy --reset -> ``` - - -Note that the database user has to have rights to create and drop a database in -order to create the dummy test app database. - -In case you are using [rbenv](https://github.com/rbenv/rbenv) and have the -[rbenv-vars](https://github.com/rbenv/rbenv-vars) plugin installed for it, you -can add these environment variables to the root directory of the project in a -file named `.rbenv-vars`. In this case, you can omit defining these in the -commands shown above. - -### Test code coverage - -Code coverage report is generated automatically in a folder named `coverage` in the project root which contains -the code coverage report. - -```bash -firefox coverage/index.html -``` - -### Localization - -If you would like to see this module in your own language, you can help with its -translation at Crowdin: - -https://crowdin.com/translate/decidim-awesome - -## License - -This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE. - -## Credits - -This plugin maintainted by ![PokeCode](app/packs/images/decidim/decidim_awesome/pokecode-logo.png) diff --git a/Rakefile b/Rakefile index 0badfca..0607f8d 100644 --- a/Rakefile +++ b/Rakefile @@ -3,13 +3,6 @@ require "decidim/dev/common_rake" require "fileutils" -def install_module(path) - Dir.chdir(path) do - system("bundle exec rake decidim_iframe:install:migrations") - system("bundle exec rake db:migrate") - end -end - def override_webpacker_config_files(path) Dir.chdir(path) do system("bundle exec rake decidim_iframe:webpacker:install") @@ -32,7 +25,6 @@ end desc "Generates a dummy app for testing" task test_app: "decidim:generate_external_test_app" do ENV["RAILS_ENV"] = "test" - install_module("spec/decidim_dummy_app") override_webpacker_config_files("spec/decidim_dummy_app") copy_helpers end @@ -51,7 +43,6 @@ task :development_app do ) end - install_module("development_app") override_webpacker_config_files("development_app") seed_db("development_app") end diff --git a/app/controllers/decidim/iframe/iframe_component/iframe_controller.rb b/app/controllers/decidim/iframe/iframe_component/iframe_controller.rb deleted file mode 100644 index 61645dc..0000000 --- a/app/controllers/decidim/iframe/iframe_component/iframe_controller.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module Decidim - module Iframe - module IframeComponent - class IframeController < Iframe::BlankComponentController - ALLOWED_ATTRIBUTES = %w(src width height frameborder title allow allowpaymentrequest name referrerpolicy sandbox srcdoc allowfullscreen).freeze - helper_method :iframe, :remove_margins?, :viewport_width? - - def show; end - - private - - def iframe - @iframe ||= sanitize(current_component.settings.iframe).html_safe - end - - def sanitize(html) - sanitizer = Rails::Html::SafeListSanitizer.new - sanitizer.sanitize(html, tags: %w(iframe), attributes: ALLOWED_ATTRIBUTES) - end - - def remove_margins? - current_component.settings.no_margins - end - - def viewport_width? - current_component.settings.viewport_width - end - end - end - end -end diff --git a/app/controllers/decidim/iframe/iframe_controller.rb b/app/controllers/decidim/iframe/iframe_controller.rb new file mode 100644 index 0000000..710c837 --- /dev/null +++ b/app/controllers/decidim/iframe/iframe_controller.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Decidim + module Iframe + class IframeController < Iframe::BlankComponentController + ALLOWED_ATTRIBUTES = %w(src width height frameborder title allow allowpaymentrequest name referrerpolicy sandbox srcdoc allowfullscreen).freeze + helper_method :iframe, :remove_margins?, :viewport_width? + + def show; end + + private + + def iframe + @iframe ||= sanitize(current_component.settings.iframe).html_safe + end + + def sanitize(html) + sanitizer = Rails::Html::SafeListSanitizer.new + sanitizer.sanitize(html, tags: %w(iframe), attributes: ALLOWED_ATTRIBUTES) + end + + def remove_margins? + current_component.settings.no_margins + end + + def viewport_width? + current_component.settings.viewport_width + end + end + end +end diff --git a/app/views/decidim/iframe/iframe_component/iframe/show.html.erb b/app/views/decidim/iframe/iframe/show.html.erb similarity index 100% rename from app/views/decidim/iframe/iframe_component/iframe/show.html.erb rename to app/views/decidim/iframe/iframe/show.html.erb diff --git a/db/migrate/20200324170000_create_iframe_config.rb b/db/migrate/20200324170000_create_iframe_config.rb deleted file mode 100644 index 7a1598e..0000000 --- a/db/migrate/20200324170000_create_iframe_config.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CreateIframeConfig < ActiveRecord::Migration[5.2] - def change - create_table :iframe_config do |t| - t.jsonb :var - t.jsonb :value - t.integer :decidim_organization_id, - foreign_key: true, - index: { name: "index_iframe_on_decidim_organization_id" } - - t.timestamps - t.index [:var, :decidim_organization_id], name: "index_iframe_organization_var", unique: true - end - end -end diff --git a/db/migrate/20200403142257_create_iframe_config_constraints.rb b/db/migrate/20200403142257_create_iframe_config_constraints.rb deleted file mode 100644 index a263091..0000000 --- a/db/migrate/20200403142257_create_iframe_config_constraints.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class CreateIframeConfigConstraints < ActiveRecord::Migration[5.2] - def change - create_table :iframe_config_constraints do |t| - t.jsonb :settings - - t.references :iframe_config, null: false, foreign_key: { to_table: :iframe_config }, index: { name: "iframe_config_constraints_config" } - t.timestamps - t.index [:settings, :iframe_config_id], name: "index_iframe_settings_iframe_config", unique: true - end - end -end diff --git a/db/migrate/20210628150825_change_iframe_config_var_type.rb b/db/migrate/20210628150825_change_iframe_config_var_type.rb deleted file mode 100644 index 9770430..0000000 --- a/db/migrate/20210628150825_change_iframe_config_var_type.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class ChangeIframeConfigVarType < ActiveRecord::Migration[5.2] - def change - change_column :iframe_config, :var, :string - - Decidim::Iframe::IframeConfig.find_each do |config| - config.var.gsub!('"', "") - config.save! - end - end -end diff --git a/db/seeds.rb b/db/seeds.rb index d8bc0cd..d508462 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -17,11 +17,4 @@ rich_text_editor_in_public_views: true ) - # Enable images in general - setting = Decidim::Iframe::IframeConfig.find_or_initialize_by(var: :allow_images_in_full_editor, organization: organization) - setting.value = true - setting.save! - setting = Decidim::Iframe::IframeConfig.find_or_initialize_by(var: :allow_images_in_small_editor, organization: organization) - setting.value = true - setting.save! end diff --git a/lib/decidim/iframe.rb b/lib/decidim/iframe.rb index 99e34a6..d326899 100644 --- a/lib/decidim/iframe.rb +++ b/lib/decidim/iframe.rb @@ -2,11 +2,9 @@ require "decidim/iframe/iframe" require "decidim/iframe/engine" +require "decidim/iframe/component" require "decidim/iframe/admin_engine" require "decidim/iframe/context_analyzers" -require "decidim/iframe/iframe_component/engine" -require "decidim/iframe/iframe_component/admin_engine" -require "decidim/iframe/iframe_component/component" # Engines to handle logic unrelated to participatory spaces or components diff --git a/lib/decidim/iframe/admin_engine.rb b/lib/decidim/iframe/admin_engine.rb index 98e42c1..26e2785 100644 --- a/lib/decidim/iframe/admin_engine.rb +++ b/lib/decidim/iframe/admin_engine.rb @@ -4,10 +4,14 @@ module Decidim module Iframe # This is the engine that runs on the public interface of `Iframe`. class AdminEngine < ::Rails::Engine + isolate_namespace Decidim::Iframe + paths["db/migrate"] = nil paths["lib/tasks"] = nil routes do + root to: "iframe#settings" + # Add admin engine routes here resources :constraints resources :custom_redirects, except: [:show] @@ -20,7 +24,6 @@ class AdminEngine < ::Rails::Engine post :rename_scope_label, to: "config#rename_scope_label" get :checks, to: "checks#index" post :migrate_images, to: "checks#migrate_images" - root to: "config#show" end initializer "decidim_iframe.admin_mount_routes" do diff --git a/lib/decidim/iframe/checksums.yml b/lib/decidim/iframe/checksums.yml deleted file mode 100644 index 54409ef..0000000 --- a/lib/decidim/iframe/checksums.yml +++ /dev/null @@ -1,63 +0,0 @@ -decidim-admin: - /app/views/layouts/decidim/admin/_header.html.erb: - decidim-0.25: 1aff077428830b12306d6c42e6b37216 -decidim-core: - /app/validators/etiquette_validator.rb: - decidim-0.25: f7a4a652005385a994208f1ab41c4f08 - decidim-0.26.4: f1f0fdf15be88f695c8359afab80f73f - /app/views/layouts/decidim/_head.html.erb: - decidim-0.26: 0927fc81123addec70853c2e7986c538 - decidim-0.27: c82ac6defe55b6d4f6a54544dbf2ac58 - /app/packs/src/decidim/editor.js: - decidim-0.25: 742698903a30034094c01aecaca6de84 - decidim-0.26: 651830d87aeeeff39316a787fc70d461 - decidim-0.26.4: eac4ea47c09762aa2e56300bf7e98f31 - decidim-0.27.3: a9585960d5979aa3adbf5561010513fe - /app/presenters/decidim/menu_presenter.rb: - decidim-0.25: f3b05daf279f909f8b3b628658dd5810 - /app/presenters/decidim/menu_item_presenter.rb: - decidim-0.25: 860ffb160ec5f8552cc2855a6a47851b - decidim-0.26.4: d6d0129d81845c61884bcfd07885e911 - decidim-0.27: c82bc2ea3c8f792472670d5996613ecf - /app/helpers/decidim/amendments_helper.rb: - decidim-0.25: 63532a04fcf07cf92b789833a9421416 - decidim-0.26: 636943ccb2e994fe0124dc87e72e49e9 -decidim-proposals: - /lib/decidim/proposals/proposal_serializer.rb: - decidim-0.26: 2d817775f79a19cfcf9cfae8e5b68c5a - /lib/decidim/api/proposal_type.rb: - decidim-0.26: e38e4875e408ec4f658e28725c5a94d4 - /app/forms/decidim/proposals/proposal_wizard_create_step_form.rb: - decidim-0.24: db69edd0ba8ffa3965a5c44a6bfaba8d - decidim-0.27: b495d37088ecebcbe4ac9563bb3498d5 - /app/helpers/decidim/proposals/application_helper.rb: - decidim-0.26: 216c974bc425393c18b01bfc4eed4f0b - decidim-0.26.4: 2e673d2aabe66a80a971d7ff80ebdbb8 - decidim-0.26.7: ddd9a1f88609c8c7b60c07882d026441 - decidim-0.27: c0ebeac39ebe4926bf0e5fc585a384d7 - decidim-0.27.1: a4f902d1c4829a7f7f62299686f8604e - decidim-0.27.3: a9c9ed5eedaf7bf80afaf9ff5a89c254 - /app/controllers/decidim/proposals/proposal_votes_controller.rb: - decidim-0.26: 65ca00fdb4aaf30da37ad75aaf66e70a - decidim-0.27: a1d416491752f4c2fb2668b29ceb8e09 - /app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb: - # this file is not overriden anymore but it needs to be the last version - decidim-0.26: 519a0d34a9ffbd8b9c26d9b68ff4e2a3 - decidim-0.27.3: 949b2163c547742549531320bf5e0de1 - /app/views/decidim/proposals/collaborative_drafts/show.html.erb: - # this file is not overriden anymore but it needs to be the last version - decidim-0.26: 519a0d34a9ffbd8b9c26d9b68ff4e2a3 - decidim-0.27.3: b1ec22d35263a2ac96fe4604c0ceb752 - /app/views/decidim/proposals/admin/proposals/_form.html.erb: - decidim-0.25: 90a04984d4269398b7cd21aa33763a1f - decidim-0.27: f60168e432e1d419e5aec5d3d1e53f0e - /app/views/decidim/proposals/proposals/_vote_button.html.erb: - decidim-0.27: f7202c37fe042cd816a6f9fd0f9e6807 - /app/views/decidim/proposals/proposals/_votes_count.html.erb: - decidim-0.27: 33339aae5004361e24c4c5b009cc2888 - /app/cells/decidim/proposals/proposal_m_cell.rb: - decidim-0.26: 21cc09a45efa20dbcda5c943d820c867 - decidim-0.27: 9df97ded3e6594b65b85fcbf1e5b0644 - decidim-0.27.4: ce3b30cdddfee547b8fb089c0fddd8a4 - /app/cells/decidim/proposals/proposal_m/footer.erb: - decidim-0.26: 7ade5bbd8412f44f1c4ed913ae1834c6 diff --git a/lib/decidim/iframe/iframe_component/component.rb b/lib/decidim/iframe/component.rb similarity index 93% rename from lib/decidim/iframe/iframe_component/component.rb rename to lib/decidim/iframe/component.rb index 692afac..8b259e6 100644 --- a/lib/decidim/iframe/iframe_component/component.rb +++ b/lib/decidim/iframe/component.rb @@ -3,8 +3,8 @@ require "decidim/components/namer" Decidim::Iframe.register_component(:iframe) do |component| - component.engine = Decidim::Iframe::IframeComponent::Engine - component.admin_engine = Decidim::Iframe::IframeComponent::AdminEngine + component.engine = Decidim::Iframe::Engine + component.admin_engine = Decidim::Iframe::AdminEngine component.icon = "media/images/decidim_meetings.svg" # TODO: create a Icon component.permissions_class_name = "Decidim::Iframe::Permissions" diff --git a/lib/decidim/iframe/engine.rb b/lib/decidim/iframe/engine.rb index cd54fe5..2db0f9a 100644 --- a/lib/decidim/iframe/engine.rb +++ b/lib/decidim/iframe/engine.rb @@ -11,7 +11,7 @@ class Engine < ::Rails::Engine isolate_namespace Decidim::Iframe routes do - post :editor_images, to: "editor_images#create" + root to: "iframe#show" end # Prepare a zone to create overrides @@ -39,6 +39,10 @@ class Engine < ::Rails::Engine initializer "decidim_iframe.add_cells_view_paths", before: "decidim_proposals.add_cells_view_paths" do Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Iframe::Engine.root}/app/views") end + + def load_seed + nil + end end end end diff --git a/lib/decidim/iframe/iframe_component/admin_engine.rb b/lib/decidim/iframe/iframe_component/admin_engine.rb deleted file mode 100644 index b124871..0000000 --- a/lib/decidim/iframe/iframe_component/admin_engine.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require "rails" -require "decidim/core" - -module Decidim - module Iframe - module IframeComponent - # This is the engine is used to create the component Map. - class AdminEngine < ::Rails::Engine - isolate_namespace Decidim::Iframe::IframeComponent - - routes do - root to: "iframe#settings" - end - - def load_seed - nil - end - end - end - end -end diff --git a/lib/decidim/iframe/iframe_component/engine.rb b/lib/decidim/iframe/iframe_component/engine.rb deleted file mode 100644 index e5c45e4..0000000 --- a/lib/decidim/iframe/iframe_component/engine.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require "rails" -require "decidim/core" - -module Decidim - module Iframe - module IframeComponent - # This is the engine is used to create the component Map. - class Engine < ::Rails::Engine - isolate_namespace Decidim::Iframe::IframeComponent - - routes do - root to: "iframe#show" - end - - def load_seed - nil - end - end - end - end -end diff --git a/lib/decidim/iframe/iframe_helpers.rb b/lib/decidim/iframe/iframe_helpers.rb deleted file mode 100644 index 85e7d03..0000000 --- a/lib/decidim/iframe/iframe_helpers.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require "decidim/iframe/version" - -module Decidim - # add a global helper with iframe configuration - module Iframe - module IframeHelpers - # Returns the normalized config for an Organization and the current url - def iframe_config_instance - return @iframe_config_instance if @iframe_config_instance - - # if already created in the middleware, reuse it as it might have additional constraints - @iframe_config_instance = request.env["iframe.current_config"] - unless @iframe_config_instance.is_a? Config - @iframe_config_instance = Config.new request.env["decidim.current_organization"] - @iframe_config_instance.context_from_request request - end - @iframe_config_instance - end - - def iframe_config - @iframe_config ||= iframe_config_instance.config - end - - def show_public_intergram? - return unless iframe_config[:intergram_for_public] - return true unless iframe_config[:intergram_for_public_settings][:require_login] - - user_signed_in? - end - - def unfiltered_iframe_config - @unfiltered_iframe_config ||= iframe_config_instance.unfiltered_config - end - - def organization_iframe_config - @organization_iframe_config ||= iframe_config_instance.organization_config - end - - def iframe_version - ::Decidim::Iframe::VERSION - end - - # Collects all CSS that is applied in the current URL context - def iframe_custom_styles - @iframe_custom_styles ||= iframe_config_instance.collect_sub_configs_values("scoped_style") - end - - # Collects all proposal custom fields that is applied in the current URL context - def iframe_scoped_admins - @iframe_scoped_admins ||= iframe_config_instance.collect_sub_configs_values("scoped_admin") - end - - def version_prefix - "v#{Decidim.version[0..3]}" - end - end - end -end diff --git a/spec/fixtures/files/tile-0.png b/spec/fixtures/files/tile-0.png deleted file mode 100644 index 35828d1..0000000 Binary files a/spec/fixtures/files/tile-0.png and /dev/null differ