Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
urbanmetamapping
platform
MapMyMaps-p1
Commits
5422c0dd
Commit
5422c0dd
authored
Mar 07, 2022
by
Klaus Stein
Browse files
Add fields to ImageMap
parent
3971f117
Changes
11
Hide whitespace changes
Inline
Side-by-side
app/controllers/image_maps_controller.rb
View file @
5422c0dd
...
...
@@ -72,6 +72,6 @@ class ImageMapsController < ApplicationController
# Only allow a list of trusted parameters through.
def
image_map_params
params
.
require
(
:image_map
).
permit
(
:name
,
:anchors
,
:clip
,
:map_id
,
:image
)
params
.
require
(
:image_map
).
permit
(
:name
,
:anchors
,
:clip
,
:title
,
:description
,
:usage
,
:map_id
,
:image
)
end
end
app/frontend/stylesheets/_image_map.scss
View file @
5422c0dd
main
.show.imagemap
{
table
{
th
{
text-align
:
left
;
}
}
}
.image_map.edit
{
table
.fields
{
tr
{
th
{
text-align
:
left
;
}
td
{
input
,
textarea
{
width
:
100%
;
min-width
:
50em
;
}
}
}
}
figure
.map
{
order
:
99
;
...
...
app/frontend/stylesheets/_main.scss
View file @
5422c0dd
...
...
@@ -93,6 +93,14 @@ div.page {
}
.place
,
.show.map
,
.show.imagemap
,
.edit.imagemap
{
border
:
2px
solid
grey
;
padding
:
1rem
;
background
:
$show-bg
;
}
main
.show
{
padding
:
0px
;
margin
:
0px
;
...
...
app/frontend/stylesheets/_maps.scss
View file @
5422c0dd
...
...
@@ -7,12 +7,6 @@
box-sizing
:
border-box
;
}
.place
,
.show.map
{
border
:
2px
solid
grey
;
padding
:
1rem
;
background
:
$show-bg
;
}
.wda-infos
,
.dfg-infos
{
padding
:
1rem
;
opacity
:
0
.5
;
...
...
app/models/image_map.rb
View file @
5422c0dd
...
...
@@ -2,13 +2,16 @@
#
# Table name: image_maps
#
# id :bigint not null, primary key
# anchors :geometry geometry, 0
# clip :geometry polygon, 0
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# map_id :bigint not null
# id :bigint not null, primary key
# anchors :geometry geometry, 0
# clip :geometry polygon, 0
# description :text
# name :string
# title :string
# usage :string
# created_at :datetime not null
# updated_at :datetime not null
# map_id :bigint not null
#
# Indexes
#
...
...
app/views/image_maps/_form.html.erb
View file @
5422c0dd
...
...
@@ -11,26 +11,44 @@
</ul>
</div>
<%
end
%>
<div
class=
"warning"
>
<p>
You should not use this page to edit map image details.
</p>
<p>
It is currently exposed only for georeferencing (click the image on the map shown below to start this).
<br
/>
Do not forget to save afterwards :-)
</p>
</div>
<main
class=
"imagemap edit"
>
<table
class=
"fields"
>
<tr><th>
<%=
form
.
label
:title
%>
:
</th>
<td>
<%=
form
.
text_field
:title
%>
</td></tr>
<tr><th>
<%=
form
.
label
:usage
%>
:
</th>
<td>
<%=
form
.
text_field
:usage
%>
</td></tr>
<tr><th>
<%=
form
.
label
:description
%>
:
</th>
<td>
<%=
form
.
text_area
:description
%>
</td></tr>
</table>
<div
class=
"actions"
>
<%=
form
.
submit
%>
</div>
<figure
class=
"map"
>
<div
class=
"imagemap-map"
data-image=
"
<%=
url_for
(
image_map
.
image_hd
)
%>
"
data-anchors=
"
<%=
RGeo
::
GeoJSON
.
encode
(
image_map
.
anchors_or_buffer
).
to_json
%>
"
data-clip=
"
<%=
RGeo
::
GeoJSON
.
encode
(
image_map
.
clip
).
to_json
%>
"
></div>
<label>
Position:
<input
type=
"text"
readonly=
"readonly"
value=
"
<%=
image_map
.
position
%>
"
></input></label>
</figure>
<div
class=
"field"
>
<%=
form
.
label
:name
%>
<%=
form
.
text_field
:name
%>
</div>
<div
class=
"actions"
>
<%=
form
.
submit
%>
</div>
</main>
<div
class=
"warning"
>
<p>
You should not use this page to edit further map image details.
</p>
<p>
It is currently exposed only for georeferencing (click the image on the map shown below to start this).
<br
/>
Do not forget to save afterwards :-)
</p>
</div>
<div
class=
"field"
>
<div
class=
"field"
>
<%=
form
.
label
:name
%>
<%=
form
.
text_field
:name
%>
</div>
<div
class=
"field"
>
<%=
form
.
label
:image
%>
<em>
(this will overwrite! better use image upload on
<%=
link_to
'Map'
,
image_map
.
map
%>
!)
</em>
<%=
form
.
file_field
:image
,
style:
'max-width: 40em;'
%>
</div>
...
...
@@ -50,8 +68,5 @@
<%=
form
.
text_field
:map_id
%>
</div>
<div
class=
"actions"
>
<%=
form
.
submit
%>
</div>
<%
end
%>
</div>
app/views/image_maps/show.html.erb
View file @
5422c0dd
<main
class=
"show imagemap"
>
<p
id=
"notice"
>
<%=
notice
%>
</p>
<table>
<tr>
<th>
Name:
</th>
<td>
<%=
@image_map
.
name
%>
</td>
</tr>
<tr>
<tr>
<th>
Title:
</th>
<td>
<%=
@image_map
.
title
%>
</td>
</tr>
<tr>
<th>
Description:
</th>
<td>
<%=
@image_map
.
description
%>
</td>
</tr>
<tr>
<th>
Usage:
</th>
<td>
<%=
@image_map
.
usage
%>
</td>
</tr>
<tr>
<th>
Title
</th>
<td>
<%=
@image_map
.
title
%>
</td>
</tr>
<tr>
<th>
Image:
</th>
<td>
<%
img
=
@image_map
.
image_preview
%>
<%=
image_tag
img
%>
<br
/>
<%=
url_for
(
@image_map
.
image
)
%>
</td>
<%
#
= url_for(@image_map.image) %>
</td>
</tr>
<tr>
<th>
Dateiname:
</th>
<td>
<%=
@image_map
.
name
%>
</td>
</tr>
<tr>
<th>
Position:
</th>
<td>
<%=
@image_map
.
position
%>
</td>
...
...
@@ -36,3 +53,4 @@
<%=
link_to
'Edit'
,
edit_image_map_path
(
@image_map
)
%>
|
<%=
link_to
'Back'
,
image_maps_path
%>
</main>
db/migrate/20220307204434_add_title_desc_to_image_maps.rb
0 → 100644
View file @
5422c0dd
class
AddTitleDescToImageMaps
<
ActiveRecord
::
Migration
[
6.1
]
def
change
add_column
:image_maps
,
:title
,
:string
add_column
:image_maps
,
:description
,
:text
add_column
:image_maps
,
:usage
,
:string
end
end
db/schema.rb
View file @
5422c0dd
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2022_03_0
5_09311
4
)
do
ActiveRecord
::
Schema
.
define
(
version:
2022_03_0
7_20443
4
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"adminpack"
...
...
@@ -99,6 +99,9 @@ ActiveRecord::Schema.define(version: 2022_03_05_093114) do
t
.
bigint
"map_id"
,
null:
false
t
.
datetime
"created_at"
,
precision:
6
,
null:
false
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
t
.
string
"title"
t
.
text
"description"
t
.
string
"usage"
t
.
index
[
"map_id"
],
name:
"index_image_maps_on_map_id"
end
...
...
test/fixtures/image_maps.yml
View file @
5422c0dd
...
...
@@ -2,13 +2,16 @@
#
# Table name: image_maps
#
# id :bigint not null, primary key
# anchors :geometry geometry, 0
# clip :geometry polygon, 0
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# map_id :bigint not null
# id :bigint not null, primary key
# anchors :geometry geometry, 0
# clip :geometry polygon, 0
# description :text
# name :string
# title :string
# usage :string
# created_at :datetime not null
# updated_at :datetime not null
# map_id :bigint not null
#
# Indexes
#
...
...
test/models/image_map_test.rb
View file @
5422c0dd
...
...
@@ -2,13 +2,16 @@
#
# Table name: image_maps
#
# id :bigint not null, primary key
# anchors :geometry geometry, 0
# clip :geometry polygon, 0
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# map_id :bigint not null
# id :bigint not null, primary key
# anchors :geometry geometry, 0
# clip :geometry polygon, 0
# description :text
# name :string
# title :string
# usage :string
# created_at :datetime not null
# updated_at :datetime not null
# map_id :bigint not null
#
# Indexes
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment