I have a form that, when maximally simplified, looks like this.
ActiveAdmin.register Foo do
form do |f1|
f1.inputs 'DeepFoos' do
f1.has_many :deep_foos do |f2|
f2.input :name
f2.inputs "DeeperFoos for #{f2.object.name}" do
f2.has_many :deeper_foos do |f3|
f3.input :color
end
end
end
end
end
end
When I was using activeadmin 0.6.6, this rendered fine, with the double-nested resource. After updating to 1.0.0.pre5, the DeeperFoos input part of the form disappeared. There's no exception, and it's not in the html source code of the page. It's simply gone.
Weirdly, if I remove the line that says f2.input :name, the DeeperFoos input rendered again.
I tried putting a debugger in it, and the debugger is hit, but the gem is so indirect and metaprogrammed that I don't know how I could possibly gain insight from it.
I can't find anything relevant in the activeadmin upgrade docs or the formtastic upgrade docs (which, as a dependency, got upgraded from 2.2.1 to 3.1.5).
This is probably due to the rewrite to integrate Arbre into forms. You are welcome to open a forms issue but I've given up for now on patching together Arbre, Formtasic and ActionView: as you have discovered it's ugly as they don't always share the same output buffers. ASFAIK relatively few try to use nested has_many. Can you move the input below inputs? Remove the blank line? It may just be a case of fiddling around and taking the best compromise.
Related
I am trying to insert value in textarea field using Excel automation, I have done a lot of research but don't get success.
I have used the scripts bellow.
IE.document.all("content").Item.Value = "Hi"
IE.document.all("content").Value = "Hi"
IE.document.all("content").innerHtml = "Hi"
None of the examples work.
Don't use Document.all
As per mozilla document.all is deprecated since HTML5 and may not work with your site.
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible;. . .
Selectors you can use
Really, the selectors that are good to use would be .getElementById, .getElementsByClassName, .querySelector, and .querySelectorAll.
Solution using correct selector
I prefer to stick with querySelector and querySelectorAll.
Using your example, it appears you are attempting to grab the only textarea with a class of content, something like <textarea class="content"></textarea>.
Therefore, that example would look like
IE.document.querySelector(".content").innerHTML = "Hi"
Please try below code. Check if it's work or not.
IE.document.all("content").Text= "Hi"
Or
Try to to add text properties at the end of the code
As the title states, I'm having a finicky issue with .NET Core 2.2. I'm using tag helpers all over, but on the specific page that I'm having trouble with, it's actually the most simple use-case of all:
<a class="logout" asp-page="/Admin/Logout">Logout</a>
Some relevant notes:
As of yesterday, it worked in all environments without any issues.
This morning I made some changes seemingly unrelated to this page, and published again.
In the published version (on Azure), the tag helpers for this page only don't render, but instead appear in the source code as literals. (e.g. <a asp-page="..."></a>)
Still works without issue locally.
Here is the directory structure. The page in question is /Admin/Index.cshtml:
And my _ViewImports.cshtml (which again, I haven't changed in months):
#using redacted
#namespace redacted.Pages
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Explicitly adding the taghelper to the .chshtml file has solved this for me in the past. Unfortunately I am not aware of why this issue occurs randomly. In my specific use case,we were using custom and third party tag helpers which we suspect was causing the issues.
Try adding this line to the /Admin/Index.cshtml file:
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
I use chosen 1.2.0 from nuget. My chosen.css file contains class like .chosen-container, .chosen-container. When i call my dropdownlist class using .chosen() function. Resulted css class will be chzn-container, chzn-container-multi. It causes display ugly. but functionality work. I have no error in browser console.
When i check another sites, both generated markup and chosen.css contains chzn-container, chzn-container-multi classes only.
Nuget adds only css. It is not add chosen.jquery.js. I don't know why.
The Nuget package named simply "chosen" does not, as the OP says, contain the .js.
You need to search for Harvest.Chosen. Hopefully this will help someone in the future.
Due to dependency complications from today's Rails and Sprockets vulnerability updates, I had to update ActiveAdmin to HEAD today, and the upgrade has done a number on one of my more complicated forms. See here for a much-simplified example: http://pastebin.com/Gt19TtYW
This markup rendered fine in the last version we were using (ref 8299dee5bd0) - the arbitrary html in the innermost inputs blocks rendered and each item.input as expected. However, in the newest version, only the last method invoked in the block is respected (so only <p>More static html</p> renders for each item). Even if I remove those static html containers and leave only item.input calls, I only get markup for the last method call in the block. This leaves me with two questions:
Is there a new preferred way to include arbitrary html under the new DSL? I tried div as per https://github.com/activeadmin/activeadmin/blob/master/docs/5-forms.md but that just made things worse (the arbitrary html ended up floating orphaned above the has_many markup).
Is there some new trick for the syntax inside has_many to get all of my item.input and other markup to render, instead of just the last thing called?
yes please do open issue(s) on GitHub for this. Our intention was that you use Arbre inside the inputs, so "para some static html" rather than "<p> ... <p>".html_safe However, so far this works inside inputs but not has_many. Also a fix was just added to has_many for the missing input so pull the latest and see if that helps.
I have an alternate view for a widget. In that view I'm suppressing the wrapper using code like this:
Model.Metadata.Wrappers.Clear();
This works, but I'd like to only suppress the Widget.Wrapper. Right now it is also suppressing the Widget.ControlWrapper which prevents the edit buttons from displaying when I have the Widget Control Wrapper module enabled.
Is there any way to clear only the Widget.Wrapper while keeping the Widget.ControlWrapper?
In case anyone comes across this for a similar problem, I was able to suppress the Widget.Wrapper thusly in a Widget-Sidebar.cshtml file in my theme:
#using Orchard.DisplayManagement.Descriptors;
#using Orchard.Environment.Extensions;
#{
Model.Metadata.Wrappers.Remove("Widget_Wrapper");
Model.Metadata.Wrappers.Add("Widget_SideBarWrapper");
Model.Metadata.Wrappers.Add("Widget_ControlWrapper");
}
#Display(Model.Content)
I started out by using the Shape Tracing tool to create an alternate for widgets I had in a "sidebar" column (basically a <div id="sidebar"> I have in my layout as #Zone(Model.Sidebar)).
I placed the code above in the Widget-Sidebar.cshtml alternate that I created using Shape Tracing.
Model.Metadata.Wrappers.Clear(); as used by the OP completely removes everything, to the point where in Shape Tracing it won't even show up as a widget. Adding my own alternate (Widget.SideBarWrapper.cshtml, which is added as "Widget_SideBarWrapper" above) would not fix this. I felt that was wrong even though the content displayed.
Model.Metadata.Wrappers.Remove("Widget_Wrapper");
seemed the right way to go (i.e., Shape Tracing still showed a Widget), but it appears to REMOVE all the other wrappers, so you then have to add your new wrapper along with Widget.ControlWrapper.cshtml (written as "Widget_ControlWrapper" in code above).
HTH.
I was able to add back the Widget.ControlWrapper like this:
Model.Metadata.Wrappers.Add("Widget_ControlWrapper");
This seems to be working just like I wanted.