* add setting to show date inline (closes GH-56)

This commit is contained in:
maxpozdeev 2023-09-12 09:43:38 +03:00
parent 0d07356817
commit 30ec81e95d
7 changed files with 29 additions and 10 deletions

View file

@ -70,6 +70,8 @@ var mytinytodo = window.mytinytodo = _mtt = {
tagPreviewDelay: 700, //milliseconds
ajaxAnimationDelay: 200,
saveShowNotes: false,
showdate: false,
showdateInline: false,
firstdayofweek: 1,
touchDevice: false,
calendarIcon: 'calendar.png', // need themeUrl+icon
@ -180,7 +182,10 @@ var mytinytodo = window.mytinytodo = _mtt = {
flag.isLogged = options.isLogged ? true : false;
if (this.options.showdate) {
$('#mtt').addClass('show-inline-date');
$('#mtt').addClass('show-date');
}
if (this.options.showdateInline) {
$('#mtt').addClass('date-inline');
}
// handlers
@ -1204,8 +1209,8 @@ _mtt.prepareTaskStr = prepareTaskStr;
function prepareTaskBlocks(item)
{
var id = item.id;
var markdown = '';
const id = item.id;
let markdown = '';
if (_mtt.options.markdown == true) markdown = 'markdown-note';
return '' +
'<div class="task-block">' +
@ -1221,12 +1226,10 @@ function prepareTaskBlocks(item)
'<span class="task-title">' + prepareTaskTitleInlineHtml(item.title) + '</span> ' +
(curList.id == -1 ? '<span class="task-listname">'+ tabLists.get(item.listId).name +'</span>' : '') +
'<span class="task-tags">' + prepareTagsStr(item) + '</span>' +
'<span class="task-date">' + prepareInlineDate(item) + '</span>' +
'</div>' +
'<div class="task-through-right">' + prepareDueDate(item) + "</div>" +
'</div>' +
'<div class="task-date">' +
prepareInlineDate(item) +
'</div>' +
"</div>" +
'<div class="task-actions"><div class="taskactionbtn"></div></div>' +
@ -1273,6 +1276,7 @@ function prepareTagsStr(item, delimiter = ', ')
if (!a.length) return '';
const b = item.tags_ids.split(',')
for (let i in a) {
// tag is escaped
a[i] = '<span class="tag" data-tag="'+a[i]+'" data-tag-id="'+b[i]+'">'+a[i]+'</span>';
}
return a.join(delimiter);

View file

@ -652,7 +652,13 @@ li.task-row.task-expanded .task-toggle { transform:rotate(90deg); }
.task-id {
/*display: none;*/
}
#mtt.show-inline-date .task-date { display: block; }
#mtt.show-date .task-date {
display: block;
}
#mtt.show-date.date-inline .task-date {
display: inline;
margin-left:3px;
}
.task-through { overflow:hidden; flex-grow:1; }
#mtt.view-task-on-click .task-title {
cursor: pointer;
@ -670,7 +676,10 @@ li.task-row.task-expanded .task-toggle { transform:rotate(90deg); }
padding: 0px 3px;
margin: 0px 2px;
}
.task-tags { padding:0px 2px; }
.task-tags {
margin:0px 3px;
display: inline-block; /* for RTL */
}
.task-tags .tag {
font-size:0.9rem;
font-weight:bold;

View file

@ -81,6 +81,7 @@ class Config
# Show task date in list
'showdate' => array('default'=>0, 'type'=>'i'),
'showtime' => array('default'=>0, 'type'=>'i'),
'showdateInline' => array('default'=>0, 'type'=>'i'),
'exactduedate' => array('default'=>0, 'type'=>'i'),
# Use Markdown syntax for notes. Set to 'v1' to use old v1.6 syntax.

View file

@ -183,6 +183,7 @@
"set_cancel": "Cancel",
"set_showdate": "Show task date in list",
"set_showtime": "Show time",
"set_showdate_inline": "Show date inline",
"set_exactduedate": "Always show due date as a date",
"set_appearance": "Appearance",
"set_appearance_system": "Same as system",

View file

@ -183,6 +183,7 @@
"set_cancel": "Отмена",
"set_showdate": "Показывать дату создания задачи",
"set_showtime": "Показывать время",
"set_showdate_inline": "В той же строке",
"set_exactduedate": "Показывать срок исполнения всегда датой",
"set_appearance": "Тема оформления",
"set_appearance_system": "Как в системе",

View file

@ -89,6 +89,7 @@ function js_options()
"isLogged" => is_logged() ? true : false,
"showdate" => Config::get('showdate') ? true : false,
"showtime" => Config::get('showtime') ? true : false,
"showdateInline" => Config::get('showdateInline') ? true : false,
"duedatepickerformat" => htmlspecialchars(Config::get('dateformat2')),
"firstdayofweek" => (int) Config::get('firstdayofweek'),
"calendarIcon" => get_mttinfo('theme_url'). 'images/calendar.svg',

View file

@ -52,6 +52,7 @@ if(isset($_POST['save']))
Config::set('title', removeNewLines(trim(_post('title'))) );
Config::set('showdate', (int)_post('showdate'));
Config::set('showtime', (int)_post('showtime'));
Config::set('showdateInline', (int)_post('showdateInline'));
Config::set('exactduedate', (int)_post('exactduedate'));
Config::set('appearance', removeNewLines(trim(_post('appearance'))) );
Config::save();
@ -360,8 +361,9 @@ header('Content-type:text/html; charset=utf-8');
<div class="tr">
<div class="th"><?php _e('set_showdate');?>:</div>
<div class="td">
<label><input type="radio" name="showdate" value="1" <?php if(_c('showdate')) echo 'checked="checked"'; ?> /> <?php _e('set_enabled');?></label> <br/>
<label><input type="radio" name="showdate" value="0" <?php if(!_c('showdate')) echo 'checked="checked"'; ?> /> <?php _e('set_disabled');?></label> <br/>
<label><input type="radio" name="showdate" value="1" <?php if(_c('showdate')) echo 'checked="checked"'; ?> /> <?php _e('set_enabled');?></label> <br>
<label><input type="radio" name="showdate" value="0" <?php if(!_c('showdate')) echo 'checked="checked"'; ?> /> <?php _e('set_disabled');?></label> <br>
<label><input type="checkbox" name="showdateInline" value="1" <?php if(_c('showdateInline')) echo 'checked="checked"'; ?> /> <?php _e('set_showdate_inline');?></label> <br>
<label><input type="checkbox" name="showtime" value="1" <?php if(_c('showtime')) echo 'checked="checked"'; ?> /> <?php _e('set_showtime');?></label>
</div>
</div>