Skip to content

Commit

Permalink
fix: made requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ayanchoudhary committed Jan 4, 2020
1 parent 0412b7a commit 506a18d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<script src="./Masonry.js"></script>
<script src="./scripts/Masonry.js"></script>
<title>SDSLabs</title>
</head>
<body>
Expand Down
File renamed without changes.
25 changes: 13 additions & 12 deletions frontend/src/views/News.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
dolor sit amet, adipiscing elit.
</div>
</div>
<div id="grid" class="sm:grid sm:w-news pt-24 pb-24">
<div id="grid" class="grid sm:w-news pt-24 pb-24">
<div
id="grid-item"
class="sm:grid-item sm:pr-navbar sm:w-event"
class="grid-item sm:pr-navbar sm:w-event"
v-for="event_block in event"
v-bind:key="event_block.event.title"
>
Expand Down Expand Up @@ -98,7 +97,6 @@

<script>
import axios from "axios";
// import Masonry from "masonry-layout";
import LargeFeed from "@/components/news/LargeFeed.vue";
import SmallFeed from "@/components/news/SmallFeed.vue";
export default {
Expand All @@ -111,25 +109,28 @@ export default {
return {
event: {},
eventUpdates: [],
key: 0
key: false,
size: 576
};
},
methods: {
// Re-render element on window resize
windowResize() {
var elem = document.getElementsByClassName("sm:grid")[0];
if (window.innerWidth < 576) {
var elem = document.getElementsByClassName("grid")[0];
if (window.innerWidth < this.size) {
elem.id = "";
this.key = 1;
this.key = true;
} else {
elem.id = "grid";
this.key = 2;
this.key = false;
}
},
// Re-initialize masonry
masonry() {
var elem = document.getElementById("grid");
var msnry = new Masonry(elem, {
// options
itemSelector: "#grid-item",
itemSelector: ".grid-item",
columnWidth: "#feed",
gutter: 24,
percentPosition: true
Expand Down Expand Up @@ -167,14 +168,14 @@ export default {
});
this.event = Object.assign({}, this.event, event);
});
if (window.innerWidth < 576) {
if (window.innerWidth < this.size) {
var elem = document.getElementById("grid");
elem.id = "";
}
this.masonry();
},
updated() {
if (window.innerWidth > 576) {
if (window.innerWidth > this.size) {
this.masonry();
}
},
Expand Down
2 changes: 1 addition & 1 deletion portfolio/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
url(r'^admin/', admin.site.urls),
url(r'^api/projects/', include('projects.urls')),
url(r'^api/news/', include('news.urls')),
url(r'^api/timeline', include('timeline.urls')),
url(r'^api/timeline/', include('timeline.urls')),
] + static(MEDIA_URL, document_root=MEDIA_ROOT)

0 comments on commit 506a18d

Please sign in to comment.