[PE] svg icon in button
This commit is contained in:
parent
a578e3c31e
commit
2bbfe4d1f4
|
@ -125,7 +125,11 @@ define([
|
||||||
'<% if ( iconImg ) { %>' +
|
'<% if ( iconImg ) { %>' +
|
||||||
'<img src="<%= iconImg %>">' +
|
'<img src="<%= iconImg %>">' +
|
||||||
'<% } else { %>' +
|
'<% } else { %>' +
|
||||||
'<i class="icon <%= iconCls %>"> </i>' +
|
'<% 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 + \'\"> </i>\'); %>' +
|
||||||
|
// '<i class="icon <%= iconCls %>"> </i>' +
|
||||||
'<% } %>' +
|
'<% } %>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<span class="caption"><%= caption %></span>' +
|
'<span class="caption"><%= caption %></span>' +
|
||||||
|
@ -182,7 +186,13 @@ define([
|
||||||
template: _.template([
|
template: _.template([
|
||||||
'<% var applyicon = function() { %>',
|
'<% var applyicon = function() { %>',
|
||||||
'<% if (iconImg) { print(\'<img src=\"\' + iconImg + \'\">\'); } else { %>',
|
'<% if (iconImg) { print(\'<img src=\"\' + iconImg + \'\">\'); } else { %>',
|
||||||
'<% if (iconCls != "") { print(\'<i class=\"icon \' + iconCls + \'\"> </i>\'); }} %>',
|
// '<% if (iconCls != "") { print(\'<i class=\"icon \' + iconCls + \'\"> </i>\'); }} %>',
|
||||||
|
'<% if (iconCls != "") { ' +
|
||||||
|
' 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 + \'\"> </i>\'); ' +
|
||||||
|
'}} %>',
|
||||||
'<% } %>',
|
'<% } %>',
|
||||||
'<% if ( !menu ) { %>',
|
'<% if ( !menu ) { %>',
|
||||||
'<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>">',
|
'<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>">',
|
||||||
|
|
|
@ -281,7 +281,7 @@ define([
|
||||||
me.btnGoBack = new Common.UI.Button({
|
me.btnGoBack = new Common.UI.Button({
|
||||||
id: 'btn-goback',
|
id: 'btn-goback',
|
||||||
cls: 'btn-toolbar',
|
cls: 'btn-toolbar',
|
||||||
iconCls: 'btn-goback',
|
iconCls: 'svgicon svg-btn-goback',
|
||||||
split: true,
|
split: true,
|
||||||
menu: new Common.UI.Menu({
|
menu: new Common.UI.Menu({
|
||||||
style: 'min-width: 60px;',
|
style: 'min-width: 60px;',
|
||||||
|
|
|
@ -229,3 +229,17 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 995;
|
z-index: 995;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-toolbar {
|
||||||
|
&:active {
|
||||||
|
svg.icon {
|
||||||
|
fill: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
svg.icon {
|
||||||
|
background-image: none;
|
||||||
|
|
||||||
|
fill: @gray-deep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2059,7 +2059,7 @@ define([
|
||||||
|
|
||||||
var button = new Common.UI.Button({
|
var button = new Common.UI.Button({
|
||||||
cls: _cls,
|
cls: _cls,
|
||||||
iconCls: 'btn-menu-comments',
|
iconCls: 'svgicon svg-btn-comments',
|
||||||
caption: 'Comment'
|
caption: 'Comment'
|
||||||
}).render( slots.eq(index) );
|
}).render( slots.eq(index) );
|
||||||
|
|
||||||
|
|
|
@ -258,13 +258,28 @@
|
||||||
|
|
||||||
<div id="viewport"></div>
|
<div id="viewport"></div>
|
||||||
|
|
||||||
|
<svg style="display: none;">
|
||||||
|
<symbol id="svg-btn-comments" viewBox="0 0 20 20">
|
||||||
|
<path d="M16,4H4C3.45,4,3,4.45,3,5v9c0,0.55,0.45,1,1,1h2l2,2h1l2-2h5c0.55,0,1-0.45,1-1V5C17,4.45,16.55,4,16,4z
|
||||||
|
M16,14h-5h-0.414l-2,2H8.414l-2-2H6H4V5h12V14z"/>
|
||||||
|
<rect x="6" y="7" width="8" height="1"/>
|
||||||
|
<rect x="6" y="9" width="8" height="1"/>
|
||||||
|
<rect x="6" y="11" width="8" height="1"/>
|
||||||
|
</symbol>
|
||||||
|
<symbol id="svg-btn-goback" viewBox="0 20 20 20">
|
||||||
|
<path d="M17,26h-6v-1c0-0.553-0.448-1-1-1H3c-0.552,0-1,0.447-1,1v11c0,0.553,0.448,1,1,1h14
|
||||||
|
c0.552,0,1-0.447,1-1v-9C18,26.447,17.552,26,17,26z M17,36H3V25h7v1c0,0.553,0.448,1,1,1h6v1V36z"/>
|
||||||
|
<polygon points="13,31 10,28 10,30 6,30 6,32 10,32 10,34 "/>
|
||||||
|
</symbol>
|
||||||
|
</svg>
|
||||||
|
|
||||||
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
|
||||||
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
|
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.g_debug_mode = true;
|
window.g_debug_mode = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- debug begin -->
|
<!-- debug begin -->
|
||||||
<script type="text/javascript">var less=less||{};less.env='development';</script>
|
<script type="text/javascript">var less=less||{};less.env='development';</script>
|
||||||
<script src="../../../vendor/less/dist/less-2.7.1.js" type="text/javascript"></script>
|
<script src="../../../vendor/less/dist/less-2.7.1.js" type="text/javascript"></script>
|
||||||
|
|
Loading…
Reference in a new issue