Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3710 flagging journals #2426

Open
wants to merge 91 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
1f239a0
prototyping on flagging feature
richard-jones Oct 10, 2024
98c66dd
some prototyping around converting notes to flags
richard-jones Oct 17, 2024
80cdba3
remove erroneous import
richard-jones Oct 17, 2024
a598eb9
remove convert_to_flag converter
amdomanska Oct 23, 2024
155d846
Merge branch 'develop' into feature/3710_flagging_journals
amdomanska Oct 23, 2024
33d0d69
remove convert to flag continued
amdomanska Oct 23, 2024
f57f728
add flag structs to the notes
amdomanska Oct 23, 2024
5bd175e
add flag to the model and save from the form as a flag
amdomanska Oct 29, 2024
ed6c0b8
add 'clear flag' functionality
amdomanska Oct 29, 2024
7070a83
add 'has_flag' to index
amdomanska Oct 29, 2024
e58fb2a
add 'notes_except_flags' and 'flags' to journal model properties; all…
amdomanska Oct 29, 2024
2e600fb
display existing flag correctly in the form
amdomanska Oct 30, 2024
1097dad
make flags field repeatable with max 2 values - one for current, one …
amdomanska Oct 31, 2024
8763161
add resolve/unresolve flag
amdomanska Nov 11, 2024
0b29b96
change resolved flag into the note
amdomanska Nov 11, 2024
b68c9c1
only one flag ensured; buttons disabled and enabled correctly; resolv…
amdomanska Nov 11, 2024
b711329
now backend handled resolving and adding well
amdomanska Nov 11, 2024
0e0873d
automatic resolved by and resolved_on
amdomanska Nov 12, 2024
0ff3317
add accounts to assigned_to
amdomanska Nov 12, 2024
41b0759
add labels and change the order
amdomanska Nov 12, 2024
cb8139d
control who can add the field
amdomanska Nov 12, 2024
ed259a7
control who can add the field - fixed
amdomanska Nov 12, 2024
9870773
filters added; sort added but mapping is off
amdomanska Nov 12, 2024
48f49e8
Sorting by deadline
amdomanska Nov 13, 2024
167d7d7
Add info about flags to todo cars
amdomanska Nov 13, 2024
e0d86fe
UI filter in dashboard works
amdomanska Nov 13, 2024
e0b60a3
remove accidental file
amdomanska Nov 13, 2024
ae610ae
manage string None as filter
amdomanska Nov 13, 2024
a0d0b5f
sorting works
amdomanska Nov 14, 2024
d0f086f
flagged to me dashboard filter works
amdomanska Nov 14, 2024
0cc7416
small changes in fields names
amdomanska Nov 14, 2024
01f62d4
set up flag editing permissions
amdomanska Nov 14, 2024
17b16d2
styling: 1st pass
amdomanska Nov 14, 2024
ce5f444
add flag icon to flags inside journal form
amdomanska Nov 15, 2024
e095c46
fix flag_details value
amdomanska Nov 15, 2024
c081a32
styling: 2st pass
amdomanska Nov 15, 2024
af30681
fix filters in dashboard
amdomanska Nov 16, 2024
37e7e8a
add information about flags to search results
amdomanska Nov 16, 2024
3dd4805
styling pass 3; refactoring pass 1
amdomanska Nov 18, 2024
0d44d4f
Merge branch 'develop' into feature/3710_flagging_journals
amdomanska Nov 18, 2024
4eadaa2
revert dev_basics file
amdomanska Nov 19, 2024
4e88cb5
PR cleanup: add while line
amdomanska Nov 19, 2024
49c1090
PR cleanup: remove print
amdomanska Nov 19, 2024
60c1471
PR cleanup: change order of lines to make diff clearer
amdomanska Nov 19, 2024
1a204cf
PR cleanup: move FAR_IN_THE_FUTURE date to dates lib
amdomanska Nov 19, 2024
93faf9a
PR cleanup: use defined property
amdomanska Nov 19, 2024
0a4a00f
PR cleanup: revert beforeunload in application_form
amdomanska Nov 19, 2024
404aa54
PR cleanup: remove unnecessary space
amdomanska Nov 19, 2024
24a0845
PR cleanup: revert unnecessary change in autoccomplete
amdomanska Nov 19, 2024
c754797
remove unnecessary templates
amdomanska Nov 19, 2024
65beebf
remove unnecessary script
amdomanska Nov 19, 2024
d67960d
remove extra doaj.session.currentUser
amdomanska Nov 19, 2024
8a9e531
PR cleanup: newline in settings
amdomanska Nov 19, 2024
a8f0aef
PR cleanup: revert changes in core.py
amdomanska Nov 19, 2024
3377644
PR cleanup: remove prints
amdomanska Nov 19, 2024
3feecd3
Merge branch 'develop' into feature/3710_flagging_journals
richard-jones Dec 4, 2024
365e291
hide newFlagGroup correctly
amdomanska Dec 4, 2024
6aa466b
show new flag correctly
amdomanska Dec 4, 2024
a08d860
extract dates js library
amdomanska Dec 4, 2024
1852def
remove moment.js and add refactoring functions to doaj.dates lib
amdomanska Dec 4, 2024
49aad78
remove moment.js
amdomanska Dec 4, 2024
d331b1c
fix typo after dates refactoring
amdomanska Dec 4, 2024
86f6c8a
fix formulaic
amdomanska Dec 4, 2024
3780552
fix Notes
amdomanska Dec 9, 2024
5e71ebb
fix autocomplete
amdomanska Dec 9, 2024
46d72ab
fix autocomplete p2
amdomanska Dec 9, 2024
91513e1
remove required attribute from flag_assignee, add short help
amdomanska Dec 9, 2024
0cfe8f4
improve short help
amdomanska Dec 9, 2024
f9a34b6
style short help
amdomanska Dec 9, 2024
ab07ed2
fix the flagExists loop; improve dateParse functions
amdomanska Dec 9, 2024
d4cec93
hide deadline when appropriate
amdomanska Dec 9, 2024
882ffd9
adjust flag display
amdomanska Dec 9, 2024
94d40c3
Merge branch 'develop' into feature/3710_flagging_journals
amdomanska Jan 21, 2025
fe59f7e
reverse dashboard code
amdomanska Jan 21, 2025
22aa207
reverse unnecessary changes
amdomanska Jan 21, 2025
79277ad
remove unnecessary code from dashboard js; add static url for flagged…
amdomanska Jan 21, 2025
ccb6693
add rule to the dashboard
amdomanska Jan 21, 2025
48a3238
clean up js in dashboard template
amdomanska Jan 21, 2025
029f7a1
remove unnecessary template
amdomanska Jan 21, 2025
74fea92
change disabled inputs on resolve on readonly to send data correctly
amdomanska Jan 21, 2025
1f4f4bf
add resolved flag field to shared structs
amdomanska Jan 21, 2025
5cb295f
fix far in the future function
amdomanska Jan 21, 2025
d713068
fix resolving flag; move transforming resolved flag from crosswalk to…
amdomanska Jan 21, 2025
6e14f61
display flagged to me todos
amdomanska Jan 21, 2025
aebad8c
remove na, ur and oh rules from flagged journals
amdomanska Jan 21, 2025
fed5d1a
fix rules display
amdomanska Jan 21, 2025
923ff13
introduce 2 rules for flagged todos
amdomanska Jan 21, 2025
4a01e3d
remove obsolete method
amdomanska Jan 22, 2025
faaed1d
remove obsolete import
amdomanska Jan 22, 2025
4ddf169
move resolved flag message to Messages module
amdomanska Jan 22, 2025
56cef2d
add rule that is too general
amdomanska Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cms/sass/base/_palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ $mid-grey: #A9A7A5;
$light-grey: #F6F4F4;
$white: #FFF;

