Reorganize and consolidate templates (#558)

* add map and images seeds

* add faker for faking and pry for debuggging

* Remove will-paginate-bootstrap

It is no longer maintained
Center pagination bar
Add will-paginate-bootstrap4

* add hidden overflow
This commit is contained in:
Cess
2019-05-15 16:44:27 +03:00
committed by Jeffrey Warren
parent 40dae2dacd
commit 1ba35931e4
9 changed files with 67 additions and 23 deletions

View File

@@ -1,7 +1,38 @@
# 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: 'Emanuel', city: cities.first)
# Fake maps
users = User.all
p 'Now faking Maps....'
maps = []
30.times do
map = Map.new(
name: Faker::Address.city,
lat: Faker::Address.latitude,
lon: Faker::Address.longitude,
location: Faker::Address.country,
description: Faker::Lorem.sentence,
slug: Faker::Lorem.word
)
map.user = (users.sample)
map.author = map.user.login
map.save
maps. << map
end
p 'Done faking maps...'
# Fake maps images
p 'Adding Warbaples to maps'
maps.each do |map|
image = map.warpables.new
image.id = Faker::Number.unique.between(10, 100)
image.history = Faker::Lorem.word
image.image_file_name = 'demo.png'
image.width = 500
image.nodes = '1,3,4,5'
system("mkdir -p public/system/images/#{image.id}/original")
system("cp test/fixtures/demo.png public/system/images/#{image.id}/original/demo.png")
image.image_content_type = 'image/png'
image.save
end
p 'Done adding images to maps'