0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

add suitable icons to wagtail's own icon set and allowing user to define icon for each streamfield block

This commit is contained in:
Dave Cranwell 2015-02-05 15:42:52 +00:00
parent 67b0ffd09c
commit f04c407ffb
9 changed files with 1513 additions and 8566 deletions

View File

@ -45,6 +45,7 @@ def js_dict(d):
@deconstructible
class Block(object):
creation_counter = 0
icon = "streamfield-block-placeholder"
"""
Setting a 'dependencies' list serves as a shortcut for the common case where a complex block type
@ -79,6 +80,8 @@ class Block(object):
def __init__(self, **kwargs):
if 'default' in kwargs:
self.default = kwargs['default'] # if not specified, leave as the class-level default
if 'icon' in kwargs:
self.icon = kwargs['icon'] # if not specified, leave as the class-level default
self.label = kwargs.get('label', None)
# Increase the creation counter, and save our local copy.

View File

@ -258,6 +258,22 @@
.icon-site:before{
content:"@";
}
.icon-larger:before{
font-size:1.5em;
}
.icon-streamfield-block-placeholder:before{
content:"{";
}
.icon-pilcrow:before {
content: "\e600";
}
.icon-title:before {
content: "\f034";
}
.icon-code:before{
content:"\e601"
}
.icon.text-replace{
font-size:0em;
@ -275,9 +291,7 @@
}
}
.icon.icon-larger:before{
font-size:1.5em;
}
@keyframes spin {
from {

File diff suppressed because one or more lines are too long

View File

@ -74,4 +74,8 @@
<glyph unicode="&#x78;" d="M954 668c0-14-4-28-16-38l-490-492c-12-10-24-16-40-16-14 0-28 6-38 16l-284 284c-12 12-16 24-16 40 0 14 4 28 16 38l76 78c12 10 24 16 40 16 14 0 28-6 38-16l168-168 376 376c10 10 24 16 38 16 16 0 28-6 40-16l76-78c12-12 16-24 16-40z" />
<glyph unicode="&#x79;" d="M115.076 175.322q0 28.393 1.875 55.447t7.5 58.393 14.197 58.125 23.035 52.231 33.215 43.393 45.803 28.66 59.732 10.715q4.822 0 22.5-11.518t39.909-25.715 57.857-25.715 71.519-11.518 71.517 11.518 57.857 25.715 39.909 25.715 22.5 11.518q32.678 0 59.732-10.715t45.803-28.66 33.215-43.393 23.035-52.231 14.197-58.125 7.5-58.393 1.875-55.447q0-64.285-39.107-101.518t-103.929-37.232h-468.214q-64.822 0-103.929 37.232t-39.107 101.518zM286.506 653.715q0 85.178 60.268 145.447t145.447 60.268 145.447-60.268 60.268-145.447-60.268-145.447-145.447-60.268-145.447 60.268-60.268 145.447z" horiz-adv-x="1029" />
<glyph unicode="&#x7a;" d="M688 682c0-6-2-10-6-14l-224-224 224-226c4-2 6-8 6-12 0-6-2-10-6-14l-28-28c-4-4-10-6-14-6s-10 2-14 6l-266 266c-4 4-6 8-6 14 0 4 2 8 6 12l266 266c4 4 10 6 14 6s10-2 14-6l28-28c4-4 6-8 6-12z" />
<glyph unicode="&#x7b;" d="M128 640v-128h-128v128h128zM0 832c0 70.656 57.344 128 128 128h64v-128c-35.392 0-64-28.608-64-64h-128v64zM320 832v128h128v-128h-128zM128 128c0-35.392 28.608-64 64-64v-128h-64c-70.656 0-128 57.344-128 128v64h128zM128 384v-128h-128v128h128zM320-64v128h128v-128h-128zM896 512v128h128v-128h-128zM576-64v128h128v-128h-128zM896 960c70.656 0 128-57.344 128-128v-64h-128c0 35.392-28.608 64-64 64v128h64zM896 256v128h128v-128h-128zM832 64c35.392 0 64 28.608 64 64h128v-64c0-70.656-57.344-128-128-128h-64v128zM576 832v128h128v-128h-128z" />
<glyph unicode="&#xe600;" d="M384 960h512v-128h-128v-896h-128v896h-128v-896h-128v512c-141.384 0-256 114.616-256 256s114.616 256 256 256z" />
<glyph unicode="&#xe601;" d="M832 224l96-96 320 320-320 320-96-96 224-224zM448 672l-96 96-320-320 320-320 96 96-224 224zM701.298 809.481l69.468-18.944-191.987-704.026-69.468 18.944 191.987 704.026z" horiz-adv-x="1280" />
<glyph unicode="&#xf034;" d="M0 657.714v218.857l46.286 0.571 30.857-15.429q6.857-2.857 120.571-2.857 25.143 0 75.429 1.143t75.429 1.143q20.571 0 61.429-0.286t61.429-0.286h167.429q3.429 0 12-0.286t11.714 0 9.143 1.714 10 5.143 8.571 10l24 0.571q2.286 0 8-0.286t8-0.286q1.143-64 1.143-192 0-45.714-2.857-62.286-22.286-8-38.857-10.286-14.286 25.143-30.857 73.143-1.714 5.143-6.286 27.429t-8.286 42-4.286 20.286q-3.429 4.571-6.857 7.143t-8.857 3.429-7.429 1.429-10.286 0.286-9.429-0.286q-9.714 0-38 0.286t-42.571 0.286-36.571-1.143-40.571-3.429q-5.143-46.286-4.571-77.714 0-53.714 1.143-221.714t1.143-260q0-9.143-1.429-40.857t0-52.286 7.143-39.429q22.857-12 70.857-24.286t68.571-21.429q2.857-22.857 2.857-28.571 0-8-1.714-16.571l-19.429-0.571q-43.429-1.143-124.571 4.571t-118.286 5.714q-28.571 0-86.286-5.143t-86.857-5.143q-1.714 29.143-1.714 29.714v5.143q9.714 15.429 35.143 24.571t56.286 16.571 44.571 15.429q10.857 24 10.857 218.857 0 57.714-1.714 173.143t-1.714 173.143v66.857q0 1.143 0.286 8.857t0.286 14.286-0.571 14.571-1.714 13.714-2.857 8q-6.286 6.857-92.571 6.857-18.857 0-53.143-6.857t-45.714-14.857q-10.857-7.429-19.429-41.429t-18-63.429-24.286-30.571q-24 14.857-32 25.143zM808 135.714q5.143 10.571 24 10.571h45.714v585.143h-45.714q-18.857 0-24 10.571t6.286 25.429l72 92.571q11.429 14.857 28 14.857t28-14.857l72-92.571q11.429-14.857 6.286-25.429t-24-10.571h-45.714v-585.143h45.714q18.857 0 24-10.571t-6.286-25.429l-72-92.571q-11.429-14.857-28-14.857t-28 14.857l-72 92.571q-11.429 14.857-6.286 25.429z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -276,29 +276,51 @@
padding:1em;
background-color:$color-grey-5;
}
li{
display:inline;
}
&.stream-menu-closed{
ul{
height:0px;
}
button{
height:auto;
&:before{
margin-top:-0.5em;
font-family:wagtail;
content:"B";
width:2em;
height:2em;
display:block;
position:relative;
left:0;right:0;
margin:auto;
z-index:5;
color:$color-teal;
font-size:1.7em;
line-height:2em;
font-family:wagtail;
font-size:3em;
width:3em;
height:3em;
line-height:3em;
text-align:center;
}
}
&:before{
margin-top:-0.5em;
font-family:wagtail;
content:"B";
width:2em;
height:2em;
display:block;
position:relative;
left:0;right:0;
margin:auto;
z-index:5;
color:$color-teal;
font-size:1.7em;
line-height:2em;
text-align:center;
}
&.stream-menu-closed{
ul{
/*height:0px;*/
}
}
}
.sequence-member .stream-menu{
margin:auto -1.5em;
}

View File

@ -1,7 +1,7 @@
<div class="stream-menu">
<ul>
{% for child_block in child_blocks %}
<li style="display: inline;"><button type="button" id="{{ prefix }}-add-{{ child_block.name }}">{{ child_block.name }}</button></li>
<li><button type="button" id="{{ prefix }}-add-{{ child_block.name }}" class="block-{{ child_block.name|slugify }} icon icon-{{ child_block.icon }}">{{ child_block.name }}</button></li>
{% endfor %}
</ul>
</div>