Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Basic support of image uploading (works)
  • Loading branch information
jbbarth committed Jan 31, 2009
1 parent 1fa8810 commit 731c413
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/images_controller.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
Expand Down
2 changes: 1 addition & 1 deletion app/models/image.rb
Expand Up @@ -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'

Expand Down
5 changes: 3 additions & 2 deletions app/views/admin/images/index.html.erb
@@ -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>

Expand All @@ -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 -%>
Expand Down
24 changes: 12 additions & 12 deletions db/schema.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 731c413

Please sign in to comment.