RefineryCMS - remove default page parts - ruby-on-rails

I want to remove the side_body section on each page in RefineryCMS.
The guide advises that you can change page parts by going into config/initializers/refinery/pages.rb and altering the settings:
So I have changed:
config.default_parts = [“Body”, “Side Body”]
to:
config.default_parts = [“Body”]
I have restarted my server, but my side_body section still appears. Can the side_body be removed?

It is just a guess, but I believe that it only appears on already existing pages. If you create a new page, you should only see the Body-tag. At least this was the behavior in Refinery 1.0.8.
To remove the Side Body from already existing pages, you will have to make the pageparts editable. I think you can achieve this by setting config.new_page_parts => true. After that, when you edit the page, you should be able to see a (+), a (-) and a (reorder)-sign right above the editor.

Related

How to add restriction based on Roles into Config.groovy file on Grails?

I'm trying to add some restrictions to some pages on my Config.groovy, but I'm not able to do it properly.
I want that RoleType.ROLE_HR_ADMIN to access index and creation pages.
While for RoleType.ROLE_HR_READONLY it should be able to access the index page and show pages only.
I'm already hiding the button so the user can't click on it to go to the creation screen. But if I get the full URL, copy and paste it on the browser I'm still able to access it.
That is what I tried to do on Config.groovy:
'/siteadmin/party/**': [RoleType.ROLE_SITE_ADMIN.id],
'/siteadmin/party/create/**': [RoleType.ROLE_HR_ADMIN.id],
'/siteadmin/party/index/**': [RoleType.ROLE_HR_ADMIN.id, RoleType.ROLE_HR_READONLY.id],
but then I'm getting:
"Sorry, you're not authorized to view this page."
If someone can send me a link showing how to do it properly it would be great.
I tried some different approaches but none of them worked.
Check this out: https://grails-plugins.github.io/grails-spring-security-core/v2/guide/requestMappings.html
Especially look at grails.plugin.springsecurity.interceptUrlMap:
'/j_spring_security_switch_user': ['ROLE_ADMIN']
so in your case:
'/siteadmin/party/create/**': ['ROLE_HR_ADMIN'],
'/siteadmin/party/index/**': ['ROLE_HR_ADMIN', 'ROLE_HR_READONLY']
'/siteadmin/party/**': ['ROLE_SITE_ADMIN']
Order matters.

Full URL for one specific page content only in Typo3 while the rest follows the base URL constant

I am managing an association's site using typo 3 version 4.5.30. The site has the config setup for [baseURL] = http://www.afj-japon.org/ in its template.
Everything works fine, but I need ONE page only to have the URLs written in full in the code.
Right now the page code indicates
and the URLs are written in full for the redirections to other pages, but as for the images.
I need to have the code to actually be as
How can I set this to affect only this one page and not the whole site ?
Thank you in advance for your help.
Regards,
Gilles
if I understand the question right you want to have absolute URLs on one certain page, right?
TYPO3 comes with a setting called config.absRefPrefix.
If said one page has no child-pages you can set up an extension template on that page and have this line in there:
config.absRefPrefix = http://www.afj-japon.org/
If the page has child-pages underneath it, you will have to use a condition in the ID of that page.
[globalVar = TSFE:id = PAGE-UID]
config.absRefPrefix = http://www.afj-japon.org/
[global]
Mind that every condition has to be evaluated prior to caching so having a lot of conditions might make your website slower.

Dynamic embeddedForm

I'm looking to add an embeddedForm dynamically in Symfony 1.4 using Doctrine.
What I'm mainly looking to do is:
1) Only show the relation based on whether or not a checkbox has been ticked
2) If checked, show the embeddedForm
3) Have then the ability to add a new embeddedForm or delete an existing form
I have seen ahDoctrineEasyEmbeddedRelationsPlugin, which looks pretty good with los of configuration. The only problem was that 'newFormsInitialCount'=> 1, means that there is always 1 form as default. I need 0 forms as default and only.
I've also seen a couple of tutorials, but all seem to have at least one relation by default.
For me, the embeddedForm needs to be OPTIONAL, and only display when needed.
Thanks
Follow information based on these links :
http://www.thatsquality.com/articles/stretching-sfform-with-dynamic-elements-ajax-a-love-story
http://www.symfony-project.org/more-with-symfony/1_4/en/06-Advanced-Forms#chapter_06_sub_the_form_saving_process
First is about adding "subforms" with ajax, derived from second you could hide the unneeded form fields and toggle them per javascript (e.g. jQuery.toggle())) !

