merit 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +103 -0
- data/README.markdown +17 -2
- data/app/models/badge.rb +27 -19
- data/app/models/merit_action.rb +5 -3
- data/app/models/sash.rb +5 -14
- data/lib/generators/active_record/merit_generator.rb +14 -14
- data/lib/generators/{merit → active_record}/templates/create_badges_sashes.rb +0 -0
- data/lib/generators/{merit → active_record}/templates/create_merit_actions.rb +0 -0
- data/lib/generators/{merit → active_record}/templates/create_sashes.rb +0 -0
- data/lib/generators/merit/install_generator.rb +3 -20
- data/lib/generators/merit/merit_generator.rb +12 -0
- data/lib/generators/merit/templates/merit.rb +10 -1
- data/lib/merit.rb +11 -2
- data/lib/merit/controller_extensions.rb +2 -2
- data/lib/merit/model_additions.rb +18 -17
- data/lib/merit/models/active_record/badges_sash.rb +12 -0
- data/lib/merit/models/active_record/merit_action.rb +2 -0
- data/lib/merit/models/active_record/sash.rb +12 -0
- data/lib/merit/models/mongo_mapper/merit_action.rb +12 -0
- data/lib/merit/models/mongo_mapper/sash.rb +15 -0
- data/lib/merit/rule.rb +2 -2
- data/lib/merit/rules_badge.rb +1 -1
- data/merit.gemspec +16 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +7 -0
- data/test/dummy/app/controllers/comments_controller.rb +90 -0
- data/test/dummy/app/controllers/registrations_controller.rb +15 -0
- data/test/dummy/app/controllers/users_controller.rb +67 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/comment.rb +4 -0
- data/test/dummy/app/models/merit_badge_rules.rb +41 -0
- data/test/dummy/app/models/merit_point_rules.rb +18 -0
- data/test/dummy/app/models/merit_rank_rules.rb +25 -0
- data/test/dummy/app/models/user.rb +9 -0
- data/test/dummy/app/views/comments/_form.html.erb +29 -0
- data/test/dummy/app/views/comments/edit.html.erb +6 -0
- data/test/dummy/app/views/comments/index.html.erb +35 -0
- data/test/dummy/app/views/comments/new.html.erb +5 -0
- data/test/dummy/app/views/comments/show.html.erb +23 -0
- data/test/dummy/app/views/layouts/application.html.haml +18 -0
- data/test/dummy/app/views/users/_form.html.erb +22 -0
- data/test/dummy/app/views/users/edit.html.erb +6 -0
- data/test/dummy/app/views/users/index.html.erb +26 -0
- data/test/dummy/app/views/users/new.html.erb +5 -0
- data/test/dummy/app/views/users/show.html.erb +18 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/badges_data.rb +40 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +9 -0
- data/test/dummy/db/migrate/20110421191249_create_users.rb +12 -0
- data/test/dummy/db/migrate/20110421191250_create_comments.rb +16 -0
- data/test/dummy/db/schema.rb +61 -0
- data/test/dummy/db/seeds.rb +17 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/controls.js +965 -0
- data/test/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/dummy/public/javascripts/effects.js +1123 -0
- data/test/dummy/public/javascripts/prototype.js +6001 -0
- data/test/dummy/public/javascripts/rails.js +191 -0
- data/test/dummy/public/stylesheets/.gitkeep +0 -0
- data/test/dummy/public/stylesheets/scaffold.css +56 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/navigation_test.rb +132 -0
- data/test/merit_unit_test.rb +22 -0
- data/test/support/integration_case.rb +5 -0
- data/test/test_helper.rb +22 -0
- metadata +132 -13
- data/app/models/badges_sash.rb +0 -14
- data/lib/generators/merit/templates/create_badges.rb +0 -19
data/app/models/badges_sash.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
class BadgesSash < ActiveRecord::Base
|
2
|
-
belongs_to :badge
|
3
|
-
belongs_to :sash
|
4
|
-
|
5
|
-
# TODO: Better way to do it? With composite keys ARel complained:
|
6
|
-
# NoMethodError: undefined method `eq' for nil:NilClass
|
7
|
-
# from ~/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.9/lib/active_support/whiny_nil.rb:48:in `method_missing'
|
8
|
-
# from ~/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.9/lib/active_record/persistence.rb:259:in `update'
|
9
|
-
def set_notified!(badge, sash)
|
10
|
-
ActiveRecord::Base.connection.execute("UPDATE badges_sashes
|
11
|
-
SET notified_user = TRUE
|
12
|
-
WHERE badge_id = #{badge.id} AND sash_id = #{sash.id}")
|
13
|
-
end
|
14
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class CreateBadges < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :badges do |t|
|
4
|
-
t.string :name
|
5
|
-
t.string :level
|
6
|
-
t.string :image
|
7
|
-
t.string :description
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
|
11
|
-
# First badges:
|
12
|
-
# Badge.create( :name => 'just-registered' )
|
13
|
-
# Badge.create( :name => 'creator', :level => 'inspired', :image => 'http://upload.wikimedia.org/wikipedia/commons/9/94/Luca_prodan.jpg' )
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.down
|
17
|
-
drop_table :badges
|
18
|
-
end
|
19
|
-
end
|