Wykres commitów

10736 Commity (68ee88796e589c18095b2629625cc873f7033bd4)

Autor SHA1 Wiadomość Data
Matt Westcott 68ee88796e Move snippet-chooser to client, and refactor to expose JS API 2021-01-07 15:03:56 +00:00
Matt Westcott a0cb7a9c81 make document title / edit_url available through get_value_data 2021-01-07 15:03:56 +00:00
Matt Westcott 1606d4d09e Move document-chooser to client, and refactor to expose a js API 2021-01-07 15:03:56 +00:00
Matt Westcott 7b8d5f504c Fix page chooser getValue so that it doesn't fail on an empty state 2021-01-07 15:03:56 +00:00
Matt Westcott afa9b16f13 Make image chooser title/preview/edit url accessible through a get_value_data method 2021-01-07 15:03:56 +00:00
Matt Westcott 4714a8424f Implement public JS API for ImageChooser 2021-01-07 15:03:56 +00:00
Matt Westcott bbc61fb2bc lint image-chooser.js 2021-01-07 15:03:56 +00:00
Matt Westcott fcddbfd58a Move image-chooser.js to client/src/entrypoints 2021-01-07 15:03:56 +00:00
Matt Westcott a2ff3e1252 Move entrypoints into an admin subfolder
This allows us to have entrypoints compiling to other apps besides wagtailadmin.
2021-01-07 15:03:56 +00:00
Robert Rollins d18ffb0233 Implemented a 'choose' permission for Images and Documents (#6466)
This PR adds the 'choose' permission discussed in #4488. It limits Image and Document choosers to showing only those Collections (and their contents) for which the current user has the Choose permission.

It grants Choose permissions to the Root Collection to every existing Group that has the "Can access Wagtail admin" perm, via data migration. So there will be no change in behavior unless the user goes in and alters the Choose perms for their site's groups.

This PR has no effect on anything except choosers. The Image and Document index pages are still controlled solely by the 'add' and 'change' permissions, as those are only accessible by users who have those permissions in the first place. This means that it's now possible to configure a Group to allow its members to choose images from existing Collections when editing pages, *without* them being able to edit said images or add new ones.
2021-01-05 12:23:49 +00:00
Karl Hobley b161b66b79 Add a github action to build the docs into JSON format 2021-01-02 11:01:31 +00:00
Matt Westcott d302bea68c
Prevent remove_stale_contenttypes from removing the access_admin permission (#6652)
Fixes #4444. Thanks to @berekuk for the pointer to how to fix this cleanly.
2020-12-23 23:35:17 +01:00
Karl Hobley fe79fbb48f Remove pre-es6 module patterns 2020-12-22 23:39:24 +00:00
Karl Hobley 9873c23e3c Manually fix/ignore remaining legacy JS linting issues 2020-12-22 23:39:24 +00:00
Karl Hobley d32ed81124 Run 'eslint --fix' on legacy JS 2020-12-22 23:39:24 +00:00
Karl Hobley f42ac4b410 Switch to 2-space indentation 2020-12-22 23:39:24 +00:00
Matt Westcott 58927f91dc Add a preprocessing step to WidgetWithScript where database lookups can happen
This avoids separate lookups during render_html and render_js_init, and means that shared logic such as building the edit-view URL can be accessed outside of template rendering (so that we can pass it to chooser.setState in the Javascript chooser API, for example).
2020-12-20 12:56:22 +00:00
Matt Westcott d2ccd0eb84 Refactor choosers to not pass model instances to templates
Passing the model instance means that logic such as rendering thumbnails and generating URLs to edit pages ends up on the template. This is bad because we're going to want to populate these widgets through mechanisms other than rendering the template (e.g. setState on the widget's Javascript API), and that would end up duplicating the logic on the template.
2020-12-20 12:56:22 +00:00
Matt Westcott d401d6dbf6 Move configuration parameters for createPageChooser into a dict
This will make them easier to manage when they need to be passed through additional levels of indirection between the Python widget code and the eventual call to createPageChooser, e.g. in PageChooserBlock.
2020-12-20 12:56:22 +00:00
Matt Westcott 73623cc66a Implement a public Javascript API for PageChooser 2020-12-20 12:56:22 +00:00
Matt Westcott 09fb115a2d Catch JSON decode errors in oembed responses (#6648)
Fixes #6646 - for private videos, Youtube's oembed endpoint returns the text "Forbidden", but with a 200 status code, which fails JSON decoding.
2020-12-18 15:59:51 +00:00
Bohreromir 3d18986610 fix ModelAdmin example (#6645) 2020-12-17 16:39:30 +00:00
Luis Nell e48c1704cb
Change embed finder credit order (#6636)
It's a really small thing, but I honestly feel like Cynthia did most of the work of taking my workaround to production quality code and pushing it over the finish line. So she should be first here.
2020-12-16 14:35:00 +00:00
Vadim Karpenko 4cfd303db9 Check action menu items (pages and snippets) for None before using (#6566) 2020-12-15 19:17:53 +00:00
Matt Westcott 3768483352 Fill in release date for 2.11.3 2020-12-10 17:59:21 +00:00
Matt Westcott c21d82924e Update translator credits 2020-12-10 17:58:56 +00:00
Matt Westcott c610e661c5 Fetch new translations from Transifex 2020-12-10 17:53:49 +00:00
Matt Westcott 49136ea4a5 Prevent error on publish check in create_log_entries_from_revisions (#6628)
Fixes #6498
2020-12-10 17:34:57 +00:00
Matt Westcott 971bdc0799 Fix combining locale/translation_of API filters with search (#6627)
Fixes #6626
2020-12-10 16:26:41 +00:00
Karl Hobley 45650053d5
Avoid recommending replacing image/document models entirely (#6624)
... when using the ``WAGTAILIMAGES_IMAGE_MODEL``/``WAGTAILDOCS_DOCUMENT_MODEL`` settings.

We can't really support this as we add new fields and methods to these base classes which all images/documents must support. If we did want to support swapping out the models entirely, every addition we make to the base models could be a breaking change.
2020-12-09 16:29:41 +00:00
Matt Westcott f4702646bd Release note for #6572 2020-12-09 16:28:20 +00:00
Andreas Morgenstern 81ab1d8cb4
Allows to mark the language names as translation strings (#6572)
* Force __str__ of Locale to be a string

* Put some translation proxies in to test settings

* Fixed import in wrong place

* Added test for gettext in LANGUAGES to the Locale model

Co-authored-by: Andreas M <am@zauberberg-medien.de>
2020-12-09 15:59:01 +00:00
David Beitey 67235accfc Improve database settings and docs for tests (#6585)
This change makes several improvements:

* Use in-memory SQLite database for test migrations

  The default database is SQLite but its NAME (which SQLite uses as the
  filename) was `wagtail`, which isn't valid since
  the wagtail codebase already has a `wagtail/` directory.  Trying to
  run migration creation commands
  (https://docs.wagtail.io/en/latest/contributing/developing.html#running-migrations-for-the-test-app-models)
  produced an error:

  django.db.utils.OperationalError: unable to open database file

  because of this conflict.

  This change uses an in-memory database as the default database for
  tests. If DATABASE_NAME were set to a real file name, then
  running the migration command with SQLite creates an empty db with
  this filename on running `django-admin`.

  Other non-SQLite engines continue to use the original `wagtail` name,
  meaning that the `test_wagtail` database gets created just as before.

* Modifies the default values for database USER, PASSWORD, HOST etc to
  being an empty string rather than None, to match Django's
  [defaults](https://docs.djangoproject.com/en/stable/ref/settings/#host).
  This helps avoid any potential issues when Django and database engines
  are expecting this being a string.

* Adds documentation to `developing.rst` regarding installation of
  required database modules and available environment variables for database
  connection customisation

* Normalises the DATABASE_PASSWORD tests environment variable to match
  the name in Django's database settings object
2020-12-09 15:28:44 +00:00
Karl Hobley 27133f9570 Moved wagtailadmin/draftail entrypoints into client folder 2020-12-09 14:37:22 +00:00
Karl Hobley 160d66ca93 Move all legacy JS into client folder 2020-12-09 14:37:22 +00:00
Matt Westcott 8edd590ea0 placate isort 2020-12-09 13:22:41 +00:00
Dan Braghis 05587e0d84 Allow customising image/document admin forms (#6462) 2020-12-09 12:35:19 +00:00
Andreas Nüßlein 6a7a5756d9 Add string representation to image Format() (#6608)
when checking on the currently registered Formats, e.g. with `get_image_formats()` the output is now easier to read.
2020-12-09 12:16:26 +00:00
Brian Oliver ac88310402
Update third-party tutorials (#6622) 2020-12-09 10:58:50 +00:00
Matt Westcott 8d9e864581 Release note for #6485 2020-12-08 18:23:56 +00:00
Matt Westcott 93a80efe50 Add docs for modifying StreamField data 2020-12-08 16:57:10 +00:00
Matt Westcott 5af357b373 Add end-to-end test of updating a streamfield in-place 2020-12-08 16:57:10 +00:00
Matt Westcott e90b6af872 Reinstate stream_data as a deprecated property of StreamValue
This (hopefully) fully replicates the old behaviour of stream_data, returning raw JSON data for lazy StreamValues and the tuple representation for non-lazy values.
2020-12-08 16:57:10 +00:00
Matt Westcott 23849d81be Give BoundBlock, StreamValue and RawDataView more helpful repr()s
It seems quite likely that the lack of nice representations for these in the shell / debugger is what stopped people from realising that they could index StreamValue as an array, and led them towards stream_data instead ("ooh, this looks like an array of data... I know how to deal with this")
2020-12-08 16:57:09 +00:00
Matt Westcott 37d4e841d7 Provide a raw_data accessor on StreamValue to allow accessing and modifying the raw JSON representation
This matches the old behaviour of stream_data for lazy StreamValues. Given that a lazy StreamValue is what you get as standard when retrieving a model instance from the database (or from a PageRevision), any existing user code that casually tinkered with stream_data unaware of the lazy versus non-lazy gotcha is almost certainly expecting it to behave this way - therefore in 99% of cases those users should be able to replace `stream_data` with `raw_data` and have their code work as before, with the added bonus that it won't fall over on page previews (which get their data from a form submission in Python format rather than JSON, and are thus NOT lazy).
2020-12-08 16:57:09 +00:00
Matt Westcott aab619550f Implement __delitem__ and insert on StreamValue 2020-12-08 16:57:09 +00:00
Matt Westcott 683c95e3ec Convert _bound_blocks from a dict into a list with None as placeholders
This makes it a lot easier to implement __delitem__ and insert, since we don't have to renumber indexes...
2020-12-08 16:57:09 +00:00
Matt Westcott caade5f0de implement __setitem__ on StreamValue 2020-12-08 16:57:09 +00:00
Matt Westcott 603dc650e5 Eliminate stream_data for StreamValue internal storage
Since stream_data existed in lazy (JSONish dicts) and non-lazy (tuples containing native values) variants, retrieval and serialisation each required two separate code paths. We now have a single representation, consisting of the raw JSONish data in _raw_data (unused if we were initialised with native data) and a cache of StreamChild objects in _bound_blocks (prefilled if we were initialised with native data).
2020-12-08 16:57:08 +00:00
Matt Westcott b05173db51 Add tests for modifying StreamField data by writing to StreamChild objects
This wasn't designed to be possible, but it's useful enough that someone somewhere is bound to have done it...
2020-12-08 16:57:08 +00:00