Browse Source

Fix no white space for article body

Carlos Hernandez 3 years ago
parent
commit
dfe7206d24
2 changed files with 11 additions and 4 deletions
  1. 5
    0
      app_template/www/css/main.css
  2. 6
    4
      app_template/www/fetch_articles.js

+ 5
- 0
app_template/www/css/main.css View File

52
 .modal button.close {
52
 .modal button.close {
53
     color: rgb(255, 0, 0) !important;
53
     color: rgb(255, 0, 0) !important;
54
 }
54
 }
55
+
56
+.modal-body,
57
+button.article-content {
58
+    white-space: pre-wrap
59
+}

+ 6
- 4
app_template/www/fetch_articles.js View File

5
             articles = response.data;
5
             articles = response.data;
6
             if (single) {
6
             if (single) {
7
                 let artName = articles[articles.length - 1];
7
                 let artName = articles[articles.length - 1];
8
+                let artNameNoExt = artName.substr(0, artName.lastIndexOf()) || artName;
8
                 axios.get(`http://136.145.231.32:8080/${artName}`)
9
                 axios.get(`http://136.145.231.32:8080/${artName}`)
9
                     .then(response => {
10
                     .then(response => {
10
                         let homeArticleParent = document.querySelector("#home-article")
11
                         let homeArticleParent = document.querySelector("#home-article")
25
                             <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
26
                             <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
26
                                 <div class="modal-content">
27
                                 <div class="modal-content">
27
                                     <div class="modal-header">
28
                                     <div class="modal-header">
28
-                                        <h5 class="modal-title" id="homeArticleModal">${artName}</h5>
29
+                                        <h5 class="modal-title" id="homeArticleModal">${artNameNoExt}</h5>
29
                                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">
30
                                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">
30
                                             <span aria-hidden="true">&times;</span>
31
                                             <span aria-hidden="true">&times;</span>
31
                                         </button>
32
                                         </button>
32
                                     </div>
33
                                     </div>
33
                                     <div class="modal-body">
34
                                     <div class="modal-body">
34
-                                        ${response.data}
35
+                                        <p>${response.data}</p>
35
                                     </div>
36
                                     </div>
36
                                     <div class="modal-footer">
37
                                     <div class="modal-footer">
37
                                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
38
                                         <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
46
             else {
47
             else {
47
                 for (let i = 0; i < articles.length; i++) {
48
                 for (let i = 0; i < articles.length; i++) {
48
                     let element = articles[i];
49
                     let element = articles[i];
50
+                    let elementNoExt = element.substr(0, element.lastIndexOf('.')) || element;
49
                     axios.get(`http://136.145.231.32:8080/${element}`)
51
                     axios.get(`http://136.145.231.32:8080/${element}`)
50
                         .then(response => {
52
                         .then(response => {
51
                             let articlesHeading = document.querySelector("#articles-heading").parentElement;
53
                             let articlesHeading = document.querySelector("#articles-heading").parentElement;
66
                                 <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
68
                                 <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
67
                                     <div class="modal-content">
69
                                     <div class="modal-content">
68
                                         <div class="modal-header">
70
                                         <div class="modal-header">
69
-                                            <h5 class="modal-title" id="articleModalLabel${i}">${element}</h5>
71
+                                            <h5 class="modal-title" id="articleModalLabel${i}">${elementNoExt}</h5>
70
                                             <button type="button" class="close" data-dismiss="modal" aria-label="Close">
72
                                             <button type="button" class="close" data-dismiss="modal" aria-label="Close">
71
                                                 <span aria-hidden="true">&times;</span>
73
                                                 <span aria-hidden="true">&times;</span>
72
                                             </button>
74
                                             </button>
73
                                         </div>
75
                                         </div>
74
                                         <div class="modal-body">
76
                                         <div class="modal-body">
75
-                                            ${response.data}
77
+                                            <p>${response.data}</p>
76
                                         </div>
78
                                         </div>
77
                                         <div class="modal-footer">
79
                                         <div class="modal-footer">
78
                                             <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
80
                                             <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>