diff --git a/.sass-lint.yml b/.sass-lint.yml new file mode 100644 index 0000000..84ba9b0 --- /dev/null +++ b/.sass-lint.yml @@ -0,0 +1,28 @@ +# https://github.com/sasstools/sass-lint/tree/master/docs/rules +files: + include: app/assets/stylesheets/**/*.scss + +options: + formatter: stylish + merge-default-rules: true + +rules: + class-name-format: 0 + id-name-format: 0 + leading-zero: + - 1 + - include: true + no-duplicate-properties: + - 1 + - + exclude: + - src # for @font mixins + no-qualifying-elements: + - 1 + - allow-element-with-attribute: true # input[type='email'] but not div.class-name + quotes: 0 + no-vendor-prefixes: + - + excluded-identifiers: + - -moz-osx-font-smoothing + - -webkit-font-smoothing diff --git a/app/assets/stylesheets/molecules/_admin_review.scss b/app/assets/stylesheets/molecules/_admin_review.scss index 8cbab59..9077423 100644 --- a/app/assets/stylesheets/molecules/_admin_review.scss +++ b/app/assets/stylesheets/molecules/_admin_review.scss @@ -34,10 +34,42 @@ margin-bottom: 30px; text-align: right; - &:before { + &::before { content: '- '; } } + + .comment-edit-stamp { + color: rgba($gray-dark, 0.65); + font-size: 0.75em; + text-align: right; + } + + .comment-edit-btn { + cursor: pointer; + display: inline-block; + font-size: 0.85em; + font-weight: bold; + padding: 2px 5px; + + &:hover { + background-color: $gray-base; + color: $gray-lighter; + } + } + + .comment-edit-form { + display: none; + margin: 30px 0; + padding: 10px 0; + + } + + [type="checkbox"] { + &:checked + .comment-edit-form { + display: block; + } + } } .review_meta { diff --git a/app/models/quiz_comment.rb b/app/models/quiz_comment.rb index 8819997..a918447 100644 --- a/app/models/quiz_comment.rb +++ b/app/models/quiz_comment.rb @@ -4,4 +4,8 @@ class QuizComment < ApplicationRecord belongs_to :candidate, foreign_key: :test_hash, primary_key: :test_hash validates :message, presence: true + + def edits? + updated_at > (created_at + 5.seconds) + end end diff --git a/app/views/admin/result/_comment.html.erb b/app/views/admin/result/_comment.html.erb index b260eca..d47d8be 100644 --- a/app/views/admin/result/_comment.html.erb +++ b/app/views/admin/result/_comment.html.erb @@ -1,2 +1,21 @@ -
+ + + + +<% if policy(comment).update? %> + +