Merge branch 'master' into feature/opengraph
This commit is contained in:
commit
86d179d590
|
@ -171,4 +171,8 @@ module ApplicationHelper
|
|||
def list_title(list)
|
||||
generate_title list.name
|
||||
end
|
||||
|
||||
def rails_admin_path_for_resource(resource)
|
||||
[rails_admin_path, resource.model_name.param_key, resource.id].join('/')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,3 +38,7 @@
|
|||
%a.dropdown-item{ href: '#', data: { a_id: a.id, action: 'ab-report' } }
|
||||
%i.fa.fa-exclamation-triangle
|
||||
= t 'views.actions.report'
|
||||
- if current_user.has_role? :administrator
|
||||
%a.dropdown-item{ href: rails_admin_path_for_resource(a), target: '_blank' }
|
||||
%i.fa.fa-gears
|
||||
View in Kontrollzentrum
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
%a.dropdown-item{ href: '#', tabindex: -1, data: { action: 'ab-question-report', q_id: a.question.id } }
|
||||
%i.fa.fa-exclamation-triangle
|
||||
= t 'views.actions.report'
|
||||
- if current_user.has_role? :administrator
|
||||
%a.dropdown-item{ href: rails_admin_path_for_resource(a.question), target: '_blank' }
|
||||
%i.fa.fa-gears
|
||||
View in Kontrollzentrum
|
||||
%h6.text-muted.media-heading.answerbox__question-user
|
||||
= raw t('views.answerbox.asked', user: user_screen_name(a.question.user, anonymous: a.question.author_is_anonymous), time: time_tooltip(a.question))
|
||||
- if !a.question.author_is_anonymous && a.question.answer_count > 1
|
||||
|
|
|
@ -28,3 +28,7 @@
|
|||
%a.dropdown-item{ href: '#', data: { target: '#modal-ban', toggle: :modal } }
|
||||
%i.fa.fa-ban
|
||||
= t 'views.actions.ban'
|
||||
- if current_user.has_role? :administrator
|
||||
%a.dropdown-item{ href: rails_admin_path_for_resource(user), target: '_blank' }
|
||||
%i.fa.fa-cogs
|
||||
"View in Kontrollzentrum"
|
||||
|
|
|
@ -87,4 +87,15 @@ EOS
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#rails_admin_path_for_resource" do
|
||||
context "user resource" do
|
||||
let(:resource) { FactoryBot.create(:user) }
|
||||
subject { rails_admin_path_for_resource(resource) }
|
||||
|
||||
it "should return a URL to the given resource within rails admin" do
|
||||
expect(subject).to eq("/justask_admin/user/#{resource.id}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue