Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/styles #118

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module TermCustomizer
module Admin
class AddTranslationsController < TermCustomizer::Admin::ApplicationController
helper_method :set
add_breadcrumb_item_from_menu :term_customizer_translation_sets_menu

def index
enforce_permission_to :read, :translation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module TermCustomizer
module Admin
class TranslationsController < TermCustomizer::Admin::ApplicationController
helper_method :collection, :set, :translations, :translation
add_breadcrumb_item_from_menu :term_customizer_translation_sets_menu

def index
enforce_permission_to :read, :translation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "src/decidim/term_customizer/admin/translations_admin"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ import "src/decidim/term_customizer/admin/multifield/component"
import "src/decidim/term_customizer/admin/constraint_fields"

import "src/decidim/term_customizer/admin/translation_sets_admin"
import "src/decidim/term_customizer/admin/translations_admin"
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
<div class="item_show__header">
<h2 class="item_show__header-title">
<div>
<%= link_to t("decidim.term_customizer.menu.term_customizer"), translation_sets_path %>
&gt;
<%= link_to translated_attribute(set.name), translation_set_translations_path(set) %>
&gt;
<%= t "decidim.term_customizer.admin.titles.add_multiple_translations" %>

<a data-toggle="help-panel" class="label secondary">
<a data-toggle="help-panel" class="label secondary button">
<%= icon "information-line" %>
<%= t("actions.help", scope: "decidim.term_customizer.admin") %>
</a>
</div>

<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= link_to t("actions.back", scope: "decidim.term_customizer.admin"), translation_set_translations_path(set), class: "button button__sm button__secondary hollow tiny button--simple" %>
</div>
</h2>
Expand Down Expand Up @@ -43,7 +39,7 @@
</div>

<div class="form__wrapper mt-[230px]">
<%= decidim_form_for(@form, url: translation_set_add_translations_path(set), html: { class: "form translations-form add_translations translations_form_admin" }) do |f| %>
<%= decidim_form_for(@form, url: translation_set_add_translations_path(set), html: { class: "form form-defaults translations-form add_translations translations_form_admin" }) do |f| %>
<div id="add-translations-results" class="hide">
<div id="add-translations">

Expand Down Expand Up @@ -73,13 +69,13 @@
</div>
</div>

<div class="item__edit-sticky">
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t(".add") %>
<%= f.submit t(".add"), class: "button button__sm button__secondary" %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<%= append_javascript_pack_tag "decidim_term_customizer_admin" %>
<%= append_javascript_pack_tag "decidim_term_customizer_admin_autocomplete" %>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<p><strong><%= t ".constraint_help_title" %></strong></p>
<%= t ".constraint_help_html" %>
</div>

<div class="form__wrapper">
<div class="card pt-4">
<div class="card-section">
Expand All @@ -13,7 +14,7 @@
</div>
</div>

<div class="multifield-fields constraints-container" data-placeholder-id="<%= blank_constraint.to_param %>">
<div class="multifield-fields constraints-container form__wrapper" data-placeholder-id="<%= blank_constraint.to_param %>">
<template>
<%= fields_for "constraints[#{blank_constraint.to_param}]", blank_constraint do |constraint_form| %>
<%= render "constraint_fields", form: constraint_form, index: blank_constraint.to_param, id: tabs_id_for_constraint(blank_constraint) %>
Expand All @@ -27,10 +28,10 @@
<% end %>
<% end %>
</div>
<div class="row column">
<div>
<button class="button button__sm button__secondary small hollow add-external-domain"><%= t(".add_constraint") %></button>
</div>
</div>
</div>

<%= append_javascript_pack_tag "decidim_term_customizer_admin" %>
<%= append_javascript_pack_tag "decidim_term_customizer_admin_sets" %>
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
<div class="item_show__header">
<h2 class="item_show__header-title">
<div>
<%= link_to t("decidim.term_customizer.menu.term_customizer"), translation_sets_path %>
&gt;
<%= t "translation_sets.form.title", scope: "decidim.term_customizer.admin" %>
<%= t "translation_sets.edit.title", scope: "decidim.term_customizer.admin" %>

<a data-toggle="help-panel" class="label secondary button">
<%= icon "information-line" %>
<%= t("actions.help", scope: "decidim.term_customizer.admin") %>
</a>
</div>

<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= link_to t("actions.back", scope: "decidim.term_customizer.admin"), translation_sets_path, class: "button button__sm button__secondary hollow tiny button--simple" %>
</div>
</h2>
</div>
<div class="item__edit-form">
<%= decidim_form_for(@form, html: { class: "form translation-sets-form edit_translation_set translation_set_form_admin" }) do |f| %>
<%= decidim_form_for(@form, html: { class: "form form-defaults translation-sets-form edit_translation_set translation_set_form_admin" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>

<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t(".save") %>
<%= f.submit t(".save"), class: "button button__sm button__secondary" %>
</div>
</div>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t "decidim.term_customizer.admin.titles.translation_sets" %>
<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<% if allowed_to? :create, :translation_set %>
<%= link_to t("actions.new_translation_set", scope: "decidim.term_customizer.admin"), new_translation_set_path, class: "imports-example tiny button button__sm button__secondary button--simple mr-2" %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<div class="item_show__header">
<h2 class="item_show__header-title">
<div>
<%= link_to t("decidim.term_customizer.menu.term_customizer"), translation_sets_path %>
&gt;
<%= t "translation_sets.form.title", scope: "decidim.term_customizer.admin" %>

<a data-toggle="help-panel" class="label secondary button">
Expand All @@ -11,13 +9,13 @@
</a>
</div>

<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= link_to t("actions.back", scope: "decidim.term_customizer.admin"), translation_sets_path, class: "button button__sm button__secondary hollow tiny button--simple" %>
</div>
</h2>
</div>
<div class="item__edit-form">
<%= decidim_form_for(@form, html: { class: "form translation-sets-form new_translation_set translation_set_form_admin" }) do |f| %>
<%= decidim_form_for(@form, html: { class: "form form-defaults translation-sets-form new_translation_set translation_set_form_admin" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<div class="item_show__header">
<h2 class="item_show__header-title">
<div>
<%= link_to t("decidim.term_customizer.menu.term_customizer"), translation_sets_path %>
&gt;
<%= link_to translated_attribute(set.name), translation_set_translations_path(set) %>
&gt;
<%= t "translations.form.title", scope: "decidim.term_customizer.admin" %>
<%= title %>

<a data-toggle="help-panel" class="label secondary button">
<%= icon "information-line" %>
<%= t("actions.help", scope: "decidim.term_customizer.admin") %>
</a>
</div>

<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= link_to t("actions.back", scope: "decidim.term_customizer.admin"), translation_set_translations_path(set), class: "button button__sm button__secondary hollow tiny button--simple" %>
</div>
</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div id="js-destroy-translations-actions" class="hide js-bulk-action-form">
<%= form_tag(translation_set_translations_destroy_path(set), method: :delete, id: "js-form-destroy-translations", class: "flex--cc flex-gap--1") do %>
<%= form_tag(translation_set_translations_destroy_path(set), method: :delete, id: "js-form-destroy-translations", class: "form form-defaults flex items-center gap-x-2") do %>
<div class="checkboxes hide">
<% translations.each do |translation| %>
<%= check_box_tag "translation_ids[]", translation.id, false, class: "js-check-all-translation js-translation-id-#{translation.id}" %>
<% end %>
</div>

<%= submit_tag(t("actions.destroy", scope: "decidim.admin"), id: "js-submit-destroy-translations", class: "button small button--simple float-left") %>
<%= submit_tag(t("actions.destroy", scope: "decidim.admin"), id: "js-submit-destroy-translations", class: "button button__sm button__secondary small button--simple float-left") %>

<button id="js-cancel-destroy-translations" class="button tiny clear compact js-cancel-bulk-action" type="button"><%= t("decidim.term_customizer.admin.actions.cancel") %></button>
<button id="js-cancel-destroy-translations" class="button button__sm button__secondary clear compact js-cancel-bulk-action" type="button"><%= t("decidim.term_customizer.admin.actions.cancel") %></button>
<% end %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
type="button"
data-toggle="js-bulk-actions-dropdown">
<%= t("decidim.term_customizer.admin.translations.index.actions") %>
<%= icon "arrow-down-s-line", class: "dropdown-filter-icon" %>
</button>

<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="item__edit-form">
<%= decidim_form_for(@form, url: translation_set_translation_path(set, translation), html: { class: "form translation-sets-form edit_translation translation_form_admin" }) do |f| %>
<%= decidim_form_for(@form, url: translation_set_translation_path(set, translation), html: { class: "form form-defaults translation-sets-form edit_translation translation_form_admin" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>

<div class="item__edit-sticky">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
<div class="item_show__header">
<h2 class="item_show__header-title">
<div>
<%= link_to t("decidim.term_customizer.menu.term_customizer"), translation_sets_path %>
&gt;
<%= translated_attribute(set.name) %>

<span id="js-selected-proposals-count" class="component-counter component-counter--inline" title="<%= t("decidim.term_customizer.admin.translations.index.selected") %>"></span>
<span id="js-selected-translation-count" class="component-counter component-counter--inline" title="<%= t("decidim.term_customizer.admin.translations.index.selected") %>"></span>
</div>

<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= render partial: "decidim/term_customizer/admin/translations/bulk_actions/dropdown" %>
<% if allowed_to? :create, :translation %>
<%= link_to t("actions.add_multiple_translations", scope: "decidim.term_customizer.admin"), translation_set_add_translations_path(set), class: "button button__sm button__secondary" %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="item__edit-form">
<%= decidim_form_for(@form, url: translation_set_translations_path(set), html: { class: "form translation-sets-form new_translation translation_form_admin" }) do |f| %>
<%= decidim_form_for(@form, url: translation_set_translations_path(set), html: { class: "form form-defaults translation-sets-form new_translation translation_form_admin" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<%= t "translations.new_import.title", scope: "decidim.term_customizer.admin" %>
</div>

<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= link_to t("actions.back", scope: "decidim.term_customizer.admin"), translation_set_translations_path(set), class: "button hollow tiny button--simple" %>
</div>
</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>

<div class="flex--cc flex-gap--1">
<div id="js-other-actions-wrapper">
<div id="js-other-actions-wrapper" class="flex align-middle gap-x-4 ml-auto">
<%= link_to t("actions.back", scope: "decidim.term_customizer.admin"), translation_set_translations_path(set), class: "button hollow tiny button--simple" %>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion config/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

# Entrypoints for the module
Decidim::Webpacker.register_entrypoints(
decidim_term_customizer_admin: "#{base_path}/app/packs/entrypoints/decidim_term_customizer_admin.js",
decidim_term_customizer_admin_autocomplete:
"#{base_path}/app/packs/entrypoints/decidim_term_customizer_admin_autocomplete.js",
decidim_term_customizer_admin_sets: "#{base_path}/app/packs/entrypoints/decidim_term_customizer_admin_sets.js",
decidim_term_customizer_admin_bulk: "#{base_path}/app/packs/entrypoints/decidim_term_customizer_admin_bulk.js"
)

Expand Down
9 changes: 5 additions & 4 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ en:
success: Translation set successfully duplicated.
edit:
save: Save
title: Translation set
title: Edit translation set
form:
add_constraint: Add constraint
constraint_help_html: <p>Constraints are specific rules that allow you
Expand All @@ -102,7 +102,7 @@ en:
processes, you can create separate translation sets for both processes
and apply the set to those processes using the constraints.</p>
help_title: What is a translation set?
title: Translation set
title: New translation set
index:
no_records_html: <p>No translation sets available.</p> <p>Start by adding
a translation set from the "<a href="%{new_set_link}">%{button_name}</a>"
Expand All @@ -121,7 +121,7 @@ en:
success: Translation successfully deleted.
edit:
save: Save
title: Translation
title: Edit translation
form:
help_html: <p>A translation key is a technical reference to the translation
to be translatated. This is not the term you want to change but the
Expand All @@ -147,7 +147,7 @@ en:
selected: selected
new:
create: Create
title: Translations
title: New translation
new_import:
accepted_mime_types:
csv: CSV
Expand All @@ -170,3 +170,4 @@ en:
title: Translations delete
menu:
term_customizer: Term customizer
translation_set: Translation set
10 changes: 10 additions & 0 deletions lib/decidim/term_customizer/admin_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ class AdminEngine < ::Rails::Engine
if: allowed_to?(:update, :organization, organization: current_organization)
)
end

Decidim.menu :term_customizer_translation_sets_menu do |menu|
menu.add_item(
:term_customizer_translation_sets,
I18n.t("menu.translation_set", scope: "decidim.term_customizer"),
decidim_admin_term_customizer.translation_set_translations_path,
active: is_active_link?(decidim_admin_term_customizer.translation_set_translations_path) ||
is_active_link?(decidim_admin_term_customizer.translation_set_add_translations_path)
)
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module TermCustomizer
expect(response).to have_http_status(:ok)

json = response.parsed_body
expect(json.length).to eq(76)
expect(json.length).to eq(77)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module Admin
upload_test_file(
Rack::Test::UploadedFile.new(
file_fixture("set-translations.json"),
"text/plain"
"text/html"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the correct MIME type for a JSON is application/json.

)
)
end
Expand Down
Loading
Loading