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

Url field data is not truncated in index view as per documentation #2544

Open
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/assets/builds/administrate/application.js
Expand Up @@ -11252,7 +11252,7 @@
return document.documentElement.querySelectorAll("script");
}
};
var Idiomorph = function() {
var Idiomorph = /* @__PURE__ */ function() {
let EMPTY_SET = /* @__PURE__ */ new Set();
let defaults = {
morphStyle: "outerHTML",
Expand Down Expand Up @@ -15921,7 +15921,14 @@
var import_jquery2 = __toESM(require_jquery());
var select_controller_default = class extends Controller {
connect() {
(0, import_jquery2.default)(this.element).selectize({});
const options = {};
if (this.shouldAllowEmptyOptionsFor(this.element)) {
options["allowEmptyOption"] = true;
}
(0, import_jquery2.default)(this.element).selectize(options);
}
shouldAllowEmptyOptionsFor(element) {
return element.children[0].value == "" && element.children[0].label == " ";
}
};

Expand Down
4 changes: 2 additions & 2 deletions app/assets/builds/administrate/application.js.map

Large diffs are not rendered by default.

Expand Up @@ -3,6 +3,15 @@ import $ from "jquery";

export default class extends Controller {
connect() {
$(this.element).selectize({});
const options = {}
if(this.shouldAllowEmptyOptionsFor(this.element)) {
options["allowEmptyOption"] = true
}
$(this.element).selectize(options);
}

shouldAllowEmptyOptionsFor(element) {
return element.children[0].value=='' && element.children[0].label==" "
}

};
2 changes: 1 addition & 1 deletion app/views/fields/url/_index.html.erb
Expand Up @@ -16,5 +16,5 @@ By default, the value is rendered as an `a` element.
%>

<%= content_tag :a, href: field.data, **field.html_options do %>
<%= field.data %>
<%= field.truncate %>
<% end %>