Commit e38691d5 authored by yPhil's avatar yPhil
Browse files

See previous commit MSG (forgot to stage)

parent b02b049c
Pipeline #408074 passed with stage
in 34 seconds
......@@ -2,6 +2,7 @@
## 1.2.8 (WIP)
- New option / dialog to merge the imported / open feeds with existing ones
- Feed name || URL in tooltip
- UTC Timestamps
- Better Item layout (Media/comment icons) and wrapping
......@@ -11,6 +12,7 @@
- In "photo" mode, vertical images wrapped around the text, fixed.
- Console size adjusted
- Better "on error" favicon image handling
- Fixed a long, outstanding & known bug where the "new tab" button was not appended after an import, because of the weird gymnastics we have to do to make sure said button is always the last one, think about that
## 1.2.7
......
{
"name": "petrolette",
"description": "News reading webapp.",
"version": "1.2.7",
"version": "1.2.8b",
"private": true,
"license": "GPL-3.0-only",
"FAVICONS_CACHE_DIR": "favicons-cache",
......
......@@ -817,6 +817,72 @@ PTL.dialog = {
});
},
importFeeds:function(existingFeeds, importedFeedsFile) {
$('#dialogs').load('/static/templates/dialogs.html #questionDialog', function() {
const $dialog = $(this),
$icon = $dialog.find('div.dialogImage > i');
$icon.addClass('icon-upload');
$dialog.dialog({
title: PTL.tr('Open / import tabs and feeds'),
buttons: [
{
text: PTL.tr('Replace'),
title: PTL.tr('Replace'),
class: 'translate',
click: function() {
PTL.tab.empty(function() {
PTL.tab.populate(JSON.parse(importedFeedsFile));
});
PTL.dialog.kill($dialog);
}
},
{
text: PTL.tr('Merge'),
title: PTL.tr('Merge'),
click: function() {
PTL.tab.empty(function() {
PTL.tab.populate(existingFeeds.concat(JSON.parse(importedFeedsFile)));
});
PTL.dialog.kill($dialog);
}
},
{
text: PTL.tr('Cancel'),
title: PTL.tr('Cancel'),
class: 'translate',
click: function() {
PTL.dialog.kill($dialog);
}
}
],
open: function () {
$('.ui-widget-overlay').on('click', function() {
PTL.dialog.kill($dialog);
});
$dialog.find('h1')
.attr('data-content', 'Open / import tabs and feeds')
.text(PTL.tr('Open / import tabs and feeds'));
$dialog.find('h2#name')
.attr('data-content', 'Replace or merge?')
.text(PTL.tr('Replace or merge?'));
$dialog.find('p#name')
.attr('data-content', 'Replace existing feeds with the new ones, or merge them together?')
.text(PTL.tr('Replace existing feeds with the new ones, or merge them together?'));
}
});
$dialog.dialog('open');
});
},
editTab:function($tab) {
......
......@@ -23,6 +23,8 @@ PTL.i18n.translations = {
"Sorry": { fr: "Désolé", ja: "ごめんなさい", es: "Perdón" },
"Warning": { fr: "Avertissement", ja: "警告", es: "Advertencia" },
"All": { fr: "Tout", ja: "すべて", es: "todos" },
"Replace": { fr: "Remplacer", ja: "交換", es: "Reemplazar" },
"Merge": { fr: "Fusionner", ja: "マージ", es: "Unir" },
// Pétrolette
......@@ -325,6 +327,10 @@ PTL.i18n.translations = {
"Open / import tabs and feeds" : { fr: "Ouvrir / importer onglets et flux" , ja: "フォルダとフィードを開く/インポートする", es: "Abrir / importar carpetas y canales RSS" },
"Save / export tabs and feeds" : { fr: "Enregistrer / exporter onglets et flux" , ja: "タブとフィードを保存/エクスポートする", es: "Guardar archivo de carpetas y feeds" },
"Replace existing feeds with the new ones, or merge them together?" : { fr: "Remplacer les flux existants par les nouveaux ou les fusionner ?" , ja: "既存のフィードを新しいフィードに置き換えますか、それともそれらをマージしますか?", es: "¿ Reemplazar los feeds existentes por los nuevos o fusionarlos ?" },
"Replace or merge?" : { fr: "Remplacer ou fusionner ?" , ja: "置き換えるかマージしますか?", es: "¿ Reemplazar o fusionar ?" },
"Reset all tabs and feeds to defaults" : { fr: "Réinitialiser tous les onglets et flux aux valeurs par défaut" , ja: "すべてのタブとフィードをデフォルトにリセットします", es: "Restablecer todas las pestañas y fuentes a los valores predeterminados" },
"Reset" : { fr: "Réinitialiser" , ja: "リセット", es: "Restablecer" },
......@@ -478,6 +484,8 @@ PTL.i18n.translations = {
"Delete tab" : { fr: "Supprimer onglet", ja: "フォルダを削除", es: "eliminar carpeta" },
"Delete column" : { fr: "Supprimer colonne", ja: "列を削除", es: "Eliminar columna" },
"Untitled" : { fr: "Sans titre", ja: "無題", es: "Intitulado" },
"%1 | Click to rename, drag to move" : { fr: "%1 | Cliquer pour renommer, glisser pour déplacer", ja: "%1 | クリックして名前を変更し、ドラッグして再注文します", es: "%1 | Haga clic para cambiar el nombre, arrastre para volver a ordenar" },
......@@ -488,11 +496,8 @@ PTL.i18n.translations = {
"Really delete this column?" : { fr: "Vraiment supprimer cette colonne ?", ja: "本当にこの列を削除しますか?", es: "¿Realmente borras esta columna?" },
"Really delete this tab?" : { fr: "Supprimer définitivement cet onglet ?", ja: "本当にこのフォルダを削除しますか?", es: "¿De verdad borras esta carpeta?" },
"Fold / unfold this feed (%1)" : { fr: "Plier / déplier ce flux (%1)", ja: "ウーブリール - ファーマー (%1)", es: "Abrir / cerrar esta fuente (%1)" },
"Move this feed (%1)" : { fr: "Déplacer ce flux (%1)", ja: "このソースを移動する (%1)", es: "Mueva esta fuente (%)" },
......
......@@ -357,18 +357,19 @@ var PTL = (function() {
$fileImportInput.change(function(evt) {
var f = evt.target.files[0],
existingFeeds = PTL.tab.list(),
existingFeeds = JSON.parse(JSON.stringify(PTL.tab.list())),
reader = new FileReader();
reader.onload = (function() {
return function(e) {
if (PTL.util.isValidJson(e.target.result)) {
PTL.tab.empty(function() {
PTL.tab.populate(JSON.parse(e.target.result));
// PTL.tab.populate(JSON.parse(existingFeeds.concat(e.target.result)), true);
// var finalObj = existingFeeds.concat(e.target.result);
});
PTL.dialog.importFeeds(existingFeeds, e.target.result);
// PTL.tab.empty(function() {
// PTL.tab.populate(existingFeeds.concat(JSON.parse(e.target.result)));
// // PTL.tab.populate(existingFeeds.concat(e.target.result));
// // var finalObj = existingFeeds.concat(e.target.result);
// });
} else if (PTL.util.isNV(e.target.result)) {
PTL.util.importNV(e.target.result);
} else {
......@@ -402,7 +403,6 @@ var PTL = (function() {
// $debugHiddenButton.appendTo('body');
},
sideMenu: function(action) {
......
......@@ -62,7 +62,6 @@ PTL.tab = {
PTL.tab.add($tabs);
});
PTL.tab.makeNewTabButton($tabs);
PTL.sync.readSync();
......@@ -79,6 +78,10 @@ PTL.tab = {
},
populate:function(feeds) {
const $tabs = $('#tabs');
PTL.tab.makeNewTabButton($tabs);
if (!feeds || feeds.length <= 0) {
PTL.util.say(PTL.tr('No feeds found'), 'error');
feeds = ['empty'];
......@@ -128,12 +131,12 @@ PTL.tab = {
});
thisTabCols.push(thisColFeeds);
});
PTL.tab.add($('#tabs'), thisGroup.name, thisTabCols, progress);
PTL.tab.add($tabs, thisGroup.name, thisTabCols, progress);
});
$('#new-group').removeClass('hidden');
$('#tabs').find('li[tabindex="0"]:first-child').focus();
$tabs.find('li[tabindex="0"]:first-child').focus();
PTL.util.say(PTL.tr('Pétrolette init finished'), 'success');
......@@ -292,34 +295,24 @@ PTL.tab = {
},
makeNewTabButton:function($tabs) {
var $newTabButton = $('<li>')
.attr('id', 'new-group')
.attr('class', 'translate new-group hidden')
.data('title', 'Add a new tab')
.attr('title', PTL.tr('Add a new tab'));
var $newTabButtonLink = $('<a>')
// .attr('tabindex', '-1')
.attr('href', '#disabled');
var $newTabButtonIcon = $('<i>')
.attr('class', 'icon-plus');
$newTabButton.focus(function() {
PTL.util.say(PTL.tr("Click this button to add a tab"), 'success', true, 'Astuce');
});
$newTabButtonLink.bind('click', function(event) {
event.stopImmediatePropagation();
PTL.tab.add($tabs);
return false;
});
const $newTabButton = $('<li>')
.attr('id', 'new-group')
.attr('class', 'translate new-group hidden')
.data('title', 'Add a new tab')
.attr('title', PTL.tr('Add a new tab'))
.focus(function() {
PTL.util.say(PTL.tr("Click this button to add a tab"), 'success', true, 'Astuce');
});
const $newTabButtonLink = $('<a>')
.attr('href', '#disabled')
.bind('click', function(event) {
event.stopImmediatePropagation();
PTL.tab.add($tabs);
return false;
}).append($('<i>')
.attr('class', 'icon-plus'));
$newTabButtonIcon.appendTo($newTabButtonLink);
$newTabButtonLink.appendTo($newTabButton);
$newTabButton.appendTo($tabs.find('ul#tab-names'));
......
......@@ -125,11 +125,11 @@
<i class="huge"></i>
</div>
<div class="dialogText">
<h1></h1>
<h2 id="name"></h2>
<p id="name"></p>
<h2 id="number"></h2>
<p id="number"></p>
<h1 class="translate"></h1>
<h2 id="name" class="translate"></h2>
<p id="name" class="translate"></p>
<h2 id="number" class="translate"></h2>
<p id="number" class="translate"></p>
</div>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment