Browse Source

publish muk_web_utils - 12.0

pull/35/head
MuK IT GmbH 6 years ago
parent
commit
398cdfa577
  1. 2
      muk_web_utils/__manifest__.py
  2. 155
      muk_web_utils/static/src/scss/switch.scss
  3. 36
      muk_web_utils/static/src/scss/variables.scss
  4. 65
      muk_web_utils/static/src/xml/switch.xml
  5. 19
      muk_web_utils/template/assets.xml

2
muk_web_utils/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Web Utils",
"summary": """Utility Features""",
"version": "12.0.2.0.17",
"version": "12.0.2.0.19",
"category": "Extra Tools",
"license": "AGPL-3",
"author": "MuK IT",

155
muk_web_utils/static/src/scss/switch.scss

@ -0,0 +1,155 @@
/**********************************************************************************
*
* Copyright (C) 2017 MuK IT GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
.switch {
font-size: $font-size-base;
position: relative;
input {
position: absolute;
height: 1px;
width: 1px;
background: none;
border: 0;
clip: rect(0 0 0 0);
clip-path: inset(50%);
overflow: hidden;
padding: 0;
+ label {
position: relative;
min-width: calc(#{$switch-height} * 2);
border-radius: $switch-border-radius;
height: $switch-height;
line-height: $switch-height;
display: inline-block;
cursor: pointer;
outline: none;
user-select: none;
vertical-align: middle;
text-indent: calc(calc(#{$switch-height} * 2) + .5rem);
}
+ label::before,
+ label::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: calc(#{$switch-height} * 2);
bottom: 0;
display: block;
}
+ label::before {
right: 0;
background-color: $switch-bg;
border-radius: $switch-border-radius;
transition: $switch-transition;
}
+ label::after {
top: $switch-thumb-padding;
left: $switch-thumb-padding;
width: calc(#{$switch-height} - calc(#{$switch-thumb-padding} * 2));
height: calc(#{$switch-height} - calc(#{$switch-thumb-padding} * 2));
border-radius: $switch-thumb-border-radius;
background-color: $switch-thumb-bg;
transition: $switch-transition;
}
&:checked + label::before {
background-color: $switch-checked-bg;
}
&:checked + label::after {
margin-left: $switch-height;
}
&:focus + label::before {
outline: none;
box-shadow: $switch-focus-box-shadow;
}
&:disabled + label {
color: $switch-disabled-color;
cursor: not-allowed;
}
&:disabled + label::before {
background-color: $switch-disabled-bg;
}
}
&.switch-sm {
font-size: $font-size-sm;
input {
+ label {
min-width: calc(#{$switch-height-sm} * 2);
height: $switch-height-sm;
line-height: $switch-height-sm;
text-indent: calc(calc(#{$switch-height-sm} * 2) + .5rem);
}
+ label::before {
width: calc(#{$switch-height-sm} * 2);
}
+ label::after {
width: calc(#{$switch-height-sm} - calc(#{$switch-thumb-padding} * 2));
height: calc(#{$switch-height-sm} - calc(#{$switch-thumb-padding} * 2));
}
&:checked + label::after {
margin-left: $switch-height-sm;
}
}
}
&.switch-lg {
font-size: $font-size-lg;
input {
+ label {
min-width: calc(#{$switch-height-lg} * 2);
height: $switch-height-lg;
line-height: $switch-height-lg;
text-indent: calc(calc(#{$switch-height-lg} * 2) + .5rem);
}
+ label::before {
width: calc(#{$switch-height-lg} * 2);
}
+ label::after {
width: calc(#{$switch-height-lg} - calc(#{$switch-thumb-padding} * 2));
height: calc(#{$switch-height-lg} - calc(#{$switch-thumb-padding} * 2));
}
&:checked + label::after {
margin-left: $switch-height-lg;
}
}
}
+ .switch {
margin-left: 1rem;
}
}

36
muk_web_utils/static/src/scss/variables.scss

@ -0,0 +1,36 @@
/**********************************************************************************
*
* Copyright (C) 2017 MuK IT GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
//----------------------------------------------------------
// Switch
//----------------------------------------------------------
$switch-bg: #dee2e6;
$switch-disabled-bg: #e9ecef;
$switch-disabled-color: #868e96;
$switch-height: calc(#{$input-height} * .8) !default;
$switch-height-sm: calc(#{$input-height-sm} * .8) !default;
$switch-height-lg: calc(#{$input-height-lg} * .8) !default;
$switch-checked-bg: map-get($theme-colors, 'primary') !default;
$switch-thumb-bg: $white !default;
$switch-thumb-border-radius: 50% !default;
$switch-thumb-padding: 2px !default;
$switch-transition: .2s all !default;
$switch-border-radius: $switch-height;
$switch-focus-box-shadow: 0 0 0 $input-btn-focus-width rgba(map-get($theme-colors, 'primary'), .25);

65
muk_web_utils/static/src/xml/switch.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2017 MuK IT GmbH
Odoo Proprietary License v1.0
This software and associated files (the "Software") may only be used
(executed, modified, executed after modifications) if you have
purchased a valid license from the authors, typically via Odoo Apps,
or if you have received a written agreement from the authors of the
Software (see the COPYRIGHT file).
You may develop Odoo modules that use the Software as a library
(typically by depending on it, importing it and using its resources),
but without copying any source code or material from the Software.
You may distribute those modules under the license of your choice,
provided that this license is compatible with the terms of the Odoo
Proprietary License (For example: LGPL, MIT, or proprietary licenses
similar to this one).
It is forbidden to publish, distribute, sublicense, or sell copies of
the Software or modified copies of the Software.
The above copyright notice and this permission notice must be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-->
<templates id="template" xml:space="preserve">
<t t-name="muk_web_utils.switch">
<span class="switch">
<input type="checkbox" t-att-id="id" />
<label t-att-for="id">
<t t-if="label"><t t-esc="label"/></t>
</label>
</span>
</t>
<t t-name="muk_web_utils.switch_sm">
<span class="switch switch-sm">
<input type="checkbox" t-att-id="id" />
<label t-att-for="id">
<t t-if="label"><t t-esc="label"/></t>
</label>
</span>
</t>
<t t-name="muk_web_utils.switch_lg">
<span class="switch switch-lg">
<input type="checkbox" t-att-id="id" />
<label t-att-for="id">
<t t-if="label"><t t-esc="label"/></t>
</label>
</span>
</t>
</templates>

19
muk_web_utils/template/assets.xml

@ -18,29 +18,14 @@
-->
<odoo>
<template id="assets_common" name="Common Assets" inherit_id="web.assets_common">
<xpath expr="//link[last()]" position="after">
</xpath>
<xpath expr="//script[last()]" position="after">
</xpath>
</template>
<template id="assets_editor" name="Editor Assets" inherit_id="web_editor.assets_editor">
<xpath expr="//link[last()]" position="after">
</xpath>
<xpath expr="//script[last()]" position="after">
</xpath>
</template>
<template id="assets_backend" name="Backend Assets" inherit_id="web.assets_backend">
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/variables.scss" />
<link rel="stylesheet" type="text/scss" href="/muk_web_utils/static/src/scss/switch.scss" />
</xpath>
<xpath expr="//script[last()]" position="after">
</xpath>
</template>
<template id="qunit_suite" name="Qunit Assets" inherit_id="web.qunit_suite">
<xpath expr="//script[last()]" position="after">
</xpath>
</template>
</odoo>
Loading…
Cancel
Save