Skip to content
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

Merged
merged 1 commit into from
Jun 29, 2016
Merged

Improve meta fields #538

merged 1 commit into from
Jun 29, 2016

Conversation

tilsammans
Copy link
Contributor

@tilsammans tilsammans commented Jun 17, 2016

This pull request adds default fields for author, publisher and keywords to Theming (Account).


entry = create(:entry)

expect(entry.draft.author).to eq("Prof. Dr. Sahra Isak")

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
});
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I knew there was something.

Fixed in e9f6f66.

I will squash & rebase now.

Copy link
Member

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

Copy link
Member

@tf tf Jun 29, 2016

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.

Copy link
Member

@tf tf Jun 29, 2016

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.

@tf tf changed the title Improve meta fields [WIP] Improve meta fields Jun 22, 2016

theming.copy_defaults_to(revision)

expect(revision.keywords).to eq("ratione, aut, blanditiis")

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.

@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

Changes Unknown when pulling c31dd02 on scrollytelling:default-meta-on-theming into * on codevise:master*.

@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

Changes Unknown when pulling 803025e on scrollytelling:default-meta-on-theming into * on codevise:master*.

@tilsammans
Copy link
Contributor Author

@tf pushed up the required changes. Review?

@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

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
Copy link
Member

@tf tf Jun 27, 2016

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tilsammans
Copy link
Contributor Author

I can continue tomorrow at the earliest.

@tilsammans
Copy link
Contributor Author

Widget.copy_all_to is now retained, and rebased on master.

@coveralls
Copy link

coveralls commented Jun 28, 2016

Coverage Status

Coverage increased (+0.01%) to 97.638% when pulling 33dc47f on scrollytelling:default-meta-on-theming into cad8bf5 on codevise:master.

expect(revision.widgets).to include_record_with(type_name: 'custom_header', role: 'header')
end
end

Copy link
Member

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.

Copy link
Contributor Author

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. 😟

Copy link
Contributor Author

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.

@tf
Copy link
Member

tf commented Jun 28, 2016

Looks good! Can you address the last remaining points and squash the commits? Then we're good to merge.

@tilsammans
Copy link
Contributor Author

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.

@tf
Copy link
Member

tf commented Jun 28, 2016

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.

@tilsammans
Copy link
Contributor Author

Those would not show up if I hit the squash button, right?

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.

@tilsammans
Copy link
Contributor Author

this is what a GitHub-squashed commit looks like. If there had been more than one commit, it would all have become just one.

@tf
Copy link
Member

tf commented Jun 28, 2016

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.

@coveralls
Copy link

coveralls commented Jun 29, 2016

Coverage Status

Coverage increased (+0.05%) to 97.673% when pulling 2bc90b3 on scrollytelling:default-meta-on-theming into cad8bf5 on codevise:master.

@coveralls
Copy link

coveralls commented Jun 29, 2016

Coverage Status

Coverage increased (+0.06%) to 97.685% when pulling 05feb74 on scrollytelling:default-meta-on-theming into cad8bf5 on codevise:master.

@coveralls
Copy link

coveralls commented Jun 29, 2016

Coverage Status

Coverage increased (+0.08%) to 97.706% when pulling e9f6f66 on scrollytelling:default-meta-on-theming into cad8bf5 on codevise:master.

@tilsammans
Copy link
Contributor Author

moved meta defaults to global JS config in 598e32a.

@coveralls
Copy link

coveralls commented Jun 29, 2016

Coverage Status

Coverage increased (+0.01%) to 97.643% when pulling 598e32a on scrollytelling:default-meta-on-theming into cad8bf5 on codevise:master.

@coveralls
Copy link

coveralls commented Jun 29, 2016

Coverage Status

Coverage increased (+0.06%) to 97.685% when pulling 47a9e93 on scrollytelling:default-meta-on-theming into cad8bf5 on codevise:master.

* 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?
@coveralls
Copy link

coveralls commented Jun 29, 2016

Coverage Status

Coverage increased (+0.02%) to 97.643% when pulling c2772b8 on scrollytelling:default-meta-on-theming into a90d696 on codevise:master.

@tf tf changed the title [WIP] Improve meta fields Improve meta fields Jun 29, 2016
@tf tf modified the milestone: v0.11 Jun 29, 2016
@tf tf merged commit 418f90c into codevise:master Jun 29, 2016
@tilsammans tilsammans deleted the default-meta-on-theming branch June 29, 2016 15:30
@tilsammans
Copy link
Contributor Author

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants