added a search for request_for_comments.

fixed translation of model for request_for_comments
This commit is contained in:
Ralf Teusner
2017-04-03 19:45:07 +02:00
parent 3bf5e69f8d
commit 58f76f53e6
5 changed files with 27 additions and 2 deletions

View File

@ -11,7 +11,8 @@ class RequestForCommentsController < ApplicationController
# GET /request_for_comments
# GET /request_for_comments.json
def index
@request_for_comments = RequestForComment.last_per_user(2).order('created_at DESC').paginate(page: params[:page])
@search = RequestForComment.last_per_user(2).search(params[:q])
@request_for_comments = @search.result.order('created_at DESC').paginate(page: params[:page])
authorize!
end

View File

@ -8,6 +8,10 @@ class RequestForCommentPolicy < ApplicationPolicy
everyone
end
def search?
everyone
end
def show?
everyone
end

View File

@ -1,12 +1,20 @@
h1 = RequestForComment.model_name.human(count: 2)
= render(layout: 'shared/form_filters') do |f|
.form-group
= f.label(:exercise_title_cont, t('activerecord.attributes.request_for_comments.exercise'), class: 'sr-only')
= f.search_field(:exercise_title_cont, class: 'form-control', placeholder: t('activerecord.attributes.request_for_comments.exercise'))
.form-group
= f.label(:title_cont, t('request_for_comments.solved'), class: 'sr-only')
= f.select(:solved_not_eq, [[t('request_for_comments.show_all'), 2], [t('request_for_comments.show_unsolved'), 1], [t('request_for_comments.show_solved'), 0]])
.table-responsive
table.table.sortable
thead
tr
th
i class="fa fa-lightbulb-o" aria-hidden="true" title = t('request_for_comments.solved') align="right"
th = t('activerecord.attributes.request_for_comments.exercise')
th = sort_link(@search, :title, t('activerecord.attributes.request_for_comments.exercise'))
th = t('activerecord.attributes.request_for_comments.question')
th
i class="fa fa-comment" aria-hidden="true" title = t('request_for_comments.comments') align="center"

View File

@ -146,6 +146,9 @@ de:
internal_user:
one: Interner Nutzer
other: Interne Nutzer
request_for_comment:
one: Kommentaranfrage
other: Kommentaranfragen
submission:
one: Abgabe
other: Abgaben
@ -417,6 +420,9 @@ de:
all: "Alle Kommentaranfragen"
no_question: "Der Autor hat keine Frage zu dieser Anfrage gestellt."
mark_as_solved: "Diese Frage als beantwortet markieren"
show_all: "Alle Anfragen anzeigen"
show_solved: "Nur gelöste Anfragen anzeigen"
show_unsolved: "Nur ungelöste Anfragen anzeigen"
solved: "Diese Frage wurde erfolgreich beantwortet"
comment_exercise: "Ich möchte die Aufgabenstellung kommentieren"
sessions:

View File

@ -167,6 +167,9 @@ en:
internal_user:
one: Internal User
other: Internal Users
request_for_comment:
one: Request for Comments
other: Requests for Comments
submission:
one: Submission
other: Submissions
@ -438,6 +441,9 @@ en:
get_my_comment_requests: My Requests for Comments
no_question: "The author did not enter a question for this request."
mark_as_solved: "Mark this question as answered"
show_all: "All requests"
show_solved: "Solved requests"
show_unsolved: "Unvsolved requests"
solved: "This question has been answered"
comment_exercise: "I would like to give feedback for this exercise"
sessions: