Further worked on achievements.Nearly done, just misses the standard checks in the user-model

This commit is contained in:
Philipp
2011-09-15 10:57:15 +10:00
parent 02135c659e
commit 193ce510d8
8 changed files with 38 additions and 9 deletions

View File

@@ -10,6 +10,10 @@ Reminder: When new search-indexes are defined on models please run
Reminder 2: You can monitor the resque-server on localhost:3000/resque (useful in killing leftover tasks)
Reminder 3: To load all standard achievements into the database run
rake db:seed OR rake db:setup (which also sets up the entire db)
= Usage
You need to have the following running to ensure that everything works:
@@ -18,7 +22,7 @@ You need to have the following running to ensure that everything works:
rake environment resque:work QUEUE=*
rake sunspot:solr:run OR rake sunspot:solr:start
rake sunspot:solr:run OR rake sunspot:solr:start (runs in background)
rails s(erver)

View File

@@ -36,8 +36,13 @@
<% end %>
<ul>
<% if current_user %>
<li class="dropdown">
<a href="#" class="dropdown-toggle"><%= current_user.name %></a>
<ul class="dropdown-menu">
<li><%= link_to("User's home", current_user)%></li>
<li><%= link_to("Sign out", '/signout') %></li>
</ul>
</li>
<% else %>
<li><%= link_to("Sign in", '/signin') %></li>
<% end %>

View File

@@ -13,6 +13,8 @@ Snpr::Application.routes.draw do
resources :snp_comments
resources :phenotype_comments
resources :search_results
resources :achievements
resources :user_achievements
match '/signup', :to => 'users#new'
match '/signin', :to => 'user_sessions#new', :as => :login

View File

@@ -8,6 +8,6 @@ class CreateUserAchievements < ActiveRecord::Migration
end
def self.down
drop_table :user_achievement
drop_table :user_achievements
end
end

View File

@@ -1,10 +1,12 @@
class CreateAchievements < ActiveRecord::Migration
def self.up
create_table :achievements do |p|
p.string :type # e.g. "has entered more than 25
p.string :award # e.g. "has entered more than 25
p.timestamps
end
end
def self.down
drop_table :achievements
end
end

View File

@@ -14,7 +14,9 @@
ActiveRecord::Schema.define(:version => 20110914151105) do
create_table "achievements", :force => true do |t|
t.string "type"
t.string "award"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "genotypes", :force => true do |t|
@@ -115,9 +117,9 @@ ActiveRecord::Schema.define(:version => 20110914151105) do
t.string "allele_frequency"
t.integer "ranking"
t.integer "number_of_users", :default => 0
t.datetime "mendeley_updated", :default => '2011-08-09 14:22:16'
t.datetime "plos_updated", :default => '2011-08-09 14:22:16'
t.datetime "snpedia_updated", :default => '2011-08-09 14:22:16'
t.datetime "mendeley_updated", :default => '2011-08-11 07:35:28'
t.datetime "plos_updated", :default => '2011-08-11 07:35:28'
t.datetime "snpedia_updated", :default => '2011-08-11 07:35:28'
t.datetime "created_at"
t.datetime "updated_at"
end

View File

@@ -6,4 +6,17 @@
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)
#
User.create(:name => "bla", :email => "abc@def.com", :password => "abc", :password_confirmation => "abc", :has_sequence => true)
#User.create(:name => "bla", :email => "abc@def.com", :password => "abc", :password_confirmation => "abc", :has_sequence => true)
if Achievement.all.length == 0
Achievement.create(:award => "Published genotyping")
Achievement.create(:award => "Published 10 Mio. SNPs")
Achievement.create(:award => "Entered variation on standard phenotypes")
Achievement.create(:award => "Entered 5 additional phenotypes")
Achievement.create(:award => "Entered 10 additional phenotypes")
Achievement.create(:award => "Entered 20 additional phenotypes")
Achievement.create(:award => "Entered 50 additional phenotypes")
Achievement.create(:award => "Entered 100 additional phenotypes")
Achievement.create(:award => "Created a new phenotype")
Achievement.create(:award => "Created 5 new phenotypes")
Achievement.create(:award => "Created 10 new phenotypes")
end

View File

@@ -3,9 +3,10 @@
$(document).ready(function()
{
$("#PaperMendeley").tablesorter({sortList: [[2,1]]});
$("#PaperPlos").tablesorter({sortList: [[2,1]]});
$("#snp_overview").tablesorter();
}
);
);