From b9ebe88c5ae12c540c9dd8fcac8605aaefe6ab1b Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 25 Oct 2021 16:53:59 +0530 Subject: [PATCH 01/51] ci: install dev dependency without condition --- .github/helper/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/helper/install.sh b/.github/helper/install.sh index 454cc89694..8cc3d01a6c 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -50,7 +50,7 @@ if [ "$TYPE" == "server" ]; then sed -i 's/^socketio:/# socketio:/g' Procfile; f if [ "$TYPE" == "server" ]; then sed -i 's/^redis_socketio:/# redis_socketio:/g' Procfile; fi if [ "$TYPE" == "ui" ]; then bench setup requirements --node; fi -if [ "$TYPE" == "server" ]; then bench setup requirements --dev; fi +bench setup requirements --dev # install node-sass which is required for website theme test cd ./apps/frappe || exit From d79c8a0f2704c1797704b707cd7373216e0862f6 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 25 Oct 2021 16:54:51 +0530 Subject: [PATCH 02/51] test: Removing cypress ui test retry --- cypress.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cypress.json b/cypress.json index f2508ca66e..97ac41bb61 100644 --- a/cypress.json +++ b/cypress.json @@ -3,9 +3,5 @@ "projectId": "92odwv", "adminPassword": "admin", "defaultCommandTimeout": 20000, - "pageLoadTimeout": 15000, - "retries": { - "runMode": 2, - "openMode": 2 - } + "pageLoadTimeout": 15000 } From 748e5dab4472cfb2a0c80a0c0cc0dea93b9d07ad Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 25 Oct 2021 17:28:15 +0530 Subject: [PATCH 03/51] test: enable video for cypres ci --- cypress.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress.json b/cypress.json index 97ac41bb61..9a81ca5ede 100644 --- a/cypress.json +++ b/cypress.json @@ -3,5 +3,7 @@ "projectId": "92odwv", "adminPassword": "admin", "defaultCommandTimeout": 20000, - "pageLoadTimeout": 15000 + "pageLoadTimeout": 15000, + "video": true, + "videoUploadOnPasses": false } From 632e3acc01b3ea2965af684f6c383dc07fc72363 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 28 Oct 2021 20:49:34 +0530 Subject: [PATCH 04/51] refactor: New Feedback & Comment Design for Blog Post --- frappe/core/doctype/feedback/feedback.json | 39 ++-- frappe/public/icons/timeless/symbol-defs.svg | 20 ++ frappe/public/scss/website/blog.scss | 99 +++++++++ frappe/templates/includes/avatar_macro.html | 6 +- .../templates/includes/comments/comment.html | 30 ++- .../templates/includes/comments/comments.html | 138 ++++++++----- .../templates/includes/comments/comments.py | 3 + .../templates/includes/feedback/feedback.html | 195 +++++------------- .../templates/includes/feedback/feedback.py | 47 ++--- frappe/website/doctype/blog_post/blog_post.py | 30 ++- .../blog_post/templates/blog_post.html | 16 +- .../doctype/blog_settings/blog_settings.json | 26 ++- .../doctype/blog_settings/blog_settings.py | 5 +- 13 files changed, 368 insertions(+), 286 deletions(-) diff --git a/frappe/core/doctype/feedback/feedback.json b/frappe/core/doctype/feedback/feedback.json index b77e7a6677..998278e89e 100644 --- a/frappe/core/doctype/feedback/feedback.json +++ b/frappe/core/doctype/feedback/feedback.json @@ -8,34 +8,15 @@ "reference_doctype", "reference_name", "column_break_3", - "rating", - "ip_address", - "section_break_6", - "feedback" + "like", + "dislike", + "ip_address" ], "fields": [ { "fieldname": "column_break_3", "fieldtype": "Column Break" }, - { - "fieldname": "rating", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Rating", - "precision": "1", - "reqd": 1 - }, - { - "fieldname": "section_break_6", - "fieldtype": "Section Break" - }, - { - "fieldname": "feedback", - "fieldtype": "Small Text", - "label": "Feedback", - "reqd": 1 - }, { "fieldname": "reference_doctype", "fieldtype": "Select", @@ -57,11 +38,23 @@ "hidden": 1, "label": "IP Address", "read_only": 1 + }, + { + "default": "0", + "fieldname": "like", + "fieldtype": "Check", + "label": "Like" + }, + { + "default": "0", + "fieldname": "dislike", + "fieldtype": "Check", + "label": "Dislike" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-06-23 12:45:42.045696", + "modified": "2021-10-27 22:33:58.362849", "modified_by": "Administrator", "module": "Core", "name": "Feedback", diff --git a/frappe/public/icons/timeless/symbol-defs.svg b/frappe/public/icons/timeless/symbol-defs.svg index b878f713e9..593303e790 100644 --- a/frappe/public/icons/timeless/symbol-defs.svg +++ b/frappe/public/icons/timeless/symbol-defs.svg @@ -712,4 +712,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/frappe/public/scss/website/blog.scss b/frappe/public/scss/website/blog.scss index ea82efed21..c842554514 100644 --- a/frappe/public/scss/website/blog.scss +++ b/frappe/public/scss/website/blog.scss @@ -1,3 +1,7 @@ +:root { + --comment-timeline-height: 60px; +} + .blog-list { display: flex; flex-wrap: wrap; @@ -96,4 +100,99 @@ margin-top: 3rem; } } + + + .feedback-button svg, .comment-count svg { + vertical-align: sub; + } + + .blog-feedback { + .feedback-header { + display: flex; + justify-content: space-between; + + .like-dislike { + display: flex; + + .like-icon, .dislike-icon { + cursor: pointer; + } + } + } + } + + .blog-comments { + .add-comment-section { + .login-required { + padding: var(--padding-sm); + border-radius: var(--border-radius-sm); + box-shadow: var(--card-shadow); + } + + .new-comment { + display: flex; + padding: var(--padding-lg); + box-shadow: var(--card-shadow); + border-radius: var(--border-radius-md); + + .new-comment-fields { + flex: 1; + + .form-label { + font-weight: var(--text-bold); + } + + .comment-text-area textarea { + resize: none; + } + + @media (min-width: 576px) { + .comment-by { + padding-right: 0px !important; + padding-bottom: 0px !important; + } + } + } + } + } + + + #comment-list { + position: relative; + padding-left: var(--padding-xl); + padding-top: var(--padding-lg); + + &::before { + content: " "; + top: 0; + position: absolute; + bottom: var(--comment-timeline-height); + border-left: 1px solid var(--dark-border-color); + } + + .comment-row { + position: relative; + + .comment-avatar { + position: absolute; + top: 10px; + left: -17px; + border-radius: var(--border-radius-full); + box-shadow: var(--shadow-xs); + } + + .comment-content { + box-shadow: var(--card-shadow); + border-radius: var(--border-radius-md); + padding: var(--padding-md); + margin-left: 35px; + flex: 1; + + .content p{ + margin-bottom: 0px; + } + } + } + } + } } diff --git a/frappe/templates/includes/avatar_macro.html b/frappe/templates/includes/avatar_macro.html index 6983477f9c..b652b573b3 100644 --- a/frappe/templates/includes/avatar_macro.html +++ b/frappe/templates/includes/avatar_macro.html @@ -1,6 +1,6 @@ -{% macro avatar(user_id=None, css_style=None) %} +{% macro avatar(user_id=None, css_style=None, size="avatar-small") %} {% set user_info = frappe.utils.get_user_info_for_avatar(user_id) %} - + {% if user_info.image %} - {{ frappe.utils.get_abbr(user_info.name) }} + {{ frappe.utils.get_abbr(user_info.name).upper() }} {% endif %} diff --git a/frappe/templates/includes/comments/comment.html b/frappe/templates/includes/comments/comment.html index 08a2b79ee6..3ce5224db2 100644 --- a/frappe/templates/includes/comments/comment.html +++ b/frappe/templates/includes/comments/comment.html @@ -1,18 +1,14 @@ -{% from "frappe/templates/includes/macros.html" import square_image_with_fallback %} +{% from "frappe/templates/includes/avatar_macro.html" import avatar %} -
- {{ square_image_with_fallback(src=frappe.get_gravatar(comment.comment_email or comment.sender), size='extra-small', alt=comment.sender_full_name, class='align-self-start mr-4') }} -
-
- - {{ comment.sender_full_name or comment.comment_by }} - - - {{ comment.creation | global_date_format }} - -
-
- {{ comment.content | markdown }} -
-
-
+
+
+ {{ avatar(user_id=(comment.comment_email or comment.sender), size='avatar-medium') }} +
+
+
+ {{ comment.sender_full_name or comment.comment_by }} + {{ frappe.utils.pretty_date(comment.creation) }} +
+
{{ comment.content | markdown }}
+
+
\ No newline at end of file diff --git a/frappe/templates/includes/comments/comments.html b/frappe/templates/includes/comments/comments.html index 935fa5367e..c0bb33fd38 100644 --- a/frappe/templates/includes/comments/comments.html +++ b/frappe/templates/includes/comments/comments.html @@ -1,55 +1,82 @@
- {% if comment_text %} -
{{ comment_text }}
- {% endif %} {% if not comment_list %} -
-

{{ _("No comments yet. Start a new discussion.") }}

-
+
+

{{ _("No comments yet. Start a new discussion.") }}

+
+ {% endif %} + + {% if not is_communication %} +
+ +
+
+
+
+ +
+
Add a comment
+ +
Ctrl+Enter to add comment
+
+ +
+
+
+
+
{% endif %}
{% for comment in comment_list %} -
{% include "templates/includes/comments/comment.html" %} -
{% endfor %}
-{% if not is_communication %} -
- - -
- {{ _("Add Comment") }} - -
-
-{% endif %} diff --git a/frappe/templates/includes/comments/comments.py b/frappe/templates/includes/comments/comments.py index 3bba388ac2..e352c7368b 100644 --- a/frappe/templates/includes/comments/comments.py +++ b/frappe/templates/includes/comments/comments.py @@ -3,11 +3,14 @@ import frappe import re from frappe.website.utils import clear_cache +from frappe.rate_limiter import rate_limit from frappe.utils import add_to_date, now +from frappe.website.doctype.blog_settings.blog_settings import get_comment_limit from frappe import _ @frappe.whitelist(allow_guest=True) +@rate_limit(key='reference_name', limit=get_comment_limit, seconds=60*60) def add_comment(comment, comment_email, comment_by, reference_doctype, reference_name, route): doc = frappe.get_doc(reference_doctype, reference_name) diff --git a/frappe/templates/includes/feedback/feedback.html b/frappe/templates/includes/feedback/feedback.html index f180fa5e42..fd509f9db3 100644 --- a/frappe/templates/includes/feedback/feedback.html +++ b/frappe/templates/includes/feedback/feedback.html @@ -1,160 +1,77 @@ -
- {% endif %} - {% if not disable_feedback %} -
- {% include 'templates/includes/feedback/feedback.html' %} -
- {% endif %}
diff --git a/frappe/templates/discussions/reply_section.html b/frappe/templates/discussions/reply_section.html index c0be40ab01..aa5f0913e8 100644 --- a/frappe/templates/discussions/reply_section.html +++ b/frappe/templates/discussions/reply_section.html @@ -30,9 +30,9 @@
{{ _("Want to join the discussion?") }} {% if frappe.session.user == "Guest" %} -
{{ _("Log In") }}
+
{{ _("Login") }}
{% elif not condition %} -
{{ button_name }} +
{{ button_name }}
{% endif %}
diff --git a/frappe/templates/discussions/sidebar.html b/frappe/templates/discussions/sidebar.html index 764d88e0bb..bb63595d8a 100644 --- a/frappe/templates/discussions/sidebar.html +++ b/frappe/templates/discussions/sidebar.html @@ -8,7 +8,7 @@ - + {{ replies | length }} {{ frappe.utils.format_date(topic.creation, "dd MMM YYYY") }} diff --git a/frappe/templates/styles/discussion_style.css b/frappe/templates/styles/discussion_style.css index fc9db68aca..42d7cb23cc 100644 --- a/frappe/templates/styles/discussion_style.css +++ b/frappe/templates/styles/discussion_style.css @@ -37,7 +37,7 @@ } .no-discussions { - width: 250px; + width: 500px; margin: 0 auto; text-align: center; } @@ -249,3 +249,11 @@ border: 1px solid var(--gray-300); margin-bottom: 1rem; } + +.empty-state { + background: #EBEEF0; + border: 1px dashed #C8CFD5; + box-sizing: border-box; + border-radius: 8px; + padding: 2.5rem; +} diff --git a/frappe/website/web_template/discussions/discussions.html b/frappe/website/web_template/discussions/discussions.html index a3127ef7e5..2e62b33def 100644 --- a/frappe/website/web_template/discussions/discussions.html +++ b/frappe/website/web_template/discussions/discussions.html @@ -1,3 +1,5 @@ {% set doctype = "Web Page" %} +{% set empty_state_title = "No " + title %} +{% set empty_state_subtitle = "There are no " + title.lower() + " for this " + doctype.lower() + ", why don't you start one!" %} {% include "frappe/templates/discussions/discussions_section.html" %} From cf416aa779338cd569e61c7ddf3b22d18c6563ef Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 8 Nov 2021 11:00:45 +0530 Subject: [PATCH 12/51] test: minor fix --- cypress/integration/timeline.js | 8 ++++---- cypress/support/commands.js | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/cypress/integration/timeline.js b/cypress/integration/timeline.js index 4322d01e4a..d39c413703 100644 --- a/cypress/integration/timeline.js +++ b/cypress/integration/timeline.js @@ -13,7 +13,7 @@ context('Timeline', () => { cy.get('.page-head .page-actions').findByRole('button', {name: 'Save'}).click(); cy.visit('/app/todo'); - cy.click_first_row_in_list(); + cy.click_listview_row_item(0); //To check if the comment box is initially empty and tying some text into it cy.get('[data-fieldname="comment"] .ql-editor').should('contain', '').type('Testing Timeline'); @@ -66,7 +66,7 @@ context('Timeline', () => { cy.click_modal_primary_button('Submit'); cy.visit('/app/custom-submittable-doctype'); - cy.click_first_row_in_list(); + cy.click_listview_row_item(0); //To check if the submission of the documemt is visible in the timeline content cy.get('.timeline-content').should('contain', 'Administrator submitted this document'); @@ -78,14 +78,14 @@ context('Timeline', () => { //Deleting the document cy.visit('/app/custom-submittable-doctype'); - cy.select_first_row_checkbox(); + cy.select_listview_row_checkbox(0); cy.get('.page-actions').findByRole('button', {name: 'Actions'}).click(); cy.get('.page-actions .actions-btn-group [data-label="Delete"]').click(); cy.click_modal_primary_button('Yes'); //Deleting the custom doctype cy.visit('/app/doctype'); - cy.select_first_row_checkbox(); + cy.select_listview_row_checkbox(0); cy.get('.page-actions').findByRole('button', {name: 'Actions'}).click(); cy.get('.page-actions .actions-btn-group [data-label="Delete"]').click(); cy.click_modal_primary_button('Yes'); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 548887a0f4..933f6a1758 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -341,7 +341,7 @@ Cypress.Commands.add('click_sidebar_button', (btn_name) => { }); Cypress.Commands.add('click_listview_row_item', (row_no) => { - cy.get('.list-row > .level-left > .list-subject > .bold > .ellipsis').eq(row_no).click({force: true}); + cy.get('.list-row > .level-left > .list-subject > .level-item > .ellipsis').eq(row_no).click({force: true}); }); Cypress.Commands.add('click_filter_button', () => { @@ -356,10 +356,6 @@ Cypress.Commands.add('click_timeline_action_btn', (btn_name) => { cy.get('.timeline-message-box .actions .action-btn').contains(btn_name).click(); }); -Cypress.Commands.add('click_first_row_in_list', () => { - cy.get('.frappe-list .list-row-container .level-item.ellipsis').first().click(); -}); - -Cypress.Commands.add('select_first_row_checkbox', () => { - cy.get('.frappe-list .select-like > .list-row-checkbox').first().click(); +Cypress.Commands.add('select_listview_row_checkbox', (row_no) => { + cy.get('.frappe-list .select-like > .list-row-checkbox').eq(row_no).click(); }); From 04518f4a662054c783fc702812b3ff10146405bd Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 8 Nov 2021 11:12:36 +0530 Subject: [PATCH 13/51] fix: Removed shadow from comment avatar --- frappe/public/scss/website/blog.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/frappe/public/scss/website/blog.scss b/frappe/public/scss/website/blog.scss index c842554514..3cabf181c9 100644 --- a/frappe/public/scss/website/blog.scss +++ b/frappe/public/scss/website/blog.scss @@ -177,8 +177,6 @@ position: absolute; top: 10px; left: -17px; - border-radius: var(--border-radius-full); - box-shadow: var(--shadow-xs); } .comment-content { From 754caca3cac4b0a511644e9b8b17c4d4b651eb3c Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 8 Nov 2021 11:48:51 +0530 Subject: [PATCH 14/51] test: Updated query_report UI test --- cypress/integration/query_report.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cypress/integration/query_report.js b/cypress/integration/query_report.js index 9bd542977d..43f26f8b50 100644 --- a/cypress/integration/query_report.js +++ b/cypress/integration/query_report.js @@ -8,6 +8,10 @@ context('Query Report', () => { 'report_type': 'Query Report', 'query': 'select * from tabToDo' }, true).as('doc'); + cy.create_records({ + doctype: 'ToDo', + description: 'this is a test todo for query report' + }).as('todos'); }); it('add custom column in report', () => { From 417ef53dfa0c14a1d849c0c59e7f43d7a9972355 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 8 Nov 2021 13:04:56 +0530 Subject: [PATCH 15/51] test: Updated form.js --- cypress/integration/form.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cypress/integration/form.js b/cypress/integration/form.js index 88262cdb9b..1f4a5136c3 100644 --- a/cypress/integration/form.js +++ b/cypress/integration/form.js @@ -24,11 +24,10 @@ context('Form', () => { it('navigates between documents with child table list filters applied', () => { cy.visit('/app/contact'); - cy.add_filter(); - cy.get('.filter-field .input-with-feedback').type('123', { force: true }); - cy.get('.filter-action-buttons').findByRole('button', {name: 'Apply Filters'}).click({ force: true }); - cy.visit('/app/contact/Test Form Contact 3'); + cy.clear_filters(); + cy.get('.standard-filter-section [data-fieldname="name"] input').type('Test Form Contact 3').blur(); + cy.click_listview_row_item(0); cy.get('.prev-doc').should('be.visible').click(); cy.get('.msgprint-dialog .modal-body').contains('No further records').should('be.visible'); @@ -38,7 +37,7 @@ context('Form', () => { cy.get('.msgprint-dialog .modal-body').contains('No further records').should('be.visible'); cy.hide_dialog(); - cy.get('.page-head').findByTitle('Test Form Contact 3').should('exist'); + cy.get('#page-Contact .page-head').findByTitle('Test Form Contact 3').should('exist'); // clear filters cy.visit('/app/contact'); From b52f8ee0995fa1fcbb5829c7fb161cbcf559bdfe Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 8 Nov 2021 16:50:27 +0530 Subject: [PATCH 16/51] style: empty state logo --- frappe/public/icons/timeless/message.svg | 2 +- frappe/templates/discussions/discussions_section.html | 2 +- frappe/templates/discussions/sidebar.html | 6 +++--- frappe/templates/styles/discussion_style.css | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frappe/public/icons/timeless/message.svg b/frappe/public/icons/timeless/message.svg index f63327f5e6..d1666202ad 100644 --- a/frappe/public/icons/timeless/message.svg +++ b/frappe/public/icons/timeless/message.svg @@ -1,3 +1,3 @@ - + diff --git a/frappe/templates/discussions/discussions_section.html b/frappe/templates/discussions/discussions_section.html index 4966151d41..b3d666265a 100644 --- a/frappe/templates/discussions/discussions_section.html +++ b/frappe/templates/discussions/discussions_section.html @@ -39,7 +39,7 @@ {% else %}
- +
{{ empty_state_title }}
{{ empty_state_subtitle }}
{% if frappe.session.user == "Guest" %} diff --git a/frappe/templates/discussions/sidebar.html b/frappe/templates/discussions/sidebar.html index bb63595d8a..eafacf6f9d 100644 --- a/frappe/templates/discussions/sidebar.html +++ b/frappe/templates/discussions/sidebar.html @@ -6,9 +6,9 @@ {{ creator.full_name }} - - - + + + {{ replies | length }} {{ frappe.utils.format_date(topic.creation, "dd MMM YYYY") }} diff --git a/frappe/templates/styles/discussion_style.css b/frappe/templates/styles/discussion_style.css index 42d7cb23cc..d2781104f2 100644 --- a/frappe/templates/styles/discussion_style.css +++ b/frappe/templates/styles/discussion_style.css @@ -195,7 +195,6 @@ color: #1F272E; } - .discussions-card { display: grid; grid-gap: 2rem; From 25ffd6ddec1f79b042aeb60e5d273b94b414081d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 8 Nov 2021 18:52:52 +0530 Subject: [PATCH 17/51] test: Updated report_view.js --- cypress/integration/report_view.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cypress/integration/report_view.js b/cypress/integration/report_view.js index e762eebea1..b999461433 100644 --- a/cypress/integration/report_view.js +++ b/cypress/integration/report_view.js @@ -23,8 +23,7 @@ context('Report View', () => { let cell = cy.get('.dt-row-0 > .dt-cell--col-4'); // select the cell cell.dblclick(); - cell.findByRole('checkbox').check({ force: true }); - cy.get('.dt-row-0 > .dt-cell--col-5').click(); + cell.findByRole('checkbox').check({ force: true }).blur(); cy.wait('@value-update'); cy.get('@doc').then(doc => { cy.call('frappe.client.get_value', { From 1b00f56e698a8c3edfa9e7c387a3d29d03bbf983 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 8 Nov 2021 19:26:21 +0530 Subject: [PATCH 18/51] test: Updated navigation.js --- cypress/integration/navigation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/navigation.js b/cypress/integration/navigation.js index fdb3284b44..b4e023c53e 100644 --- a/cypress/integration/navigation.js +++ b/cypress/integration/navigation.js @@ -15,8 +15,8 @@ context('Navigation', () => { cy.visit('/app/todo'); cy.get('.page-head').findByTitle('To Do').should('be.visible'); cy.request('/api/method/logout'); - cy.reload(); - cy.get('.page-card .btn-primary').contains('Login').click(); + cy.reload().as('reload'); + cy.get('@reload').get('.page-card .btn-primary').contains('Login').click(); cy.location('pathname').should('eq', '/login'); cy.login(); cy.visit('/app'); From c6483467425c28973717a159103ac4bf1412caa4 Mon Sep 17 00:00:00 2001 From: Pruthvi Patel Date: Tue, 9 Nov 2021 12:54:17 +0530 Subject: [PATCH 19/51] refactor: a better way to cleanup older assets when newer ones are built --- esbuild/build-cleanup.js | 38 ++++++++++++++++++++++++++++++++++++++ esbuild/esbuild.js | 27 +++++---------------------- 2 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 esbuild/build-cleanup.js diff --git a/esbuild/build-cleanup.js b/esbuild/build-cleanup.js new file mode 100644 index 0000000000..cf03606a34 --- /dev/null +++ b/esbuild/build-cleanup.js @@ -0,0 +1,38 @@ +/* eslint-disable no-console */ +const path = require("path"); +const fs = require("fs"); +const glob = require("fast-glob"); + +module.exports = { + name: 'build_cleanup', + setup(build) { + build.onEnd(result => { + if (result.errors.length) return; + clean_dist_files(Object.keys(result.metafile.outputs)); + }); + }, +}; + +function clean_dist_files(new_files) { + new_files.forEach( + file => { + if (file.endsWith(".map")) return; + + const pattern = file.split(".").slice(0, -2).join(".") + "*"; + glob.sync(pattern).forEach( + file_to_delete => { + if (file_to_delete.startsWith(file)) return; + + fs.unlink(path.resolve(file_to_delete), err => { + if (!err) return; + + console.error( + `Error deleting ${file.split(path.sep).pop()}` + ); + }); + } + + ); + } + ); +} \ No newline at end of file diff --git a/esbuild/esbuild.js b/esbuild/esbuild.js index 18de95b40d..e10e3b7804 100644 --- a/esbuild/esbuild.js +++ b/esbuild/esbuild.js @@ -12,6 +12,8 @@ let rtlcss = require('rtlcss'); let postCssPlugin = require("esbuild-plugin-postcss2").default; let ignore_assets = require("./ignore-assets"); let sass_options = require("./sass_options"); +let build_cleanup_plugin = require("./build-cleanup"); + let { app_list, assets_path, @@ -98,9 +100,6 @@ if (WATCH_MODE) { async function execute() { console.time(TOTAL_BUILD_TIME); - if (!FILES_TO_BUILD.length) { - await clean_dist_folders(APPS); - } let results; try { @@ -231,12 +230,13 @@ function get_files_to_build(files) { function build_files({ files, outdir }) { let build_plugins = [ html_plugin, + build_cleanup_plugin, vue(), ]; return esbuild.build(get_build_options(files, outdir, build_plugins)); } -function build_style_files({ files, outdir, rtl_style=false }) { +function build_style_files({ files, outdir, rtl_style = false }) { let plugins = []; if (rtl_style) { plugins.push(rtlcss); @@ -244,6 +244,7 @@ function build_style_files({ files, outdir, rtl_style=false }) { let build_plugins = [ ignore_assets, + build_cleanup_plugin, postCssPlugin({ plugins: plugins, sassOptions: sass_options @@ -313,24 +314,6 @@ function get_watch_config() { return null; } -async function clean_dist_folders(apps) { - for (let app of apps) { - let public_path = get_public_path(app); - let paths = [ - path.resolve(public_path, "dist", "js"), - path.resolve(public_path, "dist", "css"), - path.resolve(public_path, "dist", "css-rtl") - ]; - for (let target of paths) { - if (fs.existsSync(target)) { - // rmdir is deprecated in node 16, this will work in both node 14 and 16 - let rmdir = fs.promises.rm || fs.promises.rmdir; - await rmdir(target, { recursive: true }); - } - } - } -} - function log_built_assets(results) { let outputs = {}; for (const result of results) { From 30452c8b9cddce7d115a2452f950950f9ae98f73 Mon Sep 17 00:00:00 2001 From: Pruthvi Patel Date: Tue, 9 Nov 2021 13:00:15 +0530 Subject: [PATCH 20/51] style: use `const` instead of `let` --- esbuild/esbuild.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/esbuild/esbuild.js b/esbuild/esbuild.js index e10e3b7804..792cb56198 100644 --- a/esbuild/esbuild.js +++ b/esbuild/esbuild.js @@ -1,20 +1,20 @@ /* eslint-disable no-console */ -let path = require("path"); -let fs = require("fs"); -let glob = require("fast-glob"); -let esbuild = require("esbuild"); -let vue = require("esbuild-vue"); -let yargs = require("yargs"); -let cliui = require("cliui")(); -let chalk = require("chalk"); -let html_plugin = require("./frappe-html"); -let rtlcss = require('rtlcss'); -let postCssPlugin = require("esbuild-plugin-postcss2").default; -let ignore_assets = require("./ignore-assets"); -let sass_options = require("./sass_options"); -let build_cleanup_plugin = require("./build-cleanup"); +const path = require("path"); +const fs = require("fs"); +const glob = require("fast-glob"); +const esbuild = require("esbuild"); +const vue = require("esbuild-vue"); +const yargs = require("yargs"); +const cliui = require("cliui")(); +const chalk = require("chalk"); +const html_plugin = require("./frappe-html"); +const rtlcss = require('rtlcss'); +const postCssPlugin = require("esbuild-plugin-postcss2").default; +const ignore_assets = require("./ignore-assets"); +const sass_options = require("./sass_options"); +const build_cleanup_plugin = require("./build-cleanup"); -let { +const { app_list, assets_path, apps_path, @@ -28,7 +28,7 @@ let { get_redis_subscriber } = require("./utils"); -let argv = yargs +const argv = yargs .usage("Usage: node esbuild [options]") .option("apps", { type: "string", From cbbf09e1cc883d1539b37fd10f643775c56cef74 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 9 Nov 2021 15:36:56 +0530 Subject: [PATCH 21/51] revert: 'test: Removing cypress ui test retry' --- cypress.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cypress.json b/cypress.json index 9a81ca5ede..ae4495cfa8 100644 --- a/cypress.json +++ b/cypress.json @@ -5,5 +5,9 @@ "defaultCommandTimeout": 20000, "pageLoadTimeout": 15000, "video": true, - "videoUploadOnPasses": false + "videoUploadOnPasses": false, + "retries": { + "runMode": 2, + "openMode": 2 + } } From 27126889bd3d40ab9e5584fe89eabb102716c87d Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 9 Nov 2021 16:02:21 +0530 Subject: [PATCH 22/51] fix: string translations and background variable --- frappe/templates/styles/discussion_style.css | 2 +- frappe/website/web_template/discussions/discussions.html | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frappe/templates/styles/discussion_style.css b/frappe/templates/styles/discussion_style.css index d2781104f2..dc765ca850 100644 --- a/frappe/templates/styles/discussion_style.css +++ b/frappe/templates/styles/discussion_style.css @@ -250,7 +250,7 @@ } .empty-state { - background: #EBEEF0; + background: var(--gray-200); border: 1px dashed #C8CFD5; box-sizing: border-box; border-radius: 8px; diff --git a/frappe/website/web_template/discussions/discussions.html b/frappe/website/web_template/discussions/discussions.html index 2e62b33def..146dabe1f7 100644 --- a/frappe/website/web_template/discussions/discussions.html +++ b/frappe/website/web_template/discussions/discussions.html @@ -1,5 +1,6 @@ {% set doctype = "Web Page" %} -{% set empty_state_title = "No " + title %} -{% set empty_state_subtitle = "There are no " + title.lower() + " for this " + doctype.lower() + ", why don't you start one!" %} +{% set empty_state_title = _("No {0}").format(title) %} +{% set empty_state_subtitle = _("There are no {0} for this {1}, why don't you start one!").format(title | lower , doctype | lower) %} + {% include "frappe/templates/discussions/discussions_section.html" %} From f02d289992c26b15b45ebf787e27c6539ee28293 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 9 Nov 2021 21:01:21 +0530 Subject: [PATCH 23/51] feat: Editable grid/table pagination --- .../public/js/frappe/form/grid_pagination.js | 55 ++++++++++++++++++- frappe/public/scss/common/grid.scss | 12 ++++ 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/form/grid_pagination.js b/frappe/public/js/frappe/form/grid_pagination.js index 35daafe89d..8efdcb9001 100644 --- a/frappe/public/js/frappe/form/grid_pagination.js +++ b/frappe/public/js/frappe/form/grid_pagination.js @@ -46,8 +46,55 @@ export default class GridPagination { this.last_page_button.on('click', () => { this.go_to_page(this.total_pages); }); + + this.$page_number.on('keyup', (e) => { + e.currentTarget.style.width = ((e.currentTarget.value.length + 1) * 8) + 'px'; + }) + + this.$page_number.on('keydown', (e) => { + e = (e) ? e : window.event; + var charCode = (e.which) ? e.which : e.keyCode; + let arrow = { up: 38, down: 40 }; + + switch (charCode) { + case arrow.up: + this.inc_dec_number(true); + break; + case arrow.down: + this.inc_dec_number(false); + break; + } + + // only allow numbers from 0-9 and up, down, left, right arrow keys + if (charCode > 31 && (charCode < 48 || charCode > 57) && + ![37, 38, 39, 40].includes(charCode)) { + return false; + } + return true; + }) + + this.$page_number.on('focusout', (e) => { + if (this.page_index == e.currentTarget.value) return; + this.page_index = e.currentTarget.value; + + if(this.page_index < 1) { + this.page_index = 1; + } else if(this.page_index > this.total_pages) { + this.page_index = this.total_pages; + } + + this.go_to_page(); + }) } + inc_dec_number(increment) { + let new_value = parseInt(this.$page_number.val()) + increment ? new_value++ : new_value--; + + if (new_value < 1 || new_value > this.total_pages) return; + + this.$page_number.val(new_value); + } update_page_numbers() { let total_pages = Math.ceil(this.grid.data.length/this.page_length); @@ -64,8 +111,9 @@ export default class GridPagination { } get_pagination_html() { - let page_text_html = `
- ${__(this.page_index)} + let page_text_html = ` +
+ ${__('of')} ${__(this.total_pages)}
`; @@ -104,7 +152,8 @@ export default class GridPagination { let $rows = $(this.grid.parent).find(".rows").empty(); this.grid.render_result_rows($rows, true); if (this.$page_number) { - this.$page_number.text(index); + this.$page_number.val(index); + this.$page_number.css('width', ((index.toString().length + 1) * 8) + 'px'); } this.update_page_numbers(); diff --git a/frappe/public/scss/common/grid.scss b/frappe/public/scss/common/grid.scss index 57d0583b35..3014211222 100644 --- a/frappe/public/scss/common/grid.scss +++ b/frappe/public/scss/common/grid.scss @@ -373,6 +373,18 @@ .page-text { display: inline-block; + cursor: default; +} + +.current-page-number { + width: 16px; + text-align: center; + border: none; + cursor: text; + + &:focus { + outline: none; + } } .prev-page, From 8778128109984e37bc9b85f65a5cc08145055086 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 9 Nov 2021 22:16:45 +0530 Subject: [PATCH 24/51] fix: sider fix --- frappe/public/js/frappe/form/grid_pagination.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frappe/public/js/frappe/form/grid_pagination.js b/frappe/public/js/frappe/form/grid_pagination.js index 8efdcb9001..76a5f7b50b 100644 --- a/frappe/public/js/frappe/form/grid_pagination.js +++ b/frappe/public/js/frappe/form/grid_pagination.js @@ -49,13 +49,13 @@ export default class GridPagination { this.$page_number.on('keyup', (e) => { e.currentTarget.style.width = ((e.currentTarget.value.length + 1) * 8) + 'px'; - }) + }); this.$page_number.on('keydown', (e) => { e = (e) ? e : window.event; var charCode = (e.which) ? e.which : e.keyCode; let arrow = { up: 38, down: 40 }; - + switch (charCode) { case arrow.up: this.inc_dec_number(true); @@ -71,24 +71,24 @@ export default class GridPagination { return false; } return true; - }) + }); this.$page_number.on('focusout', (e) => { if (this.page_index == e.currentTarget.value) return; this.page_index = e.currentTarget.value; - if(this.page_index < 1) { + if (this.page_index < 1) { this.page_index = 1; - } else if(this.page_index > this.total_pages) { + } else if (this.page_index > this.total_pages) { this.page_index = this.total_pages; } this.go_to_page(); - }) + }); } inc_dec_number(increment) { - let new_value = parseInt(this.$page_number.val()) + let new_value = parseInt(this.$page_number.val()); increment ? new_value++ : new_value--; if (new_value < 1 || new_value > this.total_pages) return; @@ -111,8 +111,7 @@ export default class GridPagination { } get_pagination_html() { - let page_text_html = ` -
+ let page_text_html = `
${__('of')} ${__(this.total_pages)} From 0441059d2c0794d242bbb2a26ece3557f68de096 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Nov 2021 11:32:53 +0530 Subject: [PATCH 25/51] test: Updated grid_pagination UI Test --- cypress/integration/grid_pagination.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cypress/integration/grid_pagination.js b/cypress/integration/grid_pagination.js index c07230d2b8..0ec280d63e 100644 --- a/cypress/integration/grid_pagination.js +++ b/cypress/integration/grid_pagination.js @@ -13,7 +13,7 @@ context('Grid Pagination', () => { it('creates pages for child table', () => { cy.visit('/app/contact/Test Contact'); cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table'); - cy.get('@table').find('.current-page-number').should('contain', '1'); + cy.get('@table').find('.current-page-number').should('have.value', '1'); cy.get('@table').find('.total-page-number').should('contain', '20'); cy.get('@table').find('.grid-body .grid-row').should('have.length', 50); }); @@ -21,10 +21,10 @@ context('Grid Pagination', () => { cy.visit('/app/contact/Test Contact'); cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table'); cy.get('@table').find('.next-page').click(); - cy.get('@table').find('.current-page-number').should('contain', '2'); + cy.get('@table').find('.current-page-number').should('have.value', '2'); cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '51'); cy.get('@table').find('.prev-page').click(); - cy.get('@table').find('.current-page-number').should('contain', '1'); + cy.get('@table').find('.current-page-number').should('have.value', '1'); cy.get('@table').find('.grid-body .grid-row').first().should('have.attr', 'data-idx', '1'); }); it('adds and deletes rows and changes page', () => { @@ -32,12 +32,12 @@ context('Grid Pagination', () => { cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table'); cy.get('@table').findByRole('button', {name: 'Add Row'}).click(); cy.get('@table').find('.grid-body .row-index').should('contain', 1001); - cy.get('@table').find('.current-page-number').should('contain', '21'); + cy.get('@table').find('.current-page-number').should('have.value', '21'); cy.get('@table').find('.total-page-number').should('contain', '21'); cy.get('@table').find('.grid-body .grid-row .grid-row-check').click({ force: true }); cy.get('@table').findByRole('button', {name: 'Delete'}).click(); cy.get('@table').find('.grid-body .row-index').last().should('contain', 1000); - cy.get('@table').find('.current-page-number').should('contain', '20'); + cy.get('@table').find('.current-page-number').should('have.value', '20'); cy.get('@table').find('.total-page-number').should('contain', '20'); }); // it('deletes all rows', ()=> { From 990b9f0ec3a17efa749955f7b8d8cf8622a57538 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Nov 2021 11:45:53 +0530 Subject: [PATCH 26/51] test: Changing cypress browser to chrome --- frappe/commands/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index 416f014164..e311b8db6a 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -723,7 +723,7 @@ def run_ui_tests(context, app, headless=False, parallel=True, with_coverage=Fals frappe.commands.popen("yarn add cypress@^6 cypress-file-upload@^5 @testing-library/cypress@^8 @cypress/code-coverage@^3 --no-lockfile") # run for headless mode - run_or_open = 'run --browser firefox --record' if headless else 'open' + run_or_open = 'run --browser chrome --record' if headless else 'open' formatted_command = f'{site_env} {password_env} {coverage_env} {cypress_path} {run_or_open}' if parallel: From ede1c41f678cb09b7e954a02b6097c235b12e365 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Nov 2021 12:14:47 +0530 Subject: [PATCH 27/51] test: UI test for editable grid pagination --- cypress/integration/grid_pagination.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cypress/integration/grid_pagination.js b/cypress/integration/grid_pagination.js index 0ec280d63e..84b3320282 100644 --- a/cypress/integration/grid_pagination.js +++ b/cypress/integration/grid_pagination.js @@ -40,6 +40,27 @@ context('Grid Pagination', () => { cy.get('@table').find('.current-page-number').should('have.value', '20'); cy.get('@table').find('.total-page-number').should('contain', '20'); }); + it('go to specific page, use up and down arrow, type characters, 0 page and more than existing page', () => { + cy.visit('/app/contact/Test Contact'); + cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table'); + cy.get('@table').find('.current-page-number').focus().clear().type('17').blur(); + cy.get('@table').find('.grid-body .row-index').should('contain', 801); + + cy.get('@table').find('.current-page-number').focus().type('{uparrow}{uparrow}'); + cy.get('@table').find('.current-page-number').should('have.value', '19'); + + cy.get('@table').find('.current-page-number').focus().type('{downarrow}{downarrow}'); + cy.get('@table').find('.current-page-number').should('have.value', '17'); + + cy.get('@table').find('.current-page-number').focus().clear().type('700').blur(); + cy.get('@table').find('.current-page-number').should('have.value', '20'); + + cy.get('@table').find('.current-page-number').focus().clear().type('0').blur(); + cy.get('@table').find('.current-page-number').should('have.value', '1'); + + cy.get('@table').find('.current-page-number').focus().clear().type('abc').blur(); + cy.get('@table').find('.current-page-number').should('have.value', '1'); + }); // it('deletes all rows', ()=> { // cy.visit('/app/contact/Test Contact'); // cy.get('.frappe-control[data-fieldname="phone_nos"]').as('table'); From 990797080aeb76c062272da91df11558ed0f0dde Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Nov 2021 12:42:34 +0530 Subject: [PATCH 28/51] test: minor fixes --- cypress/integration/list_view.js | 2 +- cypress/integration/report_view.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/list_view.js b/cypress/integration/list_view.js index ce9e87274b..7b5ac3d27b 100644 --- a/cypress/integration/list_view.js +++ b/cypress/integration/list_view.js @@ -14,7 +14,7 @@ context('List View', () => { cy.get('.dropdown-menu li:visible .dropdown-item .menu-item-label[data-label="Edit"]').click(); cy.get('.modal-body .form-control[data-fieldname="field"]').first().select('Due Date').wait(200); - cy.fill_field('value', '09-28-21', 'Date'); + cy.get('.modal-body').fill_field('value', '09-28-21', 'Date'); cy.get('.modal-footer .standard-actions .btn-primary').click(); cy.wait(500); diff --git a/cypress/integration/report_view.js b/cypress/integration/report_view.js index b999461433..01ea4c73b2 100644 --- a/cypress/integration/report_view.js +++ b/cypress/integration/report_view.js @@ -23,7 +23,7 @@ context('Report View', () => { let cell = cy.get('.dt-row-0 > .dt-cell--col-4'); // select the cell cell.dblclick(); - cell.findByRole('checkbox').check({ force: true }).blur(); + cell.get('.dt-cell__content').findByRole('checkbox').check({ force: true }).blur(); cy.wait('@value-update'); cy.get('@doc').then(doc => { cy.call('frappe.client.get_value', { From c63e8de2ddda9fb28e6ca08c811e2439c76f1b2e Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 10 Nov 2021 16:57:42 +0530 Subject: [PATCH 29/51] style: used variables --- frappe/templates/discussions/button.html | 2 +- frappe/templates/discussions/comment_box.html | 2 +- .../discussions/discussions_section.html | 10 +-- .../templates/discussions/reply_section.html | 8 +-- frappe/templates/discussions/sidebar.html | 2 +- frappe/templates/styles/discussion_style.css | 67 +++++-------------- 6 files changed, 28 insertions(+), 63 deletions(-) diff --git a/frappe/templates/discussions/button.html b/frappe/templates/discussions/button.html index a27952bd6b..a07eee0aad 100644 --- a/frappe/templates/discussions/button.html +++ b/frappe/templates/discussions/button.html @@ -1,6 +1,6 @@ {% if frappe.session.user != "Guest" and (condition is not defined or (condition is defined and condition )) %} - + {{ _(cta_title) }} diff --git a/frappe/templates/discussions/comment_box.html b/frappe/templates/discussions/comment_box.html index ab4714185a..5e5fdc4837 100644 --- a/frappe/templates/discussions/comment_box.html +++ b/frappe/templates/discussions/comment_box.html @@ -28,7 +28,7 @@
{{ _("Cancel") }} -
+
{{ _("Post") }}
diff --git a/frappe/templates/discussions/discussions_section.html b/frappe/templates/discussions/discussions_section.html index b3d666265a..f64fb9fe99 100644 --- a/frappe/templates/discussions/discussions_section.html +++ b/frappe/templates/discussions/discussions_section.html @@ -8,13 +8,13 @@ {% include "frappe/templates/discussions/topic_modal.html" %}
- {{ _(title) }} + {{ _(title) }} {% if topics and not single_thread %} {% include "frappe/templates/discussions/button.html" %} {% endif %}
-
{% if topics and not single_thread %} @@ -40,12 +40,12 @@ {% else %}
-
{{ empty_state_title }}
+
{{ empty_state_title }}
{{ empty_state_subtitle }}
{% if frappe.session.user == "Guest" %} -
{{ _("Login") }}
+
{{ _("Login") }}
{% elif condition is defined and not condition %} -
+
{{ button_name }}
{% else %} diff --git a/frappe/templates/discussions/reply_section.html b/frappe/templates/discussions/reply_section.html index aa5f0913e8..a5ea923801 100644 --- a/frappe/templates/discussions/reply_section.html +++ b/frappe/templates/discussions/reply_section.html @@ -9,13 +9,13 @@ {% if topic %} id="t{{ topic.name }}" data-topic="{{ topic.name }}" {% endif %}> {% if not single_thread %} -
+
{{ _("Back") }}
{% endif %} {% if topic and topic.title %} -
{{ topic.title }}
+
{{ topic.title }}
{% endif %} {% for reply in replies %} @@ -30,9 +30,9 @@
{{ _("Want to join the discussion?") }} {% if frappe.session.user == "Guest" %} -
{{ _("Login") }}
+
{{ _("Login") }}
{% elif not condition %} -
{{ button_name }} +
{{ button_name }}
{% endif %}
diff --git a/frappe/templates/discussions/sidebar.html b/frappe/templates/discussions/sidebar.html index eafacf6f9d..14d38c86a5 100644 --- a/frappe/templates/discussions/sidebar.html +++ b/frappe/templates/discussions/sidebar.html @@ -3,7 +3,7 @@
{{ topic.title }}
{{ _("Cancel") }} -
+
{{ _("Post") }}
diff --git a/frappe/templates/discussions/discussions_section.html b/frappe/templates/discussions/discussions_section.html index f64fb9fe99..07c229595b 100644 --- a/frappe/templates/discussions/discussions_section.html +++ b/frappe/templates/discussions/discussions_section.html @@ -43,9 +43,9 @@
{{ empty_state_title }}
{{ empty_state_subtitle }}
{% if frappe.session.user == "Guest" %} -
{{ _("Login") }}
+
{{ _("Login") }}
{% elif condition is defined and not condition %} -
+
{{ button_name }}
{% else %} diff --git a/frappe/templates/discussions/reply_section.html b/frappe/templates/discussions/reply_section.html index a5ea923801..b269883ba0 100644 --- a/frappe/templates/discussions/reply_section.html +++ b/frappe/templates/discussions/reply_section.html @@ -30,9 +30,9 @@
{{ _("Want to join the discussion?") }} {% if frappe.session.user == "Guest" %} -
{{ _("Login") }}
+
{{ _("Login") }}
{% elif not condition %} -
{{ button_name }} +
{{ button_name }}
{% endif %}
diff --git a/frappe/templates/styles/discussion_style.css b/frappe/templates/styles/discussion_style.css index 5025bc6324..f1dab60589 100644 --- a/frappe/templates/styles/discussion_style.css +++ b/frappe/templates/styles/discussion_style.css @@ -1,7 +1,3 @@ -:root { - --discussions-card-shadow: 0 0px 4px 2px #19273405 -} - .thread-card { flex-direction: column; padding: 1rem; @@ -157,7 +153,6 @@ border-radius: 8px; position: relative; border: 1px solid var(--gray-200); - box-shadow: var(--discussions-card-shadow); } .discussions-card { @@ -221,3 +216,11 @@ border-radius: 8px; padding: 2.5rem; } + +.discussions-parent .btn-default { + color: var(--gray-700); +} + +.discussions-header .btn { + float: right; +} From e62f2627e0189bd2fb519ea5bd8acd62657640dc Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 10 Nov 2021 20:42:56 +0530 Subject: [PATCH 31/51] fix: some more changes in design --- frappe/public/scss/website/blog.scss | 56 +++++-- .../templates/includes/comments/comment.html | 2 +- .../templates/includes/comments/comments.html | 143 +++++++++++------- .../templates/includes/feedback/feedback.html | 56 ++----- .../templates/includes/feedback/feedback.py | 8 +- frappe/website/doctype/blog_post/blog_post.py | 12 +- .../blog_post/templates/blog_post.html | 24 ++- 7 files changed, 157 insertions(+), 144 deletions(-) diff --git a/frappe/public/scss/website/blog.scss b/frappe/public/scss/website/blog.scss index 3cabf181c9..e599210435 100644 --- a/frappe/public/scss/website/blog.scss +++ b/frappe/public/scss/website/blog.scss @@ -1,5 +1,6 @@ :root { - --comment-timeline-height: 60px; + --comment-timeline-bottom: 60px; + --comment-timeline-top: 8px; } .blog-list { @@ -102,26 +103,54 @@ } - .feedback-button svg, .comment-count svg { + .feedback-item svg { vertical-align: sub; } .blog-feedback { - .feedback-header { - display: flex; - justify-content: space-between; + display: flex; - .like-dislike { - display: flex; + .like-icon { + cursor: pointer; - .like-icon, .dislike-icon { - cursor: pointer; - } + &.gray use { + fill: var(--gray-600); + stroke: none; } } } + .add-comment-button { + margin-left: 35px; + } + + .timeline-dot { + width: 16px; + height: 16px; + border-radius: 50%; + position: absolute; + top: 8px; + left: 22px; + background-color: var(--fg-color); + border: 1px solid var(--dark-border-color); + + &:before { + content: ' '; + background: var(--gray-600); + position: absolute; + top: 5px; + left: 5px; + border-radius: 50%; + height: 4px; + width: 4px; + } + } + .blog-comments { + .comment-form-wrapper { + display: none; + } + .add-comment-section { .login-required { padding: var(--padding-sm); @@ -160,13 +189,12 @@ #comment-list { position: relative; padding-left: var(--padding-xl); - padding-top: var(--padding-lg); - &::before { + &:before { content: " "; - top: 0; position: absolute; - bottom: var(--comment-timeline-height); + top: var(--comment-timeline-top); + bottom: var(--comment-timeline-bottom); border-left: 1px solid var(--dark-border-color); } diff --git a/frappe/templates/includes/comments/comment.html b/frappe/templates/includes/comments/comment.html index 3ce5224db2..e0fc1c3c54 100644 --- a/frappe/templates/includes/comments/comment.html +++ b/frappe/templates/includes/comments/comment.html @@ -1,6 +1,6 @@ {% from "frappe/templates/includes/avatar_macro.html" import avatar %} -
+
{{ avatar(user_id=(comment.comment_email or comment.sender), size='avatar-medium') }}
diff --git a/frappe/templates/includes/comments/comments.html b/frappe/templates/includes/comments/comments.html index c0bb33fd38..8a9058bb4d 100644 --- a/frappe/templates/includes/comments/comments.html +++ b/frappe/templates/includes/comments/comments.html @@ -1,33 +1,35 @@
{% if not comment_list %}
-

{{ _("No comments yet. Start a new discussion.") }}

+

{{ _("No comments yet. ") }} + + +

{% endif %} {% if not is_communication %} -
- +
-
Add a comment
+
{{ _("Add a comment") }}
-
Ctrl+Enter to add comment
+
{{ _("Ctrl+Enter to add comment") }}
@@ -37,77 +39,109 @@
{% endif %} +
+
- {% for comment in comment_list %} - {% include "templates/includes/comments/comment.html" %} - {% endfor %} +
+
+ +
+
+ {% for comment in comment_list %} + {% include "templates/includes/comments/comment.html" %} + {% endfor %} +