frold
Octobre 10, 2019, 8:31
1
Im looking for users who have used the " Embedding a list of Discourse Topics in another site "
And the style and will share the CSS they are using to change the default style.
At the moment I have only tested the list. But would like to change the style - I see this a very powerfull function
Best Regards,
4 « J'aime »
frold
Octobre 15, 2019, 12:42
2
Really? No one is using the embedding feature and have made a custom style?
If so, feel free to share in this thread.
1 « J'aime »
jord8on
(Jordan)
Août 31, 2020, 8:00
3
J’aimerais aussi voir quelques exemples de cela !
J’ai un peu bricolé et ajouté une barre de recherche en haut de la liste des sujets. Voici à quoi ressemble mon embed :
Code pour le formulaire de recherche, le style et la liste des sujets :
Résumé
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://adams-discourse.com/javascripts/embed-topics.js"></script>
<style>
* {
box-sizing: border-box;
}
#form {
position:absolute;
left: 22px;
top:5px;
width:55%;
}
form.example input[type=text] {
padding: 10px;
font-size: 17px;
border: 1px solid grey;
float: left;
width: 80%;
background: #f1f1f1;
}
form.example button {
float: left;
width: 19%;
padding: 10px;
background:#1e825b;
color: white;
font-size: 17px;
border: 1px solid grey;
border-left: none;
cursor: pointer;
}
form.example button:hover {
background: green;
}
form.example::after {
content: "";
clear: both;
display: table;
}
d-topics-list iframe{
position:absolute;
width: 100%!important;
top:-10px;
}
</style>
</head>
<body>
<d-topics-list discourse-url="https://adams-discourse.com" template="complete" category="9" per-page="6" allow-create="true" ></d-topics-list>
<div id="form">
<form class="example" action="https://adams-discourse.com/search?q=" target="_blank">
<input placeholder="Rechercher dans ce forum" aria-label="Rechercher dans ce forum" type="text" id="q" name="q" value="">
<button type="submit"><i class="fa fa-search"></i></button>
</form> </div>
Pour obtenir la mise en page en boîte, j’ai utilisé flex au lieu de grid dans le CSS intégré de Discourse.
Résumé
.topics-list {
display: inline-flex;
flex-wrap: wrap;
padding: 8px 8px 0 8px;
margin: 3px 3px 0 0;
.topic-list-item .main-link {
border: 1px solid gray;
margin: 5px;
width: 250px;
height: 90px;
}
.topic-column-wrapper {
flex-direction: column-reverse;
.topic-column.details-column {
width: 100%;
}
.topic-created-at {
padding-left: 0!important;
font-size:13px;
}
.topic-column.featured-image-column .topic-featured-image img {
display:none;
}
}
}
.new-topic-btn {
float: left;
margin: 16px 0 0 58%;
height: 40.5px;;
background:#1e825b;
}
.new-topic-btn:hover {
background: rgb(73, 130, 5);
}
5 « J'aime »
@adamgpope Si je comprends bien, ce que vous avez montré ici (barre de recherche, sujets, etc.) est intégré dans un site externe ? Si oui, c’est incroyable !
Désolé d’exhumer un vieux sujet mais…
J’aimerais aussi voir des exemples de style pour la liste intégrée de sujets. La mienne ressemble à la version mobile sur ordinateur
Comment puis-je la faire prendre toute la largeur ?
Désolé pour la question de débutant
EDIT :
Pour répondre à ma propre question
EN BREF
ce qui suit a dû être placé dans la page où la liste est intégrée
<style>
d-topics-list iframe{
width: 100%!important;
}
</style>
ça rend aussi très bien sur mobile !!
J’ai trouvé cela dans ce fil de discussion
The CSS needs adding to your site, rather than Discourse’s embedded, CSS. So you’d have something like this:
<html>
<head>
<script src="https://jonathan5-discourse.com/javascripts/embed-topics.js">
</script>
<style>
d-topics-list iframe{
width: 100%!important;
}
</style>
</head>
<body>
<d-topics-list discourse-url="https://jonathan5-discourse.com" category="5" per-page="5"></d-topics-list>
</body>
</html>