-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/subscriptions modify #50
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
Conversation
martinyde
commented
May 5, 2021
- Messages view update
- Message languages fix
- Cleanup templates
- Modify icon asstes
| $dark-upvote: darken($primary-color, 10%); | ||
| $dark-follow-content: darken($primary-color, 10%); | ||
| $dark-edit: darken($secondary-color, 10%); | ||
| $dark-subscribe: darken($primary-color, 10%); |
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 should be darken($subscribe, 10%); (in case $subscribe is set to something other than $primary-color).
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.
Fixed
| $dark-subscribe: darken($primary-color, 10%); | ||
| $dark-favourite: darken($primary-color, 10%); |
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 should be darken($favourite, 10%); (in case $favourite is set to something other than $primary-color).
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.
Fixed
| {% if action == 'unflag' %} | ||
| {% set action_class = 'unsubscribe' %} | ||
| {% else %} | ||
| {% set action_class = 'subscribe' %} | ||
| {% endif %} |
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.
Should be written as {% set action_class = action == 'unflag' ? 'unsubscribe' : 'subscribe' %}.
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.
Changed
| {% set title = "About document"|t %} | ||
| {{ _self.title(title, "document", node, content) }} | ||
| {% endif %} | ||
| {{ macros.title("About document", "document", node, content) }} |
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.
"About document" must be translated, i.e. {{ macros.title("About document"|t, … }}.
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.
Fixed
| <div class="user"> | ||
| {% include '@os2loop_theme/field/user-image.html.twig' with {'uid': user.account.id} %} | ||
| {% include '@os2loop_theme/field/username.html.twig' with {'uid': user.account.id, 'account': logged_in_user} %} | ||
| {% include '@os2loop_theme/field/user-name.html.twig' with {'uid': user.account.id} %} | ||
| </div> |
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.
These 4 lines are duplicated in (at least) two template files and could be refactored into a shared template, user-info.html.twig, say. Furthermore, we should pass the entire user object to the template and let it get the parts it needs, e.g.
{% include '@os2loop_theme/user-info.html.twig' with {user: user} %}
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.
A user-info.html.twig has been added.
| <div class="col-md"> | ||
| <div> | ||
| <a href="{{ url('entity.user.canonical', {'user': uid}) }}">{{ account.os2loop_user_given_name.value }} {{ account.os2loop_user_family_name.value }}</a> | ||
| <a href="{{ url('entity.user.canonical', {'user': uid}) }}">{{ drupal_field('os2loop_user_given_name', 'user', uid)['#items'].0.value }} {{ drupal_field('os2loop_user_family_name', 'user', uid)['#items'].0.value }}</a> |
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.
Sometimes I hate Drupal! Do we really need ['#items'].0.value?
Can https://www.drupal.org/project/twig_field_value help clean this up?
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.
Looks like it could yes.
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.
After a rewrite with user-info.html.twig, it was made possible to grab the values from the user entity instead of calling drupal_field(), that turns:
drupal_field('os2loop_user_given_name', 'user', uid)['#items'].0.value
into
user['#user'].os2loop_user_given_name.value
rimi-itk
left a comment
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.
Just one final suggestion …
| /** | ||
| * @file | ||
| * Default theme implementation for displaying a username. | ||
| * Template for displaying a username. |
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.
Well, it actually displays a lot more. Maybe the comment should read “Template for displaying a user“ – or we could get rid of this template and the comment (cf. suggestion on inlining two templates).
| {% include '@os2loop_theme/field/user-image.html.twig' with {'uid': user['#user'].id} %} | ||
| {% include '@os2loop_theme/field/user-name.html.twig' with {'user': user} %} |
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.
If these two (small) templates are not used anywhere else I think we should just put their content into this template. If inlining is not possible, we should pass the full user object to user-image.html.twig for consistency.
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.
Combined into one
Feature/BKL-75-AddHeaderToCreateQuestion