Difference between revisions of "Typo"
From Wiki2
Line 1: | Line 1: | ||
====typo==== | ====typo==== | ||
What I know so far | What I know so far | ||
from /config/routes.rb - admin/(things in w are admin controllers) ex: /admin/content sends you to admin/content_controller.rb | from /config/routes.rb - admin/(things in w are admin controllers) ex: /admin/content sends you to admin/content_controller.rb | ||
Line 27: | Line 27: | ||
@article = Article.get_or_build_article(id) | @article = Article.get_or_build_article(id) | ||
@article.text_filter = current_user.text_filter if current_user.simple_editor? | @article.text_filter = current_user.text_filter if current_user.simple_editor? | ||
... | |||
@article.keywords = Tag.collection_to_string @article.tags | @article.keywords = Tag.collection_to_string @article.tags | ||
@article.attributes = params[:article] | @article.attributes = params[:article] | ||
@article.published_at = DateTime.strptime(params[:article][:published_at], "%B %e, %Y %I:%M %p GMT%z").utc rescue | |||
@article.published_at = DateTime.strptime(params[:article][:published_at], "%B %e, %Y %I:%M %p GMT%z").utc rescue | |||
render 'new' | render 'new' | ||
end | end | ||
render 'new' takes you to /view/admin/content/new.html.erb | |||
<% @page_heading = _('New article') %> | |||
<%= render "admin/shared/edit", { :form_type => "article", :form_action => { :action => "new", :id => @article.id , :class => ('autosave')} } %> | |||
which sends you to views/shared/_edit.html .erb |
Revision as of 13:59, 28 August 2013
typo
What I know so far
from /config/routes.rb - admin/(things in w are admin controllers) ex: /admin/content sends you to admin/content_controller.rb
# Admin/XController %w{advanced cache categories comments content profiles feedback general pages resources sidebar textfilters themes trackbacks users settings tags redirects seo post_types }.each do |i| match "/admin/#{i}", :to => "admin/#{i}#index", :format => false match "/admin/#{i}(/:action(/:id))", :to => "admin/#{i}", :action => nil, :id => nil, :format => false end
so http://salty-castle-8378.herokuapp.com/admin/content/edit/1 takes you to
def edit @article = Article.find(params[:id]) unless @article.access_by? current_user redirect_to :action => 'index' flash[:error] = _("Error, you are not allowed to perform this action") return end new_or_edit end
def new_or_edit id = params[:id] id = params[:article][:id] if params[:article] && params[:article][:id] @article = Article.get_or_build_article(id) @article.text_filter = current_user.text_filter if current_user.simple_editor? ... @article.keywords = Tag.collection_to_string @article.tags @article.attributes = params[:article] @article.published_at = DateTime.strptime(params[:article][:published_at], "%B %e, %Y %I:%M %p GMT%z").utc rescue render 'new' end
render 'new' takes you to /view/admin/content/new.html.erb
<% @page_heading = _('New article') %> <%= render "admin/shared/edit", { :form_type => "article", :form_action => { :action => "new", :id => @article.id , :class => ('autosave')} } %>
which sends you to views/shared/_edit.html .erb