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

Feature/default phrase #93

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dkNorth
Copy link

@dkNorth dkNorth commented Nov 25, 2020

Adds a default option for normal phrases.

If you want to change the default later on, but keep the already set up phrases intact.

In my case... I create multiple versions of the same phrase, with a default phrase that may be changed later on. I can't use the key as a default, because if I change it, it resets all other versions back to default, because the key is different. With a default phrase I can change it as often as I like without touching the key.

@cilim
Copy link
Member

cilim commented Nov 30, 2020

@dkNorth thanks for opening the pull request for this.

Can you please give me an example of your default phrase value? I think it might clear up the reason for why this behaviour is beneficial. Is your goal adding new phrases with a different default value, or performing shotgun surgery on all your views that have a default value?

Also, I'd rather go with setting the default value via configuration:

config.white_list = ["Post.title", "Post.body"] # already exists
# config.default_phrase = nil => would be the gem default
config.default_phrase = 'Please enter phrase here'

This way you wouldn't have to define default on every phrase if it's the same.

@dkNorth
Copy link
Author

dkNorth commented Dec 1, 2020

I needed the default phrase, because in my App an Editor is allowed to create personalized Pages for specific Visitors. In short they create a page and the visitor who the site is for, receives a link only to that specific page.

This page always starts out the exact same with text passages at predetermined locations. The Editor of course should be able to edit these and should also get an Idea how it looks like with default text. Now, I got many different text passages, some are long, some are just titles and so on and all of them should be filled with dummy text (the default phrase).

The way I did this before was that I put the dummy text into the key parameter, which worked fine, but there were 2 problems:

  1. The "Edit All" List was very chaotic. It wasn't really possible to see where each phrase belonged, because the keys were so long and unspecific.
  2. If me or the Editor wants to change the default phrase for new pages later on, we can't, because changing the key value (default phrase) means changing back all previous set phrases on the other pages to the new default, because the key is different now.

I can't use the default phrase in the config either, because the dummy texts should be different for different phrases.

I realize it probably is a very specific problem, but I wrote the update so that it was optional to use it like this.

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.

2 participants