mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 08:16:59 -05:00
webui: List forums, sort friends
This commit is contained in:
parent
34957b857a
commit
fdb93c3f8d
@ -34,11 +34,11 @@ TODO
|
|||||||
[ ] make stylesheets or find reusable sass/css components
|
[ ] make stylesheets or find reusable sass/css components
|
||||||
google material design has nice rules for color, spacing and everything: https://www.google.de/design/spec/material-design/introduction.html
|
google material design has nice rules for color, spacing and everything: https://www.google.de/design/spec/material-design/introduction.html
|
||||||
[ ] find icons, maybe use google material design iconfont
|
[ ] find icons, maybe use google material design iconfont
|
||||||
[ ] use urls/mithril routing for the menu. urls could replace state stored in rs.content
|
[X] use urls/mithril routing for the menu. urls could replace state stored in rs.content
|
||||||
[ ] drag and drop private key upload and import
|
[X] drag and drop private key upload and import
|
||||||
[ ] link from peer location to chat (use urls and mithril routing)
|
[ ] link from peer location to chat (use urls and mithril routing)
|
||||||
[ ] add/remove friend, own cert
|
[X] add/remove friend, own cert
|
||||||
[ ] downloads, search
|
[X] downloads, search
|
||||||
[ ] make reusable infinite list controller, the js part to load data from Pagination.h (tweak Pagination.h to make everything work)
|
[ ] make reusable infinite list controller, the js part to load data from Pagination.h (tweak Pagination.h to make everything work)
|
||||||
should provide forward, backward and follow-list-end
|
should provide forward, backward and follow-list-end
|
||||||
[ ] backend: view/create identities
|
[ ] backend: view/create identities
|
||||||
@ -49,4 +49,4 @@ should provide forward, backward and follow-list-end
|
|||||||
[ ] backend: edit shared folders
|
[ ] backend: edit shared folders
|
||||||
[ ] backend: view shared files
|
[ ] backend: view shared files
|
||||||
[ ] redirect if a url is not usable in the current runstate (e.g. redirect from login page to home page, after login)
|
[ ] redirect if a url is not usable in the current runstate (e.g. redirect from login page to home page, after login)
|
||||||
[ ] sort friendslist
|
[X] sort friendslist
|
||||||
|
@ -117,7 +117,13 @@ function lobby(lobbyid){
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
frame: function(content, right){
|
frame: function(content, right){
|
||||||
return m(".chat.container", [
|
return m(".chat.container", [
|
||||||
m(".chat.header", "headerbar"),
|
m(".chat.header", [
|
||||||
|
m(
|
||||||
|
"h2",
|
||||||
|
{style:{margin:"0px"}},
|
||||||
|
"chat"
|
||||||
|
)
|
||||||
|
]),
|
||||||
m(".chat.left", [
|
m(".chat.left", [
|
||||||
m("div.chat.header[style=position:relative]","lobbies:"),
|
m("div.chat.header[style=position:relative]","lobbies:"),
|
||||||
m("br"),
|
m("br"),
|
||||||
@ -136,7 +142,11 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
return this.frame(
|
return this.frame(
|
||||||
m("div", "please select lobby"),
|
m(
|
||||||
|
"div",
|
||||||
|
{style: {margin:"10px"}},
|
||||||
|
"please select lobby"
|
||||||
|
),
|
||||||
m("div","right"));
|
m("div","right"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
64
libresapi/src/webui-src/app/forums.js
Normal file
64
libresapi/src/webui-src/app/forums.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
var m = require("mithril");
|
||||||
|
var rs = require("retroshare");
|
||||||
|
|
||||||
|
module.exports = {view: function(){
|
||||||
|
return m("div",[
|
||||||
|
m("h2","forums"),
|
||||||
|
m("hr"),
|
||||||
|
/*
|
||||||
|
m("div.btn2", {
|
||||||
|
onclick: function (){
|
||||||
|
m.route("/addforum");
|
||||||
|
}
|
||||||
|
},"< create new forum >"),
|
||||||
|
*/
|
||||||
|
m("ul",
|
||||||
|
rs.list("forums",
|
||||||
|
function(item){
|
||||||
|
return m("li",[
|
||||||
|
m("h2",item.name),
|
||||||
|
m("div",{style:{margin:"10px"}},
|
||||||
|
[
|
||||||
|
item.description != ""
|
||||||
|
? [
|
||||||
|
m("span", "Description: "
|
||||||
|
+ item.description),
|
||||||
|
m("br")]
|
||||||
|
: [],
|
||||||
|
m("span","messages visible: "
|
||||||
|
+ item.visible_msg_count),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
item.subscribed
|
||||||
|
? [
|
||||||
|
m(
|
||||||
|
"span.btn2",
|
||||||
|
{style:{padding:"0px"}},
|
||||||
|
"unsubscribe"
|
||||||
|
),
|
||||||
|
" ",
|
||||||
|
m(
|
||||||
|
"span.btn2",
|
||||||
|
{style:{padding:"0px", margin:"10px"}},
|
||||||
|
"enter"
|
||||||
|
),
|
||||||
|
m("hr", {style: {color:"silver"}}),
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
m(
|
||||||
|
"span.btn2",
|
||||||
|
{style:{padding:"0px", margin:"10px"}},
|
||||||
|
"subscribe"
|
||||||
|
),
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
rs.sort("name")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}}
|
@ -15,7 +15,8 @@ module.exports = {view: function(){
|
|||||||
m("ul",
|
m("ul",
|
||||||
rs.list("identity/own", function(item){
|
rs.list("identity/own", function(item){
|
||||||
return m("li",[m("h2",item.name)]);
|
return m("li",[m("h2",item.name)]);
|
||||||
})
|
},
|
||||||
|
rs.sort("name"))
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
}}
|
}}
|
||||||
|
@ -63,6 +63,10 @@ module.exports = { nodes: [
|
|||||||
runstate: "running_ok.*",
|
runstate: "running_ok.*",
|
||||||
counter: rs.counting("transfers/downloads")
|
counter: rs.counting("transfers/downloads")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "forums",
|
||||||
|
runstate: "running_ok.*",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "chat",
|
name: "chat",
|
||||||
runstate: "running_ok.*",
|
runstate: "running_ok.*",
|
||||||
|
@ -14,6 +14,7 @@ module.exports = {view: function(){
|
|||||||
m("h3","waiting_server"),
|
m("h3","waiting_server"),
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
peers = peers.sort(rs.sort("name"));
|
||||||
|
|
||||||
//building peerlist (prebuild for counting)
|
//building peerlist (prebuild for counting)
|
||||||
var online = 0;
|
var online = 0;
|
||||||
|
@ -280,16 +280,19 @@ rs.counting = function(path, counterfnkt) {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// listing data-elements
|
// listing data-elements
|
||||||
rs.list = function(path, buildfktn){
|
rs.list = function(path, buildfktn, sortfktn){
|
||||||
var list = rs(path);
|
var list = rs(path);
|
||||||
if (list === undefined|| list == null) {
|
if (list === undefined|| list == null) {
|
||||||
return "< waiting for server ... >"
|
return "< waiting for server ... >"
|
||||||
};
|
};
|
||||||
return list.map(buildfktn);
|
if (sortfktn != undefined && sortfktn != null) {
|
||||||
|
list=list.sort(sortfktn);
|
||||||
}
|
}
|
||||||
|
return list.map(buildfktn);
|
||||||
|
};
|
||||||
|
|
||||||
//remember additional data (feature of last resort)
|
//remember additional data (feature of last resort)
|
||||||
rs.memory = function(path, args){
|
rs.memory = function(path, args){
|
||||||
@ -304,3 +307,22 @@ rs.memory = function(path, args){
|
|||||||
return item.memory;
|
return item.memory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//return sorting-function for string, based on property name
|
||||||
|
//using: list.sort(rs.sort("name"));
|
||||||
|
// -----
|
||||||
|
//innersort: cascading sorting - using:
|
||||||
|
//list.sort(rs.sort("type",rs.sort("name")))
|
||||||
|
rs.sort = function(name, innersort){
|
||||||
|
return function(a,b){
|
||||||
|
if (a[name].toLowerCase() == b[name].toLowerCase()) {
|
||||||
|
if (innersort === undefined) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return innersort(a,b);
|
||||||
|
} else if (a[name].toLowerCase() < b[name].toLowerCase()) {
|
||||||
|
return -1
|
||||||
|
} else {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user