Is there a way to add an "Edit HTML" button to bootstrap-wysihtml5 when integrating with Rails_Admin? - rails-admin

The Rails_Admin wiki explains how to integrate with bootstrap-wysihtml5 which is incredibly easy.
However, I'd like the wysihtml5 widget to have the "edit as html" button.
Is this possible?

You can configure wysihtml5 on a per-field basis like below. To e.g. enable the HTML editor feature, use
RailsAdmin.config do |config|
config.model Team do
edit do
field :description, :text do
bootstrap_wysihtml5 true
bootstrap_wysihtml5_config_options :html => true
end
end
end
end
This was added to Rails_admin a while ago, but they somehow forgot to update the Wiki.

The above answer is now out of date with the current version of Rails Admin. You should use the following syntax to customize the editor:
field :description, :wysihtml5 do
config_options :html => true
end
I have updated the wiki

Related

Need a second level menu

Does activeadmin support 2nd level menus? For example, I tried the following to have "Safety" under "Resources" and "Cyber Security" and "Emergency Plans" under "Safety"
ActiveAdmin.register_page 'Safety' do
menu parent:'Resources'
content do
render template: 'safety/safety'
end
end
ActiveAdmin.register_page 'Cyber Security' do
menu parent: 'Safety'
content do
render template: 'safety/cyber_security'
end
end
ActiveAdmin.register_page 'Emergency Plans' do
menu parent: 'Safety'
content do
render template: 'safety/emergency_plans'
end
end
That does not work. I simply see the Safety menu item in the dropdown but I don't see the other three We are using version 0.6.6 of activeadmin.
Question: Does this version or any newer version of active-admin support multi level menus? If so, how can I do that?
It has limited support with a feature called navigation menu, see the docs on belongs_to.
Beyond that, but take a look at active_admin-subnav I hope you will consider ActiveAdmin 1.x for newer versions of Rails.

How can I disable selected attribute from select2() dropdown Jquery?

I know how to enable the selected attribute from dropdown; I can use this code :
$('select').select2();
but my problem is how to disable it ? thx
The right way for Select2 3.x is:
$('select').select2("enable", false)
This works fine.
For those using Select2 4.x, you can disable an individual option by doing:
$('select option:selected').prop('disabled', true);
For those using Select2 4.x, you can disable the entire dropdown with:
$('select').prop('disabled', true);
The below code also works fine for Select2 3.x
For Enable Select Box:
$('#foo').select2('enable');
For Disable Select Box:
$('#foo').select2('disable');
jsfiddle: http://jsfiddle.net/DcunN/
To disable the complete select2 box, that is no deletion of already selected values and no new insertion, use:
$("id-select2").prop("disabled", true);
where id-select2 is the unique id of select2. you can also use any particular class if defined to address the dropdown.
In selec2 site you can see options. There is "disabled" option for api. You can use like :
$('#foo').select2({
disabled: true
});
As of Select2 4.1, they've removed support for .enable
$("select").prop("disabled", true); // instead of $("select").enable(false);
From: https://select2.org/upgrading/migrating-from-35
As the question seems unclear, I'm sorry if this answer is not directly related to the original intent.
For those using Select2 version 4+ and according to official plugin documentation, .select2("enable")is not the way to go anymore for disabling the select box (not a single option of it). It will even be completely removed from version 4.1 onward.
Quoted directy from the documentation (see https://select2.org/upgrading/migrating-from-35#select2-enable):
Select2 will respect the disabled property of the underlying select element. In order to enable or disable Select2, you should call .prop('disabled', true/false) on the element. Support for the old methods will be completely removed in Select2 4.1.
So in the previous answer's example, it should be:
$('select').prop(disabled,true);
As per select2 documentation: Click Here
If you wants to disable select2 then use this approach:
$(".js-example-disabled").prop("disabled", true);
If you wants to enable a disabled select2 box use this approach:
$(".js-example-disabled").prop("disabled", false);
I'm disabling select2 with:
$('select').select2("enable",false);
And enabling it with
$('select').select2("enable");
$('select').select2('enable',false);
This works for me.
I'm disable on value:
<option disabled="disabled">value</option>
if you want to disable the values of the dropdown
$('select option:not(selected)').prop('disabled', true);
$('select').prop('disabled', true);

Not able to add fields to my content type in Drupal 6

In my localhost drupal site I have created a content type "Scholarship". Now I need to add few more fields (checkboxes, radio etc) to it.
The problem is, I cannot see "Add new fields" option anywhere on the page. When I click the "Manage Fields" options I am redirected to the "content/node-type/scholarship/fields" and there is no option for adding new fields.
Any idea on what is causing this problem?
Thanks.
check $closure in the end of page.tpl.php and try clear cache once.
use cck module download and enable it then it show managefiled option for content type..

How to add subpages in Orchard CMS

I added a new page in the main menu, e.g. Products. Now I want to add a subpage e.g. Sub Products below a Products page. I tried all possible options in the dashboard but it didn't work for me. Any ideas how to handle this?
Thanks.
here is a quick solution for this
Go to your dash board -->Gallery -->Modules
search for Hierarchical menu and install it
after installing then go to Configuration -->Features and enable it.
Go go to Navigation .give position like 2 for "Products" and 2.1 for "Sub products".
you will see Sub products appear under Products page.
As of Orchard CMS 1.5 this is supported by the core navigation module. Now you can simply drag and drop menu items under one another in the Admin -> Navigation view. You can then control level rendering under the widget settings for the menu by setting the "Start level" and "Levels to display" properties.
See release notes for further details.
The navigation documentation doesn't seem to be up to date though :(
Take a look at: http://orchard.codeplex.com/Thread/View.aspx?ThreadId=242327
The module to support this (along with many other modules) is available in Orchard's module gallery.

How to disable display of authoring information in drupal?

Am doing a local website in drupal.
I have applied the theme 'Acquia Marina' (http://drupal.org/node/315555) to it.
Under Administer > Themes > Configure
I have unchecked "Enable or disable the submitted by Username on date text when displaying posts of the following type" for type 'Page' and the same is enabled for 'Story' (I don't have my own content types yet)
But I still get the submitted by Username on date text on the all the 'page's
I have tried, clearing performance cache, trying all(4) combinations on the checkboxes in question, but to no avail. But this setting works perfectly in the default theme.
I guess its some behaviour of the theme which I need to override. But have no clue.
Any suggestions?
Thanks.
If it would help to anyone, the authoring information can be disabled at each content type setting under: "admin/structure/types/manage/your_content_type" > Display setting and uncheck the "Display author and date information.". Another alternative is to set in node.tpl.php the condition "" to "".
go to index.php?q=admin/build/themes/settings/acquia_marina, > "Theme-specific settings" > "Acquia Marina settings" > expand "Node settings" (that's what i missed at first) > "Author & date", and disable authorname and date, either for all content types, or for specific ones.
Simply cut out the template.
<?php print $submitted; ?>

Resources