add previewMarkdown / click as popover-trigger / misc changes

This commit is contained in:
Negue
2015-04-27 19:23:56 +02:00
parent 78dd949f20
commit 75579a7c36
5 changed files with 25 additions and 11 deletions

View File

@@ -97,6 +97,8 @@
"abuseAlreadyReported": "You have already reported this message.",
"needsText": "Please type a message.",
"needsTextPlaceholder": "Type your message here.",
"copyMessageAsToDo": "copy message as to-do",
"messageAddedAsToDo": "Message copied as to-do."
"copyMessageAsToDo": "Copy message as To-Do",
"messageAddedAsToDo": "Message copied as To-Do.",
"messageWroteIn": "<%= user %> wrote in <%= group %>",
"msgPreviewHeading": "Message Preview"
}

View File

@@ -347,8 +347,10 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
};
$scope.copyToDo = function(message) {
var taskNotes = '[' + message.user + '](' + env.BASE_URL + '/static/front/#?memberId=' + message.uuid +
') wrote in [' + $scope.group.name + '](' + window.location.href + ')';
var taskNotes = env.t("messageWroteIn", {
user: '[' + message.user + '](' + env.BASE_URL + '/static/front/#?memberId=' + message.uuid + ')',
group: '[' + $scope.group.name + '](' + window.location.href + ')'
});
var newScope = $scope.$new();
newScope.text = message.text;

View File

@@ -118,12 +118,16 @@ script(type='text/ng-template', id='modals/copyChatToDo.html')
.modal-header
h4=env.t('copyMessageAsToDo')
.modal-body
p
input.form-control(type='text',ng-model='text')
br
p
textarea.form-control(type='text',rows='5',ng-model='notes', focus-me)
.form-group
input.form-control(type='text',ng-model='text', ng-model-options="{debounce: 1000}")
.form-group
textarea.form-control(rows='5',ng-model='notes', ng-model-options="{debounce: 1000}", focus-me)
hr
div(popover-trigger='click', data-popover-html="{{notes | markdown}}", popover-placement="top")
+previewMarkdown('text')
.modal-footer
button.btn.btn-default(ng-click='$close()')=env.t('close')
button.btn.btn-default(ng-click='saveTodo()')=env.t('submit')
button.btn.btn-primary(ng-click='saveTodo()')=env.t('submit')

View File

@@ -11,3 +11,9 @@ mixin aLink(url, label)
a(href="", ng-click="externalLink('#{url}')")= label
else
a(href='#{url}', target='_blank')= label
mixin previewMarkdown(text)
.panel.panel-warning
.panel-heading=env.t('msgPreviewHeading')
.panel-body
markdown(text='#{text}')

View File

@@ -1,4 +1,4 @@
li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s"] | conditionalOrderBy: list.view=="dated":"date"', class='task {{Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', ng-click='spell && (list.type != "reward") && castEnd(task, "task", $event)', ng-class='{"cast-target":spell && (list.type != "reward"), "locked-task":obj._locked === true}', popover-trigger='mouseenter', data-popover-html="{{task.notes | markdown}}", popover-placement="top", popover-append-to-body='{{::modal ? "false":"true"}}', ng-show='shouldShow(task, list, user.preferences)')
li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s"] | conditionalOrderBy: list.view=="dated":"date"', class='task {{Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', ng-click='spell && (list.type != "reward") && castEnd(task, "task", $event)', ng-class='{"cast-target":spell && (list.type != "reward"), "locked-task":obj._locked === true}', popover-trigger='click', data-popover-html="{{task.notes | markdown}}", popover-placement="top", popover-append-to-body='{{::modal ? "false":"true"}}', ng-show='shouldShow(task, list, user.preferences)')
// right-hand side control buttons
.task-meta-controls