Code Monkey home page Code Monkey logo

friends-r-us's People

Contributors

jrunna21 avatar karlfloersch avatar sirebacon avatar

Watchers

 avatar  avatar  avatar  avatar

friends-r-us's Issues

Build Messages page

It should be modeled after Facebook's messages. The left side should have all the people you have conversations with and the right side should be the messages for the selected user.

Enable searching for friends and pages

When you type in stuff in the search bar it should autocomplete the names of friends and pages showing their profile image next to their name, as it does in Facebook.

See: http://stackoverflow.com/questions/23034772/integrating-image-with-jquery-autocomplete

Also see implementation in socs:

views.py

@login_required(redirect_field_name='/login')
def friend_ajax(request):
data = {'first_name': request.POST["first_name"]}
print(data)
print("\n\n")
data = db_views.get_possible_friends(request.user.username,
request.POST["first_name"])
print(data)
return HttpResponse(json.dumps(data), content_type="application/json")

studentDash.js

// Setup stuff for the CSRF Token/post requests
// using jQuery
function getCookie(name) {
    var cookieValue = null;
    if (document.cookie && document.cookie != '') {
        var cookies = document.cookie.split(';');
        for (var i = 0; i < cookies.length; i++) {
            var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
    break;
}
}
}
return cookieValue;
}
var csrftoken = getCookie('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
    beforeSend: function(xhr, settings) {
        if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
            xhr.setRequestHeader("X-CSRFToken", csrftoken);
        }
    }
});
// End CSRF stuff


function addFriendAutoComplete() {
    $("#studentName").keyup(function(){
        var textValue = $("#studentName").val();
        if(textValue.slice(-1) != " "){
            return;
        }
        var firstName = textValue.trim();
        var getUrl = window.location;
        var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
        var urlSubmit = baseUrl + "/get-friends";
        var data ={
            "first_name": firstName
        };
        $.ajax({
            type: "POST",
            url: urlSubmit,
            dataType: "json",
            data : data,
            success: function(response){
                // set the autocomplete
                console.log("working?");
                console.log(response);
                var students = [];//JSON.parse(response);
                var i = 0;
                for(i = 0; i < response.length; i++){
                    students.push(response[i].first_name + " " +
                        response[i].last_name + " - " + response[i].email);
                }
                console.log(students);
                addAutoComplete($("#studentName"), students);
            }
        });
    });
}

Validate Image Upload Filetype

Right now you can upload whatever you want to the server. That is extremely dangerious. However, honestly we wouldn't be using Django's image upload service anyway in any real application. It is a development only feature. But while we are developing we should probably still validate the filetype.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.