Skip to content

Commit 05396e7

Browse files
committed
custom template for abstract block, upgrade dependencies, some fixes
1 parent f6daadd commit 05396e7

11 files changed

Lines changed: 10929 additions & 9461 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="django-streamfield",
8-
version="1.2.0",
8+
version="1.2.1",
99
author="Yury Lapshinov",
1010
author_email="y.raagin@gmail.com",
1111
description="StreamField for native Django Admin or with Grappelli",

streamfield/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
name = "streamfield"
2-
VERSION = '1.2.0'
2+
VERSION = '1.2.1'

streamfield/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def _get_render_data(model_class, model_str, content, ctx):
122122
block_tmpl = model_class.block_template
123123
else:
124124
block_tmpl = 'streamblocks/%s.html' % model_str.lower()
125-
print(block_tmpl)
126125
try:
127126
t = loader.get_template(block_tmpl)
128127
except loader.TemplateDoesNotExist:

streamfield/static/streamfield/css/streamfield_widget.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
margin-left: 10px;
4444
}
4545

46+
.streamfield_app .stream-block__option span {
47+
margin: 0 0 0 5px
48+
}
49+
50+
.streamfield_app .stream-block__option span + * {
51+
margin: 0 0 0 3px;
52+
}
53+
4654
/* Block content */
4755
.streamfield_app .stream-model-block .stream-model-block__content {
4856
padding: 20px;
@@ -148,6 +156,14 @@
148156
margin-left: 10px;
149157
}
150158

159+
.streamfield_app .stream-model-block__content.abstract-block a img {
160+
border: 3px solid #a6d1e0;
161+
}
162+
.streamfield_app .stream-model-block__content.abstract-block a:hover img {
163+
border-color: #78adbf;
164+
}
165+
166+
151167
/* add new block */
152168
.streamfield_app .stream-insert-new-block {
153169
text-align: right;

streamfield/static/streamfield/js/streamfield_widget.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
instance_admin_render_url: function(block, instance_id) {
8181
return '/streamfield/admin-instance/' + this.model_name_lower(block) + '/' + instance_id;
8282
},
83+
abstract_block_render_url: function(block) {
84+
return '/streamfield/abstract-block/' + this.model_name_lower(block) + '/';
85+
},
8386
get_change_model_link: function(block, instance_id){
8487
return this.block_admin_url(block) + instance_id +
8588
'/change/?_popup=1&block_id=' + block.unique_id +
@@ -94,9 +97,18 @@
9497
getBlockContent: function(block, item_id) {
9598
return this.blocks[this.instance_unique_id(block, item_id)];
9699
},
100+
getAbstractBlockContent: function(block) {
101+
return this.blocks[block.model_name];
102+
},
97103
updateAbstractBlock(block_unique_id) {
98104
var block = _.find(this.stream, ['unique_id', block_unique_id]);
99-
this.$set(this.blocks, block.model_name, "");
105+
106+
// change block content
107+
ax.get(this.abstract_block_render_url(block)).then(function (response) {
108+
app.$set(app.blocks, block.model_name, response.data);
109+
});
110+
111+
// this.$set(this.blocks, block.model_name, "");
100112
},
101113
updateBlock: function(block_unique_id, instance_id) {
102114
var block = _.find(this.stream, ['unique_id', block_unique_id]);

0 commit comments

Comments
 (0)