diff --git a/.gitignore b/.gitignore index 942ad3d..82c703d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ coverage/ .env .DS_Store +vcr_cassettes/ diff --git a/Gemfile b/Gemfile index 898f0db..1d930ec 100644 --- a/Gemfile +++ b/Gemfile @@ -6,11 +6,7 @@ gem 'dotenv-rails', groups: [:development, :test] gem 'twitter' gem 'omniauth' -gem 'omniauth-github' gem 'omniauth-instagram' -gem 'omniauth-twitter' - -gem 'instagram' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.3' diff --git a/Gemfile.lock b/Gemfile.lock index 94ae5ca..9f412bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,8 +82,6 @@ GEM railties (>= 3.0.0) faraday (0.9.1) multipart-post (>= 1.2, < 3) - faraday_middleware (0.9.2) - faraday (>= 0.7.4, < 0.10) globalid (0.3.5) activesupport (>= 4.1.0) hashie (3.4.2) @@ -94,11 +92,6 @@ GEM json (~> 1.8) multi_xml (>= 0.5.2) i18n (0.7.0) - instagram (1.1.5) - faraday (>= 0.7, < 0.10) - faraday_middleware (>= 0.8, < 0.10) - hashie (>= 0.4.0) - multi_json (~> 1.0, >= 1.0.3) jbuilder (2.3.1) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) @@ -124,7 +117,6 @@ GEM naught (1.0.0) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) - oauth (0.4.7) oauth2 (1.0.0) faraday (>= 0.8, < 0.10) jwt (~> 1.0) @@ -134,21 +126,12 @@ GEM omniauth (1.2.2) hashie (>= 1.2, < 4) rack (~> 1.0) - omniauth-github (1.1.2) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) omniauth-instagram (1.0.1) omniauth (~> 1.0) omniauth-oauth2 (~> 1.0) - omniauth-oauth (1.1.0) - oauth - omniauth (~> 1.0) omniauth-oauth2 (1.3.1) oauth2 (~> 1.0) omniauth (~> 1.2) - omniauth-twitter (1.2.1) - json (~> 1.3) - omniauth-oauth (~> 1.1) pg (0.18.2) pry (0.10.1) coderay (~> 1.1.0) @@ -271,13 +254,10 @@ DEPENDENCIES dotenv-rails factory_girl_rails (~> 4.0) httparty - instagram jbuilder (~> 2.0) jquery-rails omniauth - omniauth-github omniauth-instagram - omniauth-twitter pg pry-rails rails (= 4.2.3) diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico new file mode 100644 index 0000000..a80aad1 Binary files /dev/null and b/app/assets/images/favicon.ico differ diff --git a/app/assets/images/header-mouth-original.png b/app/assets/images/header-mouth-original.png new file mode 100644 index 0000000..aa59e36 Binary files /dev/null and b/app/assets/images/header-mouth-original.png differ diff --git a/app/assets/images/header-mouth.png b/app/assets/images/header-mouth.png new file mode 100644 index 0000000..98f07cf Binary files /dev/null and b/app/assets/images/header-mouth.png differ diff --git a/app/assets/images/mouths.png b/app/assets/images/mouths.png new file mode 100644 index 0000000..d53f274 Binary files /dev/null and b/app/assets/images/mouths.png differ diff --git a/app/assets/images/tongue-out-original.png b/app/assets/images/tongue-out-original.png new file mode 100644 index 0000000..ef3f4d9 Binary files /dev/null and b/app/assets/images/tongue-out-original.png differ diff --git a/app/assets/images/tongue-out.png b/app/assets/images/tongue-out.png new file mode 100644 index 0000000..a11c96a Binary files /dev/null and b/app/assets/images/tongue-out.png differ diff --git a/app/assets/javascripts/posts.coffee b/app/assets/javascripts/posts.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/posts.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 34a26df..aeebd57 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -17,13 +17,36 @@ body { // Exactly 50px because first (top) navbar is exactly 50px according to Bootstrap. // Any more than 50px and there will be white space between the first and second navbars. padding-top: 50px; - background-color: #FFFFCC; + background-color: #4FD5D6; +} + +.container-fluid { + width: 70%; + background-color: #CDFFFF; + margin-top: -20px; + background-position: fixed no-repeat; +} + +header { + background-color: #FF0000; +} + +.header1 { + float: left; + width: 20%; + margin: 5px; + box-sizing: border-box; +} + +.header1:hover { + content: image-url("tongue-out.png"); } .jumbotron { text-align: center; background-color: #FF0000; color: #FFFFCC; + margin-top: 20px; } .beast-mode { @@ -32,6 +55,7 @@ body { // Style of the navbar(s). .navbar { + padding-left: 0; background-color: #FF0000; border: none; // Default is rounded borders, which looks weird with two navbars. @@ -40,7 +64,7 @@ body { .navbar-default .navbar-brand { font-family: 'Rock Salt', cursive; - color: #FFFFCC; + color: #CDFFFF; } .navbar-default .navbar-brand:hover { @@ -48,7 +72,7 @@ body { } .navbar-default .navbar-text { - color: #FFFFCC; + color: #CDFFFF; } .navbar-brand { @@ -57,7 +81,12 @@ body { // To adjust the height of the second navbar, so it's not MASSIVE. .navbar.navbar-static-top { - min-height: 30px; + margin-top: 5px; + min-height: 35px; +} + +.navbar.navbar-static-top p { + margin-top: 20px; } //Style for the webpage subtitle. @@ -81,8 +110,56 @@ p.navbar-text { border: none; } -// Form gains a margin when shrinking window. -// .navbar-form { -// margin-top: 1px; -// margin-bottom: 1px; -// } +.fa-refresh { + margin-right: 5px; +} + +// Stuff for the feed!!!!!!!!!!!!! + +.thumbnail { + margin-top: 3rem; + width: 100%; +} + +.user{ + // padding-left: 20px; + margin-bottom: 10px; + border-bottom: solid 1px #CABCBC; +} + +.prof-pic { + width: 50px; + margin: 5px; +} + +.posted-at { + float: right; + margin-right: 10px; + margin-top: 20px; + color: #616161; +} + +.fix-width { + width: 350px; +} + +.caption { + margin: 0 60px 20px 60px; + text-align: center; + font-weight: 500; +} + +.img2 { + width: 50px; +} + + +footer { + position: fixed; + width: 100%; + bottom: 0; +} + +footer a{ + float: right; +} diff --git a/app/assets/stylesheets/home.scss b/app/assets/stylesheets/home.scss index f0ddc68..37de44d 100644 --- a/app/assets/stylesheets/home.scss +++ b/app/assets/stylesheets/home.scss @@ -1,3 +1,4 @@ // Place all the styles related to the home controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + diff --git a/app/assets/stylesheets/posts.scss b/app/assets/stylesheets/posts.scss new file mode 100644 index 0000000..1a7e153 --- /dev/null +++ b/app/assets/stylesheets/posts.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the posts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0a26894..95cec3e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -13,18 +13,10 @@ def assign_user end end - def twitter_api_object - Twitter::REST::Client.new do |config| - config.consumer_key = ENV["TWITTER_CLIENT_ID"] - config.consumer_secret = ENV["TWITTER_CLIENT_SECRET"] - config.access_token = ENV["TWITTER_ACCESS_TOKEN"] - config.access_token_secret = ENV["TWITTER_ACCESS_SECRET"] - end - end - def redirect_if_not_allowed unless logged_in? flash[:error] = "You must be logged in to see that." + redirect_to root_path end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c38ad4d..028a8a1 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,34 +1,48 @@ class HomeController < ApplicationController - # def index - # if logged_in? - # client = twitter_api_object - # twitter_ids = @user.subscriptions.pluck(:twitter_id) + def index + if logged_in? + @posts = @user.posts.sorted_order + end + end - # @sub_array_tweets = [] + def search + if params[:search].nil? || params[:search].empty? + flash[:error] = "Please enter text into the search box." + redirect_to root_path + elsif params[:website] == "twitter" + redirect_to twi_subscriptions_path(params: {twitter_search: params[:search]}) + else + # when the website is instagram + redirect_to ig_subscriptions_path(params: {instagram_search: params[:search]}) + end + end - # twitter_ids.each do |twitter_id| - # client.user_timeline(twitter_id.to_i).each do |tweet| - # @sub_array_tweets << tweet - # end - # end + # list of a user's subcriptions + def subscriptions + posts = @user.posts - # @sub_array_tweets.sort! { |a,b| b.as_json["created_at"].to_time <=> a.as_json["created_at"].to_time } + sub_array = [] - # could transform tweets into our own "post" object... - # need to combine - # end - # end + posts.each do |post| + sub_array << [post.subscription_id, post.username] + end - def search - if params[:website] == "twitter" - redirect_to twi_subscriptions_path(params: {twitter_search: params[:search]}) - elsif params[:website] == "instagram" - redirect_to ig_subscriptions_path(params: {instagram_search: params[:search]}) - else - flash[:error] = "Please search via the search box." - redirect_to root_path + @sub_array = sub_array.uniq + + @sub_array.each do |post| + id = post[0] + subscription = Subscription.find(id) + pic = subscription.profile_pic + post << pic end end + def unfollow + subscription = Subscription.find(params[:subscription_id]) + + @user.dissociate_subscription(subscription) + + redirect_to subscriptions_path + end end diff --git a/app/controllers/ig_subscriptions_controller.rb b/app/controllers/ig_subscriptions_controller.rb index f50f54c..346bcf5 100644 --- a/app/controllers/ig_subscriptions_controller.rb +++ b/app/controllers/ig_subscriptions_controller.rb @@ -5,6 +5,8 @@ class IgSubscriptionsController < ApplicationController INSTA_URI = "https://api.instagram.com/v1/users/" + COUNT = 15 + def index unless params[:instagram_search].nil? @query = params[:instagram_search] @@ -17,20 +19,72 @@ def index end end - - def create @instagram_id = params[:instagram_id] - subscription = Subscription.find_or_create_subscription(@instagram_id) + access_token = session[:access_token] + + relationship_check = HTTParty.get(INSTA_URI + "#{params[:instagram_id]}/relationship?access_token=" + access_token) + + if relationship_check["data"]["target_user_is_private"] == true && relationship_check["data"]["outgoing_status"] == "none" + + flash[:error] = "This user is private and thus spared." + + redirect_to root_path + else + subscription = Subscription.find_or_create_ig_subscription(@instagram_id) + assign_profile_pic(subscription) - @user.associate_subscription(subscription) + @user.associate_subscription(subscription) - flash[:notice] = "Subscribed successfully!" + response = [] - redirect_to root_path + response << single_subscription_httparty_object(subscription) + + Post.create_all_instagram_posts(response) + + flash[:notice] = "The Beast likes delicious grams. Yum Yum!" + + redirect_to root_path + end end + def refresh_ig + user_subs = @user.instagram_subscriptions + response = multiple_subscription_httparty_objects(user_subs) + + Post.create_all_instagram_posts(response) + + redirect_to refresh_twi_path + end + + private + + def assign_profile_pic(subscription) + subscription.profile_pic = params[:profile_pic] + + subscription.save + end + + # Returns a single HTTParty object for a single subscription. + def single_subscription_httparty_object(subscription) + access_token = session[:access_token] + + if subscription.instagram_id.present? + return HTTParty.get(INSTA_URI + "#{subscription.instagram_id}/media/recent/?count=#{COUNT}&access_token=" + access_token) + end + end + + # Returns an array with multiple subscription HTTParty objects (only for Instagram). + def multiple_subscription_httparty_objects(array_of_subscriptions) + responses = [] + + array_of_subscriptions.each do |subscription| + responses << single_subscription_httparty_object(subscription) + end + + return responses # this is an array of HTTParty objects + end end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb new file mode 100644 index 0000000..e7197d5 --- /dev/null +++ b/app/controllers/posts_controller.rb @@ -0,0 +1,9 @@ +class PostsController < ApplicationController + + def show + name = params[:username] + + @posts = Post.where(username: name).sorted_order + end + +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 21c7447..fbb62d0 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,5 +1,6 @@ class SessionsController < ApplicationController -skip_before_filter :verify_authenticity_token + # So the dev login works in testing & development environments. + skip_before_filter :verify_authenticity_token unless Rails.env.production? def create auth_hash = request.env['omniauth.auth'] @@ -15,7 +16,7 @@ def create session[:user_id] = @user.id end - redirect_to root_path + redirect_to refresh_ig_path else flash[:error] = "Failed to authenticate" @@ -26,6 +27,8 @@ def create def destroy session[:user_id] = nil + session[:access_token] = nil + redirect_to root_path, notice: "You have fled from the beast!" end end diff --git a/app/controllers/twi_subscriptions_controller.rb b/app/controllers/twi_subscriptions_controller.rb index 849a3ec..b12607e 100644 --- a/app/controllers/twi_subscriptions_controller.rb +++ b/app/controllers/twi_subscriptions_controller.rb @@ -1,25 +1,72 @@ class TwiSubscriptionsController < ApplicationController before_action :redirect_if_not_allowed + before_action :twitter_api_object def index # Guard in case someone tries to access the URL without any search results. unless params[:twitter_search].nil? - client = twitter_api_object - @results = client.user_search(params[:twitter_search]) + @response = @client.user_search(params[:twitter_search]) end end def create # Calling find_or_create_subscription and associate_subscription model methods. - @twitter_id = params[:twitter_id] - subscription = Subscription.find_or_create_subscription(@twitter_id) + if @client.user(@twitter_id.to_i).protected + flash[:error] = "This user is private so they have been spared from the beast." + redirect_to root_path + else + subscription = Subscription.find_or_create_twi_subscription(@twitter_id) + + assign_profile_pic(subscription) + + @user.associate_subscription(subscription) + + tweet_array = [] + + @client.user_timeline(@twitter_id.to_i).each do |tweet| + tweet_array << tweet + end + subscription_twitter_ids = {subscription.id => tweet_array} + Post.create_twitter_posts(subscription_twitter_ids) + flash[:notice] = "The Beast eats tweets for breakfast! Yum!" + + redirect_to root_path + end + end + + def refresh_twi + sub_twit_array = @user.subscriptions.where("twitter_id IS NOT NULL").pluck(:id, :twitter_id) - @user.associate_subscription(subscription) + sub_twit_array.each do |sub_id, twit_id| + @tweet_array = [] + @client.user_timeline(twit_id.to_i).each do |twit_id| + @tweet_array << twit_id + end - flash[:notice] = "Subscribed successfully!" + subscription_twitter_ids = {sub_id => @tweet_array} + + Post.create_twitter_posts(subscription_twitter_ids) + end redirect_to root_path end + + private + + def assign_profile_pic(subscription) + subscription.profile_pic = params[:profile_pic] + + subscription.save + end + + def twitter_api_object + @client = Twitter::REST::Client.new do |config| + config.consumer_key = ENV["TWITTER_CLIENT_ID"] + config.consumer_secret = ENV["TWITTER_CLIENT_SECRET"] + config.access_token = ENV["TWITTER_ACCESS_TOKEN"] + config.access_token_secret = ENV["TWITTER_ACCESS_SECRET"] + end + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dea16c2..f2fe260 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,7 +1,5 @@ module ApplicationHelper def logged_in? - unless session[:user_id].blank? - return true - end + session[:user_id] end end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb deleted file mode 100644 index 23de56a..0000000 --- a/app/helpers/home_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module HomeHelper -end diff --git a/app/helpers/ig_subscriptions_helper.rb b/app/helpers/ig_subscriptions_helper.rb deleted file mode 100644 index 0a1e959..0000000 --- a/app/helpers/ig_subscriptions_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module IgSubscriptionsHelper -end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb deleted file mode 100644 index 309f8b2..0000000 --- a/app/helpers/sessions_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module SessionsHelper -end diff --git a/app/helpers/twi_subscriptions_helper.rb b/app/helpers/twi_subscriptions_helper.rb deleted file mode 100644 index 3e4a3e3..0000000 --- a/app/helpers/twi_subscriptions_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module TwiSubscriptionsHelper -end diff --git a/app/models/post.rb b/app/models/post.rb index 9597e81..2ea92b7 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -2,7 +2,92 @@ class Post < ActiveRecord::Base # Associations belongs_to :subscription has_many :users, through: :subscription + serialize :image, Array - #Validations + # Validations validates_presence_of :username, :posted_at, :content_id, :subscription_id + + # Scopes + scope :sorted_order, -> { order(posted_at: :desc) } + + # Model Methods + + # Checks with the database to make sure all the posts don't already exist. + # The HTTParty objects is seperate subscribers for a user. + def self.create_all_instagram_posts(array_of_httparty_objects) + newed_post_array = new_all_instagram_posts(array_of_httparty_objects) + + newed_post_array.each do |newed_post| + create_instagram_post(newed_post) + end + end + + # Checks with the database to make sure the post doesn't already exist. + def self.create_instagram_post(newed_post) + if where(content_id: newed_post.content_id).empty? + newed_post.save + end + end + + def self.create_twitter_posts(subscription_twitter_ids) + # passes in a hash where the key is the subscription id + # and the value is an array of individual tweets + subscription_twitter_ids.each do |id, tweets| + # iterates through each tweet and creates it + # unless it is already in the database + tweets.each do |tweet| + unless self.find_by(content_id: tweet.id) + # needs to be an array because tweets can have more + # than one photos + media_array = [] + + tweet.media.as_json.each do |media| + media_array << media["media_url_https"] + end + + create( + username: tweet.user.screen_name, + text: tweet.text, + posted_at: tweet.as_json["created_at"], + content_id: tweet.id, + image: media_array, + subscription_id: id + ) + end + end + end + end + + private + + def self.newed_instagram_post(json_content) + post = Post.new( + image: [json_content["images"]["low_resolution"]["url"]], + posted_at: Time.at(json_content["created_time"].to_i), + username: json_content["user"]["username"], + content_id: json_content["id"], + subscription_id: Subscription.find_by(instagram_id: json_content["user"]["id"]).id + ) + + unless json_content["caption"].nil? + post.text = json_content["caption"]["text"] + end + + return post + end + + # Array of HTTParty objects is an array of subscriptions. + def self.new_all_instagram_posts(array_of_httparty_objects) + newed_posts = [] + + array_of_httparty_objects.each do |all_posts_for_subscriber| + + all_posts_for_subscriber["data"].each do |single_post_json| + newed_posts << newed_instagram_post(single_post_json) + end + + end + + return newed_posts + end end diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 00ec57e..7db4f98 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -5,7 +5,6 @@ class Subscription < ActiveRecord::Base # Validations validate :twitter_xor_instagram_id - # would be good to write a validation that it has either a twitter_id OR an instagram_id private # validates that there is EITHER a twitter OR instagram id @@ -21,31 +20,33 @@ def twitter_xor_instagram_id # This is by design to make scopes chainable. # Thx scopes. + def self.find_twitter_id(id) + find_by(twitter_id: id) + end + + def self.find_instagram_id(id) + find_by(instagram_id: id) + end + + #So profile pic info not currently being stored. + + def self.find_or_create_twi_subscription(id) + subscription = find_twitter_id(id) - # Not sure if this id == @twitter_id is 100% failsafe - def self.find_id(id) - if id == @twitter_id - find_by(twitter_id: id) + # If there's not a subscription, will create one or return the subscription found. + if subscription.nil? + return create(twitter_id: id) else - find_by(instagram_id: id) + return subscription end end - # - # Uses twitter_id passed in params from the link_to button from the search results. - - # Ideally would like to be able to pass in the profile_pic info as a parameter here as well. Not currently happening - #So profile pic info not currently being stored. - def self.find_or_create_subscription(id) - subscription = find_id(id) + def self.find_or_create_ig_subscription(id) + subscription = find_instagram_id(id) # If there's not a subscription, will create one or return the subscription found. if subscription.nil? - unless :instagram_id == nil - return create(instagram_id: id) - else - return create(twitter_id: id) - end + return create(instagram_id: id) else return subscription end diff --git a/app/models/user.rb b/app/models/user.rb index fa277c7..947ff1d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,13 +7,18 @@ class User < ActiveRecord::Base validates_presence_of :uid, :provider validates_uniqueness_of :uid + # Model Methods def self.find_or_create_user(auth_hash) uid = auth_hash["uid"] + provider = auth_hash["provider"] user = User.where(uid: uid, provider: provider).first_or_initialize + user.email = auth_hash["info"]["email"] + user.name = auth_hash["info"]["name"] + user.image = auth_hash["info"]["image"] return user.save ? user : nil @@ -22,6 +27,24 @@ def self.find_or_create_user(auth_hash) # Adds the association between a new subscription and the user. def associate_subscription(subscription) self.subscriptions << subscription + self.save end + + def dissociate_subscription(subscription) + self.subscriptions.delete(subscription) + end + + def already_subscribed?(sub_id) + subscriptions = self.subscriptions + + if subscriptions.find_by(twitter_id: sub_id) || subscriptions.find_by(instagram_id: sub_id) + return true + end + end + + # Returns an ActiveRecord of all instagram subscriptions for that user. + def instagram_subscriptions + self.subscriptions.where.not(instagram_id: nil) + end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 27c3500..9a4d061 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,27 +1,24 @@ - - +
+ <% if logged_in? && @user.subscriptions.blank? %> - <% @sub_array_tweets.each do |tweet| %> - <%= tweet.user.screen_name %> - <%= tweet.text %> - <%= tweet.as_json["created_at"] %> - <% tweet.media.as_json.each do |media| %> - <%= image_tag(media["media_url_https"], height: '300' ) %> - <% end %> -
###
- <% end %> -<% end %> +

You have not fed the beast yet. Use the search window + to satiate the beast!

-<% unless logged_in? %> +<% elsif logged_in? %> + <%= render 'shared/postthumbnail' %> + +<% else %>

WELCOME TO BEAST MODE!

You must to sign in to feed the beast.

+ <% unless Rails.env.production? %>

<%= link_to "Sign In via Developer", "/auth/developer", class: "btn btn-primary" %>

+ <% end %>

<%= link_to "Sign In via Instagram", "/auth/instagram", class: "btn btn-primary" %>

<% end %> +
diff --git a/app/views/home/subscriptions.html.erb b/app/views/home/subscriptions.html.erb new file mode 100644 index 0000000..4e1da34 --- /dev/null +++ b/app/views/home/subscriptions.html.erb @@ -0,0 +1,13 @@ + + + + + + <% @sub_array.each do |sub| %> + + + + + + <% end %> +
Profile PicUsernameUnfollow
<%= image_tag(sub[2], class: "img-rounded img2") %><%= sub[1] %><%= link_to "Unfollow", unfollow_path(subscription_id: sub[0]), method: :delete, data: { confirm: "Are you sure you want unfollow" } %>
diff --git a/app/views/ig_subscriptions/index.html.erb b/app/views/ig_subscriptions/index.html.erb index 05b3cc0..d617a08 100644 --- a/app/views/ig_subscriptions/index.html.erb +++ b/app/views/ig_subscriptions/index.html.erb @@ -1,14 +1 @@ - - - - - <% @response.each do |person| %> - - - - - - - <% end %> - -
UsernameNamePic
<%= image_tag(person["profile_picture"]) %><%= person["username"] %><%= person["full_name"] %><%= link_to "Feed the Beast!", ig_subscriptions_path(instagram_id: person["id"]), method: :post, class: "btn btn-default" %>
+<%= render "shared/usersearch" %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0cbc149..3554a05 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,15 +1,18 @@ - C3ProjectsSeemore + The Beast! + <%= favicon_link_tag 'favicon.ico' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> + <%= render 'shared/header' %> +
<% if flash[:notice] %>
<%= flash[:notice] %>
<% end %> @@ -18,9 +21,14 @@
<%= flash[:error] %>
<% end %> -
<%= yield %>
+ diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb new file mode 100644 index 0000000..fd3b766 --- /dev/null +++ b/app/views/posts/show.html.erb @@ -0,0 +1 @@ +<%= render 'shared/postthumbnail' %> diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb index a3310fe..d1768aa 100644 --- a/app/views/shared/_header.html.erb +++ b/app/views/shared/_header.html.erb @@ -1,7 +1,9 @@ -