mirror of
https://github.com/publiclab/mapknitter.git
synced 2025-12-11 18:59:59 +01:00
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:
4
Gemfile
4
Gemfile
@@ -6,7 +6,7 @@ gem 'rake', '~> 12.3.2'
|
||||
gem 'skylight'
|
||||
|
||||
gem "will_paginate", "3.1.7"
|
||||
gem "will_paginate-bootstrap"
|
||||
gem 'will_paginate-bootstrap4'
|
||||
gem "friendly_id"
|
||||
gem 'popper_js', '~> 1.11', '>= 1.11.1'
|
||||
|
||||
@@ -47,6 +47,8 @@ end
|
||||
|
||||
group :development, :test do
|
||||
gem "byebug"
|
||||
gem 'faker'
|
||||
gem 'pry-rails'
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
||||
17
Gemfile.lock
17
Gemfile.lock
@@ -44,10 +44,13 @@ GEM
|
||||
climate_control (0.2.0)
|
||||
cocaine (0.5.8)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.1.2)
|
||||
concurrent-ruby (1.1.5)
|
||||
docile (1.3.1)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
faker (1.9.3)
|
||||
i18n (>= 0.7)
|
||||
ffi (1.10.0)
|
||||
friendly_id (4.0.10.1)
|
||||
activerecord (>= 3.0, < 4.0)
|
||||
@@ -71,6 +74,7 @@ GEM
|
||||
mail (2.5.5)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
method_source (0.9.2)
|
||||
mime-types (1.25.1)
|
||||
mimemagic (0.3.0)
|
||||
mini_portile2 (2.4.0)
|
||||
@@ -98,6 +102,11 @@ GEM
|
||||
polyglot (0.3.5)
|
||||
popper_js (1.14.5)
|
||||
power_assert (1.1.4)
|
||||
pry (0.12.2)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
pry-rails (0.3.9)
|
||||
pry (>= 0.10.4)
|
||||
rack (1.4.7)
|
||||
rack-cache (1.9.0)
|
||||
rack (>= 0.4)
|
||||
@@ -174,8 +183,8 @@ GEM
|
||||
execjs (>= 0.3.0, < 3)
|
||||
uuidtools (2.1.5)
|
||||
will_paginate (3.1.7)
|
||||
will_paginate-bootstrap (1.0.2)
|
||||
will_paginate (>= 3.0.3)
|
||||
will_paginate-bootstrap4 (0.2.2)
|
||||
will_paginate (~> 3.0, >= 3.0.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -185,6 +194,7 @@ DEPENDENCIES
|
||||
autoprefixer-rails
|
||||
aws-sdk (~> 1.5.7)
|
||||
byebug
|
||||
faker
|
||||
friendly_id
|
||||
geokit-rails (= 1.1.4)
|
||||
httparty
|
||||
@@ -196,6 +206,7 @@ DEPENDENCIES
|
||||
paperclip (~> 4.3.7)
|
||||
passenger
|
||||
popper_js (~> 1.11, >= 1.11.1)
|
||||
pry-rails
|
||||
rails (~> 3.2)
|
||||
rake (~> 12.3.2)
|
||||
rdiscount (= 2.2.0.1)
|
||||
@@ -212,7 +223,7 @@ DEPENDENCIES
|
||||
therubyracer
|
||||
uglifier
|
||||
will_paginate (= 3.1.7)
|
||||
will_paginate-bootstrap
|
||||
will_paginate-bootstrap4
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.4.6p354
|
||||
|
||||
@@ -32,6 +32,7 @@ html, body {
|
||||
}
|
||||
|
||||
.map-list .map img {
|
||||
overflow: hidden;
|
||||
max-height:300px;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<ul>
|
||||
<% for author in Map.authors(12) %>
|
||||
<li><a href="/profile/<%= author %>"><%= author %></a></li>
|
||||
<li><a href="/profile/<%= author %>"><%= author.capitalize %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="map col-md-3 col-xs-6">
|
||||
<a href="/maps/<%= map.slug %>">
|
||||
<% if map.warpables.length > 0 %>
|
||||
<img src="<%= map.warpables.first.image.url(:small) %>" />
|
||||
<img src="<%= map.warpables.first.image.url %>" />
|
||||
<% else %>
|
||||
<div style="width:100%;background:#eee;height:170px;"></div>
|
||||
<% end %>
|
||||
|
||||
@@ -18,13 +18,11 @@
|
||||
<i class="fa fa-plus-circle"></i> Create a map
|
||||
</a>
|
||||
<% else %>
|
||||
<p><a class="btn btn-lg btn-outline-secondary btn-block disabled" href="#">
|
||||
<i class="fa fa-plus-circle"></i> Create a map
|
||||
</a></p>
|
||||
<p>
|
||||
<a href="#" onClick="$('.mini-login').toggle()">Log in</a> to create a map, or if you have privacy concerns, you may <a onClick="$('.hidden-map-btn').show()" href="#">create a map anonymously.</a>
|
||||
</p>
|
||||
<hr />
|
||||
<br>
|
||||
<p>
|
||||
<a href="#" onClick="$('.mini-login').toggle()">Log in</a> to create a map, or if you have privacy concerns, you may <a onClick="$('.hidden-map-btn').show()" href="#">create a map anonymously.</a>
|
||||
</p>
|
||||
<hr />
|
||||
|
||||
<div class="well mini-login" style="display:none;">
|
||||
<%= render :partial => "layouts/login_form" %>
|
||||
@@ -80,13 +78,13 @@
|
||||
<% end %>
|
||||
</small></h2>
|
||||
|
||||
<div class="row map-list">
|
||||
<div class="row row-eq-height map-list">
|
||||
<% @maps.each_with_index do |map,i| %>
|
||||
<%= render :partial => 'maps/list', :locals => {:map => map} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<br style="clear:both;" />
|
||||
<%= will_paginate @maps, renderer: BootstrapPagination::Rails unless @unpaginated %>
|
||||
<%= will_paginate @maps, list_classes: %w(pagination justify-content-center), previous_label: 'Prev', next_label: 'Next', renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
|
||||
</div><!-- .col-md-9 -->
|
||||
</div><!-- .row -->
|
||||
</div>
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
</table>
|
||||
|
||||
<br style="clear:both;" />
|
||||
<%= will_paginate @maps, renderer: BootstrapPagination::Rails unless @unpaginated %>
|
||||
<%= will_paginate @maps, list_classes: %w(pagination justify-content-center), previous_label: 'Prev', next_label: 'Next', renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
|
||||
</div>
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
<%= render :partial => 'maps/list', :locals => {:map => map} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= will_paginate @maps, list_classes: %w(pagination justify-content-center), previous_label: 'Prev', next_label: 'Next', renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
45
db/seeds.rb
45
db/seeds.rb
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user