Coder Social home page Coder Social logo

silverstripe / silverstripe-admin Goto Github PK

View Code? Open in Web Editor NEW
25.0 18.0 91.0 46.17 MB

Silverstripe Admin Component

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

PHP 12.92% JavaScript 57.69% CSS 7.95% HTML 3.88% Scheme 1.59% Gherkin 3.81% SCSS 11.96% Less 0.21%
hacktoberfest

silverstripe-admin's Issues

BUG Dropdown menu's cut off in toggle field

image

The toggle field does allow you to scroll and all options are accessible (at least in chrome). It would be nicer if the toggle field extended to the height of the dropdown.

Edit: This was tested in 3.1.2

ModelAdmin: Returns CMSForm when editing, RequestHandler gives Form when submitting/validating?

Hi, I found a possible bug that I think relates to silverstripe/silverstripe-cms#586 in the CMS codebase but, instead of Page instances, it's for generic DataObject's managed by ModelAdmin. This seems to affect the 3 codebase, not sure about master.

Basically, I cannot prevent validation when I delete a ModelAdmin administered DataObject instance (e.g. in my case Location object driven by LocationAdmin) even if I were to manually call this on my form either in ModelAdmin (modifying core code) or in my LocationAdmin class' own ->getEditForm() override:

$form->setValidationExemptActions(array('delete', 'doDelete'));

Even though the ->validate() method is called on submission, it doesn't work. This is because instead of calling validate on CMSForm when submitting (the instance that is returned by ModelAdmin when editing, like when you edit a Page) which would normally check for a validation exempt action, it instead manufactures a completely separate Form instance from here: https://github.com/silverstripe/silverstripe-framework/blob/3/control/RequestHandler.php#L200 (I gave up after this point).

How can I prevent form validation on my DataObject's? Is this a bug?

TinyMCE Background Colour Improvement

The shade of grey used as the TinyMCE toolbar background isn't used anywhere else in the CMS, and so the WYSIWYG toolbar doesn't look as integrated as it should.

How about changing it to the same colour as the CMS header bars? (#F0F2F4)

Before:

After:

Yes, it's a subtle change, but I think it makes a big difference.

Breadcrumb title position if there is an empty list item

When there is an empty list item in the breadcrumb the page title (last breadcrumb item) gets pushed down.

image

Adding a quick CSS fix for this but keeping in mind for the refactor of Pages breadcrumbs (will open separate issue).

Pull requests

#24

Implement a TreeMultiSelectField in React

Acceptance Criteria

  • I can choose multiple items from hierarchical data
  • I can search for items in the same way as with single select TreeDropdown (see silverstripe/silverstripe-framework#6842)
  • I can remove single items for multi selects
  • Selected values show their labels even when the element is not available in the list yet (due to lazy loading)
  • The field complies with WCAG accessibility guidelines
  • The field can handle at least five selected items without breaking the layout
  • The field presents selection efficiently in readonly/disabled views

Tasks

  • Multiple values can be selected
  • Cater for "unchanged" empty value when no option is selected in TreeMultiselectField
  • Show selected values which are not found in the tree
  • Ensure single select still works
  • Ensure readonly/disabled view works with correct titles
  • unit tests

Nice to haves

  • simplify the logic around reducers and components
  • The field efficiently displays long tiles as selected items (and provides context on nested items)

Notes

  • This should be a specialisation of the existing <TreeDropdownField> component, ideally with minimal code duplication
  • The field UX isn't really designed for selecting lots of items (e.g. for "related documents", a relational GridField is the better choice).

Designs

Looking for feedback on these (WIP) https://projects.invisionapp.com/boards/D3X68PS46K28/

Related

Pull requests

Adding javascript to LeftAndMain not working as per documentation

I wanted to add some custom javascript and css to the admin, I took a look at the LeftAndMain class I fond this in the doc block of $extra_requirements_javascript

 YAML configuration example:
 <code>
 LeftAndMain:
   extra_requirements_javascript:
     mysite/javascript/myscript.js:
 </code>

When I tried the following in an new config.yml

LeftAndMain:
  extra_requirements_javascript:
    mysite/modules/editor/code/javascript/no-follow.js:
  extra_requirements_css:
    mysite/modules/editor/code/css/no-follow.css:

It does not load the javascript file, it only loads the css file, but when I do the following, it works, is there a possible issue? or just outdated documentation?

LeftAndMain:
  extra_requirements_css:
    - mysite/modules/editor/code/css/no-follow.css
  extra_requirements_javascript:
    - mysite/modules/editor/code/javascript/no-follow.js

ACCESSIBILITY: readonly fields should be <input readonly >

At the moment we use <FormControl.Static /> in react which doesn't produce proper input tags. I suggest that we should probably stick with literal inputs for all input-type fields, and flag these with either disabled or readonly html properties.

This distinguishes readonly inputs from literals (provided by LiteralField).

Exported members CSV has broken 'First Name' column

(Using SilverStripe 3.5.x-dev on CWP)

If I export a list of the members to a CSV file:

image

It generates this CSV file:

image

Notice how there is a space in the First Name column. If I import the CSV file as is, any new members will be created but they will be missing their first name in the Member object.

So two issues here:

  • Exported member CSVs should contain the correct name for the column (which is FirstName) - thus saving the confusion
  • Isn't first name a required field? If so why is the CSV import allowing members missing first names to be created?

BUG Form change detection attaches itself to all forms

At the moment change detection is attaching itself to all forms, not simply those that submit to a dataobject. E.g. search forms, insert-link forms. These incorrectly prompt the user to save the form before they navigate away, creating a highly negative user experience.

Traced back to a change in BootRoutes.js which checks all redux forms.

https://github.com/silverstripe/silverstripe-admin/pull/76/files#r118858608

Pull requests

Inline edit/remove of links in HTML editor

Acceptance Criteria

  • I can open an edit dialog when focusing on a link without going through the "insert" button in the toolbar
  • The dialog opens correctly based on the link type (page, url, anchor, file, email)
  • I can remove a link from selected text without opening a dialog
  • It is clear to authors that the actions remove the link, not the linked text itself
  • The "unlink" button in the editor toolbar is removed, since it's duplicate functionality and clutter

Notes

  • Design: https://projects.invisionapp.com/share/BGAYOTRFY#/screens/233190188
  • The 3.x UX forces authors to choose "insert link" in the TinyMCE menu in order to edit said link, which is counterintuitive
  • Follow on task from #65
  • Ideally we have a label for the link in the overlay as a preview, but that's going to be hard because it we link shortcodes to database IDs for files and page links. So we'd need to load their titles/urls via XHR, which is out of scope for now
  • Check Wordpress implementation, we might be able to reuse the TinyMCE implementation

Tasks

  • Create inline toolbar with 2 buttons โ€“ edit and unlink
  • Show the toolbar when a link node is focused in
  • Display the right link dialog box when clicking Edit button
  • Toolbar positioning
  • Styling

Pull requests

Related

Preload and cache "insert link" forms

Acceptance Criteria

  • As a CMS author, I can insert links without breaking my writing flow due to sluggish UIs
  • All "insert link" forms are available without a loading delay in the browser after first load
  • The "page" dropdown refreshes whenever the "insert link to page" form is opened
  • The "insert anchor" form automatically has the current page set when the form is opened
  • The anchor list refreshes whenever the "insert anchor" form is opened
  • The caches are cleared when the CMS language is changed
  • The caches can be cleared by the user through default browser mechanisms

Notes

  • This is one of the most common user actions in the CMS, so detail optimisations are warranted
  • Every form schema based form should be able to opt-in to this logic
  • HTTP-based caching rules would allow easy cache clearing: Either through expiry times, or through a hard browser refresh by the user.
  • Technically different users could get different form schema responses - we should tie these caches to various environment criteria (UserID, SubsiteID)
  • This is a partial performance regression from SS3: The "insert link" form only loaded the first time and persists in the DOM until the browser is refreshed
  • Follow up from silverstripe/silverstripe-framework#5947

ModelAdmin requiring lead-slash on FQCN

The framework is evidently pointing developers towards omitting the lead-slash, however ModelAdmin::$managed_models requires a lead-slash and throws an error

[User Error] ModelAdmin::init(): Invalid Model class

private static $managed_models = [
    'Zanderwar\Scraplands\Models\Player',
    'Zanderwar\Scraplands\Models\Online'
];

This works fine if I do include the lead-slash

Previous selected items in tree are deselected on TreeMultiselectField reload

When using a TreeMultiselectField with nested items, after saving the field and reopening the dropdown, some items previously selected are not selected anymore.

To reproduce:

  1. Create nested items (taxonomies, for example). Create two parent categories, and one child per each.
  2. Create a TreeMultiselectField and display the previously created nested items with it.
  3. In the CMS, open the dropdown and open both parents, tick both children (it doesn't seem to matter if the parents are checked or not).
  4. Close the dropdown, see that the items are displayed correctly on the dropdown summary.
  5. Save.
  6. Go back to the dropdown. See that the dropdown summary is displaying the checked fields correctly still.
  7. Open the dropdown.

What happens:
The second parent leaf is opened and its child selected. The first parent leaf is not opened (even though the icon to open it is active). If you open the first parent (you have to click twice, once to close and once to reopen the leaf) you can see the child is not selected anymore. The dropdown summary now doesn't have both children displaying there.

What I expect to happen:
I expect all children selected to remain checked after reopening the dropdown. It's not a matter if the parents are all opened or not if the children are selected, the main problem is that previous selections get deleted when reopening the dropwdown.

treemultiselectfield-bug

Save buttons sometimes require two clicks

Sometimes when you make a change in the CMS and click Save... nothing happens. The Save button gets focus, but you need to click it again to see the spinning progress indicator animation and trigger the actual save. This bug has tripped me up countless times, because I assume I've saved but I haven't.

I encounter this bug often, but I can't seem to come up with conditions to reliably reproduce it. I've seen it on 3.1 through 3.3 and assume it happens in 3.0 too. I've seen it affect page forms as well as DO edit forms (such as editing a Member in the security section).

Have other people observed this bug or is it just me?

SS4 - No loading states for react components

I've noticed a few times whilst clicking around ss4 that there's sometimes a flicker whilst it loads the component or data. This happens with the campaign form when you click 'Add campaign', the breadcrumbs and most notable the files area starts by saying 'No items found' before loading the items.

I think anything that relies on retrieving data should have a hasloaded state set to false so that it can be relayed to the user that the page/component isn't ready yet.

HtmlEditorField insert link toggle broken with pre3.2 form ID/classes set

On one of my sites we have the FormTemplateHelper_Pre32 enabled for forms, this seems to break the HtmlEditorField insert link feature, when selecting the link type the form options aren't updated.

This looks to be down to https://github.com/silverstripe/silverstripe-framework/blob/3.6/javascript/HtmlEditorField.js#L582-L597 where it's searching for elements with an ID ending with _holder

When I disable the FormTemplateHelper_Pre32 extension, the insert link dialog works as expected.

New UX insert link dialog - Insert anchors

Follow up task from silverstripe/silverstripe-framework#6740

Acceptance Criteria

  • I can insert an anchor into the CMS rich text editor
  • I can choose from existing anchors both on the current page, and another page
  • By default, the current page is selected
  • I can add a custom anchor
  • I can set a link description (prepopulated to selected text)
  • I can edit an existing anchor link by placing the cursor in the link and using the "insert" dialog
  • I can choose to open the anchor in a new window/tab

Notes

Related

PRs

Don't use record-specific Redux Form identifiers

In order to interact with Redux Form data, you need to use Selectors. These require a FormName argument. We register our forms with name = schema url. This URL is record specific. Which makes it impossible to hook into forms unless you know the current record identifier used for this form - which makes for tight coupling of form behaviour to components managing their state.

Note: This is a similar issue to the dependency injection service names, e.g. admin/assets/EditForm/schema/99 schema url vs. 'TextField.AssetAdmin.EditForm` service name. We could reuse these service "namespaces"?

HtmlEditorField changetracker

We are getting false-positives for HtmlEditorFields which have extraneous &nbsp; characters in their Content, which gets mangled by TinyMCE and turns into blank spaces. This results in the popup "Are you sure you want to leave these unsaved changes?" dialog from appearing even though no changes has been made.

This could prove to impact false-negatives, as users are known to use &nbsp; to pad/indent the text on their page. This would mean that if users were only padding/indenting their text without other "meaningful" changes, the popup "Are you sure..." dialog will not appear if the user attempts to browse away, and they will lose their changes without warning.

We'll need to investigate how much of an edge case this could be

Pull requests

LeftAndMain returns EmptyForm() for invalid IDs

If a user is linked to a page id that doesn't exist they receive a mostly blank CMS page thanks to LeftAndMain returning the default empty form.

This is a rather confusing experience for users and there should likely be a 404 alert or similar to let the user know that there's no page where they are looking.

Only make one HTTP request for TinyMCE plugins

Follow up from the "insert link" work, see #58 (comment)

HTTP requests are a major factor in loading performance, even if they're small file sizes. We need to reduce them as much as possible, and the recent TinyMCE changes have gone in the opposite direction - adding four new ones. Figure out how to allow TinyMCE plugins to be loaded determininistically in our app boot, rather than relying on script inclusion order.

/cc @flamerohr

Tasks:

  • Create PHP implementation of tiny_mc_gzip.php that generates bundle from TinyMCEConfig instance
  • Ensure that output of this file is cached to assets via GeneratedAssetHandler
  • Update TinyMCEConfig to point to URLs of generated assets rather than dynamic PHP handler urls

PRS:

More options dropdown label change to icon

Requires #100 to be done first
Part of Responsive CMS issue silverstripe/silverstripe-framework#6267

More options dropdown to swap out the text "More options" for "..." icon in pages section.
image
image

Acceptence criteria

  • The more options action is viewable on small screens (320px and up) and the preview action is still viewable (far right action image )
  • The dropdown/dropup panel is viewable on smaller screens (this needs to move over to the left to be viewable)

pasted_image_19_06_17__2_38_pm

Pull requests

Client-side validation in React forms

Entwine/PJAX forms have been traditionally server-side validated only. React forms are currently working the same way, but could be much more responsive to invalid user input.

Acceptance Criteria

  • CMS authors can see immediate feedback when entering invalid input
  • Feedback applies to HTML5 input fields
  • Feedback applies to custom rules in JSON schema (enforced through Validator.js)
  • Validation defaults to HTML5 (with localised error messages in browser)
  • Feedback happens close to input (e.g. when leaving field focus)
  • Validation styling is consistent with styling of server-side errors
  • When server-side errors are present, any valid change to the form field removes the error
  • When server-side errors are present, any invalid change to the form field replaces the error

Out of scope

  • Multiple validation errors can be shown alongside each other
  • Extensible client side validation rules (needs new card)

Notes

  • At the moment schema-driven validation through Validator.js is inconsistent. Example: <input type=number> should validate decimals based on step. At the moment it's using isNumeric from the validator NPM package which doesn't allow decimals.
  • The date rule in Validator.js seems to be wrong, since there's no isDate() in the validator lib
  • We should avoid duplicate client side validation between native HTML5 and schema-driven validation (e.g. date, email, numeric, required). It's acceptable to only use HTML5 validation where available, without an equivalent "fallback" to schema-driven validation

Resources

Pull requests

Add multi-select shortcuts for dragging files ("lasso" selection)

The drag-drop functionality of files is intuitive for single images but when it comes to dragging multiple items it isn't as intuitive.
Currently you need to check multiple items to drag them, it would be good to be able to select multiple items by dragging an invisible box around items to select them and to be able to use keyboard keys which are native to PC or Mac (eg. shift key and command key for Mac)

Related

SecurityAdmin breadcrumbs show duplicates

Breadcrumbs in SecurityAdmin get duplicates after saving a group.

Steps to replicate:

  1. Go to admin/security
  2. Add a new group by clicking the "Groups" tab, then hit "Add Group" button
  3. Fill out the group name, call it "My Group", but don't set a parent group
  4. Click "Create" to create the group (reloads to show the newly created group)
  5. Click "Save" to save it again

Breadcrumbs are now broken:

Expected: "Security / Groups / My Group"
Actual: "Security / Groups / My Group / My Group"

If you click "My Group" link in the breadcrumbs you're taken back to the root of SecurityAdmin, but instead of just showing "Security" in the breadcrumbs, it shows as "Security / My Group".

Affects SilverStripe 3.1.x-dev, all browsers.

Pulls requests

Alignment of insert media toolbar actions and section title at small veiwport size

Files title should be left (has been pushed because of menu action for mobile devices).
Search icon should be placed next to the close panel action.
Sort should have an active and hover state for both smaller screens and larger as per the other actions in the toolbar. I've updated the icon in the SilverStripe icon set so that it will change to
image with the next update to icons so that the dropdown arrow and icon arrow don't conflict (this should happen automatically).

pasted_image_30_06_17__12_08_pm

Use react-select for react-based dropdowns (SingleSelectField and MultiSelectField)

Acceptance Criteria

  • I can select a single item in a dropdown
  • I can select a multiple items in a dropdown
  • I can clear selection for single selects
  • I can remove single items for multi selects
  • The field efficiently displays long tiles as selected items
  • The field can present validation errors
  • The field has a useful readonly/disabled presentation
  • The styling looks largely consistent between Entwine and React UIs
  • The styling looks largely consistent with the existing <TreeDropdownField> react component
  • Replace checkboxsetfield with listbox in asset-admin permission selection (see silverstripe/silverstripe-framework#6063)

Notes

  • This will eventually replace our use of ChosenJS as we phase out Entwine-based views
  • We're already using react-select for the new react-based TreeDropdownField
  • Consider combining the UI logic with TreeDropdownField (might not make sense, but please think about it)

Excluded

  • I can lazy load large data sets via XHR

Related

Consistency of toolbar actions positions

Buttons (of button toolbar) should align with the button area rather than the icon within the button. Just so it is consistent with the rest of the CMS.

Campaigns example
screen_shot_2017-08-28_at_11_20_33_am

AC

I would like to see all buttons on the button toolbar aligned consistently so that I feel I'm using a finished product that is stable and robust.

  • See that Button toolbar throughout the CMS is aligned from the button area and not from the icon. (SEE campaign example above)
  • I want to see "Add Campaign" Button from more noticeable, i.e. a primary button.

Archive

Buttons with no background (.btn-secondary) should align by the icon rather than the surrounding button area, applies left side of toolbar and right side.
pasted_image_10_05_17__5_17_pm
pasted_image_10_05_17__5_19_pm

Related:
Drop area on the "Up folder" icon can be improved as it is covered when an image is dragged on top of it.

Pull requests

The above pull requests fix:

silverstripe_-security

silverstripe_-files

BUG: Forward and Back button behaviour

Navigating using the forward and back browser buttons is inconsistent.

Steps to reproduce:

  1. Load the CMS at admin/pages
  2. Navigate to the Reports section using the left menu
  3. Navigate back using the browser's back button

Expected:
URL changes back to admin/pages and the pages section loads

Actual:
URL changes back to admin/pages but the section doesn't load.

RFC Solution for thirdparty-module context

Third party modules often add additional context to the CMS, often requiring these to be stored in session. E.g.

  • Translatable or Fluent locale
  • Subsite ID

It may be wiser to add a standard "context" registration in LeftAndMain that these modules can access. These context arguments would be added to all links via querystring get parameters, along with a fixed config whitelist.

See #19 (comment)

Broken styling when registering multiple CMS re-authenticators

If you register an additional authenticator by implementing get_cms_login_form and supports_cms on your Authenticator class, the tab styling to select an authenticator in the dialog is broken when you get the popup after your session times out.

This needs to support the tabs correctly by resizing the dialog to fit the form. The form styling alignments inside the tab needs to be fixed as well, e.g. "Forgot password?" is no longer inline with the password field.

screen shot 2014-10-14 at 6 21 41 pm

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.