enabled flag_lists, started flags front ui

This commit is contained in:
Bachir Soussi Chiadmi 2020-11-18 13:22:30 +01:00
parent 8db06621ce
commit 6718e5c9f9
43 changed files with 1889 additions and 123 deletions

View File

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

192
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "0fde84a349225b506081d88d67aa5cbc", "content-hash": "72666d13bf47ed93fa6c3d45a9e17370",
"packages": [ "packages": [
{ {
"name": "alchemy/zippy", "name": "alchemy/zippy",
@ -5721,6 +5721,54 @@
"source": "https://git.drupalcode.org/project/date_range_formatter" "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", "name": "drupal/devel",
"version": "4.0.1", "version": "4.0.1",
@ -6887,6 +6935,147 @@
}, },
"time": "2020-09-04T17:12:31+00:00" "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", "name": "drupal/genpass",
"version": "dev-1.x", "version": "dev-1.x",
@ -17216,6 +17405,7 @@
"drupal/commerce_variation_cart_form": 20, "drupal/commerce_variation_cart_form": 20,
"drupal/computed_field": 10, "drupal/computed_field": 10,
"drupal/content_sync": 20, "drupal/content_sync": 20,
"drupal/flag_lists": 10,
"drupal/genpass": 20, "drupal/genpass": 20,
"drupal/image_delta_formatter": 20, "drupal/image_delta_formatter": 20,
"drupal/jsonrpc": 20, "drupal/jsonrpc": 20,

View File

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

View File

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

View File

@ -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: { }

View File

@ -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: { }

View File

@ -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: { }

View File

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

View File

@ -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

View File

@ -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'

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: { }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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: { }

View File

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

View File

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

View File

@ -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

View File

@ -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'

View File

@ -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 one or more lines are too long

View File

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

View File

@ -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>

View File

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

View File

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

View File

@ -1,6 +1,7 @@
import { REST } from 'vuejs/api/rest-axios' import { REST } from "vuejs/api/rest-axios";
import { JSONAPI } from 'vuejs/api/json-axios' // import { JSONAPI } from 'vuejs/api/json-axios';
import qs from 'querystring' import { MA } from "vuejs/api/ma-axios";
import qs from "querystring";
export default { export default {
namespaced: true, namespaced: true,
@ -9,7 +10,7 @@ export default {
state: { state: {
uid: null, uid: null,
// username: '', // username: '',
mail:'', mail: "",
token: null, token: null,
csrftoken: null, csrftoken: null,
logout_token: null, logout_token: null,
@ -17,7 +18,8 @@ export default {
isAdmin: false, isAdmin: false,
isAdherent: false, isAdherent: false,
canSearch: false, canSearch: false,
roles: [] roles: [],
flags: false
}, },
// getters // getters
@ -26,55 +28,62 @@ export default {
// mutations // mutations
mutations: { mutations: {
SetCsrftoken(state, token) { SetCsrftoken(state, token) {
state.csrftoken = token state.csrftoken = token;
}, },
setToken(state, data) { setToken(state, data) {
state.uid = data.current_user.uid state.uid = data.current_user.uid;
// state.username = data.username // state.username = data.username;
state.mail = data.current_user.mail state.mail = data.current_user.mail;
state.token = data.csrf_token state.token = data.csrf_token;
state.isloggedin = true state.isloggedin = true;
state.logout_token = data.logout_token state.logout_token = data.logout_token;
}, },
setUid(state, uid) { setUid(state, uid) {
state.uid = uid state.uid = uid;
state.isloggedin = true state.isloggedin = true;
}, },
setUser(state, data) { setUser(state, data) {
state.mail = data.mail[0].value state.mail = data.mail[0].value;
state.uuid = data.uuid[0].value state.uuid = data.uuid[0].value;
}, },
setRoles(state, roles) { setRoles(state, roles) {
console.log("User setRoles", roles); console.log("User setRoles", roles);
state.roles = [] state.roles = [];
for (var i = 0; i < roles.length; i++) { for (let i = 0; i < roles.length; i++) {
state.roles.push(roles[i].target_id) state.roles.push(roles[i].target_id);
} }
// check if admin // 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'); // console.log('is admin');
state.isAdmin = true state.isAdmin = true;
} }
// check if has access to search // check if has access to search
if(state.roles.indexOf('adherent') != -1){ if (state.roles.indexOf("adherent") !== -1) {
// console.log('is admin'); // console.log('is admin');
state.canSearch = true state.canSearch = true;
state.isAdherent = true state.isAdherent = true;
} }
}, },
setLoggedOut(state) { setLoggedOut(state) {
console.log("setLoggedOut state", state); console.log("setLoggedOut state", state);
state.uid= null state.uid = null;
state.mail = '' state.mail = "";
state.token = null state.token = null;
state.isloggedin = false state.isloggedin = false;
state.logout_token = null state.logout_token = null;
if (state.isAdmin) { if (state.isAdmin) {
// TODO: what if on a page where login is needed (as commerce checkout and cart) // TODO: what if on a page where login is needed (as commerce checkout and cart)
window.location.reload(true); window.location.reload(true);
} }
state.asAdmin = false state.asAdmin = false;
state.canSearch = false state.canSearch = false;
},
setFlags(state, flags) {
console.log("User setFlags", flags);
state.flags = flags;
} }
}, },
@ -82,85 +91,112 @@ export default {
actions: { actions: {
userRegister({ dispatch, commit, state }, credentials) { userRegister({ dispatch, commit, state }, credentials) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
REST.get('/session/token') REST.get("/session/token").then(({ token }) => {
.then(({token}) => { commit("SetCsrftoken", token);
commit('SetCsrftoken', token) REST.post("/user/register?_format=json", credentials, {
REST.post('/user/register?_format=json', "X-CSRF-Token": state.csrftoken
credentials, })
{'X-CSRF-Token':state.csrftoken}
)
.then(({ data }) => { .then(({ data }) => {
console.log('user REST registered', data); console.log("user REST registered", data);
dispatch('userLogin', credentials) dispatch("userLogin", credentials).then(() => {
.then(() => { resolve();
resolve() });
})
})
.catch(( error ) => {
console.warn('Issue with register', error)
Promise.reject(error)
})
})
}) })
.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) => { return new Promise((resolve, reject) => {
dispatch('getToken', credentials) dispatch("getToken", credentials).then(() => {
.then(() => { dispatch("getUser").then(userdata => {
dispatch('getUser').then((userdata) => { console.log("User Loggedin");
console.log('User Loggedin');
if (state.isAdmin) { if (state.isAdmin) {
window.location.reload(true); window.location.reload(true);
} }
resolve() resolve();
}) });
}) });
}) });
}, },
getToken({ dispatch, commit, state }, credentials) { getToken({ dispatch, commit, state }, credentials) {
return REST.post('/user/login?_format=json', credentials) return REST.post("/user/login?_format=json", credentials)
.then(({ data }) => { .then(({ data }) => {
console.log('user REST getToken data', data) console.log("user REST getToken data", data);
commit('setToken', data) commit("setToken", data);
})
.catch(( error ) => {
console.warn('Issue with getToken', error)
Promise.reject(error)
}) })
.catch(error => {
console.warn("Issue with getToken", error);
Promise.reject(error);
});
}, },
getUser({ dispatch, commit, state }) { getUser({ dispatch, commit, state }) {
let params = { const params = {
token: state.token token: state.token
} };
return REST.get(`/user/${state.uid}?_format=json`, params) return REST.get(`/user/${state.uid}?_format=json`, params)
.then(({ data }) => { .then(({ data }) => {
console.log('user REST getUser data', data) console.log("user REST getUser data", data);
console.log('roles', data['roles']) console.log("roles", data.roles);
commit('setUser', data) commit("setUser", data);
if (data.roles) { if (data.roles) {
commit('setRoles', data.roles) commit("setRoles", data.roles);
} }
dispatch("getUserFlags");
}) })
.catch(( error ) => { .catch(error => {
console.warn('Issue with getUser', error) console.warn("Issue with getUser", error);
Promise.reject(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);
});
},
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 USER MA createFlag", error);
Promise.reject(error);
});
}, },
userLogout({ commit, state }) { userLogout({ commit, state }) {
let credentials = qs.stringify({ const credentials = qs.stringify({
token: state.token token: state.token
});
REST.post("/user/logout", credentials)
.then(resp => {
console.log("userLogout resp", resp);
commit("setLoggedOut");
}) })
REST.post('/user/logout', credentials) .catch(error => {
.then((resp) => { console.warn("Issue with logout", error);
console.log('userLogout resp', resp) Promise.reject(error);
commit('setLoggedOut') });
})
.catch(( error ) => {
console.warn('Issue with logout', error)
Promise.reject(error)
})
} }
} }
};
}