Skip to content

Instantly share code, notes, and snippets.

@aya-soft
Created May 28, 2016 17:02
Show Gist options
  • Save aya-soft/14dfbc2ead0bc2d90ed00dbc7081a4da to your computer and use it in GitHub Desktop.
Save aya-soft/14dfbc2ead0bc2d90ed00dbc7081a4da to your computer and use it in GitHub Desktop.
Жуткое дублирование кода
.down-stars-list-block(style="font-size: 16px" )
- if current_user
- if current_user.role?(:admin)
.popover-info-hover.pointer(data-title="Ваша оценка" data-content="#{render partial: "/catalog/stars_and_rows_for_admin", locals: {spare: spare}}" placement="top")
%span(title="Посмотреть отзывы")
= spare_ratio_link(spare, admin_spare_comments_path(spare_id: spare.id))
- else
- if current_user.spare_comments.by_spare(spare.id).where("active = 0").present?
%span(title="Посмотреть отзывы")
= spare_ratio_link(spare, profile_spare_comments_path(spare_id: spare.id))
-else
.popover-info-hover.pointer(data-title="Ваша оценка" data-content="#{render partial: "/catalog/stars_and_rows", locals: {spare: spare}}" placement="top")
%span(title="Посмотреть отзывы")
= spare_ratio_link(spare, profile_spare_comments_path(spare_id: spare.id))
- else
%span(title="Посмотреть отзывы")
= spare_ratio_link(spare, spare_comments_path(spare_id: spare.id, деталь: spare_short_info(spare)))
@aya-soft
Copy link
Author

%span(title="Посмотреть отзывы")
и
= spare_ratio_link(spare
используются 4 РАЗА

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment