Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
186dcc63
Commit
186dcc63
authored
Mar 28, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add enqueing messages method to display them after page has been reloaded
parent
b1c320b6
Pipeline
#2020
passed with stage
in 1 minute 27 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
8 deletions
+42
-8
manage_attached.js
members/static/js/admin/manage_attached.js
+7
-7
common.css
outils/static/css/common.css
+1
-1
all_common.js
outils/static/js/all_common.js
+34
-0
No files found.
members/static/js/admin/manage_attached.js
View file @
186dcc63
...
...
@@ -205,7 +205,7 @@ function delete_pair(childId) {
contentType
:
"application/json; charset=utf-8"
,
data
:
JSON
.
stringify
(
payload
),
success
:
function
()
{
// alert("binôme désolidarisé
");
enqueue_message_for_next_loading
(
"Binôme désolidarisé.
"
);
location
.
reload
();
},
error
:
function
(
data
)
{
...
...
@@ -223,9 +223,6 @@ function delete_pair(childId) {
function
confirmDeletion
(
childId
)
{
var
modalContent
=
$
(
'#confirmModal'
)
modalContent
.
find
(
"#parentName"
).
text
(
parentName
)
modalContent
.
find
(
"#childName"
).
text
(
childName
)
...
...
@@ -234,7 +231,7 @@ function confirmDeletion(childId) {
if
(
is_time_to
(
'delete_pair'
))
{
delete_pair
(
childId
)
}
},
'Valider'
);
},
'Valider'
,
false
);
}
...
...
@@ -246,6 +243,7 @@ function create_pair(payload) {
contentType
:
"application/json; charset=utf-8"
,
data
:
JSON
.
stringify
(
payload
),
success
:
function
(
data
)
{
enqueue_message_for_next_loading
(
"Binôme créé."
);
location
.
reload
()
},
...
...
@@ -384,6 +382,7 @@ $(document).ready(function() {
});
$
(
"#createPair"
).
on
(
'click'
,
function
()
{
if
(
parentId
&&
childId
)
{
// Note : after reload, button "Créer le binôme" is clickable...It shouldn't
var
payload
=
{
"parent"
:
{
"id"
:
parentId
},
"child"
:
{
"id"
:
childId
}
...
...
@@ -397,7 +396,9 @@ $(document).ready(function() {
if
(
is_time_to
(
'create_pair'
))
{
create_pair
(
payload
)
}
},
'Valider'
);
},
'Valider'
,
false
);
}
});
if
(
$
(
"#attached_members_table"
)
!=
"undefined"
)
{
...
...
@@ -413,7 +414,6 @@ $(document).ready(function() {
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
console
.
log
(
data
.
member
)
parentName
=
data
.
member
.
parent_barcode_base
+
' - '
+
data
.
member
.
parent_name
childName
=
data
.
member
.
barcode_base
+
' - '
+
data
.
member
.
name
confirmDeletion
(
childId
);
...
...
outils/static/css/common.css
View file @
186dcc63
...
...
@@ -6,7 +6,7 @@
.b_yellow
{
background
:
#fcf3cc
;}
.red
{
color
:
#FF0000
;}
.b_red
,
.b_less_than_25pc
{
background
:
#ff3333
!important
;}
.loading
{
background-image
:
url("/static/img/ajax-loader.gif")
;
background-repeat
:
no-repeat
;}
.loading
{
background-image
:
url("/static/img/ajax-loader.gif")
;
background-repeat
:
no-repeat
;
background-position
:
center
;
background-color
:
#efefef
;
}
.loading2
{
display
:
none
;
position
:
absolute
;
top
:
-20px
;}
.loading2-container
{
position
:
relative
;}
...
...
outils/static/js/all_common.js
View file @
186dcc63
var
actions_last_dates
=
{};
var
show_enqueued_messages
=
function
()
{
var
stored
=
null
;
try
{
stored
=
JSON
.
parse
(
localStorage
.
getItem
(
'enqueued_messages'
));
alert
(
stored
.
join
(
"
\
n"
))
localStorage
.
removeItem
(
'enqueued_messages'
)
}
catch
(
e
)
{
//no rescue system for the moment
}
};
var
enqueue_message_for_next_loading
=
function
(
msg
)
{
try
{
let
messages
=
[],
stored
=
localStorage
.
getItem
(
'enqueued_messages'
);
if
(
stored
)
{
messages
=
JSON
.
parse
(
stored
);
}
messages
.
push
(
msg
)
localStorage
.
setItem
(
'enqueued_messages'
,
JSON
.
stringify
(
messages
));
}
catch
(
e
)
{
//no rescue system for the moment
}
}
function
get_litteral_shift_template_name
(
name
)
{
var
l_name
=
''
;
...
...
@@ -209,6 +236,10 @@ function openModal() {
// 4th argument: if set and false, validate button doesn't close the modal
if
(
typeof
(
arguments
[
3
])
==
"undefined"
||
arguments
[
3
]
!=
false
)
btn_ok
.
on
(
'click'
,
closeModal
);
else
btn_ok
.
on
(
'click'
,
function
()
{
$
(
this
).
addClass
(
"loading"
)
})
btns
.
append
(
btn_ok
);
...
...
@@ -482,3 +513,5 @@ function isMacUser() {
}
if
(
isMacUser
()
&&
isSafari
())
$
(
'.mac-msg'
).
show
();
show_enqueued_messages
();
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment