Skip to content

Commit

Permalink
agility: add image to user
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlarsen committed Sep 27, 2012
1 parent fe9c345 commit 223110a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
2 changes: 2 additions & 0 deletions integration_tests/agility/Gemfile
Expand Up @@ -82,3 +82,5 @@ gem "hobo_simple_color", :git => "git://github.com/Hobo/hobo_simple_color"
gem "hobo_tokeninput", :git => "git://github.com/Hobo/hobo_tokeninput"

# gem 'dryml-firemarker', :require => 'dryml13-firemarker', :group => :development, :path => '/work/dryml-firemarker'

# gem "quiet_assets"
2 changes: 2 additions & 0 deletions integration_tests/agility/app/models/user.rb
Expand Up @@ -17,6 +17,8 @@ class User < ActiveRecord::Base
has_many :project_memberships, :dependent => :destroy
has_many :joined_projects, :through => :project_memberships, :source => :project

has_attached_file :avatar

# This gives admin rights and an :active state to the first sign-up.
# Just remove it if you don't want that
before_create do |user|
Expand Down
13 changes: 13 additions & 0 deletions integration_tests/agility/app/views/taglibs/application.dryml
Expand Up @@ -130,3 +130,16 @@
</body:>
</card>
</def>

<extend tag="form" for="User">
<old-form merge multipart>
<field-list: fields="name, email_address, administrator, avatar">
<avatar-view:>
<if test="&this.exists?">
<img src="#{this.url}"/>
</if>
<input/>
</avatar-view:>
</field-list:>
</old-form>
</extend>
7 changes: 7 additions & 0 deletions integration_tests/agility/app/views/users/edit.dryml
@@ -0,0 +1,7 @@
<edit-page>
<form: replace>
<do part="form">
<form ajax/>
</do>
</form:>
</edit-page>
@@ -0,0 +1,15 @@
class AddAvatarToUser < ActiveRecord::Migration
def self.up
add_column :users, :avatar_file_name, :string
add_column :users, :avatar_content_type, :string
add_column :users, :avatar_file_size, :integer
add_column :users, :avatar_updated_at, :datetime
end

def self.down
remove_column :users, :avatar_file_name
remove_column :users, :avatar_content_type
remove_column :users, :avatar_file_size
remove_column :users, :avatar_updated_at
end
end
6 changes: 5 additions & 1 deletion integration_tests/agility/db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120922204625) do
ActiveRecord::Schema.define(:version => 20120926163657) do

create_table "bars", :force => true do |t|
t.string "name"
Expand Down Expand Up @@ -143,6 +143,10 @@
t.datetime "updated_at"
t.string "state", :default => "inactive"
t.datetime "key_timestamp"
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
end

add_index "users", ["state"], :name => "index_users_on_state"
Expand Down

0 comments on commit 223110a

Please sign in to comment.