forked from diaspora/diaspora-project-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dennis Schubert
committed
Aug 26, 2013
1 parent
67d443f
commit 873ecc4
Showing
12 changed files
with
101 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.blogcontent { | ||
width: 75%; | ||
margin: 50px auto 0; | ||
|
||
h1, h2, h3 { | ||
text-align: left; | ||
color: rgb(64, 64, 64); | ||
} | ||
|
||
h1 { | ||
font-size: 24px; | ||
|
||
small { | ||
display: block; | ||
float: right; | ||
margin-top: 10px; | ||
} | ||
} | ||
|
||
h2 { | ||
margin: 35px 0 15px 0; | ||
} | ||
|
||
li { | ||
color: rgb(64, 64, 64); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
class BlogController < ApplicationController | ||
respond_to :html | ||
respond_to :html, :except => [:feed] | ||
respond_to :atom, :only => [:feed] | ||
|
||
def show | ||
@blogpost = Blogpost.find_by_id params[:id] | ||
end | ||
|
||
def index | ||
@blogposts = Blogpost.where(:published => true).order(:created_at => :desc) | ||
end | ||
|
||
def create | ||
Blog.create person_params | ||
end | ||
|
||
def update | ||
blog = Blog.find params[:id] | ||
blog.update_attributes! person_params | ||
redirect_to blog | ||
end | ||
|
||
private | ||
|
||
def blog_params | ||
params.require(:blog).permit :title, :published, :content | ||
def feed | ||
@blogposts = Blogpost.where(:published => true).order(:created_at => :desc).limit 5 | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class Blogpost < ActiveRecord::Base | ||
def to_param | ||
"#{self.id}-#{self.title}".parameterize | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
atom_feed do |feed| | ||
feed.title(t 'pages.blog.headline') | ||
feed.updated(@blogposts.first.updated_at) | ||
|
||
for blogpost in @blogposts | ||
feed.entry(blogpost, :url => blog_url(blogpost)) do |entry| | ||
entry.title(blogpost.title) | ||
|
||
entry.author do |author| | ||
author.name('Diaspora* Foundation') | ||
end | ||
|
||
entry.content(markdownify(blogpost.content), :type => 'html') | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<%- content_for :page_title do %> | ||
<%= @blogpost.title %> | ||
<% end %> | ||
|
||
<div class="page-header"> | ||
<h1><%= t 'pages.blog.headline' %> <small><%= t 'pages.blog.subline' %></small></h1> | ||
</div> | ||
|
||
<div class="blogcontent"> | ||
<div class="page-header clearfix"> | ||
<h1><%= @blogpost.title %> <small><%= l @blogpost.created_at, format: :blog_headline %></small></h1> | ||
</div> | ||
|
||
<%= markdownify @blogpost.content %> | ||
</div> |
This file contains 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
This file contains 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
This file contains 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