From 1c6badfb1095c01342809459290803fe0afaf1f8 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Fri, 16 Nov 2012 09:13:51 +0800 Subject: [PATCH] add more fake data --- app/assets/javascripts/orbitdesktop.js | 4 ---- db/seeds.rb | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 5a081dd85..321292a2f 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -956,17 +956,13 @@ var orbitDesktop = function(dom){ var abstractview = function(){ $("#journal_p div#paper_list div.overview").empty(); var column = $('
'), - counter = 1, li; $.each(journalData,function(i,journal){ $.each(journal.papers,function(j,paper){ li = $('
  • '+paper.title+'
    '+paper.abstract+'
  • '); column.find("ul").append(li); - if(counter%5==0){ $("#journal_p div#paper_list div.overview").append(column); column = $('
    '); - } - counter++; }) }) $("#journal_p div#paper_list div.overview").append(column); diff --git a/db/seeds.rb b/db/seeds.rb index 2561572cf..b53fb7b71 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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' FactoryGirl.define do @@ -18,10 +11,24 @@ FactoryGirl.define do 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 + + 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 #product 50 records +# 50.times.each do FactoryGirl.create(:paper_record) 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"})