diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb
index 424125ed..2dd09089 100644
--- a/app/models/dmsf_file.rb
+++ b/app/models/dmsf_file.rb
@@ -128,6 +128,16 @@ class DmsfFile < ActiveRecord::Base
deleted == STATUS_DELETED
end
+ def locked_by
+ if lock && lock.reverse[0]
+ user = lock.reverse[0].user
+ if user
+ return (user == User.current) ? l(:label_me) : user.name
+ end
+ end
+ ''
+ end
+
def delete(commit)
if locked_for_user? && (!User.current.allowed_to?(:force_file_unlock, project))
Rails.logger.info l(:error_file_is_locked)
diff --git a/app/views/dmsf_context_menus/_file.html.erb b/app/views/dmsf_context_menus/_file.html.erb
index 5cf5c158..1f0a738e 100644
--- a/app/views/dmsf_context_menus/_file.html.erb
+++ b/app/views/dmsf_context_menus/_file.html.erb
@@ -40,6 +40,7 @@
<% if locked %>
<%= context_menu_link l(:button_unlock), unlock_dmsf_files_path(id: dmsf_file), class: 'icon icon-unlock',
+ title: l(:title_locked_by_user, user: dmsf_file.locked_by),
disabled: !allowed || !unlockable %>
<% else %>
<%= context_menu_link l(:button_lock), lock_dmsf_files_path(id: dmsf_file), class: 'icon icon-lock',
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 3173acc5..415fe0a5 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -80,7 +80,6 @@ cs:
title_notifications_not_active_activate: "Notifikace nejsou aktivní: Aktivovat"
title_title_version_version_download: "%{title} verze %{version} stáhnout"
title_locked_by_user: "Zamčeno uživatelem %{user}"
- title_locked_by_you: Zamčeno Vámi
title_waiting_for_approval: Čeká na schválení
title_approved: Schváleno
title_unlock_file: Odemknout a umožnit změny ostatním uživatelům
diff --git a/config/locales/de.yml b/config/locales/de.yml
index c60dfe0c..e82a2cc9 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -80,7 +80,6 @@ de:
title_notifications_not_active_activate: "Benachrichtigungen sind nicht aktiv: Einschalten"
title_title_version_version_download: "%{title} Version %{version} Download"
title_locked_by_user: "Gesperrt von %{user}"
- title_locked_by_you: Gesperrt von dir
title_waiting_for_approval: Warte auf Zustimmung
title_approved: Zugestimmt
title_unlock_file: Hebe Sperre auf um Änderungen anderer Nutzer zu ermöglichen
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7fcd9bb5..cfd232b7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -80,7 +80,6 @@ en:
title_notifications_not_active_activate: "Notifications not active: Activate"
title_title_version_version_download: "%{title} version %{version} download"
title_locked_by_user: "Locked by %{user}"
- title_locked_by_you: Locked by you
title_waiting_for_approval: Waiting for Approval
title_approved: Approved
title_unlock_file: Unlock to allow changes for other members
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 28e4f4db..d00777d5 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -80,7 +80,6 @@ es:
title_notifications_not_active_activate: "Notificacciones No Activas: Activadas"
title_title_version_version_download: "%{title} version %{version} descargar"
title_locked_by_user: "bloqueado por %{user}"
- title_locked_by_you: Bloqueado por ti
title_waiting_for_approval: Esperando Aprobación
title_approved: Aprobado
title_unlock_file: Desbloquear para que otros miembros puedan editarlo
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 4f0ae963..089e20e9 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -80,7 +80,6 @@ fr:
title_notifications_not_active_activate: "Notifications désactivées : cliquer pour activer"
title_title_version_version_download: "Télécharger la version %{version} de %{title}"
title_locked_by_user: "Verrouillé par %{user}"
- title_locked_by_you: Verrouillé par vous-même
title_waiting_for_approval: Attente de validation
title_approved: Validé
title_unlock_file: Déverrouiller afin de permettre la modification par les membres du projet
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index d04b9faa..5c8561f9 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -80,7 +80,6 @@ hu:
title_notifications_not_active_activate: "Értesítések nincsnek bekapcsolva: Bekapcsolás"
title_title_version_version_download: "%{title} verzió %{version} letöltés"
title_locked_by_user: "Zárolva %{user}"
- title_locked_by_you: Ön zárolta
title_waiting_for_approval: Elfogadásra vár
title_approved: Elfogadva
title_unlock_file: Zárolás megszüntetése, hogy más felhasználók is változtatni tudjanak
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 7e2841aa..6d0befa2 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -80,7 +80,6 @@ it: # Italian strings thx 2 Matteo Arceci!
title_notifications_not_active_activate: "Notifiche disattivate: Attiva"
title_title_version_version_download: "%{title} versione %{version} download"
title_locked_by_user: "Bloccato da %{user}"
- title_locked_by_you: Bloccato da te
title_waiting_for_approval: In attesa di Approvazione
title_approved: Approvato
title_unlock_file: Sblocca per consentire modifiche degli altri membri
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 87f26c59..29f68af5 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -80,7 +80,6 @@ ja:
title_notifications_not_active_activate: "通知は無効です: 有効にする"
title_title_version_version_download: "%{title} のバージョン %{version} をダウンロードする"
title_locked_by_user: "%{user} によってロックされています"
- title_locked_by_you: あなたがロックしています
title_waiting_for_approval: 承認待ち
title_approved: 承認済み
title_unlock_file: ロック解除して他のメンバーの変更を許可する
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index e5add1cb..74e69c17 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -80,7 +80,6 @@ ko:
title_notifications_not_active_activate: "알림 비활성화: 활성화"
title_title_version_version_download: "%{title} 버전 %{version} 다운로드"
title_locked_by_user: "%{user} 에 의해 잠겨짐"
- title_locked_by_you: 사용자에 의해 잠겨짐
title_waiting_for_approval: 승인을 기다리는 중
title_approved: 승인됨
title_unlock_file: 다른 구성원들의 변경 허가 잠금 해제
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index a063bb10..e24946be 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -80,7 +80,6 @@ nl:
title_notifications_not_active_activate: "Notificaties niet actief: Activeren"
title_title_version_version_download: "%{title} versie %{version} downloaden"
title_locked_by_user: "Vergrendeld door %{user}"
- title_locked_by_you: Vergrendeld door u
title_waiting_for_approval: Wacht op goedkeuring
title_approved: Goedgekeurd
title_unlock_file: Ontgrendel om wijzigingen door andere leden toe te staan
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index ff02980d..6d3b4155 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -80,7 +80,6 @@ pl:
title_notifications_not_active_activate: "Powiadomienia wyłączone: Aktywuj"
title_title_version_version_download: "pobierz %{title} wersja %{version}"
title_locked_by_user: "Zablokowany przez %{user}"
- title_locked_by_you: Zablokowany przez Ciebie
title_waiting_for_approval: Oczekiwanie na akceptację
title_approved: Zaakceptowany
title_unlock_file: Odblokuj aby umożliwić wprowadzanie zmian innym użytkownikom
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index fa147da3..d5e01306 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -80,7 +80,6 @@ pt-BR:
title_notifications_not_active_activate: "Notificações não ativas: Ativar"
title_title_version_version_download: "%{title} revisão %{version} download"
title_locked_by_user: "Bloqueado por %{user}"
- title_locked_by_you: Bloqueado por você
title_waiting_for_approval: Aguardando aprovação
title_approved: Aprovado
title_unlock_file: Clique aqui para permitir alterações por outro usuário
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 5aed298c..88cfae8c 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -80,7 +80,6 @@ ru:
title_notifications_not_active_activate: "Уведомления не включены: Включить"
title_title_version_version_download: "Скачать %{title} редакции %{version}"
title_locked_by_user: "Заблокировано пользователем %{user}"
- title_locked_by_you: Заблокировано Вами
title_waiting_for_approval: Ожидается утверждение
title_approved: Утверждено
title_unlock_file: Разблокируйте файл, чтобы разрешить его изменение другими участниками
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 8a8a9c5a..93ebde3d 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -80,7 +80,6 @@ sl:
title_notifications_not_active_activate: "Obveščanje ni aktivno: Aktiviraj"
title_title_version_version_download: "%{title} verzija %{version} prenesi dol"
title_locked_by_user: "Zaklenil %{user}"
- title_locked_by_you: Zaklenili ste
title_waiting_for_approval: V postopku odobritve
title_approved: Odobreno
title_unlock_file: Odkleni drugim članom za posodabljanje
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 8e06266f..180d727d 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -80,7 +80,6 @@ zh-TW:
title_notifications_not_active_activate: "通知關閉中: 點擊啟用通知"
title_title_version_version_download: " 版本: %{version} 檔案: %{title} 下載"
title_locked_by_user: "被使用者%{user},鎖定了。"
- title_locked_by_you: 被您鎖定了。
title_waiting_for_approval: 等待批准
title_approved: 已經被批准
title_unlock_file: 解除鎖定。允許其它使用者修改。
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 601c24ed..8a475064 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -80,7 +80,6 @@ zh:
title_notifications_not_active_activate: "通知无效:点击激活通知"
title_title_version_version_download: " 下载‘%{title}’版本‘%{version}’"
title_locked_by_user: "%{user}锁定"
- title_locked_by_you: 您锁定
title_waiting_for_approval: 待批准
title_approved: 已批准
title_unlock_file: 解除锁定允许其他成员修改
diff --git a/test/unit/dmsf_file_test.rb b/test/unit/dmsf_file_test.rb
index caf8afe4..af41b0e1 100644
--- a/test/unit/dmsf_file_test.rb
+++ b/test/unit/dmsf_file_test.rb
@@ -291,4 +291,11 @@ class DmsfFileTest < RedmineDmsf::Test::UnitTest
assert @file7.assigned?(@jsmith)
end
+ def test_locked_by
+ # Locked file
+ assert_equal @jsmith.name, @file2.locked_by
+ # Unlocked file
+ assert_equal '', @file1.locked_by
+ end
+
end
\ No newline at end of file