add more fake data

This commit is contained in:
Rueshyna 2012-11-16 09:13:51 +08:00 committed by chris
parent b6004958c9
commit 1c6badfb10
2 changed files with 14 additions and 11 deletions

View File

@ -956,17 +956,13 @@ var orbitDesktop = function(dom){
var abstractview = function(){ var abstractview = function(){
$("#journal_p div#paper_list div.overview").empty(); $("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'), var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li; li;
$.each(journalData,function(i,journal){ $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div></li>'); li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div></li>');
column.find("ul").append(li); column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
}) })
}) })
$("#journal_p div#paper_list div.overview").append(column); $("#journal_p div#paper_list div.overview").append(column);

View File

@ -1,10 +1,3 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)
require 'factory_girl' require 'factory_girl'
FactoryGirl.define do FactoryGirl.define do
@ -18,10 +11,24 @@ FactoryGirl.define do
f.create_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account f.create_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
f.update_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account f.update_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
end end
factory :custom_record, class: "WritingJournal" do |f|
f.sequence(:paper_title_translations) {|n|{zh_tw: "tw_test #{n}", en: "en_test #{n}" }}
f.sequence(:keywords) {|n| "keywords #{n}"}
f.sequence(:abstract) {|n| "abstract #{n}"}
f.sequence(:isbn) {|n| "0714312#{n}#{n}#{n}"}
f.sequence(:year) {|n| "201#{n}"}
f.create_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
f.update_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
end
end end
#product 50 records #product 50 records
#
50.times.each do 50.times.each do
FactoryGirl.create(:paper_record) FactoryGirl.create(:paper_record)
end end
FactoryGirl.create(:custom_record, journal_title_translations: {zh_tw: "tw_test A", en: "en_test A"})
FactoryGirl.create(:custom_record, journal_title_translations: {zh_tw: "tw_test B", en: "en_test B"})