forked from publify/publify
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Indie Web "Standards" use the term "note" for "status" as it is less linked to a particular silo and does not have the timely meanning. Comes with a migration to move statuses to notes. Should I add one to rebuild all the perma short links as well? Also fixes the push to Twitter that was broken.
- Loading branch information
Frédéric de Villamil
committed
Aug 25, 2013
1 parent
e8fdc91
commit 21fac3a
Showing
28 changed files
with
475 additions
and
425 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
module Admin; end | ||
|
||
class Admin::NotesController < Admin::ContentController | ||
layout "administration" | ||
|
||
def index; redirect_to :action => 'new' ; end | ||
def new; new_or_edit; end | ||
def edit; new_or_edit; end | ||
|
||
def destroy | ||
destroy_a(Note) | ||
end | ||
|
||
private | ||
def get_or_build_status | ||
id = params[:id] | ||
return Note.find(id) if id | ||
|
||
Note.new do |note| | ||
note.text_filter = current_user.default_text_filter | ||
note.published = true | ||
note.published_at = Time.now | ||
note.push_to_twitter = true | ||
end | ||
end | ||
|
||
def update_status_attributes | ||
@note.attributes = params[:note] | ||
@note.published_at = parse_date_time params[:note][:published_at] | ||
@note.set_author(current_user) | ||
@note.text_filter ||= current_user.default_text_filter | ||
end | ||
|
||
def new_or_edit | ||
@notes = Note.page(params[:page]).per(this_blog.limit_article_display) | ||
@note = get_or_build_status | ||
|
||
if request.post? | ||
update_status_attributes | ||
|
||
message = "created" | ||
if @note.id | ||
unless @note.access_by?(current_user) | ||
flash[:error] = _("Error, you are not allowed to perform this action") | ||
return(redirect_to :action => 'new') | ||
end | ||
|
||
message = "updated" | ||
end | ||
|
||
if @note.save | ||
flash[:notice] = _("Note was successfully %s.", message) | ||
if params[:note][:push_to_twitter] and params[:note][:push_to_twitter] != "0" and (@note.twitter_id.nil? or @note.twitter_id.empty?) | ||
unless @note.send_to_twitter | ||
flash[:notice] = nil | ||
flash[:error] = _("Oooops something wrong happened") | ||
end | ||
end | ||
redirect_to :action => 'new' | ||
end | ||
return | ||
end | ||
|
||
render 'new' | ||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
class NotesController < ContentController | ||
require 'json' | ||
|
||
layout :theme_layout | ||
cache_sweeper :blog_sweeper | ||
caches_page :index, :show, :if => Proc.new {|c| | ||
c.request.query_string == '' | ||
} | ||
|
||
def index | ||
@notes = Note.published.page(params[:page]).per(this_blog.limit_article_display) | ||
@keywords = this_blog.meta_keywords | ||
@page_title = this_blog.statuses_title_template.to_title(@notes, this_blog, params) | ||
@description = this_blog.statuses_desc_template.to_title(@notes, this_blog, params) | ||
end | ||
|
||
def show | ||
if @note = Note.published.find_by_permalink(CGI.escape(params[:permalink])) | ||
@keywords = this_blog.meta_keywords | ||
@page_title = this_blog.status_title_template.to_title(@note, this_blog, params) | ||
@description = this_blog.status_desc_template.to_title(@note, this_blog, params) | ||
@canonical_url = @note.permalink_url | ||
|
||
if @note.in_reply_to_message and !@note.in_reply_to_message.empty? | ||
@reply = JSON.parse(@note.in_reply_to_message) | ||
end | ||
|
||
else | ||
render "errors/404", :status => 404 | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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
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,18 @@ | ||
<div class='h-entry hentry h-as-note well well-small'> | ||
<% if @reply %> | ||
<%= render :partial => "note_reply_context", :object => @reply %> | ||
<% end %> | ||
|
||
<article class='status'> | ||
<%= author_picture note %> | ||
<div class='p-name entry-title e-content entry-content article'><%= note.html(:body) %></div> | ||
<footer> | ||
<small> | ||
<%= link_to_permalink(note, display_date_and_time(note.published_at)) %> | | ||
<%= link_to note.redirects.first.to_url, note.redirects.first.to_url %> | | ||
<%= author_link note %> | ||
<%= view_on_twitter note %> | ||
</small> | ||
</footer> | ||
</article> | ||
</div> |
File renamed without changes.
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 @@ | ||
<div class="hfeed"> | ||
<% for note in @notes -%> | ||
<div class='h-entry hentry h-as-note'> | ||
<article> | ||
<p class='p-name entry-title e-content entry-content article'><%= note.html(:body) %></p> | ||
<footer> | ||
<small><%= link_to_permalink(note, display_date_and_time(note.published_at)) %></small> | ||
</footer> | ||
</article> | ||
<hr /> | ||
</div> | ||
<% end -%> | ||
</div> | ||
|
||
<%= paginate @notes, :next_label => "#{_("Next page")} »", :previous_label => "« #{_('Previous page')}" %> |
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,3 @@ | ||
<div class="hfeed"> | ||
<%= render :partial => "note", :object => @note %> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.