Browse Source

Suite de 8096ed17e4 : il faut prefixer tous les dropdown en roles-dropdown car sinon on conflicte potentiellement avec un BootStrap plus recent et le CSS+JS que le plugin ajoute cassent le reste du site

master
Cerdic 9 months ago
parent
commit
7b21f155a9
  1. 44
      css/roles-dropdown.css
  2. 8
      formulaires/inc-editer_liens_actions_roles.html
  3. 16
      javascript/roles-dropdown.js
  4. 2
      paquet.xml
  5. 6
      prive/style_prive_plugin_roles.html
  6. 2
      roles_pipelines.php

44
css/roles-dropdown.css

@ -167,7 +167,7 @@ button.roles-btn-mini {
border-bottom-left-radius: 4px;
}
.roles-btn-group > .roles-btn:last-child,
.roles-btn-group > .dropdown-toggle {
.roles-btn-group > .roles-dropdown-toggle {
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
@ -181,11 +181,11 @@ button.roles-btn-mini {
.roles-btn-group > .roles-btn.active {
z-index: 2;
}
.roles-btn-group .dropdown-toggle:active,
.roles-btn-group.open .dropdown-toggle {
.roles-btn-group .roles-dropdown-toggle:active,
.roles-btn-group.open .roles-dropdown-toggle {
outline: 0;
}
.roles-btn-group > .dropdown-toggle {
.roles-btn-group > .roles-dropdown-toggle {
padding-left: 8px;
padding-right: 8px;
-webkit-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
@ -194,17 +194,17 @@ button.roles-btn-mini {
*padding-top: 4px;
*padding-bottom: 4px;
}
.roles-btn-group > .roles-btn.dropdown-toggle {
.roles-btn-group > .roles-btn.roles-dropdown-toggle {
padding-left: 5px;
padding-right: 5px;
}
.roles-btn-group.open .dropdown-toggle {
.roles-btn-group.open .roles-dropdown-toggle {
background-image: none;
-webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
}
.roles-btn-group.open .roles-btn.dropdown-toggle {
.roles-btn-group.open .roles-btn.roles-dropdown-toggle {
background-color: #e6e6e6;
}
.roles-btn .caret {
@ -219,14 +219,14 @@ button.roles-btn-mini {
.roles-btn .caret {
margin-top: 5px;
}
.dropdown {
.roles-dropdown {
position: relative;
}
.dropdown-toggle {
.roles-dropdown-toggle {
*margin-bottom: -3px;
}
.dropdown-toggle:active,
.open .dropdown-toggle {
.roles-dropdown-toggle:active,
.open .roles-dropdown-toggle {
outline: 0;
}
.caret {
@ -241,16 +241,16 @@ button.roles-btn-mini {
opacity: 0.3;
filter: alpha(opacity=30);
}
.dropdown .caret {
.roles-dropdown .caret {
margin-top: 8px;
margin-left: 2px;
}
.dropdown:hover .caret,
.roles-dropdown:hover .caret,
.open .caret {
opacity: 1;
filter: alpha(opacity=100);
}
.dropdown-menu {
.roles-dropdown-menu {
position: absolute;
top: 100%;
left: 0;
@ -276,11 +276,11 @@ button.roles-btn-mini {
-moz-background-clip: padding;
background-clip: padding-box;
}
.dropdown-menu.pull-right {
.roles-dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
.roles-dropdown-menu .divider {
*width: 100%;
height: 1px;
margin: 8px 1px;
@ -289,7 +289,7 @@ button.roles-btn-mini {
background-color: #e5e5e5;
border-bottom: 1px solid #ffffff;
}
.dropdown-menu a {
.roles-dropdown-menu a {
display: block;
padding: 3px 15px;
clear: both;
@ -298,9 +298,9 @@ button.roles-btn-mini {
color: #333333;
white-space: nowrap;
}
.dropdown-menu li > a:hover,
.dropdown-menu .active > a,
.dropdown-menu .active > a:hover {
.roles-dropdown-menu li > a:hover,
.roles-dropdown-menu .active > a,
.roles-dropdown-menu .active > a:hover {
color: #ffffff;
text-decoration: none;
background-color: #0088cc;
@ -308,10 +308,10 @@ button.roles-btn-mini {
.open {
*z-index: 1000;
}
.open > .dropdown-menu {
.open > .roles-dropdown-menu {
display: block;
}
.pull-right > .dropdown-menu {
.pull-right > .roles-dropdown-menu {
right: 0;
left: auto;
}

8
formulaires/inc-editer_liens_actions_roles.html

@ -1,12 +1,12 @@
#SET{presents,#ENV{id}|roles_presents_sur_id{#ENV{objet_source},#ENV{objet},#ENV{id_objet},#ENV{_objet_lien}}}
<div class="roles-btn-group">
<a data-toggle="dropdown" href="#" title="<:roles:modifier_roles_title:>" class="roles-btn dropdown-toggle">[(#ENV{libelle,<:roles:modifier_roles:>})]
<a data-toggle="roles-dropdown" href="#" title="<:roles:modifier_roles_title:>" class="roles-btn roles-dropdown-toggle">[(#ENV{libelle,<:roles:modifier_roles:>})]
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<ul class="roles-dropdown-menu">
<B_roles_presents>
<li class='dropdown-header'><:roles:enlever_role:></li>
<li class='roles-dropdown-header'><:roles:enlever_role:></li>
<BOUCLE_roles_presents(DATA){source table,#ENV{_roles/roles/choix}}{valeur IN #GET{presents}}>
<li>
<button type="submit" name="supprimer_lien\[#ENV{cle}-#VALEUR\]" class="link roles-btn delete">
@ -18,7 +18,7 @@
</B_roles_presents>
<B_roles_absents>
<li class='dropdown-header'><:roles:ajouter_role:></li>
<li class='roles-dropdown-header'><:roles:ajouter_role:></li>
<BOUCLE_roles_absents(DATA){source table,#ENV{_roles/roles/choix}}{valeur !IN #GET{presents}}>
<li>
<button type="submit" name="ajouter_lien\[#ENV{cle}-#VALEUR\]" class="link roles-btn delete">

16
javascript/bootstrap-dropdown.js → javascript/roles-dropdown.js

@ -26,10 +26,10 @@
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle="dropdown"]'
var toggle = '[data-toggle="roles-dropdown"]'
, Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
var $el = $(element).on('click.roles-dropdown.data-api', this.toggle)
$('html').on('click.roles-dropdown.data-api', function () {
$el.parent().removeClass('open')
})
}
@ -78,8 +78,8 @@
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
, data = $this.data('roles-dropdown')
if (!data) $this.data('roles-dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
@ -91,10 +91,10 @@
* =================================== */
$(function () {
$('html').on('click.dropdown.data-api', clearMenus)
$('html').on('click.roles-dropdown.data-api', clearMenus)
$('body')
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('click.roles-dropdown', '.roles-dropdown form', function (e) { e.stopPropagation() })
.on('click.roles-dropdown.data-api', toggle, Dropdown.prototype.toggle)
})
}(window.jQuery);

2
paquet.xml

@ -1,7 +1,7 @@
<paquet
prefix="roles"
categorie="outil"
version="2.1.2"
version="2.2.0"
etat="test"
compatibilite="[3.1.0;4.0.*]"
logo="prive/themes/spip/images/roles-64.png"

6
prive/style_prive_plugin_roles.html

@ -3,12 +3,12 @@
.liste-objets-associer td {vertical-align:middle;}
/* gérer le sélecteur dropdown, des titres dedans, les boutons.link */
.dropdown-menu .dropdown-header {font-weight:bold; color:#666;}
.formulaire_spip .spip .dropdown-menu li:not(.divider) {
.roles-dropdown-menu .roles-dropdown-header {font-weight:bold; color:#666;}
.formulaire_spip .spip .roles-dropdown-menu li:not(.divider) {
text-align:left;
padding:.2em 1em;
}
.dropdown-menu button.link {border-radius:0; box-shadow:none;}
.roles-dropdown-menu button.link {border-radius:0; box-shadow:none;}
/* adapter le dropdown "modifier" et le caler à droite */

2
roles_pipelines.php

@ -25,7 +25,7 @@ function roles_jquery_plugins($flux) {
$config = lire_config('chosen/active', false);
}
if (test_espace_prive() || ($config === 'oui')) {
$flux[] = 'javascript/bootstrap-dropdown.js';
$flux[] = 'javascript/roles-dropdown.js';
}
return $flux;
}

Loading…
Cancel
Save