From b47a2885fe879337a88f2463cb2c115284803eac Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 6 Nov 2023 09:17:22 -0500 Subject: [PATCH 1/8] Add clear button for clearing custom content NOTE: primary and secondary buttons are sane color which probably should be changed (custom.css) --- app/controllers/page_contents_controller.rb | 2 ++ app/javascript/constants/strings.js | 2 ++ app/javascript/page-content/page_content.mixin.js | 7 ++++++- app/javascript/page-content/page_content_editor.vue | 10 +++++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/controllers/page_contents_controller.rb b/app/controllers/page_contents_controller.rb index 06b4b410e..823285567 100644 --- a/app/controllers/page_contents_controller.rb +++ b/app/controllers/page_contents_controller.rb @@ -9,3 +9,5 @@ def paginate false end end + +# TODO: check delete \ No newline at end of file diff --git a/app/javascript/constants/strings.js b/app/javascript/constants/strings.js index 70068b7f8..1593a6bf3 100644 --- a/app/javascript/constants/strings.js +++ b/app/javascript/constants/strings.js @@ -286,6 +286,8 @@ module.exports = { PAGE_CONTENT_SAVE_SUCCESS: "Page content saved successfully", PAGE_CONTENT_SAVE_ERROR: "Page content save failed", + PAGE_CONTENT_SUCCESS_DELETE: "Page content successfully deleted.", + PAGE_CONTENT_ERROR_DELETE: errorMessage("Page content failed to be deleted."), SURVEY_REDIRECT: "Unfortunately due to the browser refreshing we have lost any answers you filled in. Please fill the survey out again.", SURVEY_PUBLIC_NO_EDIT: "You cannot edit a published survey. Close the survey to enable editing.", diff --git a/app/javascript/page-content/page_content.mixin.js b/app/javascript/page-content/page_content.mixin.js index e39e5c3fc..15611fe0f 100644 --- a/app/javascript/page-content/page_content.mixin.js +++ b/app/javascript/page-content/page_content.mixin.js @@ -1,8 +1,9 @@ import { mapGetters, mapState, mapActions } from 'vuex'; import toastMixin from '../shared/toast-mixin'; import { NEW_PAGE_CONTENT } from '@/store/page_content.store'; -import { PAGE_CONTENT_SAVE_SUCCESS, PAGE_CONTENT_SAVE_ERROR } from '../constants/strings' +import { PAGE_CONTENT_SAVE_SUCCESS, PAGE_CONTENT_SAVE_ERROR, PAGE_CONTENT_SUCCESS_DELETE, PAGE_CONTENT_ERROR_DELETE } from '../constants/strings' import modelUtilsMixin from '../store/model_utils.mixin' +import { DELETE } from "@/store/model.store" export const pageContentMixin = { mixins: [toastMixin, modelUtilsMixin], @@ -10,6 +11,7 @@ export const pageContentMixin = { ...mapActions({ new_page_content: NEW_PAGE_CONTENT }), + // Do we need a delete ? savePageContent(newPageContent, success_text = PAGE_CONTENT_SAVE_SUCCESS, error_text = PAGE_CONTENT_SAVE_ERROR) { if (newPageContent.id) { return this.save_model('page_content', newPageContent) @@ -20,6 +22,9 @@ export const pageContentMixin = { ) } }, + deletePageContent(itemOrId, success_text = PAGE_CONTENT_SUCCESS_DELETE, error_text = PAGE_CONTENT_ERROR_DELETE) { + return this.toastPromise(this.$store.dispatch(DELETE, { model: 'page_content', itemOrId: itemOrId }), success_text, error_text); + } } } diff --git a/app/javascript/page-content/page_content_editor.vue b/app/javascript/page-content/page_content_editor.vue index fe90d8af2..9c95aba5f 100644 --- a/app/javascript/page-content/page_content_editor.vue +++ b/app/javascript/page-content/page_content_editor.vue @@ -11,7 +11,7 @@ > Save - + Clear @@ -57,6 +57,14 @@ export default { html: '' } }, + clearContent() { + console.debug("**** DELETE", this.content) + this.deletePageContent(this.content).then( + () => { + this.content = this.starter_content() + } + ); + }, saveContent() { let res = this.savePageContent(this.content); res.then( From ab5bc63b14454b79aeb36ad5f6b90daea521473e Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 6 Nov 2023 11:41:08 -0500 Subject: [PATCH 2/8] Change label of reset button --- app/javascript/page-content/page_content_editor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/page-content/page_content_editor.vue b/app/javascript/page-content/page_content_editor.vue index 9c95aba5f..c3cb60d26 100644 --- a/app/javascript/page-content/page_content_editor.vue +++ b/app/javascript/page-content/page_content_editor.vue @@ -11,7 +11,7 @@ > Save - Clear + Reset To Default From a02e3c6338d264aa5f2da3259efee2e46968823c Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Sat, 23 Dec 2023 14:00:51 -0500 Subject: [PATCH 3/8] fix footer z-index --- app/javascript/navbar/bottom-navbar.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/app/javascript/navbar/bottom-navbar.vue b/app/javascript/navbar/bottom-navbar.vue index 9a7ef7ee9..8e4be9a17 100644 --- a/app/javascript/navbar/bottom-navbar.vue +++ b/app/javascript/navbar/bottom-navbar.vue @@ -35,6 +35,7 @@ footer { position: absolute; bottom: 0px; padding: 10px; + z-index: 3000; a { color: white; From cb1e82121fb1c8a20c05218df7bdb1317fd4a9ff Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 28 Dec 2023 15:56:10 -0500 Subject: [PATCH 4/8] fix the identity from clyde creation --- app/services/identity_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/identity_service.rb b/app/services/identity_service.rb index b9d8f8570..9995a621f 100644 --- a/app/services/identity_service.rb +++ b/app/services/identity_service.rb @@ -135,10 +135,10 @@ def self.create_identity_from_clyde(details:) # if there is a person with this as primary email AND no OAuth Clyde identity # then we will error out - as they should login with Plano and link instead - raise "Person already exists with that email" if addr.count > 0 + raise "Person already exists with that email" if addr # Otherwise we create a new person, if the email is already used as prime we can not set it as the default - person = create_person_from_clyde(details: details, identity: identity, email_is_default: addr.nil?) + person = create_person_from_clyde(details: details, identity: identity) # And associate them with the Clyde Identity identity.person = person From c82e3e9b8104c590893d60ed13c47d47435b1ca6 Mon Sep 17 00:00:00 2001 From: Gail Terman Date: Mon, 1 Jan 2024 13:35:04 -0500 Subject: [PATCH 5/8] misc changes for person linking --- .../components/disabled_tooltip.vue | 39 +++++++++++++++++++ app/javascript/constants/strings.js | 2 + app/javascript/profile/person_details.vue | 2 +- app/javascript/profile/registration_link.vue | 39 ++++++++++++++++--- app/javascript/stylesheets/style.scss | 5 +++ config/routes.rb | 2 +- 6 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 app/javascript/components/disabled_tooltip.vue diff --git a/app/javascript/components/disabled_tooltip.vue b/app/javascript/components/disabled_tooltip.vue new file mode 100644 index 000000000..226fcdd8b --- /dev/null +++ b/app/javascript/components/disabled_tooltip.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/app/javascript/constants/strings.js b/app/javascript/constants/strings.js index 1593a6bf3..a6ccf0c31 100644 --- a/app/javascript/constants/strings.js +++ b/app/javascript/constants/strings.js @@ -266,6 +266,8 @@ module.exports = { }, PERSON_SAVE_SUCCESS: "Profile record saved successfully", PERSON_NEVER_LOGGED_IN: "Never logged in", + PERSON_DISABLED_LINK: "You can only link your own registration", + PERSON_DISABLED_UNLINK: "You can only unlink your own registration", PERSON_CON_STATE: { not_set: "Not Set", applied: "Applied", diff --git a/app/javascript/profile/person_details.vue b/app/javascript/profile/person_details.vue index 35ba7691d..bfbebf10a 100644 --- a/app/javascript/profile/person_details.vue +++ b/app/javascript/profile/person_details.vue @@ -5,7 +5,7 @@
Identity
- +
diff --git a/app/javascript/profile/registration_link.vue b/app/javascript/profile/registration_link.vue index e0698b754..1ab6c853f 100644 --- a/app/javascript/profile/registration_link.vue +++ b/app/javascript/profile/registration_link.vue @@ -4,32 +4,59 @@
- Link To Registration + + Link To Registration +
- Unlink Registration + + Unlink Registration +
+ +

ARE YOU SURE????!1?

+