Commit 5422c0dd authored by Klaus Stein's avatar Klaus Stein
Browse files

Add fields to ImageMap

parent 3971f117
......@@ -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
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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
#
......
......@@ -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>
<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>
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
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_03_05_093114) do
ActiveRecord::Schema.define(version: 2022_03_07_204434) 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
......
......@@ -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
#
......
......@@ -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
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment