Coder Social home page Coder Social logo

Comments (11)

nickcharlton avatar nickcharlton commented on July 25, 2024

@januszm, I think you're hitting a few things here, one of which was a mistake by me.

  • Could you describe in more detail what custom modifications you're making with the view templates?
  • We don't use Bootstrap, we have our own small CSS framework in Administrate itself,
  • The search input issues were probably caused by #2492 and fixed in #2512,
  • How does the Datepicker fail? Just not load at all?

Could you try with current main and let me know what's still broken?

from administrate.

januszm avatar januszm commented on July 25, 2024

@nickcharlton thanks for your quick reply, let me clarify this as I was already able to resolve issue 1.

First, problem with template from 0.19 that was customized, and below are diffs that solved it:

- ... ) if valid_action?(:edit) && show_action?(:edit, page.resource) %>
+ ... ) if accessible_action?(page.resource, :edit) %>

(valid_action? => accessible_action?)

- <% page.attributes.each do |attribute| %>
+ <% page.attributes.each do |title, attributes| %>

this is I believe what caused the no method error name for [...] Array, (attribute vs attributes)

Search box with weird blue background on hover (see attachment)
Screenshot 2024-02-16 at 14 47 53

Datepicker actually WORKS but it uses white font color on white background which of course makes the text invisible and suggests that it isn't working. (see attachment)
Screenshot 2024-02-16 at 14 48 52

from administrate.

januszm avatar januszm commented on July 25, 2024

@nickcharlton also, the last two (visual) issues are solved on the main branch. I've just updated the gem and it looks good.

So the potential, future "Upgrade to v1" Guide should contain information about the need to re-generated the customized partials and re-apply added code. I think that's all.

from administrate.

januszm avatar januszm commented on July 25, 2024

One more request, I noticed that after the upgrade the <pre> elements don't have white-space pre-wrap set anymore. I have some dashboards where I dump jsonb data with JSON.pretty_generate. It produces <pre> tags (just a poor-mans way for supporting jsonb with administrate). In 0.19 long lines were nicely wrapped. In v1 I have to somehow inject pre { white-space: pre-wrap; }

Or, can I somehow enforce applying this class to specific field?

.preserve-whitespace {
  white-space: pre-wrap;
  word-wrap: break-word;
}

https://github.com/thoughtbot/administrate/blob/main/app/assets/stylesheets/administrate/components/_attributes.scss

from administrate.

nickcharlton avatar nickcharlton commented on July 25, 2024

So the potential, future "Upgrade to v1" Guide should contain information about the need to re-generated the customized partials and re-apply added code. I think that's all.

Alright, cool! I'll add a mention to explicitly call that out in the migration guide. It is something we started highlighting in the CHANGELOG, but that's always easy to miss.

from administrate.

nickcharlton avatar nickcharlton commented on July 25, 2024

Re: <pre>, can you tell if that's something that changed in the linting PR? If it was, I think we should undo that specific change as it wasn't intentional.

from administrate.

januszm avatar januszm commented on July 25, 2024

ReL <pre>, for a regular field it looks ok, both white-space and word-wrap attributes are set properly.
In my case the issue is with a custom field (data type) that I called PrettyJson (it's a type that I use to dump a typical jsonb column data).
It generates the following css class which is missing the necessary white-space attr attribute-data attribute-data--pretty-json-field

from administrate.

januszm avatar januszm commented on July 25, 2024

UPDATE: @nickcharlton please disregard my comments about <pre>. After all it was because I had a custom field with a custom template and in that template I used <pre> tag. The solution was to add a CSS class to this custom view partial.

Any chance I can tell my custom field class to use preserve-whitespace CSS class on the generated element? Just like for the Field::Text class.

from administrate.

nickcharlton avatar nickcharlton commented on July 25, 2024

Ah, hah! Excellent. Glad to hear you figured it out.

Is that everything you were having trouble with?

from administrate.

januszm avatar januszm commented on July 25, 2024

All good now.

I'd make this section of the migrating .md file a bit more detailed, e.g.

As with most upgrades, if you're upgrading between versions with changes to the
templates, and if you've customised them, you may need to apply recent changes.
You can see those which changed in the [CHANGELOG][].

This applies to both modified files in `app/views/admin` and `app/views/fields`
if you have your own Field classes defined. A good way is to use the same command
to generate the view as for the earlier version:
`rails generate administrate:views:ACTION MyModel`
noting the changes and re-applying the modifications

from administrate.

nickcharlton avatar nickcharlton commented on July 25, 2024

Oh, yes, that's a great idea. I'll do that.

I'll close this now, but please open new issues if you find problems.

from administrate.

Related Issues (20)

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.