Commit ba0047d134e299d6214b6c38c3cc560ff851a226
1 parent
319477b1
Exists in
master
and in
3 other branches
Adjusting goal popover
Showing
2 changed files
with
58 additions
and
42 deletions
Show diff stats
notifications/templates/notifications/_view.html
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | |
| 53 | 53 | {% if notification.level < 3 %} |
| 54 | 54 | <button class="btn btn-default no_button">{% trans 'or' %}</button> |
| 55 | - <button class="btn btn-default btn-raised" data-toggle="popover" data-trigger="focus" data-placement="right"> | |
| 55 | + <button class="btn btn-default btn-raised" data-toggle="popover" data-placement="right"> | |
| 56 | 56 | {% if notification.level == 1 %} |
| 57 | 57 | {% trans 'Define goal to realization' %} |
| 58 | 58 | {% else %} |
| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | </form> |
| 79 | 79 | </div> |
| 80 | 80 | <div class="popover-footer"> |
| 81 | - <button type="button" class="btn btn-raised btn-sm btn-primary save pull-left"> | |
| 81 | + <button type="button" class="btn btn-raised btn-sm btn-success save pull-left"> | |
| 82 | 82 | {% trans 'Save Goal' %} |
| 83 | 83 | </button> |
| 84 | 84 | <button type="button" class="btn btn-default btn-sm btn-raised cancel pull-right"> |
| ... | ... | @@ -92,43 +92,3 @@ |
| 92 | 92 | </div> |
| 93 | 93 | </div> |
| 94 | 94 | </div> |
| 95 | -<script> | |
| 96 | -$(document).ready(function(){ | |
| 97 | - var locale = navigator.language || navigator.userLanguage; | |
| 98 | - | |
| 99 | - $('[data-toggle="popover"]').popover({ | |
| 100 | - html: true, | |
| 101 | - content: function () { | |
| 102 | - return $(".popover").html(); | |
| 103 | - } | |
| 104 | - }).on('shown.bs.popover', function (e) { | |
| 105 | - if($(this).is(e.target)){ | |
| 106 | - var popover = $(this), | |
| 107 | - datetime = popover.parent().find('.datetimepicker'), | |
| 108 | - form = popover.parent().find('form'), | |
| 109 | - cancel = popover.parent().find('.cancel'), | |
| 110 | - save = popover.parent().find('.save'); | |
| 111 | - | |
| 112 | - if (typeof(datetime.data("DateTimePicker")) != "undefined") { | |
| 113 | - datetime.data("DateTimePicker").destroy(); | |
| 114 | - } | |
| 115 | - | |
| 116 | - datetime.datetimepicker({ | |
| 117 | - locale: locale, | |
| 118 | - inline: true, | |
| 119 | - sideBySide: false | |
| 120 | - }); | |
| 121 | - | |
| 122 | - cancel.on("click", function () { | |
| 123 | - popover.popover('hide'); | |
| 124 | - }); | |
| 125 | - | |
| 126 | - save.on("click", function () { | |
| 127 | - var field = form.find('.meta'); | |
| 128 | - field.val(datetime.data('date')); | |
| 129 | - console.log(form.serialize()); | |
| 130 | - }); | |
| 131 | - } | |
| 132 | - }); | |
| 133 | -}); | |
| 134 | -</script> | |
| 135 | 95 | \ No newline at end of file | ... | ... |
notifications/templates/notifications/subject.html
| ... | ... | @@ -51,4 +51,60 @@ |
| 51 | 51 | {% endif %} |
| 52 | 52 | </div> |
| 53 | 53 | </div> |
| 54 | + | |
| 55 | + <script type="text/javascript"> | |
| 56 | + $(function () { | |
| 57 | + var locale = navigator.language || navigator.userLanguage; | |
| 58 | + | |
| 59 | + $('[data-toggle="popover"]').popover({ | |
| 60 | + html: true, | |
| 61 | + content: function () { | |
| 62 | + return $(".popover").html(); | |
| 63 | + } | |
| 64 | + }).on('show.bs.popover', function (e) { | |
| 65 | + $('[data-toggle="popover"]').not(e.target).popover('hide'); | |
| 66 | + }).on('shown.bs.popover', function (e) { | |
| 67 | + if($(this).is(e.target)){ | |
| 68 | + var popover = $(this), | |
| 69 | + datetime = popover.parent().find('.datetimepicker'), | |
| 70 | + form = popover.parent().find('form:visible'), | |
| 71 | + cancel = popover.parent().find('.cancel:visible'), | |
| 72 | + save = popover.parent().find('.save:visible'); | |
| 73 | + | |
| 74 | + if (typeof(datetime.data("DateTimePicker")) != "undefined") { | |
| 75 | + datetime.data("DateTimePicker").destroy(); | |
| 76 | + } | |
| 77 | + | |
| 78 | + datetime.datetimepicker({ | |
| 79 | + locale: locale, | |
| 80 | + inline: true, | |
| 81 | + sideBySide: false | |
| 82 | + }); | |
| 83 | + | |
| 84 | + cancel.on("click", function () { | |
| 85 | + popover.popover('hide'); | |
| 86 | + }); | |
| 87 | + | |
| 88 | + save.on("click", function () { | |
| 89 | + var field = form.find('.meta'); | |
| 90 | + field.val(datetime.data('date')); | |
| 91 | + console.log(form.serialize()); | |
| 92 | + }); | |
| 93 | + } | |
| 94 | + }).on('hide.bs.popover', function (e) { | |
| 95 | + if($(this).is(e.target)){ | |
| 96 | + var popover = $(this), | |
| 97 | + datetime = popover.parent().find('.datetimepicker'); | |
| 98 | + | |
| 99 | + if (typeof(datetime.data("DateTimePicker")) != "undefined") { | |
| 100 | + datetime.data("DateTimePicker").destroy(); | |
| 101 | + } | |
| 102 | + | |
| 103 | + datetime.html(''); | |
| 104 | + } | |
| 105 | + }).on('hidden.bs.popover', function (e) { | |
| 106 | + $(e.target).data("bs.popover").inState.click = false; | |
| 107 | + }); | |
| 108 | + }); | |
| 109 | + </script> | |
| 54 | 110 | {% endblock %} |
| 55 | 111 | \ No newline at end of file | ... | ... |