Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
knowledgebase-front
Manage
Activity
Members
Labels
Plan
Issues
19
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Applications
Knowledge Base
knowledgebase-front
Commits
2faa23a3
Commit
2faa23a3
authored
5 years ago
by
Alice Poggioli
Browse files
Options
Downloads
Patches
Plain Diff
Patch after review.
parent
771fb2d4
No related branches found
Branches containing commit
No related tags found
1 merge request
!38
Feature/mentor dashboard
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/includes/mentor/resources/detail.pug
+1
-1
1 addition, 1 deletion
src/includes/mentor/resources/detail.pug
src/scripts/coopstarter.js
+40
-91
40 additions, 91 deletions
src/scripts/coopstarter.js
with
41 additions
and
92 deletions
src/includes/mentor/resources/detail.pug
+
1
−
1
View file @
2faa23a3
...
...
@@ -5,7 +5,7 @@ sib-router
dialog#confirm_suppress
h1 confirm_suppress
sib-delete(data-label="D
ie bitch, die !!
" bind-resources)
sib-delete(data-label="D
elete
" bind-resources)
sib-link(class="backlink pull-right", next="mentor-resource-list") X
.block_log.block_creat_count.no_shadow
...
...
This diff is collapsed.
Click to expand it.
src/scripts/coopstarter.js
+
40
−
91
View file @
2faa23a3
...
...
@@ -37,32 +37,8 @@ function refreshList(formId, listId) {
});
}
// //Refresh information after a deletion
// function refreshAfterDeletion() {
// let list = document.getElementById("resources-history");
// console.log("list", list);
// let element = document.querySelectorAll("sib-delete");
// console.log("element", element);
// element.addEventListener("resourceDeleted", e => {
// console.log("Resource deleted: ", e.detail.resource);
// list.dataset.src = list.dataset.src;
// });
// let form = document.querySelectorAll("button");
// console.log("form", form);
// form.addEventListener("click", event => {
// let list = document.getElementById("resources-history");
// console.log("delete");
// list.dataset.src = list.dataset.src;
// });
// }
//Remove pagination when there is no resource in a step group
function
actualize
Pagination
()
{
function
refresh
Pagination
()
{
var
resources_containers
=
document
.
querySelectorAll
(
"
.resource_by_step sib-form+div
"
);
...
...
@@ -80,13 +56,36 @@ function actualizePagination() {
}
//Manage select hidden to fullfill them with more "more criterias" selection
function
selectHiddenManagement
()
{
//Need to refactor the part
function
selectHiddenManagement
(
select_hidden
,
option_selected
,
form
)
{
options_hidden
=
select_hidden
.
getElementsByTagName
(
"
option
"
);
for
(
let
option_hidden
of
options_hidden
)
{
//Removing the selected attribute from previous selection
option_hidden
.
removeAttribute
(
"
selected
"
);
if
(
option_hidden
.
value
==
option_selected
.
value
)
{
//Actually selecting the option if it is the good one
option_hidden
.
setAttribute
(
"
selected
"
,
"
selected
"
);
select_hidden
.
setAttribute
(
"
value
"
,
option_selected
.
value
);
}
//Trigerring a reload of the associated form
let
parent_form
=
select_hidden
.
closest
(
"
sib-form
"
);
parent_form
.
component
.
inputChange
();
}
refreshPagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
}
//Manage input hidden field to fullfill them with more "more criterias" selection
function
inputHiddenManagement
(
field
,
field_search
,
form
)
{
field
.
setAttribute
(
"
value
"
,
field_search
.
value
);
refreshPagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
}
jQuery
(
document
).
ready
(
function
(
$
)
{
//
Actualize
pagination
actualize
Pagination
();
//
Refresh
pagination
refresh
Pagination
();
// Get the element with id="defaultOpen" and click on it
document
.
getElementById
(
"
defaultOpen
"
).
click
();
...
...
@@ -133,7 +132,7 @@ jQuery(document).ready(function($) {
forms
.
forEach
(
form
=>
{
form
.
addEventListener
(
"
populate
"
,
e
=>
{
//On load in dashbord Entrepreneur
actualize
Pagination
();
refresh
Pagination
();
//SEARCH BY KEYWORD
//To retrieve keyword
//https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379
...
...
@@ -149,7 +148,7 @@ jQuery(document).ready(function($) {
keyword_submit
.
addEventListener
(
"
click
"
,
function
()
{
keyword_hidden_fields
.
forEach
(
hidden_field
=>
{
hidden_field
.
setAttribute
(
"
value
"
,
keyword_field
.
value
);
actualize
Pagination
();
refresh
Pagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
});
...
...
@@ -171,7 +170,6 @@ jQuery(document).ready(function($) {
// https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453
window
.
setTimeout
(()
=>
{
//Refresh data list on delete resources
const
deleteButton
=
document
.
querySelectorAll
(
"
sib-delete
"
);
...
...
@@ -184,7 +182,9 @@ jQuery(document).ready(function($) {
confirm_suppress
.
setAttribute
(
"
hidden
"
,
"
hidden
"
);
//If we supress from the detail resource view, we close this view.
let
mentor_resource_detail
=
document
.
getElementById
(
"
mentor-resource-detail
"
);
let
mentor_resource_detail
=
document
.
getElementById
(
"
mentor-resource-detail
"
);
mentor_resource_detail
.
setAttribute
(
"
hidden
"
,
"
hidden
"
);
this
.
dispatchEvent
(
new
CustomEvent
(
"
requestNavigation
"
,
{
...
...
@@ -212,22 +212,7 @@ jQuery(document).ready(function($) {
);
format_hidden_field
.
forEach
(
function
(
select_hidden
)
{
options_hidden
=
select_hidden
.
getElementsByTagName
(
"
option
"
);
for
(
let
option_hidden
of
options_hidden
)
{
//Removing the selected attribute from previous selection
option_hidden
.
removeAttribute
(
"
selected
"
);
if
(
option_hidden
.
value
==
option_selected
.
value
)
{
//Actually selecting the option if it is the good one
option_hidden
.
setAttribute
(
"
selected
"
,
"
selected
"
);
select_hidden
.
setAttribute
(
"
value
"
,
option_selected
.
value
);
}
//Trigerring a reload of the associated form
let
parent_form
=
select_hidden
.
closest
(
"
sib-form
"
);
parent_form
.
component
.
inputChange
();
}
actualizePagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
selectHiddenManagement
(
select_hidden
,
option_selected
,
form
);
});
};
...
...
@@ -245,23 +230,7 @@ jQuery(document).ready(function($) {
);
language_hidden_field
.
forEach
(
function
(
select_hidden
)
{
options_hidden
=
select_hidden
.
getElementsByTagName
(
"
option
"
);
for
(
let
option_hidden
of
options_hidden
)
{
//Removing the selected attribute from previous selection
option_hidden
.
removeAttribute
(
"
selected
"
);
if
(
option_hidden
.
value
==
option_selected
.
value
)
{
//Actually selecting the option if it is the good one
option_hidden
.
setAttribute
(
"
selected
"
,
"
selected
"
);
select_hidden
.
setAttribute
(
"
value
"
,
option_selected
.
value
);
}
//Trigerring a reload of the associated form
let
parent_form
=
select_hidden
.
closest
(
"
sib-form
"
);
parent_form
.
component
.
inputChange
();
}
actualizePagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
selectHiddenManagement
(
select_hidden
,
option_selected
,
form
);
});
};
...
...
@@ -279,23 +248,7 @@ jQuery(document).ready(function($) {
);
field_hidden_field
.
forEach
(
function
(
select_hidden
)
{
options_hidden
=
select_hidden
.
getElementsByTagName
(
"
option
"
);
for
(
let
option_hidden
of
options_hidden
)
{
//Removing the selected attribute from previous selection
option_hidden
.
removeAttribute
(
"
selected
"
);
if
(
option_hidden
.
value
==
option_selected
.
value
)
{
//Actually selecting the option if it is the good one
option_hidden
.
setAttribute
(
"
selected
"
,
"
selected
"
);
select_hidden
.
setAttribute
(
"
value
"
,
option_selected
.
value
);
}
//Trigerring a reload of the associated form
let
parent_form
=
select_hidden
.
closest
(
"
sib-form
"
);
parent_form
.
component
.
inputChange
();
}
actualizePagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
selectHiddenManagement
(
select_hidden
,
option_selected
,
form
);
});
};
...
...
@@ -310,10 +263,8 @@ jQuery(document).ready(function($) {
);
year_field_search
.
addEventListener
(
"
input
"
,
function
()
{
year_hidden_fields
.
forEach
(
year_field
=>
{
year_field
.
setAttribute
(
"
value
"
,
year_field_search
.
value
);
actualizePagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
year_hidden_fields
.
forEach
(
field
=>
{
inputHiddenManagement
(
field
,
year_field_search
,
form
);
});
});
...
...
@@ -326,10 +277,8 @@ jQuery(document).ready(function($) {
);
country_field_search
.
addEventListener
(
"
input
"
,
function
()
{
country_hidden_fields
.
forEach
(
country_field
=>
{
country_field
.
setAttribute
(
"
value
"
,
country_field_search
.
value
);
actualizePagination
();
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
country_hidden_fields
.
forEach
(
field
=>
{
inputHiddenManagement
(
field
,
country_field_search
,
form
);
});
});
},
4000
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment