GithubHelp home page GithubHelp logo

wagtail-deprecated / wagtail-condensedinlinepanel Goto Github PK

View Code? Open in Web Editor NEW
84.0 10.0 22.0 1.82 MB

Fast, drop-in replacement for Wagtail's inline panel with drag and drop

License: BSD 3-Clause "New" or "Revised" License

Python 21.29% JavaScript 6.95% HTML 1.38% TypeScript 61.13% Makefile 0.32% SCSS 8.93%
wagtail

wagtail-condensedinlinepanel's People

Contributors

acerix avatar criticalnameerror avatar dependabot[bot] avatar gasman avatar jhrr avatar kaedroho avatar mcoconnor avatar mexicat avatar nvsit avatar salahaddin avatar torchingloom avatar tylermadsen avatar unexceptable avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wagtail-condensedinlinepanel's Issues

Card titles are shunted rightwards slightly when a card's state changes

The following image shows the same card in different states. It seems that the already generous gap on the left of the card title increases slightly when a card has one of the following classes:

  • condensed-inline-panel__card--changed
  • condensed-inline-panel__card--new
  • condensed-inline-panel__card--errors

Example:

further-indentation-of-card-titles

This produces a slight shunting of the card title when the edit icon is clicked on a previously unedited card, which happens because the width of the card's left border changes from 1px to 3px.

One way this can be resolved is to adjust the left padding on the card titles slightly to counteract this. Adding the following solved the issue for me locally:

.condensed-inline-panel__card--changed .condensed-inline-panel__card-header,
.condensed-inline-panel__card--new .condensed-inline-panel__card-header,
.condensed-inline-panel__card--errors .condensed-inline-panel__card-header {
    padding-left: calc(1.5em - 2px);
}

Various display issues (help_text, classname, new_card_header_text, possibly others)

Due to the way that CondensedInlinePanel renders its form, the usual django help_text gets displayed over top of the inline panel code. The way InlinePanel usually works is to put the help_text to the right of the form UI, meaning the form needs to be shrunken horizontally a bit to fit the help_text.

In addition, the new_card_header_text and classname constructor args don't seem to be functional.

CondensedInlinePanel is such a great improvement over the default InlinePanel, so I really hope to see these fixes added soon. I may be able to provide a pull request to do this, but I don't currently have time to dedicate to learning the project well enough to do that.

Add button not rendering label

Looking at the code, the 'ADD' button is currently hard coded.

InlinePanel places the label in the add button:
https://github.com/wagtail/wagtail/blob/master/wagtail/wagtailadmin/edit_handlers.py#L761
https://github.com/wagtail/wagtail/blob/master/wagtail/wagtailadmin/templates/wagtailadmin/edit_handlers/inline_panel.html#L28

I'm not sure how we should address this because of where and how the add text is set in this library, but to truly make this match the functionality of the InlinePanel it does need to be done, because not having a custom label on the ADD button is quite confusing when nesting panels.

Support for FileField (and ImageFileField)

Currently getting:

TypeError
Object of type 'ImageFieldFile' is not JSON serializable

Starts on condensedinlinepanel/edit_handlers.py

Line 43 return super(WagtailJSONEncoder, self).default(o) 

Update for Wagtail 2.0

I'm testing the next version and i tried to update this package, but i have a problem with edit_handlers: wagtail/wagtail@5fc191b#diff-507d1915f772f388fd0ef0447953585f in this commit BaseInlinePanel was removed, so we have to replace it with the normal InlinePanel; but i get a problem with it:

Traceback (most recent call last):
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run
    self.check(display_num_errors=True)
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/django/core/management/base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/django/core/management/base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/django/core/checks/registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/wagtail/admin/checks.py", line 63, in get_form_class_check
    if not issubclass(edit_handler.get_form_class(), WagtailAdminPageForm):
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 336, in get_form_class
    fields=self.required_fields(),
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 261, in required_fields
    fields.extend(handler.required_fields())
  File "/home/salahaddin/Proyectos/Works/partnerlatam/blog.xprende/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 261, in required_fields
    fields.extend(handler.required_fields())
TypeError: required_fields() missing 1 required positional argument: 'self'

What's happening here?

Is it works with decimal field?

wagtail 1.13.1
TypeError
Object of type 'Decimal' is not JSON serializable
c:\python36-32\Lib\json\encoder.py in default, line 180
python 3.6.4

This occur when you try to edit saved page

class ProductVariantBase(models.Model):
product = ParentalKey(Product, related_name='variants')
price = models.DecimalField(max_digits=12, decimal_places=2, verbose_name='variant price')

Exception Type: MultiValueDictKeyError

def page(request):
# a = int(request.GET['num1'])
# b = int(request.GET['num2'])

# val = a + b
val1 = request.POST['num1']
a = int(val1)
val2 = request.POST['num2']
b = int(val2)

return render(request,'khushi/block.html',{'result':val})

#its very ..hard to solve this stupid..proble...last night waas working properly...now again showing same problem

RichTextField not working?

Hello!

When adding a new RichTextField instance (Wagtail 2.0 or 2.1), I get a JS error and the Draftail editor doesn't show up.

VM743:1 Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.b [as initEditor] (draftail.js:1)
    at eval (eval at FormContainer.componentDidMount (condensedinlinepanel.bundle.js:15), <anonymous>:1:17)
    at FormContainer.componentDidMount (condensedinlinepanel.bundle.js:15)
    at e.notifyAll (condensedinlinepanel.bundle.js:15)
    at r.close (condensedinlinepanel.bundle.js:15)
    at r.closeAll (condensedinlinepanel.bundle.js:1)
    at r.perform (condensedinlinepanel.bundle.js:1)
    at o.perform (condensedinlinepanel.bundle.js:1)
    at o.perform (condensedinlinepanel.bundle.js:1)

Tried it on both versions, I may be doing something wrong but it looks like this is the case.

Thank you

MultiValueDictKeyError Issue when using with Streamfields

I am getting a strange issue when i am using the condensed inline panel with a orderable that has a field that is used as a streamfield. Everything works until i try to post(save the page with new items), if i use the Normal InlinePanal it works, if i convert back to condensed inlinepanel it also works, until i add an item again.
Im using:

wagtail>=2.1,<2.2
wagtail-condensedinlinepanel==0.5.2

models

class DownloadDocPage(Page):
    content_panels = Page.content_panels + [
        MultiFieldPanel(
            [
                CondensedInlinePanel('operating_systems'),
            ],
            heading="Operating Systems",
            classname="collapsible"
        ),
        MultiFieldPanel(
            [
                CondensedInlinePanel('apis'),
            ],
            heading="Application Programming Interfaces",
            classname="collapsible"
        ),
    ]
    parent_page_types = ['HomePage']

class OperatingSystems(Orderable):
    page = ParentalKey(DownloadDocPage, related_name='operating_systems')
    operating_system = models.CharField(max_length=255)
    characterless_id = models.CharField(max_length=30, help_text='This should be a unique lower-case ID with no special characters, for example Unix-Like would be unixlike')
    text = StreamField(blocks.TextStreamBlock())

    panels = [
        FieldPanel('operating_system'),
        FieldPanel('characterless_id'),
        StreamFieldPanel('text'),
    ]

    def __str__(self):
        return u'{}'.format(self.operating_system)

blocks.py

class TextStreamBlock(StreamBlock):
    richtext = RichTextBlock()
    text = TextBlock()

traceback

Environment:


Request Method: POST
Request URL: http://localhost/cms/pages/56/edit/

Django Version: 1.11.20
Python Version: 3.6.8
Installed Applications:
['django.contrib.admin',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'django_countries',
 'user',
 'app',
 'pipeline',
 'minio_storage',
 'modelcluster',
 'taggit',
 'honeypot',
 'djcelery_email',
 'heartbeat',
 'constance.backends.database',
 'django.contrib.auth',
 'wagtail.contrib.modeladmin',
 'wagtail.contrib.forms',
 'wagtail.contrib.redirects',
 'wagtail.embeds',
 'wagtail.sites',
 'wagtail.users',
 'wagtail.snippets',
 'wagtail.documents',
 'wagtail.images',
 'wagtail.search',
 'wagtail.admin',
 'wagtail.core',
 'wagtailfontawesome',
 'condensedinlinepanel',
 'allauth',
 'allauth.account',
 'allauth.socialaccount']
Installed Middleware:
['django.middleware.cache.UpdateCacheMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'htmlmin.middleware.HtmlMinifyMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'wagtail.core.middleware.SiteMiddleware',
 'wagtail.contrib.redirects.middleware.RedirectMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware',
 'htmlmin.middleware.MarkRequestMiddleware']



Traceback:

File "/usr/local/lib/python3.6/site-packages/django/utils/datastructures.py" in __getitem__
  83.             list_ = super(MultiValueDict, self).__getitem__(key)

During handling of the above exception ('operating_systems-0-text-count'), another exception occurred:

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py" in _cache_controlled
  43.             response = viewfunc(request, *args, **kw)

File "/usr/local/lib/python3.6/site-packages/wagtail/admin/urls/__init__.py" in wrapper
  102.             return view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/wagtail/admin/decorators.py" in decorated_view
  34.             return view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/wagtail/admin/views/pages.py" in edit
  339.         if form.is_valid() and not page.locked:

File "/usr/local/lib/python3.6/site-packages/modelcluster/forms.py" in is_valid
  309.         formsets_are_valid = all([formset.is_valid() for formset in self.formsets.values()])

File "/usr/local/lib/python3.6/site-packages/modelcluster/forms.py" in <listcomp>
  309.         formsets_are_valid = all([formset.is_valid() for formset in self.formsets.values()])

File "/usr/local/lib/python3.6/site-packages/django/forms/formsets.py" in is_valid
  321.         self.errors

File "/usr/local/lib/python3.6/site-packages/django/forms/formsets.py" in errors
  295.             self.full_clean()

File "/usr/local/lib/python3.6/site-packages/django/forms/formsets.py" in full_clean
  346.             if not form.has_changed() and i >= self.initial_form_count():

File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py" in has_changed
  439.         return bool(self.changed_data)

File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py" in __get__
  35.         res = instance.__dict__[self.name] = self.func(instance)

File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py" in changed_data
  446.             data_value = field.widget.value_from_datadict(self.data, self.files, prefixed_name)

File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/base.py" in value_from_datadict
  512.         return self.block_def.value_from_datadict(data, files, name)

File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/stream_block.py" in value_from_datadict
  152.         count = int(data['%s-count' % prefix])

File "/usr/local/lib/python3.6/site-packages/django/utils/datastructures.py" in __getitem__
  85.             raise MultiValueDictKeyError(repr(key))

Exception Type: MultiValueDictKeyError at /cms/pages/56/edit/
Exception Value: "'operating_systems-0-text-count'"
```
`

TextField support

CondensedInlinePanel doesn't seem to pick up values from textarea elements currently. If there's interest in supporting TextField, I think a fix could be simply adding HTMLTextAreaElement in places where HTMLInputElements are also referenced, like here for example.

Thank you for all the effort you all have put into this project! it's really great.

DecimalField results in JSON serialization error

I have a model that is used in a CondensedInlinePanel which uses a DecimalField and I get the following traceback:

Traceback (most recent call last):
  File "/project/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/project/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/project/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/project/lib/python3.5/site-packages/django/views/decorators/cache.py", line 43, in _cache_controlled
    response = viewfunc(request, *args, **kw)
  File "/project/lib/python3.5/site-packages/wagtail/wagtailadmin/decorators.py", line 31, in decorated_view
    return view_func(request, *args, **kwargs)
  File "/project/lib/python3.5/site-packages/wagtail/wagtailadmin/views/pages.py", line 481, in edit
    edit_handler = edit_handler_class(instance=page, form=form)
  File "/project/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 269, in __init__
    self.children.append(child(instance=self.instance, form=self.form))
  File "/project/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 269, in __init__
    self.children.append(child(instance=self.instance, form=self.form))
  File "/project/lib/python3.5/site-packages/condensedinlinepanel/edit_handlers.py", line 145, in __init__
    self.formset.to_json()
  File "/project/lib/python3.5/site-packages/condensedinlinepanel/edit_handlers.py", line 132, in to_json
    for field_name in self.empty_form.fields.keys()
  File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: Decimal('2250.00') is not JSON serializable

Suggestions?

Edit link not working on ImageChooserPanels

On:
wagtail==1.13.1
wagtail-condensedinlinepanel==0.4.2

The image chooser panel's edit image link (when there is an image selected) has no href on Condensed Inlines, so its not working.

Form validation records from CondensedInlinePanel disappear

When I'm using CondensedInlinePanel in object and I will click save and form will not pass validation then records added in CondensedInlinePanel will disappear. When I change to normal InlinePanel everything works great.

Versions:

wagtail==2.9
wagtail-condensedinlinepanel==0.5.3

Wagtail 2.3 breaks it

edit_handlers.py contains a reference to self.related in its on_instance_bound method at the bottom of the file, but Wagtail 2.3's base class apparently no longer has the attribute related.

Using CondensedInlinePanel makes Wagtail always detect changes

If you open a page that has a CondensedInlinePanel in the page editor, then try to leave without changing anything, Wagtail will prompt you with a message like "There are unsaved changes, are you sure you want to leave this page?".

I think the issue is caused by condensed inline panel writes to the underlying hidden fields on start up, making Wagtail think something has been changed.

Internationalisation

We have some strings in the javascript code that are not yet marked for translation. We also need to set this up on transifex so translations can be created.

React error if card_header_from_field does not have default

I believe I've found a bug with using card_header_from_field for a field that doesn't have a default value. When I try to create a new item, I get the following error:

(index):2604 Uncaught TypeError: Cannot read property 'toString' of null
    at Object.renderCardHeader ((index):2604)
    at Card.render (Card.tsx:316)
    at ReactCompositeComponent.js:796
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:795)
    at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:822)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:362)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:258)
    at Object.mountComponent (ReactReconciler.js:46)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:371)

Since the form is empty, the tostring method fails, but when I add a default to the model, it works fine. If this is a bug, fixing it should be just a case of making sure that after this section you ensure value actually has some content before calling tostring.

Can you reproduce and confirm?

Getting `ManagementForm data is missing or has been tampered with` error on every save

Using v0.5.3 with Wagtail 2.9.0 and Django 3.0.7.
I'm trying to use CondensedInlinePanel in the ModelAdmin, but while it renders beautifully, it won't save.

Here's the panel config:

        CondensedInlinePanel(
            "menu_items",
            label="Menu Items",
            card_header_from_field="title",
            panels=[
                FieldPanel("day_of_week"),
                FieldPanel("title"),
                FieldPanel("description"),
                FieldPanel("portion_per_order"),
                ImageChooserPanel("image"),
                FieldPanel("price"),
                FieldPanel("allergens"),
                FieldPanel("menu_category"),
                FieldPanel("order_limit"),
                FieldPanel("highlight"),
                FieldPanel("include_in_portion_count"),
            ],
        ),

React missing? no plus button

Do I need to add react manually? The plus button doesnt appear and get some JS errors. The rich text editor in the inline snippets are missing too and a get some js errors in the console.

How should I add react to the cmd admin part?
screen shot 2018-07-13 at 22 13 26

Problem with latest version (0.5.2) & wagtail 2.3

I'm having a quite strange issue with the latest version.

CharFields with choices are giving me a validation error of this sort:

Select a valid choice. ['bottom-right'] is not one of the available choices.

Plus, BooleanFields appear to be showing up unchecked when editing an existing page, even though their value was True.

Thank you!!

forms.ChoiceField not rendering initial values

Hello, first of all i am not a react developer, so i do not totally understand the mechanics of react. I appreciate this repo and i myself am using this in my projects.

I've noticed that when updating an entry that renders a ChoiceField (i.e a models.CharField with the 'choices' argument), it will not initialise the entry with a value.

Looking into the code, i can see the method BaseCondensedInlinePanelFormSet.to_json is generating the initial values to the template, but when react does its magic, it does not set the initial value of the ChoiceFields.

Is there a missing JS component that is required for this particular use case to function correctly?

Nesting in collapsible MultiFieldPanel mangles card header

InlinePanel can be safely and usefully nested in a MultiFieldPanel, and in turn made collapsible. As this is meant to be a drop in replacement for inline panel, it needs to safely function as such in the same manner.

Currently, when that happens in a setup such as this:

MultiFieldPanel(
    [
        FieldPanel('features_section_title'),
        FieldPanel('features_section_text'),
        CondensedInlinePanel(
            'features', card_header_from_field="title")
    ],
    'Service Features',
    classname="collapsible"),

A card title which should be: "My Card" is displayed as: "6My Card".

This is because of this css rule here in core wagtail:

.object.collapsible h2:before, .object.collapsible h2 label:before {
    content: '6';
    cursor: pointer;
}

The fix is to add a rule to the css for this panel that overrides the content to "". I'll submit a patch for that, but wanted to document the bug first.

Icons on action buttons are slightly off-centre

When using Chrome, the action button icons (and little plus icons) seem to be slightly off-centre:

off-centre-icons

The cause of this seems to be a style in wagtail's CSS that adds a slight right margin to icons by default.

Adding the following CSS fixed the problem for me locally:

.condensed-inline-panel__add-button:before,
.condensed-inline-panel__action:before {
    margin-right: 0;
}

Checkbox field is automatically unselected

When using wagtail-condensedinlinepanel with wagtailmenus, the "Allow sub-menu" checkbox option appears unselected regardless of its state in the database. I believe that this might affect all checkboxes in CondensedInlinePanels.

This looks to be the same bug reported in jazzband/wagtailmenus#311; the consensus there was that this was a bug in wagtail-condensedinlinepanel.

Software versions:

  • wagtail-condensedinlinepanel 0.5.2
  • wagtailmenus 2.13
  • wagtail 2.4

Python 2 support?

I wondered whether you had any plans to support Python 2? I'd understand completely if you wanted to keep it to Python 3 only (what with it being a newish thing, and Django starting to lean that way).

Looking through the code, it looks like Python 2 support is intended. But there's just a couple of places where the new style super() is used, which trip things up.

Adding the usual from __future__ import absolute_import, unicode_literals to the top of python files might also be a good step.

I don't mind submitting a pull for this. Just wanted to check out the intentions first of all.

Wagtail 2.0 support status

As mentioned in #33, there are a few issues with the compatibility changes made so far, some of which are easily fixed, but others not so much.

I would say I'd be happy to submit a PR for this, but I've already had a go, and it looks like it's going to take a bit of refactoring of the various edit handler classes, which is an area of wagtail I've not really been able to get my head around. I certainly don't think I'm cut out to make the necessary changes in a backwards-compatible way.

Long card titles not being handled nicely on mobile

In the following example, the title on the 2nd item is "Chat to a customer sales advisor". You can see that on mobile, this causes some strangeness when the card is opened:

screenshot 2017-10-21 at 11 19 09

I believe the intended behaviour is to utilise text-overflow: ellipsis; (as there's a rule already in the CSS for this), but this won't work as intended without a few additional styles. Adding the following did the trick locally:

white-space: nowrap;
overflow: hidden;

The results look ever-so-slightly better with a bit more clearance on the right side. In the following example I've used width: calc(100% - 105px) instead of width: calc(100% - 100px):

screenshot 2017-10-21 at 11 25 44

Doesn't properly handle max_num and min_num

Doesn't affect me just yet, but while on save it does complain, it doesn't tell you what is wrong, just "Validation errors". And unlike the standard InlinePanel the gui doesn't do anything to tell you that there is a limit.

We should make the gui properly gray out or hide add more buttons on reaching max_num, and have the validations errors properly render as to exactly what is wrong in general, but mainly for min_num (since doing that in the gui is harder).

Nesting CondensedInlinePanel on snippet, nested panels do not show up

I would like to nest a CondensedInlinePanel inside another CondensedInlinePanel on a Snippet.

It works fine with standard InlinePanel. When I exchange it with CondensedInlinePanel, the top layer displays fine (except there are old and new add buttons) but the nested one(s) do not show up in the GUI.

Is CondensedInlinePanel supposed to work for my use case?

If so, I would construct a minimal example in order to reproduce the issue to further investigate it.

Screenshot 2020-04-27 at 18 33 08

After exchanging InlinePanel with CondensedInlinePanel:

Screenshot 2020-04-27 at 18 34 08

Field 'id' expected a number but got ['99'].

If I have some ChoiceWidget on the formset. So prepares the function self.empty_form[field_name].field.widget.format_value(self.empty_form[field_name].value())
an array [99] for that value. Here are for example 2 Choice fields: food' and unit: {'food': ['99'], 'qty': '6', 'unit': ['2'], 'block': '0', 'extra': '', 'id': '82', 'ORDER': '1', 'DELETE': None}.
That error occurs when the form is sent without having edited anything

Add LICENSE text

This package doesn't seem to include any license info, except in the setup.py
Can you document the license this is released under?

Non-field errors are not rendered

When there is a non-field error in a form, it is added in the "errors" property object as the __all__ field. Since it is not a "real" field in the form, it is ignored in FormContainer.tsx, and thus not rendered.

Support for SnippetChooserPanel

The functionality works (a user is able to choose and change the snippet), but the current value is not loaded in on page load.

Allow an object's __str__() or other method to be used as the card header

For a bit of background: I'm playing with the idea of using this for wagtailmenus. The most meaningful thing to use as a card header for MenuItem instances is a method that returns a page's title (if the item links to a page), or custom menu text value if that is provided.

I would be happy with card headers being blank until the form was saved (or maybe just something generic, like 'New menu item'), and also with the card headers not changing dynamically during editing.

I'd be happy to have a crack at this myself in PR (though, I may need some help on the React side of things) but wanted to first ask if you think this is something you would want to support, and whether you might have any ideas about how best to approach the problem?

Thank you for the great work so far!

Missing javascript map in static

I'm testing this useful package and i got this issue in the console:
"GET /static/condensedinlinepanel/dist/condensedinlinepanel.bundle.js.map HTTP/1.1" 404 1907.

Why?

Validation Errors on existing unmodified CondensedInlinePanels on save

Version Info

Wagtail: 2.5.1
Django: 2.0
Python: 3.4 & 3.6 (Two different environments)
CondensedInlinePanel: 0.5.2

The Issue:

I have a CondensedInlinePanel in my page model that contains two select inputs. They save just fine on page creation, but if I go to edit the page, all unmodified panels will throw validation errors on those input fields.

In this screenshot, I just tried to add "Edited Panel" to an existing page ("The page could not be saved due to validation errors."):

CondensedInlinePanel Validation Errors

Here are the fields that are throwing errors ("Select a valid choice. ['*'] is not one of the available choices."). Note that all of the selected options are valid choices:

CondensedInlinePanel Validation Errors - Select a valid choice. ['*'] is not one of the available choices.

The Workaround:

Currently I can prevent the validation errors from occurring by manually opening each panel so the plugin marks them as "modified". Since we're using JQuery on our site I added this code to do the same thing automatically on page load. Obviously this isn't ideal, but it does work well enough for our purposes:

$('document').ready(function(){
	$('.condensed-inline-panel__action-edit').click();
	setTimeout(function(){
		$('.condensed-inline-panel__action-close').click();
	}, 300);
});

Relevant model code

class MyCondensedInlinePanelModel(Orderable):
	parent_page = ParentalKey('MyPageModel', related_name='my_panel', on_delete=models.CASCADE)

	# ...	

	DATE_TYPES = (
		('posted',   'Posted on <Date>'),
		('launched', 'Launched on <Date>'),
		('updated',  'Updated on <Date>'),
	)
	date_type = models.CharField(max_length=12, choices=DATE_TYPES, default='posted')

	TEXT_COLORS = (
		('light', 'Light Text'),
		('dark',  'Dark Text')
	)
	text_color = models.CharField(max_length=12, choices=TEXT_COLORS, default='light')

	# ...

	panels = [
		# ...
		FieldPanel('text_color'),
		MultiFieldPanel([
			FieldPanel('date_type'),
			# ...
		], heading="Post Date"),
		# ...
	]

	# ...

Plus icon small and in the wrong place.

Hi,

I've (surprisingly) not seen any open issues mentioning this. The plus icon to add a new field is very small and easily overlooked. It's also not very user-friendly. Here is how to current add-icon looks like.
image

I propose at least one of the following:

Center the button and make it bigger:
image

Align it to the left and make it a button, just like how wagtail itself does it (this button looks horrible, but imagine the same button wagtail uses):
image

I look forward to your responses :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.