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