-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve meta fields #538
Improve meta fields #538
Conversation
|
||
entry = create(:entry) | ||
|
||
expect(entry.draft.author).to eq("Prof. Dr. Sahra Isak") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
}); | ||
this.input('keywords', pageflow.TextInputView, { | ||
placeholder: pageflow.theming.attributes.default_keywords | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that values are copied, displaying placeholders here might be misleading. Clearing the text box does not reset the values to the theming default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Drop them completely? Or replace with some generic placeholder?
Author
Publisher
comma, separated, keywords
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the meta tag helper it looks like we are actually falling back to global config, not the theming default when the user clears an input here. So I guess, we should be should be displaying that as a placeholder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that's what my latest change accomplished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it would still display theming.default_author
if that is present or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes back to our discussion about copying vs "inheriting" defaults. If we extend the fallback logic of the helper, I'm not sure whether things might get more confusing since there then can be
- entries with copied default meta data which do not change when the defaults in the theming change
- entries with emptied meta data attributes which then fallback to theming defaults but also change when the theming changes
Being able to retroactively change the meta data of a lot of entries by editing the theming seems like to much power to me. I'd say let's just display the defaults form the global config as placeholders here. Then if somebody chooses to use those by emptying his meta data fields, at least there is less risk of unexpected change because changing these defaults at least means editing the initializer and deploying. Makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing: Let's pass the global default values via app/views/pageflow/config/_editor_seeds.json.jbuilder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the theming as a transport might trip us up later, since those are not really the theming attributes we are passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attributes rendered in the config seed are available as pageflow.config.defaultSomething
inside the editor js.
|
||
theming.copy_defaults_to(revision) | ||
|
||
expect(revision.keywords).to eq("ratione, aut, blanditiis") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Changes Unknown when pulling c31dd02 on scrollytelling:default-meta-on-theming into * on codevise:master*. |
Changes Unknown when pulling 803025e on scrollytelling:default-meta-on-theming into * on codevise:master*. |
@tf pushed up the required changes. Review? |
Changes Unknown when pulling 8bec49b on scrollytelling:default-meta-on-theming into * on codevise:master*. |
publisher: default_publisher.presence || Pageflow.config.default_publisher_meta_tag, | ||
keywords: default_keywords.presence || Pageflow.config.default_keywords_meta_tag | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Hound is right here. Let's keep the Widget.copy_all_to
and extract the revision update into a copy_default_meta_tags
method. That way copy_defaults_to
has a nicer abstraction level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can continue tomorrow at the earliest. |
|
expect(revision.widgets).to include_record_with(type_name: 'custom_header', role: 'header') | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We lost a spec here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot to paste it back. 😟
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been added back in.
Looks good! Can you address the last remaining points and squash the commits? Then we're good to merge. |
I will address them. As far as squishing, this is now something built-in to GitHub. It works quite well! You can select the "squash commits" option on the merge button. I will update the PR probably later today. |
Interesting. To be honest, I actually like the merge commits though since they state the PR number and branch name. Those would not show up if I hit the squash button, right? I just don't need the fine grain commit history that lead to the final state of the PR on master. |
PR number does, in parentheses. And each commit message is added to a bullet list in the merge description. It's pretty nice. I'll squash-merge your PR for our navigation plugin so you can see if you like it. Otherwise happy to squash myself. |
this is what a GitHub-squashed commit looks like. If there had been more than one commit, it would all have become just one. |
I might try this on a new project, but for consistency I think I will stick with merging here. So it would be great if you could squash once your done. Thanks. |
moved meta defaults to global JS config in 598e32a. |
* default_author * default_publisher * default_keywords These will be taken to become author, publisher and keywords fields for new entries for this Theming. Also render those defaults as placeholders on the Entry fields. We copy Configuration meta defaults into Revision. This way, we will persist those metas with the revision, and they will always be part of that publication. Given a new revision, these meta fields can be changed, or removed. fallback to Config meta defaults in the editor Also show placeholders in Theming edit form render config values as Theming defaults This goes back to our discussion about copying vs "inheriting" defaults. If we extend the fallback logic of the helper, I'm not sure whether things might get more confusing since there then can be entries with copied default meta data which do not change when the defaults in the theming change entries with emptied meta data attributes which then fallback to theming defaults but also change when the theming changes Being able to retroactively change the meta data of a lot of entries by editing the theming seems like to much power to me. I'd say let's just display the defaults form the global config as placeholders here. Then if somebody chooses to use those by emptying his meta data fields, at least there is less risk of unexpected change because changing these defaults at least means editing the initializer and deploying. Makes sense?
🎉 |
This pull request adds default fields for author, publisher and keywords to Theming (Account).