forked from ScoDoc/ScoDoc
Upgrade bootstrap-multiselect to 1.1.2 and adapt css
This commit is contained in:
parent
e92efb50e2
commit
6cedf99e5e
@ -45,14 +45,14 @@ import sco_version
|
|||||||
# Multiselect menus are used on a few pages and not loaded by default
|
# Multiselect menus are used on a few pages and not loaded by default
|
||||||
BOOTSTRAP_MULTISELECT_JS = [
|
BOOTSTRAP_MULTISELECT_JS = [
|
||||||
"libjs/bootstrap/js/bootstrap.min.js",
|
"libjs/bootstrap/js/bootstrap.min.js",
|
||||||
"libjs/bootstrap-multiselect/bootstrap-multiselect.js",
|
"libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.js",
|
||||||
"libjs/purl.js",
|
"libjs/purl.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
BOOTSTRAP_MULTISELECT_CSS = [
|
BOOTSTRAP_MULTISELECT_CSS = [
|
||||||
"libjs/bootstrap/css/bootstrap.min.css",
|
"libjs/bootstrap/css/bootstrap.min.css",
|
||||||
"libjs/bootstrap/css/bootstrap-theme.min.css",
|
"libjs/bootstrap/css/bootstrap-theme.min.css",
|
||||||
"libjs/bootstrap-multiselect/bootstrap-multiselect.css",
|
"libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.css",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,6 @@ def groups_view(
|
|||||||
# - ajouter du JS pour modifier les liens (arguments group_ids) quand le menu change
|
# - ajouter du JS pour modifier les liens (arguments group_ids) quand le menu change
|
||||||
|
|
||||||
# Tabs
|
# Tabs
|
||||||
# H.extend( ("""<span>toto</span><ul id="toto"><li>item 1</li><li>item 2</li></ul>""",) )
|
|
||||||
H.extend(
|
H.extend(
|
||||||
(
|
(
|
||||||
"""<ul class="nav nav-tabs">
|
"""<ul class="nav nav-tabs">
|
||||||
@ -631,9 +630,10 @@ def groups_table(
|
|||||||
else:
|
else:
|
||||||
htitle = "Aucun étudiant !"
|
htitle = "Aucun étudiant !"
|
||||||
H = [
|
H = [
|
||||||
'<div class="tab-content"><form>' '<h3 class="formsemestre"><span>',
|
f"""<div class="tab-content">
|
||||||
htitle,
|
<form>
|
||||||
"</span>",
|
<span style="font-weight:bold; font-size:120%;">{htitle}</span>
|
||||||
|
"""
|
||||||
]
|
]
|
||||||
if groups_infos.members:
|
if groups_infos.members:
|
||||||
Of = []
|
Of = []
|
||||||
@ -675,7 +675,7 @@ def groups_table(
|
|||||||
""",
|
""",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
H.append("</h3></form>")
|
H.append("</div></form>")
|
||||||
if groups_infos.members:
|
if groups_infos.members:
|
||||||
H.extend(
|
H.extend(
|
||||||
[
|
[
|
||||||
|
@ -39,6 +39,41 @@ h3 {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* customization of multiselect style */
|
||||||
|
.multiselect-container.dropdown-menu {
|
||||||
|
background-color: #e9e9e9;
|
||||||
|
}
|
||||||
|
.multiselect-container label.form-check-label {
|
||||||
|
font-weight: normal;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
button.multiselect-option {
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.multiselect-container button.multiselect-option span.form-check {
|
||||||
|
padding-left: 2px;
|
||||||
|
}
|
||||||
|
.multiselect-container span.multiselect-group {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.multiselect-container
|
||||||
|
.multiselect-all.active:not(.multiselect-active-item-fallback),
|
||||||
|
.multiselect-container
|
||||||
|
.multiselect-all:not(.multiselect-active-item-fallback):active,
|
||||||
|
.multiselect-container
|
||||||
|
.multiselect-group.active:not(.multiselect-active-item-fallback),
|
||||||
|
.multiselect-container
|
||||||
|
.multiselect-group:not(.multiselect-active-item-fallback):active,
|
||||||
|
.multiselect-container
|
||||||
|
.multiselect-option.active:not(.multiselect-active-item-fallback),
|
||||||
|
.multiselect-container
|
||||||
|
.multiselect-option:not(.multiselect-active-item-fallback):active {
|
||||||
|
background-color: #e9e9e9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Legacy ScoDoc pages */
|
||||||
div#gtrcontent {
|
div#gtrcontent {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
@ -61,7 +96,8 @@ div#gtrcontent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scotext {
|
.scotext {
|
||||||
font-family: TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
|
font-family: TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia,
|
||||||
|
serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sco-hidden {
|
.sco-hidden {
|
||||||
@ -212,7 +248,6 @@ div.about-logo {
|
|||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.head_message {
|
div.head_message {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
@ -289,7 +324,6 @@ p.footer {
|
|||||||
border-top: 1px solid rgb(60, 60, 60);
|
border-top: 1px solid rgb(60, 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---- (left) SIDEBAR ----- */
|
/* ---- (left) SIDEBAR ----- */
|
||||||
|
|
||||||
div.sidebar {
|
div.sidebar {
|
||||||
@ -403,7 +437,6 @@ div.table_etud_in_dept table.gt_table {
|
|||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.etud-insidebar ul {
|
.etud-insidebar ul {
|
||||||
padding-left: 1.5em;
|
padding-left: 1.5em;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
@ -571,7 +604,7 @@ table.semlist tbody tr td.modalite {
|
|||||||
|
|
||||||
.sco_modified {
|
.sco_modified {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: indigo
|
color: indigo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
@ -586,7 +619,7 @@ table.semlist tbody tr td.modalite {
|
|||||||
border-radius: 0 0 10px 10px;
|
border-radius: 0 0 10px 10px;
|
||||||
background: #ec7068;
|
background: #ec7068;
|
||||||
background: #90c;
|
background: #90c;
|
||||||
color: #FFF;
|
color: #fff;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
animation: message 3s;
|
animation: message 3s;
|
||||||
transform: translate(-50%, 0);
|
transform: translate(-50%, 0);
|
||||||
@ -594,15 +627,14 @@ table.semlist tbody tr td.modalite {
|
|||||||
|
|
||||||
@keyframes message {
|
@keyframes message {
|
||||||
20% {
|
20% {
|
||||||
transform: translate(-50%, 100%)
|
transform: translate(-50%, 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
80% {
|
80% {
|
||||||
transform: translate(-50%, 100%)
|
transform: translate(-50%, 100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div#gtrcontent table.semlist tbody tr.css_S-1 td {
|
div#gtrcontent table.semlist tbody tr.css_S-1 td {
|
||||||
background-color: rgb(251, 250, 216);
|
background-color: rgb(251, 250, 216);
|
||||||
}
|
}
|
||||||
@ -643,7 +675,8 @@ div.news {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.news a, div.news a.stdlink {
|
div.news a,
|
||||||
|
div.news a.stdlink {
|
||||||
color: black;
|
color: black;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@ -672,7 +705,6 @@ span.newstext {
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
span.gt_export_icons {
|
span.gt_export_icons {
|
||||||
margin-left: 1.5em;
|
margin-left: 1.5em;
|
||||||
}
|
}
|
||||||
@ -683,7 +715,7 @@ div.scoinfos {
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
background-color: #F4F4B2;
|
background-color: #f4f4b2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----- fiches etudiants ------ */
|
/* ----- fiches etudiants ------ */
|
||||||
@ -752,17 +784,17 @@ div.etudarchive ul {
|
|||||||
div.etudarchive ul li {
|
div.etudarchive ul li {
|
||||||
background-image: url(/ScoDoc/static/icons/bullet_arrow.png);
|
background-image: url(/ScoDoc/static/icons/bullet_arrow.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: 0 .4em;
|
background-position: 0 0.4em;
|
||||||
padding-left: .6em;
|
padding-left: 0.6em;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.etudarchive ul li.addetudarchive {
|
div.etudarchive ul li.addetudarchive {
|
||||||
background-image: url(/ScoDoc/static/icons/bullet_plus.png);
|
background-image: url(/ScoDoc/static/icons/bullet_plus.png);
|
||||||
padding-left: 1.2em
|
padding-left: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.etudarchive_descr {
|
span.etudarchive_descr {
|
||||||
margin-right: .4em;
|
margin-right: 0.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.deletudarchive {
|
span.deletudarchive {
|
||||||
@ -871,7 +903,6 @@ div.ficheinscriptions {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
td.photocell {
|
td.photocell {
|
||||||
padding-left: 32px;
|
padding-left: 32px;
|
||||||
}
|
}
|
||||||
@ -989,7 +1020,6 @@ span.linktitresem a:visited {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
a.stdlink,
|
a.stdlink,
|
||||||
a.stdlink:visited {
|
a.stdlink:visited {
|
||||||
color: blue;
|
color: blue;
|
||||||
@ -1070,7 +1100,6 @@ span.trombi_box a img {
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* markup non semantique pour les cas simples */
|
/* markup non semantique pour les cas simples */
|
||||||
|
|
||||||
.fontred {
|
.fontred {
|
||||||
@ -1126,7 +1155,8 @@ a.discretelink:hover {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.expl, .help {
|
.expl,
|
||||||
|
.help {
|
||||||
max-width: var(--sco-content-max-width);
|
max-width: var(--sco-content-max-width);
|
||||||
}
|
}
|
||||||
.help {
|
.help {
|
||||||
@ -1138,7 +1168,8 @@ a.discretelink:hover {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.sco_box, div.sco_help {
|
div.sco_box,
|
||||||
|
div.sco_help {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
@ -1369,7 +1400,6 @@ table.notes_evaluation td.exc a {
|
|||||||
color: rgb(0, 131, 0);
|
color: rgb(0, 131, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.notes_evaluation tr td a.discretelink:hover {
|
table.notes_evaluation tr td a.discretelink:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@ -1444,7 +1474,6 @@ div.jury_footer>span {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
span.eval_info {
|
span.eval_info {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
@ -1592,7 +1621,7 @@ formsemestre_page_title .lock img {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#formnotes td.tf-ro-fieldlabel:after {
|
#formnotes td.tf-ro-fieldlabel:after {
|
||||||
content: '';
|
content: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
#formnotes .tf-ro-field.formnote_bareme {
|
#formnotes .tf-ro-field.formnote_bareme {
|
||||||
@ -1731,7 +1760,7 @@ tr.formsemestre_status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tr.formsemestre_status_green {
|
tr.formsemestre_status_green {
|
||||||
background-color: #EFF7F2;
|
background-color: #eff7f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.formsemestre_status_ue {
|
tr.formsemestre_status_ue {
|
||||||
@ -1814,7 +1843,6 @@ span.mod_coef_indicator_zero {
|
|||||||
border: 1px solid rgb(156, 156, 156);
|
border: 1px solid rgb(156, 156, 156);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
span.status_ue_acro {
|
span.status_ue_acro {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -1875,7 +1903,8 @@ ul.ue_inscr_list li.etud {
|
|||||||
grid-template-columns: 240px auto;
|
grid-template-columns: 240px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sem-groups-list, .sem-groups-assi {
|
.sem-groups-list,
|
||||||
|
.sem-groups-assi {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
@ -2028,7 +2057,6 @@ span.mievr_rattr {
|
|||||||
margin-left: 2em;
|
margin-left: 2em;
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
;
|
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
padding: 1px 3px 1px 3px;
|
padding: 1px 3px 1px 3px;
|
||||||
}
|
}
|
||||||
@ -2054,7 +2082,8 @@ tr.mievr td {
|
|||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.mievr.non_visible_inter td, tr.mievr.non_visible_inter th {
|
tr.mievr.non_visible_inter td,
|
||||||
|
tr.mievr.non_visible_inter th {
|
||||||
/* background-color: #d2cdc5; */
|
/* background-color: #d2cdc5; */
|
||||||
background: repeating-linear-gradient(
|
background: repeating-linear-gradient(
|
||||||
45deg,
|
45deg,
|
||||||
@ -2145,7 +2174,8 @@ span.eval_coef_ue {
|
|||||||
margin-right: 2em;
|
margin-right: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.eval_coef_ue_titre {}
|
span.eval_coef_ue_titre {
|
||||||
|
}
|
||||||
|
|
||||||
/* Inscriptions modules/UE */
|
/* Inscriptions modules/UE */
|
||||||
div.list_but_ue_inscriptions {
|
div.list_but_ue_inscriptions {
|
||||||
@ -2201,7 +2231,6 @@ form.list_but_ue_inscriptions td {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table#but_ue_inscriptions {
|
table#but_ue_inscriptions {
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
width: auto;
|
width: auto;
|
||||||
@ -2355,10 +2384,11 @@ div.formation_list_ues {
|
|||||||
|
|
||||||
div.formation_list_ues {
|
div.formation_list_ues {
|
||||||
background-color: #b7d2fa;
|
background-color: #b7d2fa;
|
||||||
margin-top: 20px
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.formation_list_ues_content {}
|
div.formation_list_ues_content {
|
||||||
|
}
|
||||||
|
|
||||||
div.formation_list_modules {
|
div.formation_list_modules {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
@ -2455,7 +2485,6 @@ div.ue_choix_niveau>div.formation_parcs>div {
|
|||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.ue_list_tit {
|
div.ue_list_tit {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
@ -2688,7 +2717,6 @@ div#ue_list_modules {
|
|||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
span.ue_share {
|
span.ue_share {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -3074,7 +3102,6 @@ a.bull_link:hover {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.bulletin_menubar {
|
div.bulletin_menubar {
|
||||||
padding-left: 25px;
|
padding-left: 25px;
|
||||||
}
|
}
|
||||||
@ -3122,9 +3149,9 @@ div.eval_description {
|
|||||||
|
|
||||||
div.bul_foot {
|
div.bul_foot {
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
background: #FFE7D5;
|
background: #ffe7d5;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
border: 1px solid #AAA;
|
border: 1px solid #aaa;
|
||||||
padding: 16px 32px;
|
padding: 16px 32px;
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
@ -3155,7 +3182,6 @@ span.titredivsaisienote {
|
|||||||
font-size: 115%;
|
font-size: 115%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.etud_dem {
|
.etud_dem {
|
||||||
color: rgb(130, 130, 130);
|
color: rgb(130, 130, 130);
|
||||||
}
|
}
|
||||||
@ -3293,7 +3319,6 @@ mark {
|
|||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
form.sco_pref table.tf {
|
form.sco_pref table.tf {
|
||||||
border-spacing: 5px 15px;
|
border-spacing: 5px 15px;
|
||||||
}
|
}
|
||||||
@ -3305,7 +3330,7 @@ td.tf-ro-fieldlabel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td.tf-ro-fieldlabel:after {
|
td.tf-ro-fieldlabel:after {
|
||||||
content: ' :';
|
content: " :";
|
||||||
}
|
}
|
||||||
|
|
||||||
td.tf-ro-field {
|
td.tf-ro-field {
|
||||||
@ -3416,7 +3441,7 @@ P.gtr_devel:before {
|
|||||||
/* ---- Sortable tables --- */
|
/* ---- Sortable tables --- */
|
||||||
/* Sortable tables */
|
/* Sortable tables */
|
||||||
table.sortable a.sortheader {
|
table.sortable a.sortheader {
|
||||||
background-color: #E6E6E6;
|
background-color: #e6e6e6;
|
||||||
color: black;
|
color: black;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -3502,7 +3527,6 @@ table.recap_parcours td {
|
|||||||
|
|
||||||
td.rcp_dec {
|
td.rcp_dec {
|
||||||
color: rgb(0%, 0%, 50%);
|
color: rgb(0%, 0%, 50%);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
td.rcp_nonass,
|
td.rcp_nonass,
|
||||||
@ -3541,7 +3565,13 @@ table.recap_hide_details tr.sem_precedent td.ue_acro span {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.recap_parcours tr.sem_autre_formation td.rcp_titre_sem {
|
.recap_parcours tr.sem_autre_formation td.rcp_titre_sem {
|
||||||
background-image: repeating-linear-gradient(-45deg, rgb(100, 205, 193), rgb(100, 205, 193) 2px, transparent 5px, transparent 40px);
|
background-image: repeating-linear-gradient(
|
||||||
|
-45deg,
|
||||||
|
rgb(100, 205, 193),
|
||||||
|
rgb(100, 205, 193) 2px,
|
||||||
|
transparent 5px,
|
||||||
|
transparent 40px
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.rcp_l2 td {
|
.rcp_l2 td {
|
||||||
@ -3612,7 +3642,6 @@ th.sfv_subtitle {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tr.sfv_ass {
|
tr.sfv_ass {
|
||||||
background-color: rgb(90%, 90%, 80%);
|
background-color: rgb(90%, 90%, 80%);
|
||||||
}
|
}
|
||||||
@ -3659,7 +3688,7 @@ span.finalisationinscription {
|
|||||||
.pas_sembox_title a {
|
.pas_sembox_title a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
color: #1C721C;
|
color: #1c721c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pas_sembox_subtitle {
|
.pas_sembox_subtitle {
|
||||||
@ -3786,7 +3815,6 @@ div.module_check_absences ul {
|
|||||||
|
|
||||||
/* ----------------------------------------------- */
|
/* ----------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------- */
|
/* ----------------------------- */
|
||||||
/* TABLES generees par gen_table */
|
/* TABLES generees par gen_table */
|
||||||
/* ----------------------------- */
|
/* ----------------------------- */
|
||||||
@ -3811,7 +3839,6 @@ table.table_coldate tr td:first-child {
|
|||||||
color: rgb(0%, 0%, 50%);
|
color: rgb(0%, 0%, 50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.table_listegroupe tr td {
|
table.table_listegroupe tr td {
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
padding-right: 0.5em;
|
padding-right: 0.5em;
|
||||||
@ -3827,7 +3854,6 @@ table.list_users th.roles_string {
|
|||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.formsemestre_description tr.table_row_ue td {
|
table.formsemestre_description tr.table_row_ue td {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -3866,7 +3892,6 @@ div.form_rename_partition {
|
|||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
td.calday {
|
td.calday {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
@ -3877,7 +3902,6 @@ div.cal_evaluations table.monthcalendar td.calcell {
|
|||||||
width: 6em;
|
width: 6em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.cal_evaluations table.monthcalendar td a {
|
div.cal_evaluations table.monthcalendar td a {
|
||||||
color: rgb(128, 0, 0);
|
color: rgb(128, 0, 0);
|
||||||
}
|
}
|
||||||
@ -3895,12 +3919,10 @@ div.othersemlist {
|
|||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.othersemlist input {
|
div.othersemlist input {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div#update_warning {
|
div#update_warning {
|
||||||
display: none;
|
display: none;
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
@ -3959,9 +3981,8 @@ ul.main li {
|
|||||||
padding-bottom: 2ex;
|
padding-bottom: 2ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#scodoc_admin {
|
#scodoc_admin {
|
||||||
background-color: #EEFFFF;
|
background-color: #eeffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#message,
|
#message,
|
||||||
@ -4027,11 +4048,13 @@ div.apo_csv_status span {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.apo_csv_status_nok {
|
div.apo_csv_status_nok {
|
||||||
background: url(/ScoDoc/static/icons/bullet_warning_img.png) no-repeat left top 0px;
|
background: url(/ScoDoc/static/icons/bullet_warning_img.png) no-repeat left
|
||||||
|
top 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.apo_csv_status_missing_elems {
|
div.apo_csv_status_missing_elems {
|
||||||
background: url(/ScoDoc/static/icons/bullet_warning_img.png) no-repeat left top 0px;
|
background: url(/ScoDoc/static/icons/bullet_warning_img.png) no-repeat left
|
||||||
|
top 0px;
|
||||||
padding-left: 22px;
|
padding-left: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4054,7 +4077,6 @@ div.apo_csv_jury_nok li {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pre.small_pre_acc {
|
pre.small_pre_acc {
|
||||||
font-size: 60%;
|
font-size: 60%;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
@ -4063,7 +4085,7 @@ pre.small_pre_acc {
|
|||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.apo_csv_jury_ok input[type=submit] {
|
.apo_csv_jury_ok input[type="submit"] {
|
||||||
color: green;
|
color: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4610,7 +4632,6 @@ table.table_recap th.col_malus {
|
|||||||
color: rgb(165, 0, 0);
|
color: rgb(165, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.table_recap tr.ects td {
|
table.table_recap tr.ects td {
|
||||||
color: rgb(160, 86, 3);
|
color: rgb(160, 86, 3);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -4688,7 +4709,6 @@ table.table_recap th.evaluation.first_of_mod {
|
|||||||
border-left: 1px dashed rgb(4, 16, 159);
|
border-left: 1px dashed rgb(4, 16, 159);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.table_recap td.evaluation.att {
|
table.table_recap td.evaluation.att {
|
||||||
color: rgb(255, 0, 217);
|
color: rgb(255, 0, 217);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -4760,7 +4780,6 @@ table.evaluations_recap tr.sae td {
|
|||||||
background-color: #d8fcc8;
|
background-color: #d8fcc8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table.evaluations_recap tr.module td {
|
table.evaluations_recap tr.module td {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
44
app/static/libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.css
vendored
Normal file
44
app/static/libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.css
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Bootstrap Multiselect (http://davidstutz.de/bootstrap-multiselect/)
|
||||||
|
*
|
||||||
|
* Apache License, Version 2.0:
|
||||||
|
* Copyright (c) 2012 - 2022 David Stutz
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a
|
||||||
|
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* BSD 3-Clause License:
|
||||||
|
* Copyright (c) 2012 - 2022 David Stutz
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither the name of David Stutz nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
span.multiselect-native-select{position:relative}span.multiselect-native-select select{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px -1px -1px -3px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;left:50%;top:30px}.multiselect.dropdown-toggle:after{display:none}.multiselect{overflow:hidden;text-overflow:ellipsis}.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .multiselect-reset .input-group{width:93%}.multiselect-container .multiselect-filter>.fa-search{z-index:1;padding-left:.75rem}.multiselect-container .multiselect-filter>input.multiselect-search{border:none;border-bottom:1px solid #d3d3d3;padding-left:2rem;margin-left:-1.625rem;border-bottom-right-radius:0;border-bottom-left-radius:0}.multiselect-container .multiselect-filter>input.multiselect-search:focus{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.multiselect-container .multiselect-filter>.multiselect-moz-clear-filter{margin-left:-1.5rem;display:none}.multiselect-container .multiselect-option.multiselect-group-option-indented-full{padding-left:2.6rem}.multiselect-container .multiselect-option.multiselect-group-option-indented{padding-left:1.8rem}.multiselect-container .multiselect-group{cursor:pointer}.multiselect-container .multiselect-group.closed .dropdown-toggle::after{transform:rotate(-90deg)}.multiselect-container .multiselect-group .caret-container~.form-check{margin-left:.5rem}.multiselect-container .multiselect-all,.multiselect-container .multiselect-group,.multiselect-container .multiselect-option{padding:.25rem .25rem .25rem .75rem}.multiselect-container .multiselect-all.dropdown-item,.multiselect-container .multiselect-all.dropdown-toggle,.multiselect-container .multiselect-group.dropdown-item,.multiselect-container .multiselect-group.dropdown-toggle,.multiselect-container .multiselect-option.dropdown-item,.multiselect-container .multiselect-option.dropdown-toggle{cursor:pointer}.multiselect-container .multiselect-all .form-check-label,.multiselect-container .multiselect-group .form-check-label,.multiselect-container .multiselect-option .form-check-label{cursor:pointer}.multiselect-container .multiselect-all.active:not(.multiselect-active-item-fallback),.multiselect-container .multiselect-all:not(.multiselect-active-item-fallback):active,.multiselect-container .multiselect-group.active:not(.multiselect-active-item-fallback),.multiselect-container .multiselect-group:not(.multiselect-active-item-fallback):active,.multiselect-container .multiselect-option.active:not(.multiselect-active-item-fallback),.multiselect-container .multiselect-option:not(.multiselect-active-item-fallback):active{background-color:#d3d3d3;color:#000}.multiselect-container .multiselect-all:focus,.multiselect-container .multiselect-all:hover,.multiselect-container .multiselect-group:focus,.multiselect-container .multiselect-group:hover,.multiselect-container .multiselect-option:focus,.multiselect-container .multiselect-option:hover{background-color:#a9a9a9!important}.multiselect-container .multiselect-all .form-check,.multiselect-container .multiselect-group .form-check,.multiselect-container .multiselect-option .form-check{padding:0 5px 0 20px}.multiselect-container .multiselect-all:focus,.multiselect-container .multiselect-group:focus,.multiselect-container .multiselect-option:focus{outline:0}.form-inline .multiselect-container span.form-check{padding:3px 20px 3px 40px}.input-group.input-group-sm>.multiselect-native-select .multiselect{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;padding-right:1.75rem;height:calc(1.5em + .5rem + 2px)}.input-group>.multiselect-native-select{flex:1 1 auto;width:1%}.input-group>.multiselect-native-select>div.btn-group{width:100%}.input-group>.multiselect-native-select:not(:first-child) .multiselect{border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.multiselect-native-select:not(:last-child) .multiselect{border-top-right-radius:0;border-bottom-right-radius:0}
|
44
app/static/libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.js
vendored
Normal file
44
app/static/libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:bold}.multiselect-container>li>label.multiselect-group{margin:0;padding:3px 20px 3px 20px;height:100%;font-weight:bold}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:normal}.multiselect-container>li>a>label.radio,.multiselect-container>li>a>label.checkbox{margin:0}.multiselect-container>li>a>label>input[type="checkbox"]{margin-bottom:5px}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}
|
|
@ -1,899 +0,0 @@
|
|||||||
/**
|
|
||||||
* bootstrap-multiselect.js
|
|
||||||
* https://github.com/davidstutz/bootstrap-multiselect
|
|
||||||
*
|
|
||||||
* Copyright 2012, 2013 David Stutz
|
|
||||||
*
|
|
||||||
* Dual licensed under the BSD-3-Clause and the Apache License, Version 2.0.
|
|
||||||
*/
|
|
||||||
!function($) {
|
|
||||||
|
|
||||||
"use strict";// jshint ;_;
|
|
||||||
|
|
||||||
if (typeof ko !== 'undefined' && ko.bindingHandlers && !ko.bindingHandlers.multiselect) {
|
|
||||||
ko.bindingHandlers.multiselect = {
|
|
||||||
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {},
|
|
||||||
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
|
||||||
|
|
||||||
var config = ko.utils.unwrapObservable(valueAccessor());
|
|
||||||
var selectOptions = allBindingsAccessor().options;
|
|
||||||
var ms = $(element).data('multiselect');
|
|
||||||
|
|
||||||
if (!ms) {
|
|
||||||
$(element).multiselect(config);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ms.updateOriginalOptions();
|
|
||||||
if (selectOptions && selectOptions().length !== ms.originalOptions.length) {
|
|
||||||
$(element).multiselect('rebuild');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to create a new multiselect using the given select.
|
|
||||||
*
|
|
||||||
* @param {jQuery} select
|
|
||||||
* @param {Object} options
|
|
||||||
* @returns {Multiselect}
|
|
||||||
*/
|
|
||||||
function Multiselect(select, options) {
|
|
||||||
|
|
||||||
this.options = this.mergeOptions(options);
|
|
||||||
this.$select = $(select);
|
|
||||||
|
|
||||||
// Initialization.
|
|
||||||
// We have to clone to create a new reference.
|
|
||||||
this.originalOptions = this.$select.clone()[0].options;
|
|
||||||
this.query = '';
|
|
||||||
this.searchTimeout = null;
|
|
||||||
|
|
||||||
this.options.multiple = this.$select.attr('multiple') === "multiple";
|
|
||||||
this.options.onChange = $.proxy(this.options.onChange, this);
|
|
||||||
this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this);
|
|
||||||
this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this);
|
|
||||||
|
|
||||||
// Build select all if enabled.
|
|
||||||
this.buildContainer();
|
|
||||||
this.buildButton();
|
|
||||||
this.buildSelectAll();
|
|
||||||
this.buildDropdown();
|
|
||||||
this.buildDropdownOptions();
|
|
||||||
this.buildFilter();
|
|
||||||
|
|
||||||
this.updateButtonText();
|
|
||||||
this.updateSelectAll();
|
|
||||||
|
|
||||||
this.$select.hide().after(this.$container);
|
|
||||||
};
|
|
||||||
|
|
||||||
Multiselect.prototype = {
|
|
||||||
|
|
||||||
defaults: {
|
|
||||||
/**
|
|
||||||
* Default text function will either print 'None selected' in case no
|
|
||||||
* option is selected or a list of the selected options up to a length of 3 selected options.
|
|
||||||
*
|
|
||||||
* @param {jQuery} options
|
|
||||||
* @param {jQuery} select
|
|
||||||
* @returns {String}
|
|
||||||
*/
|
|
||||||
buttonText: function(options, select) {
|
|
||||||
if (options.length === 0) {
|
|
||||||
return this.nonSelectedText + ' <b class="caret"></b>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (options.length > this.numberDisplayed) {
|
|
||||||
return options.length + ' ' + this.nSelectedText + ' <b class="caret"></b>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var selected = '';
|
|
||||||
options.each(function() {
|
|
||||||
var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).html();
|
|
||||||
|
|
||||||
selected += label + ', ';
|
|
||||||
});
|
|
||||||
return selected.substr(0, selected.length - 2) + ' <b class="caret"></b>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Updates the title of the button similar to the buttonText function.
|
|
||||||
* @param {jQuery} options
|
|
||||||
* @param {jQuery} select
|
|
||||||
* @returns {@exp;selected@call;substr}
|
|
||||||
*/
|
|
||||||
buttonTitle: function(options, select) {
|
|
||||||
if (options.length === 0) {
|
|
||||||
return this.nonSelectedText;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var selected = '';
|
|
||||||
options.each(function () {
|
|
||||||
selected += $(this).text() + ', ';
|
|
||||||
});
|
|
||||||
return selected.substr(0, selected.length - 2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Create a label.
|
|
||||||
*
|
|
||||||
* @param {jQuery} element
|
|
||||||
* @returns {String}
|
|
||||||
*/
|
|
||||||
label: function(element){
|
|
||||||
return $(element).attr('label') || $(element).html();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Triggered on change of the multiselect.
|
|
||||||
* Not triggered when selecting/deselecting options manually.
|
|
||||||
*
|
|
||||||
* @param {jQuery} option
|
|
||||||
* @param {Boolean} checked
|
|
||||||
*/
|
|
||||||
onChange : function(option, checked) {
|
|
||||||
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Triggered when the dropdown is shown.
|
|
||||||
*
|
|
||||||
* @param {jQuery} event
|
|
||||||
*/
|
|
||||||
onDropdownShow: function(event) {
|
|
||||||
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Triggered when the dropdown is hidden.
|
|
||||||
*
|
|
||||||
* @param {jQuery} event
|
|
||||||
*/
|
|
||||||
onDropdownHide: function(event) {
|
|
||||||
|
|
||||||
},
|
|
||||||
buttonClass: 'btn btn-default',
|
|
||||||
dropRight: false,
|
|
||||||
selectedClass: 'active',
|
|
||||||
buttonWidth: 'auto',
|
|
||||||
buttonContainer: '<div class="btn-group" />',
|
|
||||||
// Maximum height of the dropdown menu.
|
|
||||||
// If maximum height is exceeded a scrollbar will be displayed.
|
|
||||||
maxHeight: false,
|
|
||||||
includeSelectAllOption: false,
|
|
||||||
selectAllText: ' Select all',
|
|
||||||
selectAllValue: 'multiselect-all',
|
|
||||||
enableFiltering: false,
|
|
||||||
enableCaseInsensitiveFiltering: false,
|
|
||||||
filterPlaceholder: 'Search',
|
|
||||||
// possible options: 'text', 'value', 'both'
|
|
||||||
filterBehavior: 'text',
|
|
||||||
preventInputChangeEvent: false,
|
|
||||||
nonSelectedText: 'None selected',
|
|
||||||
nSelectedText: 'selected',
|
|
||||||
numberDisplayed: 3
|
|
||||||
},
|
|
||||||
|
|
||||||
templates: {
|
|
||||||
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"></button>',
|
|
||||||
ul: '<ul class="multiselect-container dropdown-menu"></ul>',
|
|
||||||
filter: '<div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div>',
|
|
||||||
li: '<li><a href="javascript:void(0);"><label></label></a></li>',
|
|
||||||
divider: '<li class="divider"></li>',
|
|
||||||
liGroup: '<li><label class="multiselect-group"></label></li>'
|
|
||||||
},
|
|
||||||
|
|
||||||
constructor: Multiselect,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the container of the multiselect.
|
|
||||||
*/
|
|
||||||
buildContainer: function() {
|
|
||||||
this.$container = $(this.options.buttonContainer);
|
|
||||||
this.$container.on('show.bs.dropdown', this.options.onDropdownShow);
|
|
||||||
this.$container.on('hide.bs.dropdown', this.options.onDropdownHide);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the button of the multiselect.
|
|
||||||
*/
|
|
||||||
buildButton: function() {
|
|
||||||
this.$button = $(this.templates.button).addClass(this.options.buttonClass);
|
|
||||||
|
|
||||||
// Adopt active state.
|
|
||||||
if (this.$select.prop('disabled')) {
|
|
||||||
this.disable();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manually add button width if set.
|
|
||||||
if (this.options.buttonWidth && this.options.buttonWidth != 'auto') {
|
|
||||||
this.$button.css({
|
|
||||||
'width' : this.options.buttonWidth
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep the tab index from the select.
|
|
||||||
var tabindex = this.$select.attr('tabindex');
|
|
||||||
if (tabindex) {
|
|
||||||
this.$button.attr('tabindex', tabindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$container.prepend(this.$button);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the ul representing the dropdown menu.
|
|
||||||
*/
|
|
||||||
buildDropdown: function() {
|
|
||||||
|
|
||||||
// Build ul.
|
|
||||||
this.$ul = $(this.templates.ul);
|
|
||||||
|
|
||||||
if (this.options.dropRight) {
|
|
||||||
this.$ul.addClass('pull-right');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set max height of dropdown menu to activate auto scrollbar.
|
|
||||||
if (this.options.maxHeight) {
|
|
||||||
// TODO: Add a class for this option to move the css declarations.
|
|
||||||
this.$ul.css({
|
|
||||||
'max-height': this.options.maxHeight + 'px',
|
|
||||||
'overflow-y': 'auto',
|
|
||||||
'overflow-x': 'hidden'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$container.append(this.$ul);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the dropdown options and binds all nessecary events.
|
|
||||||
* Uses createDivider and createOptionValue to create the necessary options.
|
|
||||||
*/
|
|
||||||
buildDropdownOptions: function() {
|
|
||||||
|
|
||||||
this.$select.children().each($.proxy(function(index, element) {
|
|
||||||
|
|
||||||
// Support optgroups and options without a group simultaneously.
|
|
||||||
var tag = $(element).prop('tagName')
|
|
||||||
.toLowerCase();
|
|
||||||
|
|
||||||
if (tag === 'optgroup') {
|
|
||||||
this.createOptgroup(element);
|
|
||||||
}
|
|
||||||
else if (tag === 'option') {
|
|
||||||
|
|
||||||
if ($(element).data('role') === 'divider') {
|
|
||||||
this.createDivider();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.createOptionValue(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other illegal tags will be ignored.
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
// Bind the change event on the dropdown elements.
|
|
||||||
$('li input', this.$ul).on('change', $.proxy(function(event) {
|
|
||||||
var checked = $(event.target).prop('checked') || false;
|
|
||||||
var isSelectAllOption = $(event.target).val() === this.options.selectAllValue;
|
|
||||||
|
|
||||||
// Apply or unapply the configured selected class.
|
|
||||||
if (this.options.selectedClass) {
|
|
||||||
if (checked) {
|
|
||||||
$(event.target).parents('li')
|
|
||||||
.addClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(event.target).parents('li')
|
|
||||||
.removeClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the corresponding option.
|
|
||||||
var value = $(event.target).val();
|
|
||||||
var $option = this.getOptionByValue(value);
|
|
||||||
|
|
||||||
var $optionsNotThis = $('option', this.$select).not($option);
|
|
||||||
var $checkboxesNotThis = $('input', this.$container).not($(event.target));
|
|
||||||
|
|
||||||
if (isSelectAllOption) {
|
|
||||||
if (this.$select[0][0].value === this.options.selectAllValue) {
|
|
||||||
var values = [];
|
|
||||||
var options = $('option[value!="' + this.options.selectAllValue + '"]', this.$select);
|
|
||||||
for (var i = 0; i < options.length; i++) {
|
|
||||||
// Additionally check whether the option is visible within the dropcown.
|
|
||||||
if (options[i].value !== this.options.selectAllValue && this.getInputByValue(options[i].value).is(':visible')) {
|
|
||||||
values.push(options[i].value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checked) {
|
|
||||||
this.select(values);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.deselect(values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checked) {
|
|
||||||
$option.prop('selected', true);
|
|
||||||
|
|
||||||
if (this.options.multiple) {
|
|
||||||
// Simply select additional option.
|
|
||||||
$option.prop('selected', true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Unselect all other options and corresponding checkboxes.
|
|
||||||
if (this.options.selectedClass) {
|
|
||||||
$($checkboxesNotThis).parents('li').removeClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
$($checkboxesNotThis).prop('checked', false);
|
|
||||||
$optionsNotThis.prop('selected', false);
|
|
||||||
|
|
||||||
// It's a single selection, so close.
|
|
||||||
this.$button.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.options.selectedClass === "active") {
|
|
||||||
$optionsNotThis.parents("a").css("outline", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Unselect option.
|
|
||||||
$option.prop('selected', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$select.change();
|
|
||||||
this.options.onChange($option, checked);
|
|
||||||
|
|
||||||
this.updateButtonText();
|
|
||||||
this.updateSelectAll();
|
|
||||||
|
|
||||||
if(this.options.preventInputChangeEvent) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
$('li a', this.$ul).on('touchstart click', function(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
if (event.shiftKey) {
|
|
||||||
var checked = $(event.target).prop('checked') || false;
|
|
||||||
|
|
||||||
if (checked) {
|
|
||||||
var prev = $(event.target).parents('li:last')
|
|
||||||
.siblings('li[class="active"]:first');
|
|
||||||
|
|
||||||
var currentIdx = $(event.target).parents('li')
|
|
||||||
.index();
|
|
||||||
var prevIdx = prev.index();
|
|
||||||
|
|
||||||
if (currentIdx > prevIdx) {
|
|
||||||
$(event.target).parents("li:last").prevUntil(prev).each(
|
|
||||||
function() {
|
|
||||||
$(this).find("input:first").prop("checked", true)
|
|
||||||
.trigger("change");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(event.target).parents("li:last").nextUntil(prev).each(
|
|
||||||
function() {
|
|
||||||
$(this).find("input:first").prop("checked", true)
|
|
||||||
.trigger("change");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(event.target).blur();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Keyboard support.
|
|
||||||
this.$container.on('keydown', $.proxy(function(event) {
|
|
||||||
if ($('input[type="text"]', this.$container).is(':focus')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((event.keyCode === 9 || event.keyCode === 27)
|
|
||||||
&& this.$container.hasClass('open')) {
|
|
||||||
|
|
||||||
// Close on tab or escape.
|
|
||||||
this.$button.click();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var $items = $(this.$container).find("li:not(.divider):visible a");
|
|
||||||
|
|
||||||
if (!$items.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var index = $items.index($items.filter(':focus'));
|
|
||||||
|
|
||||||
// Navigation up.
|
|
||||||
if (event.keyCode === 38 && index > 0) {
|
|
||||||
index--;
|
|
||||||
}
|
|
||||||
// Navigate down.
|
|
||||||
else if (event.keyCode === 40 && index < $items.length - 1) {
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
else if (!~index) {
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var $current = $items.eq(index);
|
|
||||||
$current.focus();
|
|
||||||
|
|
||||||
if (event.keyCode === 32 || event.keyCode === 13) {
|
|
||||||
var $checkbox = $current.find('input');
|
|
||||||
|
|
||||||
$checkbox.prop("checked", !$checkbox.prop("checked"));
|
|
||||||
$checkbox.change();
|
|
||||||
}
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
}, this));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an option using the given select option.
|
|
||||||
*
|
|
||||||
* @param {jQuery} element
|
|
||||||
*/
|
|
||||||
createOptionValue: function(element) {
|
|
||||||
if ($(element).is(':selected')) {
|
|
||||||
$(element).prop('selected', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Support the label attribute on options.
|
|
||||||
var label = this.options.label(element);
|
|
||||||
var value = $(element).val();
|
|
||||||
var inputType = this.options.multiple ? "checkbox" : "radio";
|
|
||||||
|
|
||||||
var $li = $(this.templates.li);
|
|
||||||
$('label', $li).addClass(inputType);
|
|
||||||
$('label', $li).append('<input type="' + inputType + '" />');
|
|
||||||
|
|
||||||
var selected = $(element).prop('selected') || false;
|
|
||||||
var $checkbox = $('input', $li);
|
|
||||||
$checkbox.val(value);
|
|
||||||
|
|
||||||
if (value === this.options.selectAllValue) {
|
|
||||||
$checkbox.parent().parent()
|
|
||||||
.addClass('multiselect-all');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('label', $li).append(" " + label);
|
|
||||||
|
|
||||||
this.$ul.append($li);
|
|
||||||
|
|
||||||
if ($(element).is(':disabled')) {
|
|
||||||
$checkbox.attr('disabled', 'disabled')
|
|
||||||
.prop('disabled', true)
|
|
||||||
.parents('li')
|
|
||||||
.addClass('disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
$checkbox.prop('checked', selected);
|
|
||||||
|
|
||||||
if (selected && this.options.selectedClass) {
|
|
||||||
$checkbox.parents('li')
|
|
||||||
.addClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a divider using the given select option.
|
|
||||||
*
|
|
||||||
* @param {jQuery} element
|
|
||||||
*/
|
|
||||||
createDivider: function(element) {
|
|
||||||
var $divider = $(this.templates.divider);
|
|
||||||
this.$ul.append($divider);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an optgroup.
|
|
||||||
*
|
|
||||||
* @param {jQuery} group
|
|
||||||
*/
|
|
||||||
createOptgroup: function(group) {
|
|
||||||
var groupName = $(group).prop('label');
|
|
||||||
|
|
||||||
// Add a header for the group.
|
|
||||||
var $li = $(this.templates.liGroup);
|
|
||||||
$('label', $li).text(groupName);
|
|
||||||
|
|
||||||
this.$ul.append($li);
|
|
||||||
|
|
||||||
// Add the options of the group.
|
|
||||||
$('option', group).each($.proxy(function(index, element) {
|
|
||||||
this.createOptionValue(element);
|
|
||||||
}, this));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the selct all.
|
|
||||||
* Checks if a select all ahs already been created.
|
|
||||||
*/
|
|
||||||
buildSelectAll: function() {
|
|
||||||
var alreadyHasSelectAll = this.hasSelectAll();
|
|
||||||
|
|
||||||
// If options.includeSelectAllOption === true, add the include all checkbox.
|
|
||||||
if (this.options.includeSelectAllOption && this.options.multiple && !alreadyHasSelectAll) {
|
|
||||||
this.$select.prepend('<option value="' + this.options.selectAllValue + '">' + this.options.selectAllText + '</option>');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the filter.
|
|
||||||
*/
|
|
||||||
buildFilter: function() {
|
|
||||||
|
|
||||||
// Build filter if filtering OR case insensitive filtering is enabled and the number of options exceeds (or equals) enableFilterLength.
|
|
||||||
if (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering) {
|
|
||||||
var enableFilterLength = Math.max(this.options.enableFiltering, this.options.enableCaseInsensitiveFiltering);
|
|
||||||
|
|
||||||
if (this.$select.find('option').length >= enableFilterLength) {
|
|
||||||
|
|
||||||
this.$filter = $(this.templates.filter);
|
|
||||||
$('input', this.$filter).attr('placeholder', this.options.filterPlaceholder);
|
|
||||||
this.$ul.prepend(this.$filter);
|
|
||||||
|
|
||||||
this.$filter.val(this.query).on('click', function(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
}).on('input keydown', $.proxy(function(event) {
|
|
||||||
// This is useful to catch "keydown" events after the browser has updated the control.
|
|
||||||
clearTimeout(this.searchTimeout);
|
|
||||||
|
|
||||||
this.searchTimeout = this.asyncFunction($.proxy(function() {
|
|
||||||
|
|
||||||
if (this.query !== event.target.value) {
|
|
||||||
this.query = event.target.value;
|
|
||||||
|
|
||||||
$.each($('li', this.$ul), $.proxy(function(index, element) {
|
|
||||||
var value = $('input', element).val();
|
|
||||||
var text = $('label', element).text();
|
|
||||||
|
|
||||||
if (value !== this.options.selectAllValue && text) {
|
|
||||||
// by default lets assume that element is not
|
|
||||||
// interesting for this search
|
|
||||||
var showElement = false;
|
|
||||||
|
|
||||||
var filterCandidate = '';
|
|
||||||
if ((this.options.filterBehavior === 'text' || this.options.filterBehavior === 'both')) {
|
|
||||||
filterCandidate = text;
|
|
||||||
}
|
|
||||||
if ((this.options.filterBehavior === 'value' || this.options.filterBehavior === 'both')) {
|
|
||||||
filterCandidate = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.options.enableCaseInsensitiveFiltering && filterCandidate.toLowerCase().indexOf(this.query.toLowerCase()) > -1) {
|
|
||||||
showElement = true;
|
|
||||||
}
|
|
||||||
else if (filterCandidate.indexOf(this.query) > -1) {
|
|
||||||
showElement = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showElement) {
|
|
||||||
$(element).show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(element).hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: check whether select all option needs to be updated.
|
|
||||||
}, this), 300, this);
|
|
||||||
}, this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unbinds the whole plugin.
|
|
||||||
*/
|
|
||||||
destroy: function() {
|
|
||||||
this.$container.remove();
|
|
||||||
this.$select.show();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refreshs the multiselect based on the selected options of the select.
|
|
||||||
*/
|
|
||||||
refresh: function() {
|
|
||||||
$('option', this.$select).each($.proxy(function(index, element) {
|
|
||||||
var $input = $('li input', this.$ul).filter(function() {
|
|
||||||
return $(this).val() === $(element).val();
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($(element).is(':selected')) {
|
|
||||||
$input.prop('checked', true);
|
|
||||||
|
|
||||||
if (this.options.selectedClass) {
|
|
||||||
$input.parents('li')
|
|
||||||
.addClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$input.prop('checked', false);
|
|
||||||
|
|
||||||
if (this.options.selectedClass) {
|
|
||||||
$input.parents('li')
|
|
||||||
.removeClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($(element).is(":disabled")) {
|
|
||||||
$input.attr('disabled', 'disabled')
|
|
||||||
.prop('disabled', true)
|
|
||||||
.parents('li')
|
|
||||||
.addClass('disabled');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$input.prop('disabled', false)
|
|
||||||
.parents('li')
|
|
||||||
.removeClass('disabled');
|
|
||||||
}
|
|
||||||
}, this));
|
|
||||||
|
|
||||||
this.updateButtonText();
|
|
||||||
this.updateSelectAll();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select all options of the given values.
|
|
||||||
*
|
|
||||||
* @param {Array} selectValues
|
|
||||||
*/
|
|
||||||
select: function(selectValues) {
|
|
||||||
if(selectValues && !$.isArray(selectValues)) {
|
|
||||||
selectValues = [selectValues];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < selectValues.length; i++) {
|
|
||||||
var value = selectValues[i];
|
|
||||||
|
|
||||||
var $option = this.getOptionByValue(value);
|
|
||||||
var $checkbox = this.getInputByValue(value);
|
|
||||||
|
|
||||||
if (this.options.selectedClass) {
|
|
||||||
$checkbox.parents('li')
|
|
||||||
.addClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
$checkbox.prop('checked', true);
|
|
||||||
$option.prop('selected', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateButtonText();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deselects all options of the given values.
|
|
||||||
*
|
|
||||||
* @param {Array} deselectValues
|
|
||||||
*/
|
|
||||||
deselect: function(deselectValues) {
|
|
||||||
if(deselectValues && !$.isArray(deselectValues)) {
|
|
||||||
deselectValues = [deselectValues];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < deselectValues.length; i++) {
|
|
||||||
|
|
||||||
var value = deselectValues[i];
|
|
||||||
|
|
||||||
var $option = this.getOptionByValue(value);
|
|
||||||
var $checkbox = this.getInputByValue(value);
|
|
||||||
|
|
||||||
if (this.options.selectedClass) {
|
|
||||||
$checkbox.parents('li')
|
|
||||||
.removeClass(this.options.selectedClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
$checkbox.prop('checked', false);
|
|
||||||
$option.prop('selected', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateButtonText();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rebuild the plugin.
|
|
||||||
* Rebuilds the dropdown, the filter and the select all option.
|
|
||||||
*/
|
|
||||||
rebuild: function() {
|
|
||||||
this.$ul.html('');
|
|
||||||
|
|
||||||
// Remove select all option in select.
|
|
||||||
$('option[value="' + this.options.selectAllValue + '"]', this.$select).remove();
|
|
||||||
|
|
||||||
// Important to distinguish between radios and checkboxes.
|
|
||||||
this.options.multiple = this.$select.attr('multiple') === "multiple";
|
|
||||||
|
|
||||||
this.buildSelectAll();
|
|
||||||
this.buildDropdownOptions();
|
|
||||||
this.buildFilter();
|
|
||||||
|
|
||||||
this.updateButtonText();
|
|
||||||
this.updateSelectAll();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The provided data will be used to build the dropdown.
|
|
||||||
*
|
|
||||||
* @param {Array} dataprovider
|
|
||||||
*/
|
|
||||||
dataprovider: function(dataprovider) {
|
|
||||||
var optionDOM = "";
|
|
||||||
dataprovider.forEach(function (option) {
|
|
||||||
optionDOM += '<option value="' + option.value + '">' + option.label + '</option>';
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$select.html(optionDOM);
|
|
||||||
this.rebuild();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the multiselect.
|
|
||||||
*/
|
|
||||||
enable: function() {
|
|
||||||
this.$select.prop('disabled', false);
|
|
||||||
this.$button.prop('disabled', false)
|
|
||||||
.removeClass('disabled');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the multiselect.
|
|
||||||
*/
|
|
||||||
disable: function() {
|
|
||||||
this.$select.prop('disabled', true);
|
|
||||||
this.$button.prop('disabled', true)
|
|
||||||
.addClass('disabled');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the options.
|
|
||||||
*
|
|
||||||
* @param {Array} options
|
|
||||||
*/
|
|
||||||
setOptions: function(options) {
|
|
||||||
this.options = this.mergeOptions(options);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Merges the given options with the default options.
|
|
||||||
*
|
|
||||||
* @param {Array} options
|
|
||||||
* @returns {Array}
|
|
||||||
*/
|
|
||||||
mergeOptions: function(options) {
|
|
||||||
return $.extend({}, this.defaults, options);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a select all option is present.
|
|
||||||
*
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
hasSelectAll: function() {
|
|
||||||
return this.$select[0][0] ? this.$select[0][0].value === this.options.selectAllValue : false;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the select all option based on the currently selected options.
|
|
||||||
*/
|
|
||||||
updateSelectAll: function() {
|
|
||||||
if (this.hasSelectAll()) {
|
|
||||||
var selected = this.getSelected();
|
|
||||||
|
|
||||||
if (selected.length === $('option', this.$select).length - 1) {
|
|
||||||
this.select(this.options.selectAllValue);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.deselect(this.options.selectAllValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the button text and its title base don the currenty selected options.
|
|
||||||
*/
|
|
||||||
updateButtonText: function() {
|
|
||||||
var options = this.getSelected();
|
|
||||||
|
|
||||||
// First update the displayed button text.
|
|
||||||
$('button', this.$container).html(this.options.buttonText(options, this.$select));
|
|
||||||
|
|
||||||
// Now update the title attribute of the button.
|
|
||||||
$('button', this.$container).attr('title', this.options.buttonTitle(options, this.$select));
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all selected options.
|
|
||||||
*
|
|
||||||
* @returns {jQUery}
|
|
||||||
*/
|
|
||||||
getSelected: function() {
|
|
||||||
return $('option[value!="' + this.options.selectAllValue + '"]:selected', this.$select).filter(function() {
|
|
||||||
return $(this).prop('selected');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a select option by its value.
|
|
||||||
*
|
|
||||||
* @param {String} value
|
|
||||||
* @returns {jQuery}
|
|
||||||
*/
|
|
||||||
getOptionByValue: function(value) {
|
|
||||||
return $('option', this.$select).filter(function() {
|
|
||||||
return $(this).val() === value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the input (radio/checkbox) by its value.
|
|
||||||
*
|
|
||||||
* @param {String} value
|
|
||||||
* @returns {jQuery}
|
|
||||||
*/
|
|
||||||
getInputByValue: function(value) {
|
|
||||||
return $('li input', this.$ul).filter(function() {
|
|
||||||
return $(this).val() === value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for knockout integration.
|
|
||||||
*/
|
|
||||||
updateOriginalOptions: function() {
|
|
||||||
this.originalOptions = this.$select.clone()[0].options;
|
|
||||||
},
|
|
||||||
|
|
||||||
asyncFunction: function(callback, timeout, self) {
|
|
||||||
var args = Array.prototype.slice.call(arguments, 3);
|
|
||||||
return setTimeout(function() {
|
|
||||||
callback.apply(self || window, args);
|
|
||||||
}, timeout);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.multiselect = function(option, parameter) {
|
|
||||||
return this.each(function() {
|
|
||||||
var data = $(this).data('multiselect');
|
|
||||||
var options = typeof option === 'object' && option;
|
|
||||||
|
|
||||||
// Initialize the multiselect.
|
|
||||||
if (!data) {
|
|
||||||
$(this).data('multiselect', ( data = new Multiselect(this, options)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call multiselect method.
|
|
||||||
if (typeof option === 'string') {
|
|
||||||
data[option](parameter);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.multiselect.Constructor = Multiselect;
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
$("select[data-role=multiselect]").multiselect();
|
|
||||||
});
|
|
||||||
|
|
||||||
}(window.jQuery);
|
|
Loading…
Reference in New Issue
Block a user