Salesforce communities how to edit CSS - salesforce

I need help in how to identify which .Class CSS in communities I have to edit?
I am able to inspect the what changes needs to be done but unable to understand that in communities how do I edit it as I cannot find the class in it.Issue with button.
I am able to inspect it, but when I try to edit my changes made to communities, I am unable to find .slds-size_2-of-12 in communities. I am trying to make the changes from this Edit Css Make changes in communities. Please any one can guide me a little.

If the buttons come from aura/lwc custom code you should be able to set CSS on that component's level and it'lll override community defaults.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_css.htm - empty file should be generated for you automatically
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_components_css - there will be no empty file, create one in same directory as rest of component, with same name (myComponent.js, myComponent.html -> add myComponent.css). Here's a bit advanced example: https://salesforce.stackexchange.com/a/339936/799
If you're after community-wide change - in the Builder go to Security "tab" and there should be a menu to "edit head markup", you can paste some CSS overrides here. For example use this to hide Chatter "+ Follow" button on all pages. Since it's standard - you couldn't do it in component-level CSS.

Related

Admin-on-rest: how to decrease button spacing and how to edit page without ID in url

I started with admin-on-rest recently and I love what it brings. However, I am stuck on 2 issues and I was hoping to get some help:
Question 1
I created a custom theme with custom color pallette etcetera. How can I reduce the spacing around buttons? You can see it on the demo here: https://marmelab.com/admin-on-rest-demo/#/customers/121, the save button has an indent of maybe 20-30 pixels. Can I remove this and align the button with the input fields, title, etcetera?
Question 2
What is the best approach for creating an /#/user/details/ view for example, where users can edit their own account details, re-using the EDIT component? I have now added this resource:
<Resource name="user/details" edit={EditDetails} />
I can edit the account by going to /#/user/details/ID (replacing ID with the actual user ID). But I don't want to expose the ID. Better yet, the SPA doesn't need to know about the ID at all, because the API can understand a PUT request to /user/details/ as a request to update the current user details. So I don't actually need the SPA to send or need this ID. Any ideas on this?
Question 1: https://marmelab.com/admin-on-rest/Theming.html#overriding-a-component-style
Customizing the Toolbar which contain the button will require a bit a of work in versions 1.*.*. You'll have to create a custom Toolbar using the original as a starting point (https://github.com/marmelab/admin-on-rest/blob/master/src/mui/form/Toolbar.js) and use it as the toolbar prop for your form (https://marmelab.com/admin-on-rest/CreateEdit.html#toolbar). This will be a lot easier in v2.
Question 2: this can be achieved using a custom restClient. In a nutshell, intercept calls which target the user resource and build the url yourself, not forgetting to handle the response.
However, for such a thing, I would advise against using the admin-on-rest mechanisms as it seems users are not really a resource but an application concept. As such you might want to handle this in a custom page with fetch by yourself.

How do I modify Drupal's Admin Screens?

I'm looking to edit Drupal's admin pages.
Some of the things I'm trying to achieve:
Remove is the the filter setting on the Content page/node/view. In other words, if I go to to the Content page and I filter by a certain type of node, then I leave that page, then come back, the filter setting is saved, I'd like it to reset each time I visit the Content page.
I would like to modify some of links associated with these pages, as an example on that Same Content page, the titles of the pages are linked to their 'front-end' views, I'd rather have them link to their 'edit' screens.
While I have been successful in modifying the front-end theme of Drupal, by editing the actual php files. I can't find the the same php files for the Admin theme. In our case we are using Seven (7.21). I've read something about views, and thought maybe the entire Admin theme is built as views, aka there no php files involved like the front-end theme has, but under the Views section I did not find any either. I'm still pretty new at this and coming from the Wordpress world, this is a Drupal is a lot different.
The logic for that section of the admin area is at (from the public root):
/modules/node
Specifically "node.admin.inc"
That being said, I don't recommend editing core scripts, as they will be overwritten when you update the core.
You could explore making your own module to supplement that page, or your own view or explore some pre-made modules, such as "Admin Views"
Find de view displayed and go to its configuration :
1 - Edit configuration view like suggested here : https://drupal.stackexchange.com/questions/44440/how-to-remember-exposed-filter-choices
2 - Rewrite output views to rewrite link : field https://www.drupal.org/node/1578524
Another option is to create and use your own dashboard/views to achive like you want http://definitivedrupal.org/suggestions/creating-custom-administrator-view-content
also you can see contrib module : https://www.drupal.org/project/admin_views
You don't have to use that default content overview page at all. Make your own instead:
Make a page view (you have to install views module if you already did not: https://www.drupal.org/project/views) and use table layout. Make sure that page paths starts with "admin" so it will use admin theme. Also pay attention about permissions, so only specific set of users (admins) can use it.
For that view you can freely select what columns you what to show. You can also allow ordering by any column and action if you click on some field.
Use exposed filters to add filtering form, again add any filters you need. You can even set the form to use AJAX, to do auto-submit when some filter field is changed, include reset button and more. Also for every exposed filed you can select (at fields settings) should it remember it's value or not.
At end, edit admin menu and add your new page to it so it will look and act as default one but will offer much more functionality. You can even totally remove default one from the admin menu.
Views module is very powerful, not only for front-end but also for back-end content handling.

2sxc: How to disable the quick insert hover items?

For the 2sxc DNN module: Is it possible to disable the "quick insert" menu (with "add content module" and "add app module") that appears when I hover over ANY module or pane on the page...whether in Edit mode or not? See screenshot:
Screenshot
I only use the Content module in a few areas and DNN's core HTML module for the rest of the content. It's very confusing to my editors. They keep accidentally adding more Content modules to the page and it's just visually distracting if not needed/wanted. It would be nice to have a choice in whether this feature is enabled. Thanks!
For now there is no real switch to do this, but you can easily do it yourself.
There are some unique css classes. If you target them in your CSS, you can make it go away. I would need more time to figure out exactly which ones they are, but I'm sure you'll figure it out.
As #iJungleBoy recommended I did it with CSS using the Snipped Inject App. Unfortunately this App also adds some menus i don't want. This is my CSS rule:
.sc-content-block-menu, .DnnModule-7777 .sc-menu { display: none !important; }
These answers are old - you can now do it by adding an attribute to any dom-element as described here: https://github.com/2sic/2sxc/wiki/Html-Js-%24quickE

Drupal 7 - Newly added custom page--*.tpl refuses to render

I am working with Drupal 7 and need to create some alternate page tpl's so that I can have pages full width as well as a page with one right sidebar. I have read the documentation and scoured the net and at this point am totally stumped.
Step 1: I created a new content type called test and made it a basic page.
Step 2: I went to the template.php file and added the following code for the pre_process page function:
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__'. $vars['node']->type;
}
Step 3: I created a new page named page--test.tpl.php
Step 4: In admin > configuration > I cleared the site cache
Step 5: Epic failure... the newly created page does not render and the page.tpl.php is still displaying. I tried different browsers & cleared cache to no avail. I don't know what I did wrong as my procedure seems to follow the correct steps that I have studied.
A search here landed me at custom page-xxxx.tpl.php doesnt works but the suggestion there is to implement the same preprocess code that I have already installed.
I found some great information at https://drupal.stackexchange.com/questions/36054/how-to-have-a-another-page-tpl-php-file-in-drupal-with-different-regions-and-blo which enabled me to solve this issue.
The solution:
Instead of naming your custom page page--yourcustompagename.tpl.php use a format like this: page--node--23.tpl.php If you are unsure of the node number of your custom page navigate to the content section and hover your mouse over the edit option for your custom created basic page and Drupal will display the node number for you.
As mentioned in one comment you will also need to clear your cache by clicking the clear cache button in Configuration > Performance > Clear Cache. You should also clear the theme registry as mentioned in a comment above. A helpful tool I found for clearing the theme registry is the Magic Module which you can find at https://www.drupal.org/project/magic After you install this module go to Appearance > (Your Active Theme) Settings > Development Enhancements and check the box for "Rebuild Theme Registry on Reload"

Drupal 7 - How to create custom admin menu for client management of content

I'm trying to find the best way to create a user friendly admin menu for my client on the site I am building. So far I have been able to set access rights to the various types of content which I would like the client to edit, however this has some drawbacks in that I can't set provide access to individual blocks and the content overview page is wayy too confusing for the client.
Instead I would like to provide a structure like the following:
Admin Menu
Services
Manage
Edit page header block
Developments
Manage
Edit page header block
Private commissions
Manage
Edit page header block
Each Manage option would take the client to a page like the Content overview page in the standard admin but it would automatically filter the results to include only the relevant content type e.g. the Manage option for developments page would show the user a list of the current developments and an option to Add a new one.
The Edit page header block options would take the user to the edit page for the relevant page header block.
Is this possible and if so how?
Any advice would be really appreciated.
Thanks
Have you checked out the Quickbar module?
Your description might be a little hard to understand what you're trying to accomplish, but if I get it right, you're trying to do a very custom "view" of the content pages. If you have to code it, then it's gonna take a long time.

Resources