forked from xaviershay/enki
-
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.
Main changes: - Upgrade routes.rb (unused routes were not ported). - ApplicationController#config -> ApplicationController#enki_config (config is used by Rails 3). - Remove h() from views and helpers, as it is now included by default. Conversely, add raw() where needed. - Remove posts_path, formatted_posts_path, page_path from UrlHelper and use helpers created by routes instead. - Use <%= %> instead of deprecated <% %> for block-type helpers in views. - Change form_for(@object, object) to form_for(@object, :as => object) (former is deprecated). - Edit tag_list.rb in acts_as_taggable_on_steroids to not use returning (deprecated). - Pass specs (left with 5 failures).
- Loading branch information
1 parent
3f111df
commit bc0c319
Showing
84 changed files
with
341 additions
and
519 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--colour |
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 |
---|---|---|
@@ -1,25 +1,15 @@ | ||
# Filters added to this controller apply to all controllers in the application. | ||
# Likewise, all the methods added will be available for all controllers. | ||
|
||
class ApplicationController < ActionController::Base | ||
include ExceptionNotifiable | ||
|
||
helper :all # include all helpers, all the time | ||
|
||
protect_from_forgery | ||
after_filter :set_content_type | ||
|
||
# See ActionController::RequestForgeryProtection for details | ||
# Uncomment the :secret if you're not using the cookie session store | ||
# protect_from_forgery :secret => 'a6a9e417376364b61645d469f04ac8cf' | ||
|
||
protected | ||
|
||
def set_content_type | ||
headers['Content-Type'] ||= 'application/xhtml+xml; charset=utf-8' | ||
end | ||
|
||
def config | ||
@@config = Enki::Config.default | ||
def enki_config | ||
@@enki_config = Enki::Config.default | ||
end | ||
helper_method :config | ||
helper_method :enki_config | ||
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,6 +1,6 @@ | ||
module Admin::NavigationHelper | ||
def nav_link_to(text, url, options) | ||
options.merge!(:class => 'current') if url == request.request_uri | ||
options.merge!(:class => 'current') if url == request.fullpath | ||
link_to(text, url, options) | ||
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
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,5 +1,5 @@ | ||
module TagHelper | ||
def linked_tag_list(tags) | ||
tags.collect {|tag| link_to(h(tag.name), posts_path(:tag => tag))}.join(", ") | ||
raw tags.collect {|tag| link_to(tag.name, posts_path(:tag => tag.name))}.join(", ") | ||
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 |
---|---|---|
@@ -1,52 +1,20 @@ | ||
module UrlHelper | ||
def posts_path(options = {}) | ||
if options[:tag] | ||
options[:tag] = options[:tag].name if options[:tag].respond_to?(:name) | ||
options[:tag] = options[:tag].downcase | ||
posts_with_tag_path(options) | ||
else | ||
super | ||
end | ||
end | ||
|
||
def formatted_posts_path(options = {}) | ||
if options[:tag] | ||
options[:tag] = options[:tag].name if options[:tag].respond_to?(:name) | ||
options[:tag] = options[:tag].downcase | ||
formatted_posts_with_tag_path(options) | ||
else | ||
posts_path(options) | ||
end | ||
end | ||
|
||
def post_path(post, options = {}) | ||
suffix = options[:anchor] ? "##{options[:anchor]}" : "" | ||
path = post.published_at.strftime("/%Y/%m/%d/") + post.slug + suffix | ||
path = URI.join(config[:url], path) if options[:only_path] == false | ||
path.untaint | ||
path = URI.join(enki_config[:url], path) if options[:only_path] == false | ||
path | ||
end | ||
|
||
def post_comments_path(post) | ||
post_path(post) + "/comments" | ||
end | ||
|
||
def page_path(page) | ||
"/pages/#{page.slug}" | ||
end | ||
|
||
def author_link(comment) | ||
if comment.author_url.blank? | ||
h(comment.author) | ||
else | ||
link_to(h(comment.author), h(comment.author_url), :class => 'openid') | ||
end | ||
end | ||
|
||
def posts_atom_path(tag) | ||
if tag.blank? | ||
formatted_posts_path(:format => 'atom') | ||
comment.author | ||
else | ||
formatted_posts_with_tag_path(:tag => tag, :format => 'atom') | ||
link_to(comment.author, comment.author_url, :class => 'openid') | ||
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
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,13 +1,13 @@ | ||
<h1>Editing comment by <%=h @comment.author %></h1> | ||
<h1>Editing comment by <%= @comment.author %></h1> | ||
|
||
<% semantic_form_for([:admin, @comment]) do |form| -%> | ||
<% form.input_field_set do -%> | ||
<%= semantic_form_for([:admin, @comment]) do |form| -%> | ||
<%= form.input_field_set do -%> | ||
<%= form.input :author %> | ||
<%= form.input :author_url, :required => false %> | ||
<%= form.input :author_email, :required => false %> | ||
<%= form.input :body, :hint => "<a href='http://lesstile.rubyforge.org'>Lesstile enabled</a>." %> | ||
<% end %> | ||
<% form.button_field_set do -%> | ||
<%= form.button_field_set do -%> | ||
<%= form.commit_button("Save") %> | ||
<% 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
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,8 +1,8 @@ | ||
<h1>New page</h1> | ||
|
||
<% semantic_form_for([:admin, @page]) do |form| -%> | ||
<%= semantic_form_for([:admin, @page]) do |form| -%> | ||
<%= render :partial => 'form', :locals => {:form => form} %> | ||
<% form.button_field_set do -%> | ||
<%= form.button_field_set do -%> | ||
<%= form.commit_button("Save") -%> | ||
<% 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<h1>Editing page - <%= link_to(h(@page.title), page_path(@page)) %></h1> | ||
<h1>Editing page - <%= link_to(@page.title, page_path(@page.slug)) %></h1> | ||
|
||
<% semantic_form_for([:admin, @page]) do |form| -%> | ||
<%= semantic_form_for([:admin, @page]) do |form| -%> | ||
<%= render :partial => 'form', :locals => {:form => form} %> | ||
<% form.button_field_set do -%> | ||
<%= form.button_field_set do -%> | ||
<%= form.commit_button("Save") -%> | ||
<% 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
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,8 +1,8 @@ | ||
<h1>New post</h1> | ||
|
||
<% semantic_form_for([:admin, @post]) do |form| -%> | ||
<%= semantic_form_for([:admin, @post]) do |form| -%> | ||
<%= render :partial => 'form', :locals => {:form => form} -%> | ||
<% form.button_field_set do -%> | ||
<%= form.button_field_set do -%> | ||
<%= form.commit_button("Save") -%> | ||
<% end -%> | ||
<% end -%> |
Oops, something went wrong.