Skip to content

Commit

Permalink
text column works
Browse files Browse the repository at this point in the history
  • Loading branch information
mrb committed Dec 5, 2008
1 parent e54b353 commit b387255
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -4,3 +4,6 @@
[submodule "vendor/flickr"] [submodule "vendor/flickr"]
path = vendor/flickr path = vendor/flickr
url = git://github.com/ctagg/flickr.git url = git://github.com/ctagg/flickr.git
[submodule "vendor/static_model"]
path = vendor/static_model
url = git://github.com/quirkey/static_model.git
10 changes: 6 additions & 4 deletions data/text.yml
@@ -1,5 +1,7 @@
--- ---
- title: Link #1 - title: News 12/5/08
body: http://www.google.com body: Not too much news today! Not too much news today! Not too much news today! Not too much news today!
- title: Link #2 posted_at: Fri Dec 05 15:32:10 -0500 2008
body: http://www.nytimes.com - title: News 12/4/08
body: Not too much news today!
posted_at: Fri Dec 04 12:21:30 -0500 2008
5 changes: 2 additions & 3 deletions lib/columnlog/apps/gist.rb
Expand Up @@ -5,12 +5,11 @@ class Gist < Base
@@gist_url = 'http://gist.github.com/%s.txt' @@gist_url = 'http://gist.github.com/%s.txt'


def post(content) def post(content)
content = content.is_a?(Post) ? content.body : content
app.post(content)
end end


def get(how_many = nil) def get(how_many = nil)
doc = Nokogiri::HTML.parse(open("http://gist.github.com/mrb")) super
doc = Nokogiri::HTML(open("http://gist.github.com/mrb"))
doc.css('div.file').collect{|x| to_post(x.to_html) } doc.css('div.file').collect{|x| to_post(x.to_html) }
end end


Expand Down
8 changes: 5 additions & 3 deletions lib/columnlog/apps/text.rb
Expand Up @@ -10,21 +10,23 @@ class Text < Base
# app.post(content) # app.post(content)
# end # end


def get(how_many = 10) def get(how_many = nil)
super super
out = app.collect {|i| to_post(i) } out = app.collect {|i| to_post(i) }
out.first(how_many) out.first(how_many)
end end


def app def app
Columnlog::SimpleText.set_data_file settings.data_file data_root = File.join(Columnlog.root, 'data/')
Columnlog::SimpleText.set_data_file data_root+settings.data_file
Columnlog::SimpleText.all Columnlog::SimpleText.all
end end


protected protected
def to_post(item, other = {}) def to_post(item, other = {})
Post.new({:title =>item.title, Post.new({:title =>item.title,
:body => item.body}) :body => item.body,
:posted_at => item.posted_at})
end end


end end
Expand Down
1 change: 0 additions & 1 deletion lib/columnlog/errors.rb
Expand Up @@ -3,6 +3,5 @@ module Errors


class Error < Exception; end class Error < Exception; end
class UnauthorizedApp < Error; end class UnauthorizedApp < Error; end

end end
end end
1 change: 1 addition & 0 deletions sinatra
Submodule sinatra added at c08fba
165 changes: 155 additions & 10 deletions themes/default/public/stylesheets/default.css
@@ -1,13 +1,158 @@
body { font: 75% "Helvetica", arial, Verdana, sans-serif; background: #FFB03B; } /******************************************************
h1 { margin: 0; color: #8E2800; } * theme(quirkey).css *
h2 { margin-bottom: 0;} \*****************************************************/
a { color: #468966; }
#page { margin: 1em auto; width: 1024px; border: 0.75em solid #B64926; background: white; padding: 2em; } body {
.post { border-bottom: 0.4em double #FFB03B; padding-bottom: 1em;} margin: 0px;
.post .subtitle { padding-bottom: 1em; font-size: 83.333%; display: block;} background: #2D2F3D;
#header, #footer { width: 1024px; margin: 0 auto} font-family: Helvetica, Arial, sans-serif;
#header h3 { font-size: 220%; margin: 0.5em 0 0 0; font-family: "Georgia";} color: #FFF;
#header h3 a { color: #FFF0A5; text-decoration: none; text-transform: uppercase; letter-spacing: 0.3em; text-shadow: #B64926 0.04em 0.04em;} font-size: 14px;
}
a:link, a:visited {
color:#B6D7F0;
text-decoration:none;
}
a:hover {
color:#ECE2E8;
}

#header {
font-family: Georgia, Times, serif;
border-bottom: 10px solid #222833;
}
#header h1 {
font-weight:normal;
font-size: 50px;
margin: -5px 0px 0px 10px;
height: 45px;
}
#header h1 a {
color: #F5F0E2;
}
#footer {
width: 100%;
text-align:right;
font-size: 11px;
margin: 20px 0px;
}
#footer p {
padding: 0px 10px;
}
#main {
width: 100%;
height: auto;
background: #111 ;
overflow: auto;
}
#columns {
/* white-space: nowrap;*/
width: auto;
margin-left: 200px;
}
.column {
width: 350px;
margin: 0px;
/* margin-bottom: 30000px;*/
border-top: 1px solid #13171E;
border-right: 2px solid #666;
float:left;
height: 480px;
}
.post {
padding: 10px;
line-height: 170%;
border-bottom: 1px solid #666;
}
.post h3 {
font-size: 16px;
line-height: 140%;
padding: 0px;
margin: 0px;
color:#B6B6B6;
}
.post .meta_info {
font-size: 11px;
color: #9E9E9E;
}

