Displays a message when an unregistered user tries to annotate
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
_t = (key) -> new Gettext().gettext(key)
|
||||
|
||||
App.Annotatable =
|
||||
initialize: ->
|
||||
current_user_id = $('html').data('current-user-id')
|
||||
if current_user_id == ""
|
||||
annotator.ui.editor.Editor.template = [
|
||||
'<div class="annotator-outer annotator-editor annotator-hide">',
|
||||
' <form class="annotator-widget">',
|
||||
' ' + _t('Unregistered'),
|
||||
' <div class="annotator-controls">',
|
||||
' <a href="#cancel" class="annotator-cancel">' + _t('Cancel') + '</a>',
|
||||
' </div>',
|
||||
' </form>',
|
||||
'</div>'
|
||||
].join('\n')
|
||||
|
||||
$("[data-annotatable-type]").each ->
|
||||
$this = $(this)
|
||||
ann_type = $this.data("annotatable-type")
|
||||
@@ -16,7 +31,7 @@ App.Annotatable =
|
||||
|
||||
|
||||
app.start().then ->
|
||||
app.ident.identity = $('html').data('current-user-id')
|
||||
app.ident.identity = current_user_id
|
||||
|
||||
options = {}
|
||||
options[ann_type + "_id"] = ann_id
|
||||
|
||||
@@ -3,11 +3,13 @@ i18n = {
|
||||
"Comments": "Comentarios",
|
||||
"Cancel": "Cancelar",
|
||||
"Save": "Guardar",
|
||||
"Unregistered": "Necesitas <a href='/users/sign_in'>iniciar sesión</a> o <a href='/users/sign_up'>registratre</a> para continuar."
|
||||
},
|
||||
en: {
|
||||
"Comments": "Coments",
|
||||
"Cancel": "Cancel",
|
||||
"Save": "Save",
|
||||
"Unregistered": "You need to <a href='/users/sign_in'>sign in</a> or <a href='/users/sign_up'>sign up</a> to continue."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user