Browse Source

Added Json-Files + included them

pull/1/head
Xenia Grünzinger 6 years ago
parent
commit
ff0ac4aba2
8 changed files with 102 additions and 37 deletions
  1. 7
    0
      public/1.json
  2. 7
    0
      public/2.json
  3. 7
    0
      public/3.json
  4. 21
    11
      public/home.js
  5. 34
    3
      public/index.html
  6. 1
    0
      public/list.json
  7. 2
    23
      public/messageData.js
  8. 23
    0
      public/messageData.json

+ 7
- 0
public/1.json View File

{
"id": "1",
"subject": "Betreff",
"message": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.",
"tag": "#efi #bme #semester",
"user": "user_1"
}

+ 7
- 0
public/2.json View File

{
"id": "2",
"subject": "Betreff",
"message": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.",
"tag": "#efi #bme #semester",
"user": "user_1"
}

+ 7
- 0
public/3.json View File

{
"id": "3",
"subject": "Betreff",
"message": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.",
"tag": "#efi #bme #semester",
"user": "user_1"
}

+ 21
- 11
public/home.js View File

const HomeRouter = { const HomeRouter = {
template: `
<div>
template: `
<div id="om-msg-cards">
<MsgCard <MsgCard
v-for="(msg, index) in messages"
:key="msg.id"
:msg="msg"
v-for="id in messagelist"
:key="id"
:msg="messages[id] || {}"
></MsgCard> ></MsgCard>
</div>`, </div>`,
data: function () {
return { messages: _messages };
},
methods: {
data: function () {
return {
messagelist: _messagelist,
messages: _messages,
};
},
methods: {
refresh_messages: function () { refresh_messages: function () {
_messages.push ({id: 42, subject: "xxx", message: "warum habt ihr auch so viel", user: "nobody", tags:"foo"});
_messages.push({ //////// alt
id: 42,
subject: "xxx",
message: "warum habt ihr auch so viel",
user: "nobody",
tags: "foo"
});
}, },
},
},

/*mounted: function() { /*mounted: function() {
this.refresh_messages(); this.refresh_messages();
}*/ }*/

+ 34
- 3
public/index.html View File

<script src="profilCard.js"></script> <script src="profilCard.js"></script>
<script src="profilData.js"></script> <script src="profilData.js"></script>


<script type = "text/javascript" language = "javascript">

function get_insert_message (id) {
$.get (id+".json"
) .done (function (msg) {
// _messages[id] = msg;
Vue.set (_messages, id, msg);
}) .fail (function (e,f,g) {
console.log ("cannot load "+id+".json: "+e+f+g);
})
}
$(document).ready(function() {
console.log("egal");
$.get('list.json'
) .done (function (jd) {
// _messagelist = jd;
_messagelist.splice (0, _messagelist.length);
_messagelist.push.apply (_messagelist, jd);
console.log("egal2");
//$('#xxx').text(jd[0]);
for (var e in jd) {
if (! _messages[jd[e]]) {
get_insert_message (jd[e]);
}
}
}) .fail (function(e,f,g) {
console.log("egal3: "+e+f+g );
});
});
</script>




<title>OMApp</title> <title>OMApp</title>
</head> </head>


<body> <body>
<div id="app">
<div id="api">
<div class="om-header-container"> <div class="om-header-container">
<div class="om-header"> <div class="om-header">
<a href="index.html"><img src="img/th_nbg_ohmicon_amp.png" width=55px height=55px></a> <a href="index.html"><img src="img/th_nbg_ohmicon_amp.png" width=55px height=55px></a>
</div> </div>


<div class="om-content"> <div class="om-content">
<div id=xxx></div>
<router-view></router-view> <router-view></router-view>
</div> </div>


}); });
var app = new Vue({ var app = new Vue({
router, router,
el: '#app'
el: '#api'
}); });


</script> </script>
<!-- CDN_Bootstrap JS lib --> <!-- CDN_Bootstrap JS lib -->
<script src="https://unpkg.com/bootstrap-material-design@4.1.1/dist/js/bootstrap-material-design.js" integrity="sha384-CauSuKpEqAFajSpkdjv3z9t8E7RlpJ1UP0lKM/+NdtSarroVKu069AlsRPKkFBz9" crossorigin="anonymous"></script> <script src="https://unpkg.com/bootstrap-material-design@4.1.1/dist/js/bootstrap-material-design.js" integrity="sha384-CauSuKpEqAFajSpkdjv3z9t8E7RlpJ1UP0lKM/+NdtSarroVKu069AlsRPKkFBz9" crossorigin="anonymous"></script>
<!-- NOTE: Call main.js --> <!-- NOTE: Call main.js -->
<script src="main.js"></script>
<xxxscript src="main.js"></script>


</body> </body>



+ 1
- 0
public/list.json View File

["1","2","3"]

+ 2
- 23
public/messageData.js View File

_messages = [
{
id: 1,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bme #semester',
user: 'user_1'
},
{
id: 2,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
tag: '#efi #fachschaft',
user: 'user_2'
},
{
id: 3,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bei #wichtig',
user: 'user_3'
},
];
_messagelist = [];
_messages = {};

+ 23
- 0
public/messageData.json View File

[
{
"id": "1",
"subject": "Betreff",
"message": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.",
"tag": "#efi #bme #semester",
"user": "user_1"
},
{
"id": "2",
"subject": "Betreff",
"message": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"tag": "#efi #fachschaft",
"user": "user_2"
},
{
"id": "3",
"subject": "Betreff",
"message": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.",
"tag": "#efi #bei #wichtig",
"user": "user_3"
}
]

Loading…
Cancel
Save