.clear {
font-size: 1px;
line-height: 0px;
clear:both;
}
.column h2 {
padding: 0px 10px;
margin: 0px;
font-size: 40px;
height: 30px;
/* text-shadow: #333 2px 2px 5px;*/
}
.column_twitter {
background:#0C2A47;
}
.column_twitter h2 {
background: #B6D7F0;
display:block;
}
.column_twitter h2 a:link, .column_twitter h2 a:visited {
color: #0C2A47;
}
.column_twitter .post_body {
font-size: 20px;
font-family: Georgia, Times, serif;
}
.column_rss {
background:#22455E;
}
.column_rss h2 {
background: #B6D7F0;
display:block;
}
.column_rss h2 a:link, .column_rss h2 a:visited {
color: #22455E;
}
.column_tumblr {
background: #13323A;
}
.column_tumblr h2 {
background: #B6D7F0;
display:block;
}
.column_tumblr h2 a:link, .column_tumblr h2 a:visited {
color: #13323A;
}
.column_last_fm {
background: #51373D;
}
.column_last_fm h2 {
background: #B6D7F0;
display:block;
}
.column_last_fm h2 a:link, .column_last_fm h2 a:visited {
color: #51373D;
}
.column_flickr {
background: #141B22;
}
.column_flickr h2 {
background: #B6D7F0;
display:block;
}
.column_flickr h2 a:link, .column_flickr h2 a:visited {
color: #141B22;
}
.column_flickr img {
float:left;
margin: 0px 10px 10px 0px;
}
.home_description {
width: 200px;
}
/*
Flash Stuff
*/

#flash { position: fixed; top: 0px; left: 0px; width: 100%; z-index: 1000; background-color: #569; color: white; border-bottom: 1px solid #555; } #flash { position: fixed; top: 0px; left: 0px; width: 100%; z-index: 1000; background-color: #569; color: white; border-bottom: 1px solid #555; }
#flash, #flash * { cursor: pointer; } #flash, #flash * { cursor: pointer; }
#flash .yui-b { padding: 5px 0; } #flash .yui-b { padding: 5px 0; }
Expand Down
8 changes: 4 additions & 4 deletions themes/default/views/index.erb
@@ -1,14 +1,14 @@
<% columns = Columnlog::Column.all.reject {|c| c.updated_at.nil? } %> <% columns = Columnlog::Column.all %>
<div id="columns"> <div id="columns">
<% columns.sort_by {|c| c.updated_at }.reverse.each do |column| %> <% columns.each do |column| %>
<div class="column column_<%= column.app_type.underscore %>" id="column_<%= column.name %>" style="width: <%= 99.4 / columns.length %>%;"> <div class="column column_<%= column.app_type.underscore %>" id="column_<%= column.name %>" style="width: <%= 99.4 / columns.length %>%;">
<h2><%= link_to column.title, column.url %></h2> <h2><%= link_to column.title, column.url %></h2>
<div class="posts"> <div class="posts">
<% column.get.each do |post| %> <% column.get.each do |post| %>
<div class="post"> <div class="post">
<% if post.title %><h3><%= link_to post.title, post.url %></h3><% end %> <% if post.title %><h3><%= post.title %></h3><% end %>
<% if post.body %><div class="post_body"><%= post.body %></div><% end %> <% if post.body %><div class="post_body"><%= post.body %></div><% end %>
<div class="meta_info"><%= post.posted_at.strftime("%B, %e %Y at %I:%M%p") %><% if post.author %> by <%= post.author %><% end %><% if post.url %>&nbsp;<%= link_to "&raquo;", post.url %><% end %></div> <div class="meta_info"><% if post.posted_at %><i><%= post.posted_at.strftime("%B, %e %Y at %I:%M%p") %></i><% end %><% if post.author %> by <%= post.author %><% end %><% if post.url %>&nbsp;<%= link_to "&raquo;", post.url %><% end %></div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<% end %> <% end %>
Expand Down
1 change: 1 addition & 0 deletions vendor/static_model
Submodule static_model added at 3b6596

0 comments on commit b387255

Please sign in to comment.