$disabled: #5c595626;

// Primary
$sanguine: #982E0A;
$grapefruit: #FD5A3B;
Expand Down Expand Up @@ -35,6 +37,6 @@ $bronze: #A77044;

--dark-green: #3A5959;
--mid-green: #47A178;
--light-greeen: #A3C386;
--light-green: #A3C386;
--yellow: #F9D950;
}
1 change: 1 addition & 0 deletions cms/sass/base/_spacing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$spacing-01: 0.1875rem;
$spacing-02: 0.375rem;
$spacing-03: 0.75rem;
$spacing-03--negative: -.75rem;
$spacing-04: 1.5rem;
$spacing-05: 3rem;
$spacing-06: 6rem;
Expand Down
6 changes: 6 additions & 0 deletions cms/sass/base/_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
justify-content: flex-end;
}

.flex-start {
display: flex;
align-items: flex-start;
justify-content: flex-start;
}

.flex-col {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion cms/sass/components/_removable-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@include unstyled-list;
}

label {
label.hiddenLabel {
@extend .sr-only; // a11y-friendly, can’t add class to the form itself
}
}
122 changes: 96 additions & 26 deletions cms/sass/layout/_editorial-panel.scss
Original file line number Diff line number Diff line change
@@ -1,34 +1,104 @@
.editorial-panel {
margin-top: 0;

.form__question {
select, textarea, input {
width: 100%;
.flag--resolved {
position: relative;
opacity: 0.2; /* Set opacity of entire div */
}
}

hr {
margin: $spacing-02;
}
.flag--resolved::before {
content: "RESOLVED"; /* The word to display as the stamp */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(-45deg); /* Center and rotate the text */
font-size: 3em; /* Adjust the size of the stamp */
color: rgba(0, 0, 0, 0.5); /* Light black color for the stamp */
z-index: 10; /* Place the stamp behind the button */
pointer-events: none; /* Ensure the stamp doesn't interfere with interactions */
opacity: 0.6; /* Make the stamp slightly transparent */
letter-spacing: 0.2em; /* Adjust the spacing between letters for the stamp */
font-weight: bold;
}
.editorial-panel__content {
.form__question.editorial-panel__question {
padding: 0 !important;
.editorial-panel__question-header {
padding: .5rem;
align-items: flex-start;
label, p {
margin: 0;
}
}
.editorial-panel__legend {
display: flex;
align-items: center;
gap: .5rem;
padding: 0 .5rem;
margin-bottom: .375rem;
}
.editorial-panel__questions-content {
.form-inputs--container {
&:has(input[type="hidden"]) {

@media (min-width: 992px) {
position: -webkit-sticky;
position: sticky;
top: 100px;
}
&:has(label) {
label {
font-size: .75rem;
margin-bottom: 0;
margin-left: .5rem;
.form__question--optional {
font-size: .75rem;
}
}
}
&:has(svg) {
position: relative;
width:100%;
svg {
position: absolute;
left: .5rem;
top:50%;
transform: translateY(-25%);
z-index: 1;
}
.select2-choice {
.select2-chosen {
padding-left: calc(.5rem + 20px);
}
}
}
input {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

&__wrapper {
display: flex;
flex-direction: column;
max-height: calc(100vh - 75px - 1.5rem - 25px); //(full viewport)-(nav height)-(top padding)-(bottom padding)
}
span.spanPretendingToBeInput {
display: block;
&:has(svg) {
display: flex;
align-items: flex-start;
gap: .5rem;
}
background-color: $disabled;
width: 100%;
padding: 0.5rem;
margin-bottom: .375rem;
font-style: italic;

&__content {
flex: 1;
overflow-y: scroll;
span {
white-space: normal;
}
}

select, textarea, input {
display: block;
}
input:disabled ~ label {
display: none;
}
}
[class^="control_buttons_div"] {
padding-left: .5rem;
padding-right: .5rem;
}
}
}
}
}
}
}
73 changes: 68 additions & 5 deletions portality/bll/services/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def group_stats(self, group_id):
eg = models.EditorGroup.pull(group_id)
stats = {"editor_group": eg.data}

#~~-> Account:Model ~~
# ~~-> Account:Model ~~
stats["editors"] = {}
editors = [eg.editor] + eg.associates
for editor in editors:
Expand All @@ -43,7 +43,8 @@ def group_stats(self, group_id):
stats["by_editor"][bucket["key"]]["update_requests"] = b["doc_count"]
stats["total"]["update_requests"] += b["doc_count"]

unassigned_buckets = resp.get("aggregations", {}).get("unassigned", {}).get("application_type", {}).get("buckets", [])
unassigned_buckets = resp.get("aggregations", {}).get("unassigned", {}).get("application_type", {}).get(
"buckets", [])
stats["unassigned"] = {"applications": 0, "update_requests": 0}
for ub in unassigned_buckets:
if ub["key"] == constants.APPLICATION_TYPE_NEW_APPLICATION:
Expand Down Expand Up @@ -123,7 +124,7 @@ def user_finished_historical_counts(self, account, year=None):

return count

def top_todo(self, account, size=25, new_applications=True, update_requests=True, on_hold=True):
def top_todo(self, account, size=25, new_applications=True, update_requests=True, flag=True, on_hold=True):
"""
Returns the top number of todo items for a given user

Expand Down Expand Up @@ -179,6 +180,12 @@ def top_todo(self, account, size=25, new_applications=True, update_requests=True
TodoRules.associate_start_pending(account.id, size),
TodoRules.associate_all_applications(account.id, size)
])
# if flagged filter is on than all types of records are displayed and the ownership is not taken into consideration
if flag:
queries.extend([
TodoRules.urgent_flags(account.id, size),
TodoRules.regular_flags(account.id, size)
])

todos = []
for aid, q, sort, boost in queries:
Expand Down Expand Up @@ -225,6 +232,7 @@ def _rationalise_todos(self, todos, size):


class TodoRules(object):

@classmethod
def maned_stalled(cls, size, maned_of):
sort_date = "created_date"
Expand Down Expand Up @@ -335,7 +343,6 @@ def maned_last_month_update_requests(cls, size, maned_of):
constants.APPLICATION_STATUS_ACCEPTED,
constants.APPLICATION_STATUS_REJECTED
])
# TodoQuery.exists("admin.editor")
],
sort=sort_date,
size=size
Expand All @@ -358,7 +365,6 @@ def maned_new_update_requests(cls, size, maned_of):
constants.APPLICATION_STATUS_ACCEPTED,
constants.APPLICATION_STATUS_REJECTED
])
# TodoQuery.exists("admin.editor")
],
sort=sort_date,
size=size
Expand Down Expand Up @@ -539,6 +545,34 @@ def associate_all_applications(cls, acc_id, size):
)
return constants.TODO_ASSOCIATE_ALL_APPLICATIONS, all, sort_field, -1

@classmethod
def urgent_flags(cls, acc_id, size):
sort_field = "most_urgent_flag_deadline"
all = TodoQuery(
musts=[
TodoQuery.flagged_to_me(acc_id),
TodoQuery.urgent_flags()
],
sort=sort_field,
size=size
)
return constants.TODO_URGENT_FLAGS, all, sort_field, -1

@classmethod
def regular_flags(cls, acc_id, size):
sort_field = "most_urgent_flag_deadline"
all = TodoQuery(
musts=[
TodoQuery.flagged_to_me(acc_id)
],
must_nots=[
TodoQuery.urgent_flags()
],
sort=sort_field,
size=size
)
return constants.TODO_REGULAR_FLAGS, all, sort_field, -1


class TodoQuery(object):
"""
Expand Down Expand Up @@ -660,6 +694,35 @@ def editor(cls, acc_id):
}
}

@classmethod
def flagged_to_me(cls, acc_id):
return {
"terms": {
"index.flag_assignees": [acc_id]
}
}

@classmethod
def urgent_flags(cls):
return {
"range": {
"index.most_urgent_flag_deadline": {
"gte": "now",
"lte": "now+7d/d"
}
}
}

@classmethod
def flags_with_nonurgent_deadline(cls):
return {
"range": {
"index.most_urgent_flag_deadline": {
"gt": "now+7d/d"
}
}
}


class GroupStatsQuery():
"""
Expand Down
3 changes: 3 additions & 0 deletions portality/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
LINK_TYPE_FULLTEXT = "fulltext"

# ~~-> Todo:Service~~
TODO_ASSIGNED_TO_ME = "todo_assigned_to_me"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

TODO_MANED_STALLED = "todo_maned_stalled"
TODO_MANED_FOLLOW_UP_OLD = "todo_maned_follow_up_old"
TODO_MANED_READY = "todo_maned_ready"
Expand All @@ -60,6 +61,8 @@
TODO_ASSOCIATE_FOLLOW_UP_OLD = "todo_associate_follow_up_old"
TODO_ASSOCIATE_START_PENDING = "todo_associate_start_pending"
TODO_ASSOCIATE_ALL_APPLICATIONS = "todo_associate_all_applications"
TODO_URGENT_FLAGS = "todo_urgent_flags"
TODO_REGULAR_FLAGS = "todo_regular_flags"

EVENT_ACCOUNT_CREATED = "account:created"
EVENT_ACCOUNT_PASSWORD_RESET = "account:password_reset"
Expand Down
2 changes: 1 addition & 1 deletion portality/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,4 @@ def build_statics(app):


app = create_app()
es_connection = create_es_connection(app)
es_connection = create_es_connection(app)
Loading
Loading