aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-05-03 00:00:00 -0700
committerzotlabs <mike@macgirvin.com>2019-05-03 00:00:00 -0700
commitb1dec1289340385df3699db9e2fe84fe1e37cae5 (patch)
tree1cd70a41107dcb69537e8d028e8dae3377435278 /view
parent319b0acdd81851340b332c10aa29d437897ccde7 (diff)
parentc605c46f83b6dc5141f2506ba4b0047b299c26de (diff)
downloadvolse-hubzilla-b1dec1289340385df3699db9e2fe84fe1e37cae5.tar.gz
volse-hubzilla-b1dec1289340385df3699db9e2fe84fe1e37cae5.tar.bz2
volse-hubzilla-b1dec1289340385df3699db9e2fe84fe1e37cae5.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
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.tpl157
-rwxr-xr-xview/tpl/conv_item.tpl5
4 files changed, 137 insertions, 42 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 1322c2112..b99fc0586 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 + "} ");
+ $('#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..9641e2ab5 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -6,12 +6,17 @@ var views = {'dayGridMonth' : '{{$month}}', 'timeGridWeek' : '{{$week}}', 'timeG
var event_id;
var event_uri;
+var event_xchan;
var contact_allow = [];
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 +34,9 @@ $(document).ready(function() {
firstDay: {{$first_day}},
+ defaultView: default_view,
+ defaultDate: default_date,
+
monthNames: aStr['monthNames'],
monthNamesShort: aStr['monthNamesShort'],
dayNames: aStr['dayNames'],
@@ -75,7 +83,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>');
@@ -121,6 +129,7 @@ $(document).ready(function() {
$('#event_submit').val('update_event').html('{{$update}}');
$('#dbtn-acl').addClass('d-none');
event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
+ event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : '';
contact_allow = event.extendedProps.contact_allow || [];
group_allow = event.extendedProps.group_allow || [];
@@ -137,8 +146,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 +169,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 +178,42 @@ $(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;
+ event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : '';
+
+ if(event.extendedProps.calendar_id === 'channel_calendar') {
+ $.post( 'channel_calendar', {
+ 'event_id': event_id,
+ 'event_hash': event_uri,
+ 'xchan': event_xchan,
+ //'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 +225,45 @@ $(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;
+ event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : '';
+
+ if(event.extendedProps.calendar_id === 'channel_calendar') {
+ $.post( 'channel_calendar', {
+ 'event_id': event_id,
+ 'event_hash': event_uri,
+ 'xchan': event_xchan,
+ //'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 +276,7 @@ $(document).ready(function() {
});
calendar.render();
-
+
$('#title').text(calendar.view.title);
$('#view_selector').html(views[calendar.view.type]);
@@ -250,6 +310,30 @@ $(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;
+ event_xchan = resource.event_xchan;
+
+ $('#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(event_xchan !== '{{$channel_hash}}')
+ $('#event_submit').hide();
+ else
+ $('#event_submit').html('{{$update}}');
+ }
});
@@ -302,7 +386,7 @@ function updateSize() {
}
function on_submit() {
- if($('#calendar_select').val() == 'channel_calendar') {
+ if($('#calendar_select').val() === 'channel_calendar') {
if(new_event_id) {
$("input[name='contact_allow[]']").each(function() {
contact_allow.push($(this).val());
@@ -321,7 +405,7 @@ function on_submit() {
$.post( 'channel_calendar', {
'event_id': event_id,
'event_hash': event_uri,
- 'xchan': '{{$channel_hash}}',
+ 'xchan': event_xchan,
//'mid': mid,
'type': 'event',
'preview': 0,
@@ -332,21 +416,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');
@@ -378,7 +453,7 @@ function on_submit() {
}
function on_delete() {
- if($('#calendar_select').val() == 'channel_calendar') {
+ if($('#calendar_select').val() === 'channel_calendar') {
$.get('channel_calendar/drop/' + event_uri, function() {
var eventSource = calendar.getEventSourceById('channel_calendar');
eventSource.refetch();
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}}">