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"