Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
knowledgebase-front
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
83ffe187
Commit
83ffe187
authored
5 years ago
by
Alice Poggioli
Browse files
Options
Downloads
Patches
Plain Diff
WIP: TRy with sib-form-dropdown.
parent
1b4d3fff
No related branches found
Branches containing commit
No related tags found
1 merge request
!36
Feature/entrepreneur dashboard
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/includes/entrepreneur/resources/list.pug
+22
-2
22 additions, 2 deletions
src/includes/entrepreneur/resources/list.pug
src/scripts/coopstarter.js
+115
-114
115 additions, 114 deletions
src/scripts/coopstarter.js
with
137 additions
and
116 deletions
src/includes/entrepreneur/resources/list.pug
+
22
−
2
View file @
83ffe187
...
...
@@ -57,7 +57,7 @@ div.container_min
multiple-language.name='sib-multiple-select'
widget-language.name='sib-form-auto-completion'
multiple-format='sib-
multiple-select
'
multiple-format='sib-
form-dropdown
'
widget-format='sib-form-auto-completion'
multiple-fields='sib-multiple-select'
...
...
@@ -88,9 +88,13 @@ div.side-block.block_log
data-src=`${endpoints.steps}1/resources/`,
fields='name, author, format, publication_year, description, country, language.name, field',
search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)',
search-range-format=`${endpoints.formats}`
search-widget-search_for_a_resource="hidden-widget"
search-widget-more_criterias_hidden="hidden-widget"
search-multiple-format='sib-form-dropdown'
search-widget-format='sib-form-auto-completion'
widget-name='cs-display-property'
widget-country='cs-display-property'
...
...
@@ -121,8 +125,12 @@ div.side-block.block_log
fields='name, author, format, publication_year, description, country, language.name, field',
search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)',
search-range-format=`${endpoints.formats}`
search-widget-search_for_a_resource="hidden-widget"
search-widget-more_criterias_hidden="hidden-widget"
search-multiple-format='sib-form-dropdown'
search-widget-format='sib-form-auto-completion'
widget-name='cs-display-property'
widget-country='cs-display-property'
...
...
@@ -154,8 +162,12 @@ div.side-block.block_log
fields='name, author, format, publication_year, description, country, language.name, field',
search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)',
search-range-format=`${endpoints.formats}`
search-widget-search_for_a_resource="hidden-widget"
search-widget-more_criterias_hidden="hidden-widget"
search-multiple-format='sib-form-dropdown'
search-widget-format='sib-form-auto-completion'
widget-name='cs-display-property'
widget-country='cs-display-property'
...
...
@@ -187,8 +199,12 @@ div.side-block.block_log
fields='name, author, format, publication_year, description, country, language.name, field',
search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)',
search-range-format=`${endpoints.formats}`
search-widget-search_for_a_resource="hidden-widget"
search-widget-more_criterias_hidden="hidden-widget"
search-multiple-format='sib-form-dropdown'
search-widget-format='sib-form-auto-completion'
widget-name='cs-display-property'
widget-country='cs-display-property'
...
...
@@ -219,8 +235,12 @@ div.side-block.block_log
fields='name, author, format, publication_year, description, country, language.name, field',
search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)',
search-range-format=`${endpoints.formats}`
search-widget-search_for_a_resource="hidden-widget"
search-widget-more_criterias_hidden="hidden-widget"
search-multiple-format='sib-form-dropdown'
search-widget-format='sib-form-auto-completion'
widget-name='cs-display-property'
widget-country='cs-display-property'
...
...
This diff is collapsed.
Click to expand it.
src/scripts/coopstarter.js
+
115
−
114
View file @
83ffe187
...
...
@@ -70,132 +70,133 @@ jQuery(document).ready(function($) {
});
}
//ENTREPRENEUR DASHBOARD*************************************************************
//In the entrepreneur dashboard, we set data from the display form to the hidden ones.
var
forms
=
document
.
querySelectorAll
(
"
.resource_by_step
"
);
forms
.
forEach
(
form
=>
{
form
.
addEventListener
(
"
populate
"
,
e
=>
{
//To retrieve keyword
//https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379
//TODO: Wait for a solution to filter with multiple value with "OR" instead of "AND".
let
keyword_form
=
document
.
getElementById
(
"
search-by-keyword
"
);
let
keyword_field
=
keyword_form
.
querySelector
(
`input[name="keyword"]`
);
let
keyword_submit
=
document
.
getElementById
(
`keyword_submit`
);
let
keyword_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="search_for_a_resource"] input
'
form
.
addEventListener
(
"
populate
"
,
e
=>
{
//SEARCH BY KEYWORD
//To retrieve keyword
//https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379
//TODO: Wait for a solution to filter with multiple value with "OR" instead of "AND".
let
keyword_form
=
document
.
getElementById
(
"
search-by-keyword
"
);
let
keyword_field
=
keyword_form
.
querySelector
(
`input[name="keyword"]`
);
let
keyword_submit
=
document
.
getElementById
(
`keyword_submit`
);
let
keyword_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="search_for_a_resource"] input
'
);
keyword_submit
.
addEventListener
(
"
click
"
,
function
()
{
keyword_hidden_fields
.
forEach
(
hidden_field
=>
{
hidden_field
.
setAttribute
(
"
value
"
,
keyword_field
.
value
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
});
//SEARCH IN DATABASE INSTANCE ONLY
let
instance_only
=
document
.
getElementById
(
"
instance_database_only
"
);
let
checkbox_instance_only
=
instance_only
.
querySelector
(
"
input
"
);
checkbox_instance_only
.
onclick
=
function
()
{
if
(
this
.
checked
)
{
//We have to retrieve all data-scr needed to make them pointed only on the instance.
//How to?
}
};
//MORE CRITERIAS
//TODO: Refactor this section ?
const
more_criterias_form
=
document
.
getElementById
(
"
more_criterias
"
);
// https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453
window
.
setTimeout
(()
=>
{
//To retrieve format
//TODO: How we should filled the hidden field with multiple value?
//TODO: The hidden search field set with one value doesn't work
let
format_field_search
=
more_criterias_form
.
querySelector
(
`select[name="format"]`
);
format_hidden_field
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] select[name="format"]
'
);
format_field_search
.
onchange
=
function
()
{
console
.
log
(
"
format_field_search
"
,
format_field_search
);
format_hidden_field
.
forEach
(
function
(
select_hidden
)
{
options_hidden
=
select_hidden
.
getElementsByTagName
(
"
option
"
);
for
(
let
option_hidden
of
options_hidden
)
{
option_selected
=
format_field_search
.
querySelector
(
"
option:checked
"
);
if
(
option_hidden
.
value
==
option_selected
.
value
)
{
console
.
log
(
"
option_selected
"
,
option_selected
)
option_hidden
.
setAttribute
(
"
checked
"
,
"
checked
"
);
console
.
log
(
"
option_hidden
"
,
option_hidden
)
}
}
});
};
//To retrieve language
//TODO: How we should filled the hidden field?
let
language_field_search
=
more_criterias_form
.
querySelector
(
`select[name="language.name"]`
);
language_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="language.name"]
'
);
keyword_submit
.
addEventListener
(
"
click
"
,
function
()
{
keyword_hidden_fields
.
forEach
(
hidden_field
=>
{
hidden_field
.
setAttribute
(
"
value
"
,
keyword_field
.
value
);
language_field_search
.
onchange
=
function
()
{
language_hidden_fields
.
forEach
(
language_field
=>
{
language_field
.
setAttribute
(
"
value
"
,
language_field_search
.
options
[
language_field_search
.
selectedIndex
]
.
text
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
}
)
;
};
//MORE CRITERIAS
//TODO: Refactor this section ?
const
more_criterias_form
=
document
.
getElementById
(
"
more_criterias
"
);
// https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453
window
.
setTimeout
(()
=>
{
//To retrieve format
//TODO: How we should filled the hidden field with multiple value?
//TODO: The hidden search field set with one value doesn't work
let
format_field_search
=
more_criterias_form
.
querySelector
(
`select[name="format"]`
);
format_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="format"]
'
);
format_field_search
.
onchange
=
function
()
{
format_hidden_fields
.
forEach
(
format_field
=>
{
format_field
.
setAttribute
(
"
value
"
,
format_field_search
.
options
[
format_field_search
.
selectedIndex
]
.
text
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
};
//To retrieve language
//TODO: How we should filled the hidden field?
let
language_field_search
=
more_criterias_form
.
querySelector
(
`select[name="language.name"]`
);
language_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="language.name"]
'
);
language_field_search
.
onchange
=
function
()
{
language_hidden_fields
.
forEach
(
language_field
=>
{
language_field
.
setAttribute
(
"
value
"
,
language_field_search
.
options
[
language_field_search
.
selectedIndex
]
.
text
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
};
// //To retrieve step, but I think it's gonna disapear
// let step_field_search = more_criterias_form.querySelector(
// `select[name="step"]`
// );
// step_hidden_fields = document.querySelectorAll(
// 'hidden-widget[name="more_criterias_hidden"] input[name="step"]'
// );
// step_field_search.onchange = function() {
// step_hidden_fields.forEach(step_field => {
// step_field.setAttribute(
// "value",
// step_field_search.options[step_field_search.selectedIndex]
// .text
// );
// form.querySelector("sib-form").component.inputChange();
// });
// };
//To retrieve year of publication
//WARNING: If the user want to select "20" to get 21century made, he will get no result.
//I think it is a UX problem.
let
year_field_search
=
more_criterias_form
.
querySelector
(
`input[name="publication_year"]`
);
let
year_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="publication_year"]
'
);
year_field_search
.
addEventListener
(
"
input
"
,
function
()
{
year_hidden_fields
.
forEach
(
year_field
=>
{
year_field
.
setAttribute
(
"
value
"
,
year_field_search
.
value
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
//To retrieve year of publication
//WARNING: If the user want to select "20" to get 21century made, he will get no result.
//I think it is a UX problem.
let
year_field_search
=
more_criterias_form
.
querySelector
(
`input[name="publication_year"]`
);
let
year_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="publication_year"]
'
);
year_field_search
.
addEventListener
(
"
input
"
,
function
()
{
year_hidden_fields
.
forEach
(
year_field
=>
{
year_field
.
setAttribute
(
"
value
"
,
year_field_search
.
value
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
});
//To retrieve the country
let
country_field_search
=
more_criterias_form
.
querySelector
(
`input[name="country"]`
);
let
country_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="country"]
'
);
country_field_search
.
addEventListener
(
"
input
"
,
function
()
{
country_hidden_fields
.
forEach
(
country_field
=>
{
country_field
.
setAttribute
(
"
value
"
,
country_field_search
.
value
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
//To retrieve the country
let
country_field_search
=
more_criterias_form
.
querySelector
(
`input[name="country"]`
);
let
country_hidden_fields
=
document
.
querySelectorAll
(
'
hidden-widget[name="more_criterias_hidden"] input[name="country"]
'
);
country_field_search
.
addEventListener
(
"
input
"
,
function
()
{
country_hidden_fields
.
forEach
(
country_field
=>
{
country_field
.
setAttribute
(
"
value
"
,
country_field_search
.
value
);
form
.
querySelector
(
"
sib-form
"
).
component
.
inputChange
();
});
});
},
4000
);
},
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