This file contains hidden or 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 ConversationsController < ApplicationController | |
before_filter :authenticate_user! | |
helper_method :mailbox, :conversation | |
def index | |
@conversations ||= current_user.mailbox.inbox.all | |
end | |
def outbox | |
@conversations ||= current_user.mailbox.sentbox.all |
This file contains hidden or 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
def get_links | |
needle = /#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be\/)[^&\n]+#/ | |
bracket_needle = /\[(.*?)\]/ | |
links = @doc.search("a.title.may-blank").each do |x| | |
y = x['href'] | |
t = y.scan(needle) | |
unless t.empty? | |
#important part is here | |
# puts x.text |
This file contains hidden or 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
def usertags | |
if params[:tags] != nil | |
@tags = params[:tags] | |
session[:tags] = @tags | |
@videos = Video.tagged_with(session[:tags]).order("views DESC").page params[:page] | |
else | |
session[:tags] = nil | |
@videos = Video.order(views: :desc).page params[:page] | |
end | |
respond_to do |format| |
This file contains hidden or 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
def draft | |
@params = params[:tags] | |
respond_to do |format| | |
format.js | |
end | |
end |
This file contains hidden or 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
function eval_tags (){ | |
tags = $('#tags').val() | |
$.get("/tags/usertags/", $('#tags').val()) | |
.done(function() { | |
alert( "second success" ); | |
}) | |
.fail(function() { | |
alert( "error" ); | |
}) | |
.always(function() { |
This file contains hidden or 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 FavoritesController < ApplicationController | |
before_filter :authenticate_user! | |
before_action :set_favorite, only: [:show, :edit, :update, :destroy] | |
# GET /favorites | |
# GET /favorites.json | |
def index | |
@favorites = current_user.favorites | |
end |