Permalink
Browse files

picture captions no longer show as editable on non-admin pages

  • Loading branch information...
1 parent 0929f6a commit a025aa374127bd73db0eba88dd435123474c6c90 @nakajima nakajima committed Feb 3, 2009
@@ -12,9 +12,7 @@ def index
@posts = post_repo.paginate_index(:page => params[:page])
respond_to do |format|
- format.html # index.html.erb
- format.rss { render :action => 'index.rss.builder' }
- format.xml { render :xml => @posts }
+ format.html { render :template => 'admin/posts/index.html.erb' }
end
end
@@ -25,7 +23,7 @@ def show
redirect_to admin_posts_path and return unless @post.type.match(/Article|Snippet/)
@comment = flash[:comment] || @post.comments.build
respond_to do |format|
- format.html # show.html.erb
+ format.html { render :template => 'admin/posts/show.html.erb' }
format.xml { render :xml => @post }
end
end
@@ -51,9 +51,8 @@ def edit_in_place_for(resource, field, options={})
record = resource.is_a?(Array) ? resource.last : resource
options[:id] ||= "#{dom_id(record)}_#{field}"
+ options[:url] ||= options[:rel] = polymorphic_path(resource)
options[:tag] ||= :div
- options[:url] ||= url_for(resource)
- options[:rel] = options.delete(:url)
classes = options[:class].try(:split, ' ') || []
classes << 'editable'
View
@@ -31,7 +31,7 @@ def type
end
def to_param
- permalink
+ from_feed? ? id.to_s : permalink
end
def delete!
@@ -4,7 +4,7 @@
</div>
<%= image_tag post.permalink %>
<% if post.header -%>
-<%= edit_in_place_for post, :header, :tag => :small, :url => "/posts/#{post.id}", :id => "post_#{post.id}_header" %>
+<%= edit_in_place_for [:admin, post], :header, :tag => :small, :id => "#{dom_id(post)}_header" %>
<% end -%>
<cite>
&#x2010; Posted from <%= link_to 'flickr', post.cite %>
@@ -3,9 +3,7 @@
<span class="day"><%= post.created_at.strftime('%e') -%></span>
</div>
<%= image_tag post.permalink %>
-<% if post.header -%>
-<%= edit_in_place_for post, :header, :tag => :small, :url => "/posts/#{post.id}", :id => "post_#{post.id}_header" %>
-<% end -%>
+<small><%= post.header %></small>
<cite>
&#x2010; Posted from <%= link_to 'flickr', post.cite %>
</cite>
View
@@ -14,12 +14,12 @@
map.namespace(:admin) do |admin|
admin.root :controller => 'posts'
admin.resources :posts
- admin.resources :articles, :controller => 'posts', :has_many => :comments
- admin.resources :quotes, :controller => 'posts'
- admin.resources :pictures, :controller => 'posts'
- admin.resources :tweets, :controller => 'posts'
- admin.resources :links, :controller => 'posts'
- admin.resources :snippets, :controller => 'posts', :has_many => :comments
+ admin.resources :articles, :has_many => :comments
+ admin.resources :quotes
+ admin.resources :pictures
+ admin.resources :tweets
+ admin.resources :links
+ admin.resources :snippets, :has_many => :comments
admin.resources :comments, :member => { :report => :put }
end
@@ -33,7 +33,8 @@ Event.observe(document, 'dom:loaded', function() {
parseField: function() {
var params = new Array; var values = new Array;
- var levels = this.element.readAttribute('rel').replace(/(http:|https:|file:)\/\/[^\/]+/, '').split('/').without('');
+ var levels = this.element.readAttribute('rel').replace(/admin/, '');
+ levels = levels.replace(/(http:|https:|file:)\/\/[^\/]+/, '').split('/').without('');
levels.each(function(level, i) {
if ( i % 2 == 0 ) { params.push(level.gsub(/s$/, '')) }
else { values.push(level); }

0 comments on commit a025aa3

Please sign in to comment.