Permalink
Browse files

Basic support of image uploading (works)

  • Loading branch information...
1 parent 1fa8810 commit 731c413bde908de57fe5fbcb15584557c73ea507 @jbbarth jbbarth committed Jan 31, 2009
Showing with 17 additions and 16 deletions.
  1. +1 −1 app/controllers/admin/images_controller.rb
  2. +1 −1 app/models/image.rb
  3. +3 −2 app/views/admin/images/index.html.erb
  4. +12 −12 db/schema.rb
@@ -1,7 +1,7 @@
class Admin::ImagesController < Admin::BaseController
def index
@sorter = SortingHelper::Sorter.new self, %w(filename), params[:sort], params[:order], 'filename', 'ASC'
- @images = Image.find(:all)
+ @images = Image.find(:all, :conditions => ['parent_id is null'])
end
def new
View
@@ -3,7 +3,7 @@ class Image < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 5.megabytes,
- :resize_to => '320x200>',
+ :resize_to => '740x400>',
:thumbnails => { :thumb => '100x100>' },
:path_prefix => 'public/assets'
@@ -1,7 +1,8 @@
<%= render :partial => 'admin/images/subnav', :locals => {:na => false} %>
<div id="header">
- <h1>Your images</h1>
+ <h1 class="skinny">Your images</h1>
+ <h2 class="fat">Right-click on an image and copy link location to use it in your posts or pages.</h2><br />
<% if flash[:notice] %><div class="green flash"><b>Success:</b> <%= flash[:notice] %></div><% end %>
</div>
@@ -19,7 +20,7 @@
<tr class="<%= cycle('alt_row ','') %><%= (f == 1 ? 'first_row' : '') %>">
<td class="first_col"><%= link_to image_tag(image.public_filename(:thumb)), image.public_filename %></td>
<td><%= link_to image.filename, image.public_filename %></td>
- <td><%= image.created_at %></td>
+ <td><%= image.created_at.strftime('%d %b, %Y') %></td>
<td class="del_col"><%= link_to 'X', Site.full_url + '/admin/images/destroy/' + image.id.to_s, :confirm => "You are about to delete this image. This is permanent.\n\nAre you ABSOLUTELY sure?" %></td>
</tr>
<% f += 1 -%>
View
@@ -11,18 +11,6 @@
ActiveRecord::Schema.define(:version => 30) do
- create_table "images", :force => true do |t|
- t.integer "parent_id"
- t.string "content_type"
- t.string "filename"
- t.string "thumbnail"
- t.integer "size"
- t.integer "width"
- t.integer "height"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
create_table "authors", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "modified_at", :null => false
@@ -54,6 +42,18 @@
t.datetime "modified_at", :null => false
end
+ create_table "images", :force => true do |t|
+ t.integer "parent_id"
+ t.string "content_type"
+ t.string "filename"
+ t.string "thumbnail"
+ t.integer "size"
+ t.integer "width"
+ t.integer "height"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "pages", :force => true do |t|
t.string "permalink", :limit => 128
t.text "body_raw"

0 comments on commit 731c413

Please sign in to comment.