Skip to content

Commit

Permalink
Add tooltip direction configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Apr 23, 2024
1 parent e130fc2 commit 8f0a8fc
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def update_questionnaire_question(form_question)
answer_option_attributes = {
body: form_answer_option.body,
geojson: form_answer_option.geojson,
tooltip_direction: form_answer_option.tooltip_direction,
free_text: form_answer_option.free_text
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module AnswerOptionFormExtensions

included do
attribute :geojson, JSON
attribute :tooltip_direction, String, default: "left"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
color: #202734;
}

.answer_option_map {
.answer-option-map {
width: 100%;
height: 75%;
}

.location-option-define {
position: relative;
bottom: 45px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
</div>

<% if Decidim::Map.autocomplete(organization: current_organization).present? %>
<div id="answer-option-map-selector" data-reveal class="reveal answer_option_map">
<div id="answer-option-map-selector" data-reveal class="reveal answer-option-map">
<%= cell(
"decidim/locations/locations",
questionnaire,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@
<%= form.button t(".define"), type: "button", class: "button small button--title location-option-define" %>
<% end %>
</div>

<div class="row column">
<%=
form.select(
:tooltip_direction,
options_for_select(
[
[t(".left"), "left"],
[t(".right"), "right"],
[t(".top"), "top"],
[t(".bottom"), "bottom"],
[t(".center"), "center"]
],
answer_option.tooltip_direction
),
{},
label: t(".tooltip_direction"),
disabled: !editable
)
%>
</div>
</div>

<% if answer_option.persisted? %>
Expand Down
6 changes: 6 additions & 0 deletions decidim-module-forms_locations/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ en:
geojson_help: Insert GeoJSON to add option or press "Define" to
define GeoJSON.
define: Define
tooltip_direction: Tooltip direction
top: Top
bottom: Bottom
left: Left
right: Right
center: Center
activemodel:
attributes:
questionnaire_question:
Expand Down
6 changes: 6 additions & 0 deletions decidim-module-forms_locations/config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ fi:
geojson_help: Lisää GeoJSON lisätäksesi vaihtoehto tai paina
"Määritä" painiketta määrittääksesi GeoJSON.
define: Määritä
tooltip_direction: Vihjetekstin suunta
top: Ylös
bottom: Alas
left: Vasen
right: Oikea
center: Keskelle
activemodel:
attributes:
questionnaire_question:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class AddConfigurationsToAnswerOption < ActiveRecord::Migration[5.2]
def change
add_column :decidim_forms_answer_options, :geojson, :jsonb
add_column :decidim_forms_answer_options, :tooltip_direction, :string, default: "left"
end
end

This file was deleted.

0 comments on commit 8f0a8fc

Please sign in to comment.