Browse Source

enabled flag_lists, started flags front ui

Bachir Soussi Chiadmi 3 years ago
parent
commit
6718e5c9f9
43 changed files with 1830 additions and 116 deletions
  1. 2 0
      composer.json
  2. 191 1
      composer.lock
  3. 1 1
      config/sync/block.block.header.yml
  4. 3 0
      config/sync/core.extension.yml
  5. 32 0
      config/sync/flag.flag.dossier.yml
  6. 32 0
      config/sync/flag.flag.flag_list_template_1.yml
  7. 33 0
      config/sync/flag.flag.test_dossier.yml
  8. 9 0
      config/sync/flag_lists.flag_for_list.dossier.yml
  9. 11 0
      config/sync/flag_lists.flag_for_list.flag_list_template_1.yml
  10. 8 0
      config/sync/flag_lists.flagging_collection_type.flagging_collection_type_1.yml
  11. 1 0
      config/sync/language/fr/views.view.files.yml
  12. 49 0
      config/sync/language/fr/views.view.my_flag_list_items.yml
  13. 18 0
      config/sync/rest.resource.entity.flag.yml
  14. 18 0
      config/sync/rest.resource.entity.flag_for_list.yml
  15. 21 0
      config/sync/rest.resource.entity.flag_list_item.yml
  16. 21 0
      config/sync/rest.resource.entity.flagging.yml
  17. 21 0
      config/sync/rest.resource.entity.flagging_collection.yml
  18. 18 0
      config/sync/rest.resource.entity.flagging_collection_type.yml
  19. 15 0
      config/sync/system.action.flag_action.dossier_flag.yml
  20. 15 0
      config/sync/system.action.flag_action.dossier_unflag.yml
  21. 17 0
      config/sync/system.action.flag_action.flag_list_template_1_flag.yml
  22. 17 0
      config/sync/system.action.flag_action.flag_list_template_1_unflag.yml
  23. 15 0
      config/sync/system.action.flag_action.test_dossier_flag.yml
  24. 15 0
      config/sync/system.action.flag_action.test_dossier_unflag.yml
  25. 13 0
      config/sync/system.action.flag_delete_flagging.yml
  26. 5 0
      config/sync/user.role.adherent.yml
  27. 5 0
      config/sync/user.role.admin.yml
  28. 5 0
      config/sync/user.role.admin_showroom.yml
  29. 5 0
      config/sync/user.role.alpha_testeur.yml
  30. 5 0
      config/sync/user.role.student.yml
  31. 5 0
      config/sync/user.role.translator.yml
  32. 852 0
      config/sync/views.view.my_flag_list_items.yml
  33. 7 0
      web/modules/custom/materio_flag/materio_flag.info.yml
  34. 1 0
      web/modules/custom/materio_flag/materio_flag.module
  35. 9 0
      web/modules/custom/materio_flag/materio_flag.permissions.yml
  36. 7 0
      web/modules/custom/materio_flag/materio_flag.routing.yml
  37. 113 0
      web/modules/custom/materio_flag/src/Controller/MaterioFlagController.php
  38. 8 0
      web/themes/custom/materiotheme/assets/dist/main.js
  39. 6 4
      web/themes/custom/materiotheme/assets/scripts/main.js
  40. 47 0
      web/themes/custom/materiotheme/vuejs/components/User/UserFlags.vue
  41. 9 2
      web/themes/custom/materiotheme/vuejs/components/User/UserTools.vue
  42. 1 0
      web/themes/custom/materiotheme/vuejs/store/modules/search.js
  43. 144 108
      web/themes/custom/materiotheme/vuejs/store/modules/user.js

+ 2 - 0
composer.json

@@ -35,9 +35,11 @@
         "drupal/consumer_image_styles": "^3.0",
         "drupal/content_sync": "2.x-dev@dev",
         "drupal/core-composer-scaffold": "^9.0",
+        "drupal/debug_bar": "^1.4",
         "drupal/entity_clone": "^1.0",
         "drupal/error_log": "^1.0",
         "drupal/field_permissions": "^1.0",
+        "drupal/flag_lists": "^4.0@beta",
         "drupal/genpass": "^1.x-dev",
         "drupal/image_delta_formatter": "^1.x-dev",
         "drupal/jsonapi_extras": "^3.7",

+ 191 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "0fde84a349225b506081d88d67aa5cbc",
+    "content-hash": "72666d13bf47ed93fa6c3d45a9e17370",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -5721,6 +5721,54 @@
                 "source": "https://git.drupalcode.org/project/date_range_formatter"
             }
         },
+        {
+            "name": "drupal/debug_bar",
+            "version": "1.4.0",
+            "source": {
+                "type": "git",
+                "url": "https://git.drupalcode.org/project/debug_bar.git",
+                "reference": "8.x-1.4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://ftp.drupal.org/files/projects/debug_bar-8.x-1.4.zip",
+                "reference": "8.x-1.4",
+                "shasum": "49046c56bcb1abdff29b561774ed8b5f29f12425"
+            },
+            "require": {
+                "drupal/core": "^8.7.0"
+            },
+            "type": "drupal-module",
+            "extra": {
+                "drupal": {
+                    "version": "8.x-1.4",
+                    "datestamp": "1567404482",
+                    "security-coverage": {
+                        "status": "covered",
+                        "message": "Covered by Drupal's security advisory policy"
+                    }
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0+"
+            ],
+            "authors": [
+                {
+                    "name": "Chi",
+                    "homepage": "https://www.drupal.org/user/556138"
+                }
+            ],
+            "description": "A simple toolbar with debug information.",
+            "homepage": "https://www.drupal.org/project/debug_bar",
+            "keywords": [
+                "Drupal"
+            ],
+            "support": {
+                "source": "http://cgit.drupalcode.org/debug_bar",
+                "issues": "https://www.drupal.org/project/issues/debug_bar"
+            }
+        },
         {
             "name": "drupal/devel",
             "version": "4.0.1",
@@ -6887,6 +6935,147 @@
             },
             "time": "2020-09-04T17:12:31+00:00"
         },
+        {
+            "name": "drupal/flag",
+            "version": "4.0.0-beta2",
+            "source": {
+                "type": "git",
+                "url": "https://git.drupalcode.org/project/flag.git",
+                "reference": "8.x-4.0-beta2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://ftp.drupal.org/files/projects/flag-8.x-4.0-beta2.zip",
+                "reference": "8.x-4.0-beta2",
+                "shasum": "6f180b6f65e0e778e6fccebd07de9f9c689f6a1f"
+            },
+            "require": {
+                "drupal/core": "^8.8 || ^9"
+            },
+            "type": "drupal-module",
+            "extra": {
+                "drupal": {
+                    "version": "8.x-4.0-beta2",
+                    "datestamp": "1595273815",
+                    "security-coverage": {
+                        "status": "not-covered",
+                        "message": "Beta releases are not covered by Drupal security advisories."
+                    }
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "Berdir",
+                    "homepage": "https://www.drupal.org/user/214652"
+                },
+                {
+                    "name": "fago",
+                    "homepage": "https://www.drupal.org/user/16747"
+                },
+                {
+                    "name": "fubhy",
+                    "homepage": "https://www.drupal.org/user/761344"
+                },
+                {
+                    "name": "joachim",
+                    "homepage": "https://www.drupal.org/user/107701"
+                },
+                {
+                    "name": "merlinofchaos",
+                    "homepage": "https://www.drupal.org/user/26979"
+                },
+                {
+                    "name": "mooffie",
+                    "homepage": "https://www.drupal.org/user/78454"
+                },
+                {
+                    "name": "quicksketch",
+                    "homepage": "https://www.drupal.org/user/35821"
+                },
+                {
+                    "name": "shabana.navas",
+                    "homepage": "https://www.drupal.org/user/1311398"
+                },
+                {
+                    "name": "socketwench",
+                    "homepage": "https://www.drupal.org/user/65793"
+                }
+            ],
+            "description": "Create customized flags that users can set on entities.",
+            "homepage": "https://www.drupal.org/project/flag",
+            "support": {
+                "source": "https://git.drupalcode.org/project/flag"
+            }
+        },
+        {
+            "name": "drupal/flag_lists",
+            "version": "4.0.0-beta8",
+            "source": {
+                "type": "git",
+                "url": "https://git.drupalcode.org/project/flag_lists.git",
+                "reference": "4.0.0-beta8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://ftp.drupal.org/files/projects/flag_lists-4.0.0-beta8.zip",
+                "reference": "4.0.0-beta8",
+                "shasum": "3262bbcdb3a28db2d9fbb0c8820da98f90c3d854"
+            },
+            "require": {
+                "drupal/core": "^8 || ^9",
+                "drupal/flag": "^4.0"
+            },
+            "type": "drupal-module",
+            "extra": {
+                "drupal": {
+                    "version": "4.0.0-beta8",
+                    "datestamp": "1598351532",
+                    "security-coverage": {
+                        "status": "not-covered",
+                        "message": "Beta releases are not covered by Drupal security advisories."
+                    }
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0+"
+            ],
+            "authors": [
+                {
+                    "name": "awolfey",
+                    "homepage": "https://www.drupal.org/user/277371"
+                },
+                {
+                    "name": "branana",
+                    "homepage": "https://www.drupal.org/user/758394"
+                },
+                {
+                    "name": "erikwebb",
+                    "homepage": "https://www.drupal.org/user/273404"
+                },
+                {
+                    "name": "queenvictoria",
+                    "homepage": "https://www.drupal.org/user/856454"
+                },
+                {
+                    "name": "sl27257",
+                    "homepage": "https://www.drupal.org/user/15938"
+                }
+            ],
+            "description": "Flag Lists handle collection of flags",
+            "homepage": "https://www.drupal.org/project/flag_lists",
+            "keywords": [
+                "Drupal"
+            ],
+            "support": {
+                "source": "http://cgit.drupalcode.org/flag_lists",
+                "issues": "https://www.drupal.org/project/issues/flag_lists"
+            }
+        },
         {
             "name": "drupal/genpass",
             "version": "dev-1.x",
@@ -17216,6 +17405,7 @@
         "drupal/commerce_variation_cart_form": 20,
         "drupal/computed_field": 10,
         "drupal/content_sync": 20,
+        "drupal/flag_lists": 10,
         "drupal/genpass": 20,
         "drupal/image_delta_formatter": 20,
         "drupal/jsonrpc": 20,

+ 1 - 1
config/sync/block.block.header.yml

@@ -23,7 +23,7 @@ settings:
   follow_parent: child
   level: 1
   depth: 0
-  expand: 0
+  expand: false
   parent: 'header:'
   suggestion: header
 visibility: {  }

+ 3 - 0
config/sync/core.extension.yml

@@ -78,6 +78,8 @@ module:
   file_mdm_exif: 0
   filter: 0
   filter_perms: 0
+  flag: 0
+  flag_lists: 0
   genpass: 0
   help: 0
   honeypot: 0
@@ -103,6 +105,7 @@ module:
   maillog: 0
   mailsystem: 0
   materio_decoupled: 0
+  materio_flag: 0
   materio_home: 0
   materio_jsonapi: 0
   materio_migrate: 0

+ 32 - 0
config/sync/flag.flag.dossier.yml

@@ -0,0 +1,32 @@
+uuid: 4183b53b-30db-4b2d-b087-cb903f23fe27
+langcode: en
+status: true
+dependencies:
+  module:
+    - node
+id: dossier
+label: Dossier
+bundles:
+  - article
+  - materiau
+  - thematique
+entity_type: node
+global: false
+weight: 0
+flag_short: 'Flag this item'
+flag_long: ''
+flag_message: ''
+unflag_short: 'Unflag this item'
+unflag_long: ''
+unflag_message: ''
+unflag_denied_text: ''
+flag_type: 'entity:node'
+link_type: reload
+flagTypeConfig:
+  show_in_links: {  }
+  show_as_field: true
+  show_on_form: false
+  show_contextual_link: true
+  extra_permissions:
+    owner: owner
+linkTypeConfig: {  }

+ 32 - 0
config/sync/flag.flag.flag_list_template_1.yml

@@ -0,0 +1,32 @@
+uuid: cc972bc9-a9d6-4715-bde0-b686a22069d2
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag_lists
+    - node
+_core:
+  default_config_hash: gv5HCXt_zANnxz5g4ygaALNMnN5yQzI4jy3A7c8phFc
+id: flag_list_template_1
+label: 'Flag list template 1'
+bundles: {  }
+entity_type: node
+global: false
+weight: 0
+flag_short: 'Add this item to the [flagging_collection:name] list'
+flag_long: 'Add this to your flag list'
+flag_message: 'Added to the flag list'
+unflag_short: 'Remove this item from the [flagging_collection:name] list'
+unflag_long: 'Remove this item from your flag list'
+unflag_message: 'Removed from the flag list'
+unflag_denied_text: ''
+flag_type: 'entity:node'
+link_type: ajax_link
+flagTypeConfig:
+  show_in_links: {  }
+  show_as_field: true
+  show_on_form: false
+  show_contextual_link: false
+  extra_permissions:
+    owner: '0'
+linkTypeConfig: {  }

+ 33 - 0
config/sync/flag.flag.test_dossier.yml

@@ -0,0 +1,33 @@
+uuid: null
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag_lists
+    - node
+id: test_dossier
+label: 'test dossier'
+bundles:
+  - article
+  - materiau
+  - thematique
+entity_type: node
+global: false
+weight: 0
+flag_short: 'Flag this item'
+flag_long: ''
+flag_message: ''
+unflag_short: 'Unflag this item'
+unflag_long: ''
+unflag_message: ''
+unflag_denied_text: ''
+flag_type: 'entity:node'
+link_type: ajax_link
+flagTypeConfig:
+  show_in_links: {  }
+  show_as_field: true
+  show_on_form: false
+  show_contextual_link: false
+  extra_permissions:
+    owner: owner
+linkTypeConfig: {  }

+ 9 - 0
config/sync/flag_lists.flag_for_list.dossier.yml

@@ -0,0 +1,9 @@
+uuid: null
+langcode: en
+status: true
+dependencies: {  }
+id: dossier
+label: Dossier
+base_flag: dossier
+owner: root
+weight: null

+ 11 - 0
config/sync/flag_lists.flag_for_list.flag_list_template_1.yml

@@ -0,0 +1,11 @@
+uuid: e0111fa4-31c3-483a-918f-aca9c752190f
+langcode: en
+status: true
+dependencies: {  }
+_core:
+  default_config_hash: is37xp2En_K1r0KAxyELb0cyrB6aQH5Ygr7o6tICk24
+id: flag_list_template_1
+label: 'Flag list template 1'
+base_flag: flag_list_template_1
+owner: 'Drupal Master'
+weight: null

+ 8 - 0
config/sync/flag_lists.flagging_collection_type.flagging_collection_type_1.yml

@@ -0,0 +1,8 @@
+uuid: 93164e3c-1d21-4129-bafc-e8956664f1db
+langcode: en
+status: true
+dependencies: {  }
+_core:
+  default_config_hash: FgMUj7Lcs3yxNwSGpVwKZ6N00JNmxn3FndQcd-230hM
+id: flagging_collection_type_1
+label: 'Flagging collection type 1'

+ 1 - 0
config/sync/language/fr/views.view.files.yml

@@ -78,6 +78,7 @@ display:
           label: 'Enregistrement du module'
         count:
           label: 'Nombre d''utilisations'
+          format_plural_string: !!binary MQNAY291bnQ=
       title: 'Utilisation du fichier'
       arguments:
         fid:

+ 49 - 0
config/sync/language/fr/views.view.my_flag_list_items.yml

@@ -0,0 +1,49 @@
+display:
+  default:
+    display_title: Maître
+    display_options:
+      exposed_form:
+        options:
+          submit_button: Appliquer
+          reset_button_label: Réinitialiser
+          exposed_sorts_label: 'Trier par'
+          sort_asc_label: Asc
+          sort_desc_label: Desc
+      pager:
+        options:
+          expose:
+            items_per_page_label: 'Éléments par page'
+            items_per_page_options_all_label: '- Tout -'
+            offset_label: Décalage
+          tags:
+            previous: ‹‹
+            next: ››
+      fields:
+        name_1:
+          separator: ', '
+        title:
+          label: Titre
+          separator: ', '
+        type:
+          label: 'Type d''entité'
+          separator: ', '
+        entity_id:
+          label: 'Identifiant (ID) de l''entité'
+          separator: ', '
+  block_1:
+    display_title: Bloc
+    display_options:
+      fields:
+        name_1:
+          separator: ', '
+        title:
+          label: Titre
+          separator: ', '
+        type:
+          label: 'Type d''entité'
+          separator: ', '
+        entity_id:
+          label: 'Identifiant (ID) de l''entité'
+          separator: ', '
+  page_1:
+    display_title: Page

+ 18 - 0
config/sync/rest.resource.entity.flag.yml

@@ -0,0 +1,18 @@
+uuid: c6b97e2c-7823-4aa3-9102-9482d78c4551
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag
+    - serialization
+    - user
+id: entity.flag
+plugin_id: 'entity:flag'
+granularity: resource
+configuration:
+  methods:
+    - GET
+  formats:
+    - json
+  authentication:
+    - cookie

+ 18 - 0
config/sync/rest.resource.entity.flag_for_list.yml

@@ -0,0 +1,18 @@
+uuid: 619d9b48-cf3a-429a-b9e8-eae1106b05a5
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag_lists
+    - serialization
+    - user
+id: entity.flag_for_list
+plugin_id: 'entity:flag_for_list'
+granularity: resource
+configuration:
+  methods:
+    - GET
+  formats:
+    - json
+  authentication:
+    - cookie

+ 21 - 0
config/sync/rest.resource.entity.flag_list_item.yml

@@ -0,0 +1,21 @@
+uuid: 9b95ad99-19d6-495c-8d3b-e9b79fc390f5
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag_lists
+    - serialization
+    - user
+id: entity.flag_list_item
+plugin_id: 'entity:flag_list_item'
+granularity: resource
+configuration:
+  methods:
+    - GET
+    - POST
+    - DELETE
+    - PATCH
+  formats:
+    - json
+  authentication:
+    - cookie

+ 21 - 0
config/sync/rest.resource.entity.flagging.yml

@@ -0,0 +1,21 @@
+uuid: 5ab3e66a-7ab2-42f7-988a-d60bc5cb502e
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag
+    - serialization
+    - user
+id: entity.flagging
+plugin_id: 'entity:flagging'
+granularity: resource
+configuration:
+  methods:
+    - GET
+    - POST
+    - DELETE
+    - PATCH
+  formats:
+    - json
+  authentication:
+    - cookie

+ 21 - 0
config/sync/rest.resource.entity.flagging_collection.yml

@@ -0,0 +1,21 @@
+uuid: bdabf98a-bd5a-434c-b442-24de2558894c
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag_lists
+    - serialization
+    - user
+id: entity.flagging_collection
+plugin_id: 'entity:flagging_collection'
+granularity: resource
+configuration:
+  methods:
+    - GET
+    - POST
+    - DELETE
+    - PATCH
+  formats:
+    - json
+  authentication:
+    - cookie

+ 18 - 0
config/sync/rest.resource.entity.flagging_collection_type.yml

@@ -0,0 +1,18 @@
+uuid: 61a720a3-ee1e-47c4-a5d9-9fe052d020e8
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag_lists
+    - serialization
+    - user
+id: entity.flagging_collection_type
+plugin_id: 'entity:flagging_collection_type'
+granularity: resource
+configuration:
+  methods:
+    - GET
+  formats:
+    - json
+  authentication:
+    - cookie

+ 15 - 0
config/sync/system.action.flag_action.dossier_flag.yml

@@ -0,0 +1,15 @@
+uuid: 19f6415c-55ae-4d43-9804-3b6c9725eb29
+langcode: en
+status: true
+dependencies:
+  config:
+    - flag.flag.dossier
+  module:
+    - flag
+id: flag_action.dossier_flag
+label: 'Flag this item'
+type: node
+plugin: 'flag_action:dossier_flag'
+configuration:
+  flag_id: dossier
+  flag_action: flag

+ 15 - 0
config/sync/system.action.flag_action.dossier_unflag.yml

@@ -0,0 +1,15 @@
+uuid: ee3693e6-2a01-4850-a464-099930242d42
+langcode: en
+status: true
+dependencies:
+  config:
+    - flag.flag.dossier
+  module:
+    - flag
+id: flag_action.dossier_unflag
+label: 'Unflag this item'
+type: node
+plugin: 'flag_action:dossier_unflag'
+configuration:
+  flag_id: dossier
+  flag_action: unflag

+ 17 - 0
config/sync/system.action.flag_action.flag_list_template_1_flag.yml

@@ -0,0 +1,17 @@
+uuid: b883b2b8-2955-4df1-987b-10a5e1488fd2
+langcode: en
+status: true
+dependencies:
+  config:
+    - flag.flag.flag_list_template_1
+  module:
+    - flag
+_core:
+  default_config_hash: LkE1QB2Y0oqjrb33mVsdE0cSy6E9wujJklHGqH91GvE
+id: flag_action.flag_list_template_1_flag
+label: 'Add this item to a list'
+type: node
+plugin: 'flag_action:flag_list_template_1_flag'
+configuration:
+  flag_id: flag_list_template_1
+  flag_action: flag

+ 17 - 0
config/sync/system.action.flag_action.flag_list_template_1_unflag.yml

@@ -0,0 +1,17 @@
+uuid: 657ee4d7-61e7-4466-b6d5-37270056d4ef
+langcode: en
+status: true
+dependencies:
+  config:
+    - flag.flag.flag_list_template_1
+  module:
+    - flag
+_core:
+  default_config_hash: dkSOtOrwdYQJVIAi2LOYl8XRZCqSIIIb0Hb9J-2NNug
+id: flag_action.flag_list_template_1_unflag
+label: 'Remove this item from the list'
+type: node
+plugin: 'flag_action:flag_list_template_1_unflag'
+configuration:
+  flag_id: flag_list_template_1
+  flag_action: unflag

+ 15 - 0
config/sync/system.action.flag_action.test_dossier_flag.yml

@@ -0,0 +1,15 @@
+uuid: dbe3c645-f4b1-416c-b9b2-43bf919eb593
+langcode: en
+status: true
+dependencies:
+  config:
+    - flag.flag.test_dossier
+  module:
+    - flag
+id: flag_action.test_dossier_flag
+label: 'Flag this item'
+type: node
+plugin: 'flag_action:test_dossier_flag'
+configuration:
+  flag_id: test_dossier
+  flag_action: flag

+ 15 - 0
config/sync/system.action.flag_action.test_dossier_unflag.yml

@@ -0,0 +1,15 @@
+uuid: c4aa7c16-1473-471b-81b0-3a862238bda7
+langcode: en
+status: true
+dependencies:
+  config:
+    - flag.flag.test_dossier
+  module:
+    - flag
+id: flag_action.test_dossier_unflag
+label: 'Unflag this item'
+type: node
+plugin: 'flag_action:test_dossier_unflag'
+configuration:
+  flag_id: test_dossier
+  flag_action: unflag

+ 13 - 0
config/sync/system.action.flag_delete_flagging.yml

@@ -0,0 +1,13 @@
+uuid: 11e49c6d-d0f0-4e79-b692-1e482ce100bc
+langcode: en
+status: true
+dependencies:
+  module:
+    - flag
+_core:
+  default_config_hash: Z9dGFmjyQgZjDwdsI-Mmgd2tZkUsjYi7cOSUPqjXPtw
+id: flag_delete_flagging
+label: 'Delete flagging'
+type: flagging
+plugin: flag_delete_flagging
+configuration: {  }

+ 5 - 0
config/sync/user.role.adherent.yml

@@ -8,11 +8,16 @@ weight: -3
 is_admin: null
 permissions:
   - 'access materio search'
+  - 'add flag lists'
   - 'create member profile'
+  - 'edit own flag lists'
+  - 'flag dossier other items'
+  - 'unflag dossier other items'
   - 'update own commerce_license'
   - 'update own member profile'
   - 'use jsonrpc services'
   - 'view materio_order_type commerce_order'
   - 'view own commerce_license'
+  - 'view own flag lists'
   - 'view own member profile'
   - 'view recurring commerce_order'

+ 5 - 0
config/sync/user.role.admin.yml

@@ -20,6 +20,7 @@ permissions:
   - 'access site in maintenance mode'
   - 'access synonyms entity autocomplete'
   - 'access toolbar'
+  - 'add flag lists'
   - 'administer commerce_order'
   - 'administer newsletters'
   - 'administer productions menu items'
@@ -85,6 +86,7 @@ permissions:
   - 'edit field_memo'
   - 'edit field_showroom'
   - 'edit own enregistrement content'
+  - 'edit own flag lists'
   - 'edit terms in assisted_research'
   - 'edit terms in collectionneurs'
   - 'edit terms in company'
@@ -111,6 +113,7 @@ permissions:
   - 'execute views_bulk_edit all'
   - 'execute workflow_node_given_state_action node'
   - 'execute workflow_node_next_state_action node'
+  - 'flag dossier other items'
   - 'revert any corpus_documents workflow_transition'
   - 'revert any generique workflow_transition'
   - 'revert article revisions'
@@ -140,6 +143,7 @@ permissions:
   - 'translate static node'
   - 'translate tags taxonomy_term'
   - 'translate thesaurus taxonomy_term'
+  - 'unflag dossier other items'
   - 'update any commerce_license'
   - 'update commerce_promotion'
   - 'update content translations'
@@ -164,6 +168,7 @@ permissions:
   - 'view materiau revisions'
   - 'view materio_order_type commerce_order'
   - 'view member profile'
+  - 'view own flag lists'
   - 'view own profile'
   - 'view page revisions'
   - 'view simplenews_issue revisions'

+ 5 - 0
config/sync/user.role.admin_showroom.yml

@@ -8,4 +8,9 @@ weight: 0
 is_admin: null
 permissions:
   - 'access materio search'
+  - 'add flag lists'
+  - 'edit own flag lists'
+  - 'flag dossier other items'
+  - 'unflag dossier other items'
   - 'use jsonrpc services'
+  - 'view own flag lists'

+ 5 - 0
config/sync/user.role.alpha_testeur.yml

@@ -8,7 +8,12 @@ weight: -5
 is_admin: null
 permissions:
   - 'access materio search'
+  - 'add flag lists'
   - 'create member profile'
+  - 'edit own flag lists'
+  - 'flag dossier other items'
+  - 'unflag dossier other items'
   - 'update own member profile'
   - 'use jsonrpc services'
+  - 'view own flag lists'
   - 'view own member profile'

+ 5 - 0
config/sync/user.role.student.yml

@@ -8,7 +8,12 @@ weight: -4
 is_admin: null
 permissions:
   - 'access materio search'
+  - 'add flag lists'
   - 'create member profile'
+  - 'edit own flag lists'
+  - 'flag dossier other items'
+  - 'unflag dossier other items'
   - 'update own member profile'
   - 'use jsonrpc services'
+  - 'view own flag lists'
   - 'view own member profile'

+ 5 - 0
config/sync/user.role.translator.yml

@@ -8,3 +8,8 @@ weight: -1
 is_admin: null
 permissions:
   - 'access materio search'
+  - 'add flag lists'
+  - 'edit own flag lists'
+  - 'flag dossier other items'
+  - 'unflag dossier other items'
+  - 'view own flag lists'

+ 852 - 0
config/sync/views.view.my_flag_list_items.yml

@@ -0,0 +1,852 @@
+uuid: bdcbca4d-9bcf-47fd-b8d9-68a721afdbe0
+langcode: en
+status: true
+dependencies:
+  config:
+    - system.menu.tools
+  module:
+    - flag_lists
+    - node
+    - user
+_core:
+  default_config_hash: y1M-Cg-Ne3EcH-8k16QBBb-q-aReeTXz-Uu99lV7P9g
+id: my_flag_list_items
+label: 'My flag list items'
+module: views
+description: 'List a users flag lists'
+tag: 'Flag lists'
+base_table: flag_list_item_field_data
+base_field: id
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: 0
+    display_options:
+      access:
+        type: perm
+        options:
+          perm: 'access content'
+      cache:
+        type: tag
+        options: {  }
+      query:
+        type: views_query
+        options:
+          disable_sql_rewrite: false
+          distinct: false
+          replica: false
+          query_comment: ''
+          query_tags: {  }
+      exposed_form:
+        type: basic
+        options:
+          submit_button: Apply
+          reset_button: false
+          reset_button_label: Reset
+          exposed_sorts_label: 'Sort by'
+          expose_sort_order: true
+          sort_asc_label: Asc
+          sort_desc_label: Desc
+      pager:
+        type: mini
+        options:
+          items_per_page: 10
+          offset: 0
+          id: 0
+          total_pages: null
+          expose:
+            items_per_page: false
+            items_per_page_label: 'Items per page'
+            items_per_page_options: '5, 10, 25, 50'
+            items_per_page_options_all: false
+            items_per_page_options_all_label: '- All -'
+            offset: false
+            offset_label: Offset
+          tags:
+            previous: ‹‹
+            next: ››
+      style:
+        type: table
+        options:
+          grouping:
+            -
+              field: name_1
+              rendered: true
+              rendered_strip: false
+          row_class: ''
+          default_row_class: true
+          override: true
+          sticky: false
+          caption: ''
+          summary: ''
+          description: ''
+          columns:
+            name_1: name_1
+            type: type
+            entity_id: entity_id
+          info:
+            name_1:
+              sortable: true
+              default_sort_order: asc
+              align: ''
+              separator: ''
+              empty_column: false
+              responsive: ''
+            type:
+              sortable: true
+              default_sort_order: asc
+              align: ''
+              separator: ''
+              empty_column: false
+              responsive: ''
+            entity_id:
+              sortable: true
+              default_sort_order: asc
+              align: ''
+              separator: ''
+              empty_column: false
+              responsive: ''
+          default: name_1
+          empty_table: false
+      row:
+        type: fields
+      fields:
+        name_1:
+          id: name_1
+          table: flagging_collection_field_data
+          field: name
+          relationship: flag_list
+          group_type: group
+          admin_label: ''
+          label: 'Flag list'
+          exclude: true
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: false
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: flagging_collection
+          entity_field: name
+          plugin_id: field
+        title:
+          id: title
+          table: node_field_data
+          field: title
+          relationship: entity_id
+          group_type: group
+          admin_label: ''
+          label: Title
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: true
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: node
+          entity_field: title
+          plugin_id: field
+        type:
+          id: type
+          table: flag_list_item_field_data
+          field: type
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: 'Entity Type'
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: false
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: flag_list_item
+          entity_field: type
+          plugin_id: field
+        entity_id:
+          id: entity_id
+          table: flag_list_item_field_data
+          field: entity_id
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: 'Entity ID'
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: number_integer
+          settings:
+            thousand_separator: ''
+            prefix_suffix: true
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: flag_list_item
+          entity_field: entity_id
+          plugin_id: field
+      filters:
+        uid_current:
+          id: uid_current
+          table: users
+          field: uid_current
+          relationship: user_id
+          group_type: group
+          admin_label: ''
+          operator: '='
+          value: '1'
+          group: 1
+          exposed: false
+          expose:
+            operator_id: ''
+            label: ''
+            description: ''
+            use_operator: false
+            operator: ''
+            identifier: ''
+            required: false
+            remember: false
+            multiple: false
+            remember_roles:
+              authenticated: authenticated
+            operator_limit_selection: false
+            operator_list: {  }
+          is_grouped: false
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: true
+            widget: select
+            multiple: false
+            remember: false
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
+          entity_type: user
+          plugin_id: user_current
+        type:
+          id: type
+          table: flag_list_item_field_data
+          field: type
+          relationship: none
+          group_type: group
+          admin_label: ''
+          operator: '='
+          value: node
+          group: 1
+          exposed: false
+          expose:
+            operator_id: ''
+            label: ''
+            description: ''
+            use_operator: false
+            operator: ''
+            identifier: ''
+            required: false
+            remember: false
+            multiple: false
+            remember_roles:
+              authenticated: authenticated
+            placeholder: ''
+            operator_limit_selection: false
+            operator_list: {  }
+          is_grouped: false
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: true
+            widget: select
+            multiple: false
+            remember: false
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
+          entity_type: flag_list_item
+          entity_field: type
+          plugin_id: string
+      sorts: {  }
+      title: 'My flag list items'
+      header:
+        area:
+          id: area
+          table: views
+          field: area
+          plugin_id: text
+      footer: {  }
+      empty:
+        area:
+          id: area
+          table: views
+          field: area
+          relationship: none
+          group_type: group
+          admin_label: ''
+          empty: true
+          tokenize: false
+          content:
+            value: 'You don''t have any Flag List Items.'
+            format: basic_html
+          plugin_id: text
+      relationships:
+        flag_list:
+          id: flag_list
+          table: flag_list_item_field_data
+          field: flag_list
+          relationship: none
+          group_type: group
+          admin_label: 'Connected flag'
+          required: false
+          entity_type: flag_list_item
+          plugin_id: standard
+        entity_id:
+          id: entity_id
+          table: flag_list_item_field_data
+          field: entity_id
+          relationship: none
+          group_type: group
+          admin_label: 'Connected node'
+          required: false
+          entity_type: flag_list_item
+          plugin_id: standard
+        user_id:
+          id: user_id
+          table: flag_list_item_field_data
+          field: user_id
+          relationship: none
+          group_type: group
+          admin_label: User
+          required: false
+          entity_type: flag_list_item
+          entity_field: user_id
+          plugin_id: standard
+      arguments: {  }
+      display_extenders: {  }
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - url.query_args
+        - user
+        - user.permissions
+      tags: {  }
+  block_1:
+    display_plugin: block
+    id: block_1
+    display_title: Block
+    position: 2
+    display_options:
+      display_extenders: {  }
+      block_description: 'My Flag Lists'
+      pager:
+        type: none
+        options:
+          offset: 0
+      defaults:
+        pager: false
+        fields: false
+      block_category: 'Flag Lists'
+      fields:
+        name_1:
+          id: name_1
+          table: flagging_collection_field_data
+          field: name
+          relationship: flag_list
+          group_type: group
+          admin_label: ''
+          label: 'Flag list'
+          exclude: true
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: false
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: flagging_collection
+          entity_field: name
+          plugin_id: field
+        title:
+          id: title
+          table: node_field_data
+          field: title
+          relationship: entity_id
+          group_type: group
+          admin_label: ''
+          label: Title
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: true
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: node
+          entity_field: title
+          plugin_id: field
+        type:
+          id: type
+          table: flag_list_item_field_data
+          field: type
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: 'Entity Type'
+          exclude: true
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: false
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: flag_list_item
+          entity_field: type
+          plugin_id: field
+        entity_id:
+          id: entity_id
+          table: flag_list_item_field_data
+          field: entity_id
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: 'Entity ID'
+          exclude: true
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: number_integer
+          settings:
+            thousand_separator: ''
+            prefix_suffix: true
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: flag_list_item
+          entity_field: entity_id
+          plugin_id: field
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - url.query_args
+        - user
+        - user.permissions
+      tags: {  }
+  page_1:
+    display_plugin: page
+    id: page_1
+    display_title: Page
+    position: 1
+    display_options:
+      display_extenders: {  }
+      path: my-flag-list-items
+      menu:
+        type: normal
+        title: 'My flag list items'
+        description: 'All my flag list items'
+        expanded: false
+        parent: ''
+        weight: 0
+        context: '0'
+        menu_name: tools
+      header:
+        area:
+          id: area
+          table: views
+          field: area
+          relationship: none
+          group_type: group
+          admin_label: ''
+          empty: false
+          tokenize: false
+          content:
+            value: 'My flag lists for node''s entities on this system'
+            format: basic_html
+          plugin_id: text
+      defaults:
+        header: false
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - url.query_args
+        - user
+        - user.permissions
+      tags: {  }

+ 7 - 0
web/modules/custom/materio_flag/materio_flag.info.yml

@@ -0,0 +1,7 @@
+name: Materio FLAG
+type: module
+description: Defines api behaviours for flaglist.
+core: 8.x
+package: Materio
+dependencies:
+  - drupal:flag_lists

+ 1 - 0
web/modules/custom/materio_flag/materio_flag.module

@@ -0,0 +1 @@
+<?php

+ 9 - 0
web/modules/custom/materio_flag/materio_flag.permissions.yml

@@ -0,0 +1,9 @@
+materio_jsonapi roles:
+  title: 'view role info'
+  description: 'View any role info in jsonapi.'
+  restrict access: true
+
+materio_jsonapi ownroles:
+  title: 'view own role info'
+  description: 'View own role info in jsonapi.'
+  restrict access: true

+ 7 - 0
web/modules/custom/materio_flag/materio_flag.routing.yml

@@ -0,0 +1,7 @@
+materio_flag.user_flagging_collections:
+  path: 'materio_flag/user_flagging_collections'
+  defaults:
+    _controller: '\Drupal\materio_flag\Controller\MaterioFlagController::getUsersFlaggingCollections'
+    _title: 'User Flagging Colleciton'
+  requirements:
+    _permission: 'access content'

+ 113 - 0
web/modules/custom/materio_flag/src/Controller/MaterioFlagController.php

@@ -0,0 +1,113 @@
+<?php
+
+namespace Drupal\materio_flag\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+// use Drupal\Core\Entity\EntityManagerInterface;
+// use Drupal\language\ConfigurableLanguageManagerInterface;
+// use Drupal\Core\Render\RendererInterface;
+// use Drupal\Core\Entity\EntityTypeManagerInterface;
+// use Drupal\Core\Cache\CacheableJsonResponse;
+// use Drupal\Core\Cache\CacheableMetadata;
+use Symfony\Component\HttpFoundation\JsonResponse;
+// use Drupal\Core\Url;
+// use Drupal\core\render\RenderContext;
+use Drupal\flag_lists\FlagListsService;
+
+/**
+ * Class AjaxHomeController.
+ */
+class MaterioFlagController extends ControllerBase {
+
+  /**
+   * Drupal\Core\Entity\EntityManagerInterface definition.
+   *
+   * @var \Drupal\Core\Entity\EntityManagerInterface
+   */
+  // protected $entityManager;
+  /**
+   * Drupal\language\ConfigurableLanguageManagerInterface definition.
+   *
+   * @var \Drupal\language\ConfigurableLanguageManagerInterface
+   */
+  // protected $languageManager;
+  /**
+   * Drupal\Core\Render\RendererInterface definition.
+   *
+   * @var \Drupal\Core\Render\RendererInterface
+   */
+  // protected $renderer;
+  /**
+   * Drupal\Core\Render\RendererInterface definition.
+   *
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+   */
+  // protected $entityTypeManager;
+
+  /**
+   * Drupal\Core\Render\RendererInterface definition.
+   *
+   * @var \Drupal\flag_lists\FlagListsService
+   */
+  protected $flaglists;
+
+  /**
+   * Constructs a new AjaxHomeController object.
+   */
+  // public function __construct(EntityManagerInterface $entity_manager, ConfigurableLanguageManagerInterface $language_manager, RendererInterface $renderer, EntityTypeManagerInterface $entity_type_manager) {
+  //   $this->entityManager = $entity_manager;
+  //   $this->languageManager = $language_manager;
+  //   $this->renderer = $renderer;
+  //   $this->entityTypeManager = $entity_type_manager;
+  // }
+  public function __construct(FlagListsService $flag_lists_service ) {
+   $this->flaglists = $flag_lists_service;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('flaglists'),
+    );
+  }
+
+  /**
+   * Hello.
+   *
+   * @return string
+   *   Return Hello string.
+   */
+  public function getUsersFlaggingCollections() {
+
+    // $data['data'] = ['test', 'hello'];
+
+    // $data['data'] = $this->flaglists->getUsersFlaggingCollections();
+
+    // $data['#cache'] = [
+    //   // 'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
+    //   'tags' => ['materio-flag-cache'],
+    //   // 'contexts' => [
+    //   //   'languages:language_content'
+    //   // ]
+    // ];
+    // $response = new CacheableJsonResponse($data);
+    // $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
+    // return $response;
+
+    $colls = $this->flaglists->getUsersFlaggingCollections();
+
+    $data = [];
+    foreach ($colls as $id => $collection) {
+      $data[] = array(
+        "id" => $id,
+        "name" => $collection->getName()
+      );
+    }
+
+    return new JsonResponse($data);
+  }
+
+}

File diff suppressed because it is too large
+ 8 - 0
web/themes/custom/materiotheme/assets/dist/main.js


+ 6 - 4
web/themes/custom/materiotheme/assets/scripts/main.js

@@ -55,16 +55,18 @@ import 'theme/assets/styles/main.scss'
     function checkNoVuePages(){
       // return drupalDecoupled.sys_path != '/cart'
       // && drupalDecoupled.sys_path.indexOf('checkout') != 1;
-      if( drupalDecoupled.route_name.indexOf('commerce') == -1 ){
-        return true;
-      }else{
+      if( drupalDecoupled.route_name.indexOf('commerce') == -1 &&
+          drupalDecoupled.route_name.indexOf('flagging_collection') == -1 &&
+          drupalDecoupled.route_name.indexOf('user') == -1){
         return false;
+      }else{
+        return true;
       }
     }
 
     function initVues(){
       // only launch views if we are not in commerce pages
-      if(checkNoVuePages()){
+      if(!checkNoVuePages()){
         initVRouter();
         initVSiteBrandingBlock()
         initVPagetitleBlock()

+ 47 - 0
web/themes/custom/materiotheme/vuejs/components/User/UserFlags.vue

@@ -0,0 +1,47 @@
+<template lang="html">
+  <div id="user-flags">
+    <h4
+      class="mdi mdi-folder-outline"
+    >My folders</h4>
+    <ul>
+      <li v-for="flag in flags" :key="flag.id">
+        <h5>{{ flag.name }}</h5>
+      </li>
+      <li ref="create-flag">
+        <h5
+          class="mdi mdi-folder-plus-outline"
+          @click.prevent="onCreateFlag()"
+        >new folder</h5>
+      </li>
+    </ul>
+  </div>
+</template>
+
+<script>
+
+import { mapState, mapActions } from 'vuex'
+
+export default {
+  name: "userFlags",
+  data: () => ({
+
+  }),
+  computed: {
+    ...mapState({
+      flags: state => state.User.flags
+    })
+  },
+  methods: {
+    ...mapActions({
+      createFlag: 'User/createFlag'
+    }),
+    onLogout () {
+      console.log("UserFlags onCreateFlag")
+      this.userLogout()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 9 - 2
web/themes/custom/materiotheme/vuejs/components/User/UserTools.vue

@@ -13,13 +13,19 @@
       class="mdi mdi-logout"
       title="logout"
     ></a>
+    <UserFlags v-if="flags"/>
   </div>
 </template>
 
 <script>
 import { mapState, mapActions } from 'vuex'
 
+import UserFlags from 'vuejs/components/User/UserFlags'
+
 export default {
+  components: {
+    UserFlags
+  },
   // data () {
   //   return {
   //     mail: "Hello User!"
@@ -28,7 +34,8 @@ export default {
   computed: {
     ...mapState({
       mail: state => state.User.mail,
-      isAdmin: state => state.User.isAdmin
+      isAdmin: state => state.User.isAdmin,
+      flags: state => state.User.flags
     })
   },
   methods: {
@@ -36,7 +43,7 @@ export default {
       userLogout: 'User/userLogout'
     }),
     onLogout () {
-      console.log('UserTools onLogout');
+      console.log("UserTools onLogout")
       this.userLogout()
     }
   }

+ 1 - 0
web/themes/custom/materiotheme/vuejs/store/modules/search.js

@@ -1,3 +1,4 @@
+import { REST } from 'vuejs/api/rest-axios'
 import { JSONAPI } from 'vuejs/api/json-axios'
 import { MA } from 'vuejs/api/ma-axios'
 import qs from 'querystring'

+ 144 - 108
web/themes/custom/materiotheme/vuejs/store/modules/user.js

@@ -1,15 +1,16 @@
-import { REST } from 'vuejs/api/rest-axios'
-import { JSONAPI } from 'vuejs/api/json-axios'
-import qs from 'querystring'
+import { REST } from "vuejs/api/rest-axios";
+// import { JSONAPI } from 'vuejs/api/json-axios';
+import { MA } from "vuejs/api/ma-axios";
+import qs from "querystring";
 
 export default {
   namespaced: true,
 
   // initial state
-  state : {
-    uid:null,
+  state: {
+    uid: null,
     // username: '',
-    mail:'',
+    mail: "",
     token: null,
     csrftoken: null,
     logout_token: null,
@@ -17,150 +18,185 @@ export default {
     isAdmin: false,
     isAdherent: false,
     canSearch: false,
-    roles: []
+    roles: [],
+    flags: false
   },
 
   // getters
-  getters : {},
+  getters: {},
 
   // mutations
-  mutations : {
-    SetCsrftoken (state, token) {
-      state.csrftoken = token
+  mutations: {
+    SetCsrftoken(state, token) {
+      state.csrftoken = token;
     },
-    setToken (state, data) {
-      state.uid = data.current_user.uid
-      // state.username = data.username
-      state.mail = data.current_user.mail
-      state.token = data.csrf_token
-      state.isloggedin = true
-      state.logout_token = data.logout_token
+    setToken(state, data) {
+      state.uid = data.current_user.uid;
+      // state.username = data.username;
+      state.mail = data.current_user.mail;
+      state.token = data.csrf_token;
+      state.isloggedin = true;
+      state.logout_token = data.logout_token;
     },
-    setUid (state, uid) {
-      state.uid = uid
-      state.isloggedin = true
+    setUid(state, uid) {
+      state.uid = uid;
+      state.isloggedin = true;
     },
-    setUser (state, data) {
-      state.mail = data.mail[0].value
-      state.uuid = data.uuid[0].value
+    setUser(state, data) {
+      state.mail = data.mail[0].value;
+      state.uuid = data.uuid[0].value;
     },
-    setRoles (state, roles) {
+    setRoles(state, roles) {
       console.log("User setRoles", roles);
-      state.roles = []
-      for (var i = 0; i < roles.length; i++) {
-        state.roles.push(roles[i].target_id)
+      state.roles = [];
+      for (let i = 0; i < roles.length; i++) {
+        state.roles.push(roles[i].target_id);
       }
       // check if admin
-      if(state.roles.indexOf('admin') != -1 || state.roles.indexOf('root') != -1){
+      if (
+        state.roles.indexOf("admin") !== -1 ||
+        state.roles.indexOf("root") !== -1
+      ) {
         // console.log('is admin');
-        state.isAdmin = true
+        state.isAdmin = true;
       }
       // check if has access to search
-      if(state.roles.indexOf('adherent') != -1){
+      if (state.roles.indexOf("adherent") !== -1) {
         // console.log('is admin');
-        state.canSearch = true
-        state.isAdherent = true
+        state.canSearch = true;
+        state.isAdherent = true;
       }
     },
-    setLoggedOut (state) {
+    setLoggedOut(state) {
       console.log("setLoggedOut state", state);
-      state.uid= null
-      state.mail = ''
-      state.token = null
-      state.isloggedin = false
-      state.logout_token = null
-      if (state.isAdmin){
+      state.uid = null;
+      state.mail = "";
+      state.token = null;
+      state.isloggedin = false;
+      state.logout_token = null;
+      if (state.isAdmin) {
         // TODO: what if on a page where login is needed (as commerce checkout and cart)
         window.location.reload(true);
       }
-      state.asAdmin = false
-      state.canSearch = false
+      state.asAdmin = false;
+      state.canSearch = false;
+    },
+    setFlags(state, flags) {
+      console.log("User setFlags", flags);
+      state.flags = flags;
     }
   },
 
   // actions
-  actions : {
-    userRegister({ dispatch, commit, state }, credentials){
+  actions: {
+    userRegister({ dispatch, commit, state }, credentials) {
       return new Promise((resolve, reject) => {
-        REST.get('/session/token')
-          .then(({token}) => {
-            commit('SetCsrftoken', token)
-            REST.post('/user/register?_format=json',
-              credentials,
-              {'X-CSRF-Token':state.csrftoken}
-            )
-              .then(({ data }) => {
-                console.log('user REST registered', data);
-                dispatch('userLogin', credentials)
-                  .then(() => {
-                    resolve()
-                  })
-              })
-              .catch(( error ) => {
-                console.warn('Issue with register', error)
-                Promise.reject(error)
-              })
-
+        REST.get("/session/token").then(({ token }) => {
+          commit("SetCsrftoken", token);
+          REST.post("/user/register?_format=json", credentials, {
+            "X-CSRF-Token": state.csrftoken
           })
-      })
+            .then(({ data }) => {
+              console.log("user REST registered", data);
+              dispatch("userLogin", credentials).then(() => {
+                resolve();
+              });
+            })
+            .catch(error => {
+              console.warn("Issue with register", error);
+              Promise.reject(error);
+            });
+        });
+      });
     },
-    userLogin({ dispatch, commit, state }, credentials){
+    userLogin({ dispatch, commit, state }, credentials) {
       return new Promise((resolve, reject) => {
-        dispatch('getToken', credentials)
-          .then(() => {
-            dispatch('getUser').then((userdata) => {
-              console.log('User Loggedin');
-              if (state.isAdmin){
-                window.location.reload(true);
-              }
-              resolve()
-            })
-          })
-      })
+        dispatch("getToken", credentials).then(() => {
+          dispatch("getUser").then(userdata => {
+            console.log("User Loggedin");
+            if (state.isAdmin) {
+              window.location.reload(true);
+            }
+            resolve();
+          });
+        });
+      });
     },
-    getToken ({ dispatch, commit, state }, credentials) {
-      return REST.post('/user/login?_format=json', credentials)
+    getToken({ dispatch, commit, state }, credentials) {
+      return REST.post("/user/login?_format=json", credentials)
         .then(({ data }) => {
-          console.log('user REST getToken data', data)
-          commit('setToken', data)
-        })
-        .catch(( error ) => {
-          console.warn('Issue with getToken', error)
-          Promise.reject(error)
+          console.log("user REST getToken data", data);
+          commit("setToken", data);
         })
+        .catch(error => {
+          console.warn("Issue with getToken", error);
+          Promise.reject(error);
+        });
     },
-    getUser ({ dispatch, commit, state }) {
-      let params = {
+    getUser({ dispatch, commit, state }) {
+      const params = {
         token: state.token
-      }
+      };
       return REST.get(`/user/${state.uid}?_format=json`, params)
         .then(({ data }) => {
-          console.log('user REST getUser data', data)
-          console.log('roles', data['roles'])
-          commit('setUser', data)
-          if(data.roles){
-            commit('setRoles', data.roles)
+          console.log("user REST getUser data", data);
+          console.log("roles", data.roles);
+          commit("setUser", data);
+          if (data.roles) {
+            commit("setRoles", data.roles);
           }
+          dispatch("getUserFlags");
         })
-        .catch(( error ) => {
-            console.warn('Issue with getUser', error)
-            Promise.reject(error)
+        .catch(error => {
+          console.warn("Issue with getUser", error);
+          Promise.reject(error);
+        });
+    },
+    getUserFlags({ dispatch, commit, state }) {
+      // flags
+      // REST.get('/flagging_collection/1?_format=json')
+      //   .then(( data ) => {
+      //     console.log('TEST FLAG REST data', data)
+      //   })
+      //   .catch(error => {
+      //       console.warn('Issue USER TEST FLAG REST', error)
+      //       Promise.reject(error)
+      //   })
+      return MA.get("materio_flag/user_flagging_collections")
+        .then(({ data }) => {
+          console.log("user MA getFlags data", data);
+          commit("setFlags", data);
         })
+        .catch(error => {
+          console.warn("Issue USER MA getFlags", error);
+          Promise.reject(error);
+        });
     },
-    userLogout ({ commit, state }) {
-      let credentials = qs.stringify({
-        token: state.token
-      })
-      REST.post('/user/logout', credentials)
-        .then((resp) => {
-          console.log('userLogout resp', resp)
-          commit('setLoggedOut')
+    createFlag({ dispatch, commit, state }) {
+      // https://drupal.stackexchange.com/questions/248539/cant-get-flagging-api-to-accept-post-request
+      return REST.post("/entity/flagging_collection?_format=json")
+        .then(({ data }) => {
+          console.log("user REST createFlag data", data);
+          // commit("setFlags", data);
         })
-        .catch(( error ) => {
-            console.warn('Issue with logout', error)
-            Promise.reject(error)
+        .catch(error => {
+          console.warn("Issue USER MA createFlag", error);
+          Promise.reject(error);
+        });
+    },
+    userLogout({ commit, state }) {
+      const credentials = qs.stringify({
+        token: state.token
+      });
+      REST.post("/user/logout", credentials)
+        .then(resp => {
+          console.log("userLogout resp", resp);
+          commit("setLoggedOut");
         })
+        .catch(error => {
+          console.warn("Issue with logout", error);
+          Promise.reject(error);
+        });
     }
   }
-
-}
+};

Some files were not shown because too many files changed in this diff