This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Search extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
locationValue: [], | |
resourceValue: [], | |
keywords: null, | |
results: { | |
loading: false, | |
data: { resources: [], num_hits: 0 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TimelineView(CreateView): | |
fields= ['text'] | |
model = Post | |
success_url = reverse_lazy('timeline_feed') | |
template_name = 'stream/timeline.html' | |
def form_valid(self, form): | |
form.instance.user = self.request.user | |
return super(TimelineView, self).form_valid(form) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.shortcuts import render, redirect | |
from django.views import View | |
from django.contrib import messages | |
from ..forms import contact_form | |
class IndexView(View): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @users_index.doc_type | |
class User(DocType): | |
email = Text() | |
first_name = Text() | |
last_name = Text() | |
date_joined = Date() | |
expertise = Text() | |
institution = Text() | |
position = Text() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Bookmark = ({ clickHandler, icon, tooltip, bookmarkId }) => ( | |
<DropdownButton | |
onSelect={(evt) => clickHandler(evt)} | |
title={ <i className={`fa fa-${icon} fa-lg`} aria-hidden="true" /> } | |
bsSize="small" | |
noCaret | |
> | |
<MenuItem eventKey="food">Food</MenuItem> | |
<MenuItem eventKey='transportation'>Transportation</MenuItem> | |
<MenuItem eventKey='utilites'>Utilities</MenuItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class ResourcePanel extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
isBookmark: !_.isEmpty(props.data.bookmark), | |
inPrintQueue: false, // we assume not because we don't map this onto data model currently... | |
shareModalOpen: false, | |
correctModalOpen: false, | |
hasPdf: false | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Bookmark = ({ clickHandler, icon, tooltip, bookmarkId }) => ( | |
<DropdownButton | |
title={ <i className={`fa fa-${icon} fa-lg`} aria-hidden="true" /> } | |
bsSize="small" | |
noCaret | |
> | |
<MenuItem eventKey="1" onClick={() => clickHandler()} >Food</MenuItem> | |
<MenuItem eventKey='2' onClick={() => clickHandler()} >Transportation</MenuItem> | |
<MenuItem eventKey='3' onClick={() => clickHandler()} >Utilities</MenuItem> | |
<MenuItem eventKey='4' onClick={() => clickHandler()}>Add/Remove Bookmark</MenuItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BookmarkMetaSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Bookmark | |
fields = '__all__' | |
class BookmarkGroupSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = BookmarkGroup | |
fields = '__all__' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bookmark(models.Model): | |
user = models.ForeignKey(User, on_delete=models.CASCADE) | |
resource = models.ForeignKey("Resource", on_delete=models.CASCADE, related_name="bookmarks") | |
# meta | |
created_at = models.DateTimeField(auto_now_add=True) | |
modified_at = models.DateTimeField(auto_now=True) | |
class Meta: | |
unique_together = ('user', 'resource',) | |
ordering = ('resource',) |