Commit fbab24c8
Changed files (5)
app
app/models/creation.rb
@@ -2,7 +2,7 @@ class Creation < ActiveRecord::Base
acts_as_commentable
validates :name, :presence => true
validates :image, :presence => true
- attr_accessible :user_id, :story, :name, :image, :remote_image_url, :category_ids, :is_restricted, :caption
+ attr_accessible :user_id, :story, :name, :image, :remote_image_url, :category_ids, :is_restricted, :watermark
belongs_to :user
has_and_belongs_to_many :categories, :join_table => 'creations_categories', :uniq => true, :autosave => true
has_many :photos, :dependent => :destroy
app/uploaders/image_uploader.rb
@@ -32,8 +32,6 @@ class ImageUploader < CarrierWave::Uploader::Base
end
def watermark
- Rails.logger.info "watermarking..."
- Rails.logger.info "name is #{model.name} caption is #{model.caption}"
manipulate! do |image|
gc = Magick::Draw.new
gc.gravity = Magick::SouthEastGravity
@@ -42,7 +40,7 @@ class ImageUploader < CarrierWave::Uploader::Base
gc.font_weight = Magick::BoldWeight
gc.stroke = 'none'
mark = Magick::Image.new(image.columns, image.rows)
- gc.annotate(mark, 0, 0, 25, 25, "#{model.caption}\non CakeSide.com")
+ gc.annotate(mark, 0, 0, 25, 25, "#{model.watermark}\non CakeSide.com")
mark = mark.shade(true, 310, 30)
image.composite!(mark, Magick::SouthEastGravity, Magick::HardLightCompositeOp)
end
app/views/creations/_form.html.erb
@@ -7,9 +7,9 @@
</div>
</div>
<div class="control-group">
- <%= f.label :caption, "Image Watermark", :class => "control-label" %>
+ <%= f.label :watermark, "Image Watermark", :class => "control-label" %>
<div class="controls">
- <%= f.text_field :caption, :class => "input-xlarge", :maxlength=> 20 %>
+ <%= f.text_field :watermark, :class => "input-xlarge", :maxlength=> 20 %>
</div>
</div>
<div class="control-group">
db/migrate/20120825152140_rename_caption_to_watermark.rb
@@ -0,0 +1,7 @@
+class RenameCaptionToWatermark < ActiveRecord::Migration
+ def change
+ change_table :creations do |t|
+ t.rename :caption, :watermark
+ end
+ end
+end
db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120821131902) do
+ActiveRecord::Schema.define(:version => 20120825152140) do
create_table "active_admin_comments", :force => true do |t|
t.integer "resource_id", :null => false
@@ -29,18 +29,18 @@ ActiveRecord::Schema.define(:version => 20120821131902) do
add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
create_table "admin_users", :force => true do |t|
- t.string "email", :default => "", :null => false
- t.string "encrypted_password", :default => "", :null => false
+ t.string "email", :default => "", :null => false
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
- t.integer "sign_in_count", :default => 0
+ t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
@@ -85,7 +85,7 @@ ActiveRecord::Schema.define(:version => 20120821131902) do
t.integer "user_id"
t.string "image"
t.boolean "is_restricted", :default => false, :null => false
- t.string "caption"
+ t.string "watermark"
end
create_table "creations_categories", :id => false, :force => true do |t|
@@ -114,18 +114,18 @@ ActiveRecord::Schema.define(:version => 20120821131902) do
end
create_table "users", :force => true do |t|
- t.string "email", :default => "", :null => false
- t.string "encrypted_password", :default => "", :null => false
+ t.string "email", :default => "", :null => false
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
- t.integer "sign_in_count", :default => 0
+ t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "name"
t.string "website"
t.string "twitter"