Skip to content

Commit

Permalink
Merge pull request #25 from jasonpettus/sections
Browse files Browse the repository at this point in the history
Sections
  • Loading branch information
jasonpettus committed Jul 19, 2015
2 parents d3508f2 + 289035b commit cdbf50f
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 16 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ gem 'fastimage'
gem 'image_info'
gem 'open_uri_redirections'
gem 'mechanize'
gem 'image_info'

gem 'text'

Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ GEM
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
ethon (0.7.4)
ffi (>= 1.3.0)
execjs (2.5.2)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
Expand All @@ -88,11 +90,16 @@ GEM
faraday_middleware (~> 0.9)
loofah (~> 2.0)
sax-machine (~> 1.0)
ffi (1.9.10)
globalid (0.3.5)
activesupport (>= 4.1.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.7.0)
image_info (1.1.0)
image_size
typhoeus
image_size (1.4.1)
jbuilder (2.3.1)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
Expand Down Expand Up @@ -210,6 +217,8 @@ GEM
tins (1.5.4)
turbolinks (2.5.3)
coffee-rails
typhoeus (0.7.2)
ethon (>= 0.7.4)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.1)
Expand Down Expand Up @@ -239,6 +248,7 @@ DEPENDENCIES
factory_girl_rails
fastimage
feedjira
image_info
jbuilder (~> 2.0)
jquery-rails
mechanize
Expand Down
18 changes: 8 additions & 10 deletions app/controllers/sections_controller.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
class SectionsController < ApplicationController

before_action :authorize_user_logged_in, except: :index
before_action :authorize_user_logged_in, except: :show

def index

def show
if user_logged_in?
redirect_to(user_url(current_user))
@active_section = Section.find(params[:id])
@sections = current_user.sections
@stories = @section.stories
else
@section = Section.find_by(title: 'Default')
@section = Section.find_by(title: 'default')
@stories = @section.stories
render 'default'
end
end

def show
@active_section = Section.find(params[:id])
@sections = current_user.sections
@stories = @section.stories
end

def edit
@section = Section.find(params[:id])
end
Expand Down
5 changes: 5 additions & 0 deletions coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"result": {
"covered_percent": 36.9
}
}
150 changes: 150 additions & 0 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"RSpec": {
"coverage": {
"/Users/apprentice/Desktop/evening-edition/app/helpers/application_helper.rb": [
1,
1,
0,
null,
null,
1,
0,
null,
null
],
"/Users/apprentice/Desktop/evening-edition/app/models/article.rb": [
1,
1,
null,
1,
0,
0,
0,
0,
0,
null,
null,
null,
1,
0,
null,
null
],
"/Users/apprentice/Desktop/evening-edition/app/models/section.rb": [
1,
1,
1,
1,
null,
1,
null,
null,
1,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
null,
0,
null,
null,
null,
0,
null,
null
],
"/Users/apprentice/Desktop/evening-edition/app/models/subscription.rb": [
1,
1,
1,
null,
1,
1,
null,
1,
1,
1,
1,
1,
null,
1,
0,
0,
0,
null,
null,
1,
0,
0,
0,
null,
0,
null,
null,
1,
0,
0,
0,
0,
0,
0,
0,
0,
null,
0,
null,
null,
0,
0,
0,
0,
0,
0,
null,
null,
0,
0,
0,
null,
0,
null,
null,
1,
1,
0,
0,
0,
null,
null,
1,
0,
0,
0,
0,
0,
null,
null,
null,
null
]
},
"timestamp": 1437267285
}
}
Empty file added coverage/.resultset.json.lock
Empty file.
59 changes: 59 additions & 0 deletions db/defaultfeeds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
New York Times: Front Page
http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml

BBC: Top Stories
http://feeds.bbci.co.uk/news/rss.xml

CNN: Top Stories
http://rss.cnn.com/rss/cnn_topstories.rss

Al Jazeera: All Articles
http://america.aljazeera.com/content/ajam/articles.rss

Los Angeles Times: All Articles
http://www.latimes.com/rss2.0.xml

Chicago Tribune: Front Page
http://www.chicagotribune.com/rss2.0.xml

TIME
http://newsfeed.time.com/feed/&t1=

Newsweek
http://www.newsweek.com/rss

The Economist
http://www.economist.com/rss/the_world_this_week_rss.xml

Wall Street Journal
http://www.wsj.com/xml/rss/3_7085.xml

The Daily Beast
http://feeds.feedburner.com/thedailybeast/articles

The Huffington Post
http://www.huffingtonpost.com/feeds/index.xml

Sports Illustrated
http://www.si.com/rss/si_topstories.rss

WIRED
http://feeds.wired.com/wired/index

Chicagoist
http://chicagoist.com/index.xml

Politico
http://www.politico.com/rss/magazine.xml

The Week
http://theweek.com/rss.xml

Council on Foreign Relations
http://feeds.cfr.org/cfr_main

Boing Boing
http://boingboing.net/feed

AV Club
http://www.avclub.com/feed/rss/
11 changes: 6 additions & 5 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)

default_section = Section.create!(title: 'Default9')

default_section.subscriptions.create(set_feed: 'http://america.aljazeera.com/content/ajam/articles.rss', name: 'Al Jazeera America')
# default_section.subscriptions.create!(set_feed: 'http://feeds.bbci.co.uk/news/rss.xml', name: 'BBC Top Stories')
default_section.subscriptions.create!(set_feed: 'http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml', name: 'NYTimes US')
default_section = Section.create!(title: 'Default20')

File.foreach('db/defaultfeeds.txt').each_slice(3) do |feed|
p feed[0].chomp
p feed[1].chomp
default_section.subscriptions.create(name: feed[0].chomp, set_feed: feed[1].chomp)
end

0 comments on commit cdbf50f

Please sign in to comment.