Skip to content

Commit

Permalink
add rails_admin.
Browse files Browse the repository at this point in the history
  • Loading branch information
sakomoko committed Dec 31, 2012
1 parent 9af412f commit 5bb6313
Show file tree
Hide file tree
Showing 8 changed files with 1,022 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Expand Up @@ -20,6 +20,8 @@ end


gem 'jquery-rails' gem 'jquery-rails'


gem 'rails_admin'

# Use unicorn as the web server # Use unicorn as the web server
# gem 'unicorn' # gem 'unicorn'


Expand Down
31 changes: 31 additions & 0 deletions Gemfile.lock
Expand Up @@ -31,6 +31,8 @@ GEM
addressable (2.3.2) addressable (2.3.2)
arel (3.0.2) arel (3.0.2)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
bootstrap-sass (2.2.2.0)
sass (~> 3.2)
builder (3.0.4) builder (3.0.4)
capybara (2.0.1) capybara (2.0.1)
mime-types (>= 1.16) mime-types (>= 1.16)
Expand Down Expand Up @@ -67,6 +69,9 @@ GEM
factory_girl (~> 4.1.0) factory_girl (~> 4.1.0)
railties (>= 3.0.0) railties (>= 3.0.0)
ffi (1.2.0) ffi (1.2.0)
font-awesome-sass-rails (2.0.0.0)
railties (>= 3.1.1)
sass-rails (>= 3.1.1)
growl (1.0.3) growl (1.0.3)
guard (1.6.1) guard (1.6.1)
listen (>= 0.6.0) listen (>= 0.6.0)
Expand All @@ -92,7 +97,13 @@ GEM
jquery-rails (2.1.4) jquery-rails (2.1.4)
railties (>= 3.0, < 5.0) railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-ui-rails (2.0.2)
jquery-rails
railties (>= 3.1.0)
json (1.7.6) json (1.7.6)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
libwebsocket (0.1.7.1) libwebsocket (0.1.7.1)
addressable addressable
websocket websocket
Expand All @@ -119,6 +130,7 @@ GEM
multi_json (1.5.0) multi_json (1.5.0)
named_let (0.1.3) named_let (0.1.3)
rspec-core rspec-core
nested_form (0.3.1)
nokogiri (1.5.6) nokogiri (1.5.6)
origin (1.0.11) origin (1.0.11)
orm_adapter (0.4.0) orm_adapter (0.4.0)
Expand All @@ -130,6 +142,9 @@ GEM
rack (1.4.1) rack (1.4.1)
rack-cache (1.2) rack-cache (1.2)
rack (>= 0.4) rack (>= 0.4)
rack-pjax (0.6.0)
nokogiri (~> 1.5)
rack (~> 1.3)
rack-ssl (1.3.2) rack-ssl (1.3.2)
rack rack
rack-test (0.6.2) rack-test (0.6.2)
Expand All @@ -142,6 +157,20 @@ GEM
activesupport (= 3.2.9) activesupport (= 3.2.9)
bundler (~> 1.0) bundler (~> 1.0)
railties (= 3.2.9) railties (= 3.2.9)
rails_admin (0.3.0)
bootstrap-sass (~> 2.1)
builder (~> 3.0)
coffee-rails (~> 3.1)
font-awesome-sass-rails (~> 2.0)
haml (~> 3.1)
jquery-rails (~> 2.1)
jquery-ui-rails (~> 2.0)
kaminari (~> 0.14)
nested_form (> 0.2.3, < 0.4.0)
rack-pjax (~> 0.6)
rails (~> 3.1)
remotipart (~> 1.0)
sass-rails (~> 3.1)
railties (3.2.9) railties (3.2.9)
actionpack (= 3.2.9) actionpack (= 3.2.9)
activesupport (= 3.2.9) activesupport (= 3.2.9)
Expand All @@ -153,6 +182,7 @@ GEM
rb-fsevent (0.9.2) rb-fsevent (0.9.2)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
remotipart (1.0.2)
rspec (2.12.0) rspec (2.12.0)
rspec-core (~> 2.12.0) rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0) rspec-expectations (~> 2.12.0)
Expand Down Expand Up @@ -229,6 +259,7 @@ DEPENDENCIES
mongoid-tree mongoid-tree
named_let named_let
rails (~> 3.2) rails (~> 3.2)
rails_admin
rb-fsevent rb-fsevent
rspec-rails rspec-rails
sass-rails (~> 3.2) sass-rails (~> 3.2)
Expand Down
3 changes: 3 additions & 0 deletions app/models/character.rb
Expand Up @@ -11,6 +11,7 @@ class Character
before_create :set_default_documents before_create :set_default_documents


embeds_one :candy embeds_one :candy

embeds_one :equip embeds_one :equip
embeds_one :position embeds_one :position
embeds_many :assigned_skills embeds_many :assigned_skills
Expand Down Expand Up @@ -100,6 +101,8 @@ def remove(item, num = 1)
validates_presence_of :name validates_presence_of :name
validates_uniqueness_of :name, :case_sensitive => true validates_uniqueness_of :name, :case_sensitive => true


accepts_nested_attributes_for :candy, :equip, :position, :assigned_skills, :belongings

def action=(action) def action=(action)
if action.instance_of? Skill if action.instance_of? Skill
unless self.assigned_skills.where(skill_id: action.id).first unless self.assigned_skills.where(skill_id: action.id).first
Expand Down
15 changes: 8 additions & 7 deletions app/models/equip.rb
Expand Up @@ -9,13 +9,14 @@ class Equip
belongs_to :boots, class_name: 'Belonging' belongs_to :boots, class_name: 'Belonging'
belongs_to :accessory, class_name: 'Belonging' belongs_to :accessory, class_name: 'Belonging'
belongs_to :arrow, class_name: 'Belonging' belongs_to :arrow, class_name: 'Belonging'
end


def each def each
@equips ||= [:weapon, :shield, :head, :armor, :groob, :boots, :accessory, :arrow] @equips ||= [:weapon, :shield, :head, :armor, :groob, :boots, :accessory, :arrow]
@equips.each do |key| @equips.each do |key|
result = self.send key result = self.send key
next unless result next unless result
yield key, self.send(key) yield key, self.send(key)
end
end end
end end

2 changes: 2 additions & 0 deletions app/models/skill.rb
Expand Up @@ -8,6 +8,8 @@ class Skill
embeds_one :status_adjustment embeds_one :status_adjustment
embeds_one :status_coefficient embeds_one :status_coefficient


accepts_nested_attributes_for :status_adjustment, :status_coefficient

belongs_to :system_message, index: true belongs_to :system_message, index: true


field :name, :type => String field :name, :type => String
Expand Down
Empty file.

0 comments on commit 5bb6313

Please sign in to comment.