auto_complete_for: prevent the first item from being auto-selected

The auto_complete_for dealio from script.aculo.us is great an all, but is there a way for me to selectively disable the fact that it always auto-selects the first item in the list?
The problem is that, if I want to type my own entry that is new, and novel, I don't want the first item in the list to be auto-selected. The reason is because when I TAB out of the field, it selects, and fills the text box with that first item.
I got around that, somewhat, by making the first item in the list the same as what I'm typing, but that's not perfect either, because the auto_complete list doesn't always update with every keystroke, depending on how fast I type. I've tried setting the list refresh rate to the lowest value (1 millisecond) but no go.
What I really want is an option in "auto_complete_for" that doesn't select that first item at all - the same way that Google Instant doesn't automatically select the first suggested search phrase - you have to arrow-down to select one.
Maybe I can do this via an HTML option that I'm missing?
Looking at the source, there doesn't appear to be an option for that, but I bet if you changed line 284 of controls.js to this.index = -1; it would do what you want.
Otherwise, it might be time to look for a different autocomplete widget.
If your requirements are too far away from the available plugin, then I guess there is no point in tinkering around. Its best to write your own JS code.
You might want to consider this: https://github.com/laktek/jQuery-Smart-Auto-Complete
or this : https://github.com/reinh/jquery-autocomplete
I'll add another alternative that works great with Rails 3:
http://github.com/crowdint/rails3-jquery-autocomplete
I recently implemented auto complete for more than a field for Rails 2.0.2.
The plugin I used is:- https://github.com/david-kerins/auto_complete . Not sure if it supports Rails 3.
I have also encountered issues on implementing the above scenario and have posted questions( Implementing auto complete for more than one field in Rails ; Implementing a OnClick kind of functionality and formatting wrt Rails Partial-Views ) on stackoverflow for the same, I have been lucky on getting things working for me based on my requirement.
Kindly refer to these questions, they might have relevance to your requirement.

Django admin/doc/views/ all blank or broken

I'm trying to use Django's built-in admin docs feature to make writing templates easier. Supposedly if you go to /admin/docs/views you should get documentation for every view in your application. I see a list, but none of the links work:
-) Any view listed that's related to my application just goes to a blank page with nothing but the name of the view as a header.
-) The views related to admin all give me Django 404 errors when I click on them, except those that are related to the docs itself. The docs-related links also give me blank pages. (i.e. clicking /admin/doc/filters gives a blank page with nothing but "django.contrib.admindocs.views.template_filter_index" as a title, but clicking /admin/auth/user gives me a Django 404 error
The 404 errors lead me to suspect my URLconf is wrong, but all I did was uncomment the built-in lines. The relevant sections read:
# Uncomment the admin/doc line below to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
And I have no idea what to make of the blank pages. Do I need to provide some extra meta information somewhere, like I know you need to provide the get_absolute_url on models for some of the admin features to work right?
Even if no one knows the answer, any documentation on the admin docs feature would be useful -- I've been Google all over (and searching StackOverflow) and this feature seems very little-documented.
Thanks!
You need to add 'django.contrib.admindocs' to your INSTALLED_APPS in settings.py. It should already be there and commented out. Though it would be nice if the comment in urls.py mentioned it ... Source.
I've never looked at the views admin doc pages before -- I've never had a need to. B4ut you're right, they seem to be -- lacking in potential features.
If you give your views functions docstrings (documentation), that content will appear on your "blank pages".
Most -- no, all -- of the admin sites views are actually decorated member methods of admin.sites.AdminSite. I looked around, and a view of mine which uses a decorator also suffers from the 404.
The view responsible for view details starts:
def view_detail(request, view):
if not utils.docutils_is_available:
return missing_docutils_page(request)
mod, func = urlresolvers.get_mod_func(view)
try:
view_func = getattr(import_module(mod), func)
except (ImportError, AttributeError):
raise Http404
title, body, metadata = utils.parse_docstring(view_func.__doc__)
...
You can see it tries to import the view to get info from it; if the view is actually a decorator (which probably used an internal function to wrap the real view), it won't be able to import it. eg, if you do from django.contrib.admin.sites import index in a django shell, you'll get an ImportError, whereas django.contrib.admin.site.index (note the singular site) is a:
<bound method AdminSite.index of <django.contrib.admin.sites.AdminSite object at 0x...>>
Further, that last line in my snippet seems to indicate that there's a capability for finer control over what shows up on those pages, if you care to figure out the template that util.parse_docstring uses.

Resources