aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js14
-rw-r--r--view/theme/redbasic/js/redbasic.js3
-rw-r--r--view/tpl/cdav_calendar.tpl145
-rwxr-xr-xview/tpl/conv_item.tpl5
4 files changed, 128 insertions, 39 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 1322c2112..325ad9a51 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -231,6 +231,10 @@ function handle_comment_form(e) {
$('#' + emptyCommentElm).removeAttr('tabindex');
$('#' + emptySubmitElm).removeAttr('tabindex');
form.find(':not(.comment-edit-text)').hide();
+ form.find(':input[name=parent]').val(emptyCommentElm.replace(/\D/g,''));
+ var btn = form.find(':button[type=submit]').html();
+ form.find(':button[type=submit]').html(btn.replace(/<[^>]*>/g, '').trim());
+ form.find(':button[type=submit]').prop('title', '');
}
});
@@ -1144,6 +1148,16 @@ function doprofilelike(ident, verb) {
$.get('like/' + ident + '?verb=' + verb, function() { window.location.href=window.location.href; });
}
+function doreply(parent, ident, owner, hint) {
+ var form = $('#comment-edit-form-' + parent.toString());
+ form.find('input[name=parent]').val(ident);
+ var i = form.find('button[type=submit]');
+ var btn = i.html().replace(/<[^>]*>/g, '').trim();
+ i.html('<i class="fa fa-reply" ></i> ' + btn);
+ i.prop('title', hint);
+ form.find('textarea').val("@{" + owner + "}\n");
+ $('#comment-edit-text-' + parent.toString()).focus();
+}
function dropItem(url, object) {
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index 8d3b795cc..b8e7946c2 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -21,7 +21,8 @@ $(document).ready(function() {
$('#left_aside_wrapper, #right_aside_wrapper').stick_in_parent({
offset_top: parseInt($('aside').css('padding-top')),
parent: 'main',
- spacer: '.aside_spacer'
+ spacer: '.aside_spacer',
+ recalc_every: 10
});
}
diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl
index 5c2f0080b..827c57b96 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -12,6 +12,10 @@ var group_allow = [];
var contact_deny = [];
var group_deny = [];
+var resource = {{$resource}};
+var default_view = resource !== null ? 'timeGridDay' : 'dayGridMonth';
+var default_date = resource !== null ? new Date(resource.dtstart) : new Date();
+
$(document).ready(function() {
var calendarEl = document.getElementById('calendar');
calendar = new FullCalendar.Calendar(calendarEl, {
@@ -29,6 +33,9 @@ $(document).ready(function() {
firstDay: {{$first_day}},
+ defaultView: default_view,
+ defaultDate: default_date,
+
monthNames: aStr['monthNames'],
monthNamesShort: aStr['monthNamesShort'],
dayNames: aStr['dayNames'],
@@ -75,7 +82,7 @@ $(document).ready(function() {
var event = info.event._def;
var dtstart = new Date(info.event._instance.range.start);
var dtend = new Date(info.event._instance.range.end);
- console.log(event.extendedProps.categories);
+
if(event.extendedProps.plink) {
if(! $('#l2s').length)
$('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
@@ -137,8 +144,7 @@ $(document).ready(function() {
$('#id_description').attr('disabled', false);
$('#id_location').attr('disabled', false);
- if(calendar_id == 'channel_calendar' && !event.extendedProps.is_editable) {
- console.log(calendar_id)
+ if(calendar_id == 'channel_calendar' && !event.ui.startEditable) {
$('#event_submit').hide();
}
}
@@ -161,7 +167,7 @@ $(document).ready(function() {
},
eventResize: function(info) {
-
+
var event = info.event._def;
var dtstart = new Date(info.event._instance.range.start);
var dtend = new Date(info.event._instance.range.end);
@@ -170,16 +176,41 @@ $(document).ready(function() {
$('#id_dtstart').val(dtstart.toUTCString());
$('#id_dtend').val(dtend.toUTCString());
- $.post( 'cdav/calendar', {
- 'update': 'resize',
- 'id[]': event.extendedProps.calendar_id,
- 'uri': event.extendedProps.uri,
- 'dtstart': dtstart ? dtstart.toUTCString() : '',
- 'dtend': dtend ? dtend.toUTCString() : ''
- })
- .fail(function() {
- info.revert();
- });
+ event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
+
+ if(event.extendedProps.calendar_id === 'channel_calendar') {
+ $.post( 'channel_calendar', {
+ 'event_id': event_id,
+ 'event_hash': event_uri,
+ 'xchan': '{{$channel_hash}}',
+ //'mid': mid,
+ 'type': 'event',
+ 'preview': 0,
+ 'summary': event.title,
+ 'dtstart': dtstart.toUTCString(),
+ 'dtend': dtend.toUTCString(),
+ 'adjust': event.extendedProps.item.adjust,
+ 'categories': event.extendedProps.categories,
+ 'desc': event.extendedProps.description,
+ 'location': event.extendedProps.location,
+ //'submit': $('#event_submit').val()
+ })
+ .fail(function() {
+ info.revert();
+ });
+ }
+ else {
+ $.post( 'cdav/calendar', {
+ 'update': 'resize',
+ 'id[]': event.extendedProps.calendar_id,
+ 'uri': event.extendedProps.uri,
+ 'dtstart': dtstart ? dtstart.toUTCString() : '',
+ 'dtend': dtend ? dtend.toUTCString() : ''
+ })
+ .fail(function() {
+ info.revert();
+ });
+ }
},
eventDrop: function(info) {
@@ -191,19 +222,44 @@ $(document).ready(function() {
$('#id_title').val(event.title);
$('#id_dtstart').val(dtstart.toUTCString());
$('#id_dtend').val(dtend.toUTCString());
-
- $.post( 'cdav/calendar', {
- 'update': 'drop',
- 'id[]': event.extendedProps.calendar_id,
- 'uri': event.extendedProps.uri,
- 'dtstart': dtstart ? dtstart.toUTCString() : '',
- 'dtend': dtend ? dtend.toUTCString() : ''
- })
- .fail(function() {
- info.revert();
- });
+
+ event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
+
+ if(event.extendedProps.calendar_id === 'channel_calendar') {
+ $.post( 'channel_calendar', {
+ 'event_id': event_id,
+ 'event_hash': event_uri,
+ 'xchan': '{{$channel_hash}}',
+ //'mid': mid,
+ 'type': 'event',
+ 'preview': 0,
+ 'summary': event.title,
+ 'dtstart': dtstart.toUTCString(),
+ 'dtend': dtend.toUTCString(),
+ 'adjust': event.extendedProps.item.adjust,
+ 'categories': event.extendedProps.categories,
+ 'desc': event.extendedProps.description,
+ 'location': event.extendedProps.location,
+ //'submit': $('#event_submit').val()
+ })
+ .fail(function() {
+ info.revert();
+ });
+ }
+ else {
+ $.post( 'cdav/calendar', {
+ 'update': 'drop',
+ 'id[]': event.extendedProps.calendar_id,
+ 'uri': event.extendedProps.uri,
+ 'dtstart': dtstart ? dtstart.toUTCString() : '',
+ 'dtend': dtend ? dtend.toUTCString() : ''
+ })
+ .fail(function() {
+ info.revert();
+ });
+ }
},
-
+
loading: function(isLoading, view) {
$('#events-spinner').show();
$('#today-btn > i').hide();
@@ -216,7 +272,7 @@ $(document).ready(function() {
});
calendar.render();
-
+
$('#title').text(calendar.view.title);
$('#view_selector').html(views[calendar.view.type]);
@@ -250,6 +306,28 @@ $(document).ready(function() {
$(document).on('click','#event_more', on_more);
$(document).on('click','#event_cancel, #event_cancel_recurrent', reset_form);
$(document).on('click','#event_delete, #event_delete_recurrent', on_delete);
+
+ if(resource !== null) {
+ $('.section-content-tools-wrapper, #event_form_wrapper').show();
+
+ $('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
+ $('#l2s').html('<a href="' + resource.plink[0] + '" target="_blank"><i class="fa fa-external-link"></i> ' + resource.plink[1] + '</a>');
+
+ event_id = resource.id;
+ event_uri = resource.event_hash;
+ $('#calendar_select').val('channel_calendar').attr('disabled', true);
+ $('#id_title').val(resource.summary);
+ $('#id_dtstart').val(new Date(resource.dtstart).toUTCString());
+ $('#id_dtend').val(new Date(resource.dtend).toUTCString());
+ $('#id_categories').tagsinput('add', '{{$categories}}'),
+ $('#id_description').val(resource.description);
+ $('#id_location').val(resource.location);
+
+ if(resource.event_xchan !== '{{$channel_hash}}')
+ $('#event_submit').hide();
+ else
+ $('#event_submit').html('{{$update}}');
+ }
});
@@ -332,21 +410,12 @@ function on_submit() {
'categories': $('#id_categories').val(),
'desc': $('#id_description').val(),
'location': $('#id_location').val(),
- 'submit': $('#event_submit').val(),
+ //'submit': $('#event_submit').val(),
'contact_allow[]': contact_allow,
'group_allow[]': group_allow,
'contact_deny[]': contact_deny,
'group_deny[]': group_deny
-/*
- 'submit': $('#event_submit').val(),
- 'target': $('#calendar_select').val(),
- 'uri': $('#event_uri').val(),
- 'title': $('#id_title').val(),
- 'dtstart': $('#id_dtstart').val(),
- 'dtend': $('#id_dtend').val(),
- 'description': $('#id_description').val(),
- 'location': $('#id_location').val()
-*/
+
})
.done(function() {
var eventSource = calendar.getEventSourceById('channel_calendar');
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 428529de2..5df706b20 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -102,6 +102,11 @@
<i class="fa fa-thumbs-o-down{{if $item.my_responses.dislike}} ivoted{{/if}}" ></i>
</button>
{{/if}}
+ {{if $item.reply_to}}
+ <button type="button" title="{{$item.reply_to.0}}" class="btn btn-outline-secondary btn-sm" onclick="doreply({{$item.parent}},{{$item.id}},'{{$item.author_id}}', '{{$item.reply_to.2}} {{$item.name}}'); return false;">
+ <i class="fa fa-reply" ></i>
+ </button>
+ {{/if}}
{{if $item.isevent}}
<div class="btn-group">
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown" id="wall-item-attend-menu-{{$item.id}}" title="{{$item.attend_title}}">