decidim-extra_blocks 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65d1d64d1df85e8ae10a9122487d14d2a90784c14d2b3e264f4e37da114605be
4
- data.tar.gz: b69027a69d0a53bf055706d008eb11a34a3023a6c84f6ce6531031ac431e61d0
3
+ metadata.gz: 0eb18776a75b41c496a8d63cd3b04f02b4b6fbb2b74609b7d3832fa35865912f
4
+ data.tar.gz: e752109e1b5f7ddafd1730176766f4cd4bc363294a8f817e54531c2c4d0a08d0
5
5
  SHA512:
6
- metadata.gz: 546690d55a297308b0072b178fcc0284b78adb521897bb8e4b76c785d432f13c85dee5ccf4f022204fba8396faded1a93551de1f6e827c65df9d0fe6b47747d5
7
- data.tar.gz: f328d60eba8350b39058e28214f7b03df163dfadc9d97610e18bb9e8a9974445739e8f024a2620ef46c47a63544de3ba6211f475a82cf0f4f8e1d684d96eae1b
6
+ metadata.gz: afc29d408f150f0e5eb3308a06009c9bba058d4cc6737b992096fe93aeb0519535c2a7253bf5145fd44d3c87f6ec8720b1afd5f676264901db1d4233ee35ed24
7
+ data.tar.gz: 20a20bd57781355fa4abe77558ef473af8a8206b0e5ca37b3564d7aae4939b62f7c0174680f3c1055b2cc33c6390ad5b44ad1a5a6ae77839f90cac4e7e6ac307
@@ -7,6 +7,6 @@ Deface::Override.new(
7
7
  virtual_path: "layouts/decidim/_wrapper",
8
8
  name: "decidim_extra_blocks_public_layout_container_data_attributes",
9
9
  set_attributes: "div.layout-container",
10
- original: %(<div class="layout-container">),
10
+ original: "bc51c3a8fc2e1441082246012f4007b38f84ddca",
11
11
  attributes: Decidim::ExtraBlocks::BodyDataAttributes.deface_attributes
12
12
  )
@@ -4,7 +4,22 @@ module Decidim
4
4
  module ExtraBlocks
5
5
  module Admin
6
6
  # Shows frozen layout in the ContentBlock DnD list label.
7
+ # Stamps data-extra-blocks-* on the list <li> so availability CSS can hide
8
+ # items (Deface cannot target cell templates under app/cells).
7
9
  module ContentBlockCellExtensions
10
+ def show
11
+ html = super
12
+ attrs = list_item_data_attributes
13
+ return html if attrs.blank?
14
+
15
+ fragment = Nokogiri::HTML::DocumentFragment.parse(html.to_s)
16
+ li = fragment.at_css("li")
17
+ return html unless li
18
+
19
+ attrs.each { |key, value| li[key] = value.to_s if value.present? }
20
+ fragment.to_html.html_safe
21
+ end
22
+
8
23
  def name
9
24
  return Decidim::ExtraBlocks::AdminDisplayName.for(model) if extra_block?
10
25
 
@@ -13,6 +28,15 @@ module Decidim
13
28
 
14
29
  private
15
30
 
31
+ def list_item_data_attributes
32
+ return {} unless model.respond_to?(:manifest_name)
33
+
34
+ {
35
+ "data-extra-blocks-manifest" => model.manifest_name.to_s,
36
+ "data-extra-blocks-category" => Decidim::ExtraBlocks::AdminListItemData.category_for(model)
37
+ }.compact
38
+ end
39
+
16
40
  def extra_block?
17
41
  model.respond_to?(:manifest_name) && model.manifest_name.to_s == "extra_block"
18
42
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module ExtraBlocks
5
5
  def self.version
6
- "0.1.2" # DO NOT UPDATE MANUALLY
6
+ "0.1.3" # DO NOT UPDATE MANUALLY
7
7
  end
8
8
 
9
9
  def self.decidim_version
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decidim-extra_blocks",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "private": true,
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "packageManager": "yarn@1.22.22"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-extra_blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hadrien Froger
@@ -266,7 +266,6 @@ files:
266
266
  - app/forms/decidim/extra_blocks/fast_proposal_form.rb
267
267
  - app/helpers/decidim/extra_blocks/picture_helper.rb
268
268
  - app/overrides/extra_blocks_admin_body_data_attributes.rb
269
- - app/overrides/extra_blocks_admin_content_block_list_item.rb
270
269
  - app/overrides/extra_blocks_admin_edit_back_link.rb
271
270
  - app/overrides/extra_blocks_admin_styles.rb
272
271
  - app/overrides/extra_blocks_public_body_data_attributes.rb
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Mark admin landing-page content-block list items so CSS can hide Extra Blocks
4
- # by module / category when Toggle disables them.
5
-
6
- Deface::Override.new(
7
- virtual_path: "decidim/admin/content_block/show",
8
- name: "decidim_extra_blocks_admin_content_block_list_item_data",
9
- set_attributes: "li",
10
- attributes: {
11
- "data-extra-blocks-manifest" => "<%= model.manifest_name %>",
12
- "data-extra-blocks-category" =>
13
- "<%= Decidim::ExtraBlocks::AdminListItemData.category_for(model) %>"
14
- }
15
- )