[Common] refactoring

This commit is contained in:
Maxim Kadushkin 2017-06-26 12:19:08 +03:00
parent 72eda1de98
commit f5bb8c8ed8
2 changed files with 23 additions and 23 deletions

View file

@ -119,18 +119,20 @@ define([
], function () {
'use strict';
var templateBtnIcon =
'<% if ( iconImg ) { %>' +
'<img src="<%= iconImg %>">' +
'<% } else { %>' +
'<% if (/svgicon/.test(iconCls)) {' +
'print(\'<svg width="26" height="26" class=\"icon\"><use href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); %>' +
'<% } %>';
var templateHugeCaption =
'<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown">' +
'<button type="button" class="btn <%= cls %>">' +
'<div class="inner-box-icon">' +
'<% if ( iconImg ) { %>' +
'<img src="<%= iconImg %>">' +
'<% } else { %>' +
'<% if (/svgicon/.test(iconCls)) {' +
'print(\'<svg class=\"icon\"><use xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); %>' +
// '<i class="icon <%= iconCls %>">&nbsp;</i>' +
'<% } %>' +
templateBtnIcon +
'</div>' +
'<span class="caption"><%= caption %></span>' +
'</button>';
@ -139,11 +141,7 @@ define([
'<div class="btn-group icon-top" id="<%= id %>" style="<%= style %>">' +
'<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown">' +
'<div class="inner-box-icon">' +
'<% if ( iconImg ) { %>' +
'<img src="<%= iconImg %>">' +
'<% } else { %>' +
'<i class="icon <%= iconCls %>">&nbsp;</i>' +
'<% } %>' +
templateBtnIcon +
'</div>' +
'<div class="inner-box-caption">' +
'<span class="caption"><%= caption %></span>' +
@ -155,11 +153,7 @@ define([
var templateHugeSplitCaption =
'<div class="btn-group x-huge split icon-top" id="<%= id %>" style="<%= style %>">' +
'<button type="button" class="btn <%= cls %> inner-box-icon">' +
'<% if ( iconImg ) { %>' +
'<img src="<%= iconImg %>">' +
'<% } else { %>' +
'<i class="icon <%= iconCls %>">&nbsp;</i>' +
'<% } %>' +
templateBtnIcon +
'</button>' +
'<button type="button" class="btn <%= cls %> inner-box-caption dropdown-toggle" data-toggle="dropdown">' +
'<span class="caption"><%= caption %></span>' +

View file

@ -103,10 +103,16 @@
button.disabled > .@{icon-class} {background-position-x: -3*@icon-size !important; --bgX: -(3*@icon-size);}
}
.mx-button-otherstates-icon2(@icon-size) {
&.active .icon,
&:active .icon {background-position-x: -1*@icon-size; --bgX: -(1*@icon-size);}
&.disabled .icon {background-position-x: -2*@icon-size; --bgX: -(2*@icon-size);}
}
.button-otherstates-icon2(@icon-class, @icon-size) {
button.@{icon-class}.active .icon,
button.@{icon-class}:active .icon {background-position-x: -1*@icon-size; --bgX: -(1*@icon-size);}
button.@{icon-class}.disabled .icon {background-position-x: -2*@icon-size; --bgX: -(2*@icon-size);}
button.@{icon-class} {
.mx-button-otherstates-icon2(@icon-size);
}
}
.menu-icon-normal(@icon-class, @index, @icon-size) {