How to make PhpStorm not auto-expand methods in a class - phpstorm

Class methods are exposed in the file system, they take up a lot of space and are not needed.
How to make them not show?

Open "Project View" panel options (right click on the panel header or click on the gear/cog icon)
Ensure that "Tree Appearance | Show Members" is unchecked/disabled.
From https://www.jetbrains.com/help/phpstorm/project-tool-window.html#title_bar_context_menu
Show Members
If this option is on, the files in the tree that contain classes turn into nodes. When such node is unfolded, the contained classes with their fields, methods, and other members of the selected item are shown.

Related

Bootstrap Tabs - trigger tabs by href link (how to trigger tab view in addition to hitting the tab itself)

For my projects section on my website I have them laid out in tabs. I have an overview tab that shows small cards with images of each of the projects. I would like to enable a feature where clicking on a project card will make "active" the respective tab.
I copied the format of the tabs by setting the following on my project card divs:
<a href="#Tab_Content_ID" data-toggle="tab" role="tab">
<div id="Project_Image"></div>
</a>
I am able to trigger the opening of that project's tab. However, the tab itself (in the tab navbar) is not selected. The overview tab is still selected (active) and thus the user can not return to the overview without first clicking on another project tab then back to the overview tab.
How can I fix this?
Project link
This is the current live version of the page. It does not reflect the changes I have made because they are still in testing. Just linking here so you can get a visual idea of what I'm talking about.
Relevant Projects Section HTML link
I can't post it in a codepen because none of the images will show.
Alright I doubt anyone will ever read this but I solved it myself. Now to be fair this is somewhat specific to my ID system but here goes
Each tab is a list item in the unordered list of the nav-tab bar. This is important because the "active" class is placed on the LIST item not the TAB itself.
Each tab content has an ID which I have titled "Project-Tab" where Project is the name of that particular project.
Each tab then links (href) to the content of that tab with an ID I have titled "Project" where project is the name of that particular project.
Now in my overview section on each of the "project cards" that I have linked to the tab content I added a class "Overview_Tab"
With that explanation here is the solution
$('.Overview_Tab').click(function(){
/* Gets the href of the clicked "project card" which is a link to the tab
content for that project. I then concatenate '-Tab' onto the end to get the
id of the associated tab (as explained above) */
var target = $(this).attr('href')+'-Tab';
// Get the parent (the list item containing that tab div) this is where
"active" needs to be placed
var target_parent = $(target).parent();
// Remove the active class on the overview tab
$('#Overview-Tab').parent().removeClass('active');
// Add active class to the target parent
target_parent.addClass('active');
});
So to generalize this you want your tab ID and tabContent ID to be the same just add '-Tab' to the end of your tab ID.
Pick any class name you want to add to the element that is replicating a tab (I picked "Overview_Tab" but you can put anything there as long as it matches between the HTML and the JS function)

Displaying image content types as grids in drupal 7?

I am currently using the Views and Display Suite modules to create a page that works as an image gallery. You click on the menu button to take you to a page (the view) that has multiple links to nodes (individual galleries).
When you click these nodes, they take you into the separate page and show all images uploaded using the "event" content type that I made.
The event content type has one field (type: image) that uses a multiupload widget, allowing for multiple file uploads.
However, the images on the node are displayed within divs, so they all have their own rows basically. I would like to know if it was possible to put them all into grids, and if so; how? I tried using display suite, but I only have that one field to work with.
If you want to get a fully customized page and arrange the fields just like you want, use the theme suggestions.
For a node of type "event", as you said, it would be node--event.tpl.php. You can duplicate the code inside the base template node.tpl.php of your parent theme (or if you don't have one, of Bartik for example) to have a good starting material.
Just rearrange the div, the tags, the variables as your convenience, add some custom CSS to make your grid, and you should be done!
I hope it helps.

Dynamically changing component reference

This seems simple enough but I can't quite think of how to actually do it...
In IBM Web Content Management (WCM) version 7 I have a Presentation Template (PT) which calls a Menu Component to display some content items.
I also have some (static) links on the sidebar which I want to basically just change the menu component that is being used, and that's it.
So for example...
In the PT:
[Component name="Main Page"]
When I click on a link, I want the exact same PT to be displayed except I want it to use:
[Component name="Next Page"]
Basically, Main Page and Next Page are showing the same content items, they just have different filters on them (so they appear to be different pages). The "Main Page" shows "everything" and then if you click on a link it's suppose to only show a subset of that.
I can't quite figure out how to connect the link to the PT to change it. I've thought about using JavaScript or JSP to simply rewrite the HTML, but even then I'm not sure how I set it up to say that: "if the link has been clicked, rewrite the HTML" because I'm not sure what to even point the link to, or pass through the link.
I thought about creating different content items with different PTs to link to, but there are about a dozen links (and therefore a dozen different Menu Components that I want to use), so I thought it might be better in the long run to just use 1 dynamic PT (in case the number of links grows).
It is only that one component that needs to be changed in order to display how I need for every link though.
Any ideas how to go about doing this?
So this is how I resolved this:
I created a component reference element in the content items called "menuComp" and then I set that to point to the appropriate Menu Component for each particular page.
In the presentation template, I removed the component reference and changed it to an [Element] tag which used key="menuComp".

How to hide class on click and display an other, all through a site?

I have a site on which I use several divs with one class, which are displayed, and severals divs with an other class which are hidden.
I would then like to have two buttons, which I can use to toggle between which one of the two classes are displayed, with the button for the currently displayed class beeing inactive.
When the button is clicked I would like it to take effect all through the site, so the correct class is also displayed or hidden on other pages on the site.
To simplify:
So if I click button A, class A is displayed all through the site, and button B is hidden. If I then click button B, class B is displayed all through the site, and button A is hidden.
Any ideas to an easy solution for this?
Since new UK legislation requires you to tell the users of the website about all cookies the website stores on their machine, I would recomend you use a session variable, you could use $_SESSION['class']="class1"; using PHP or you could use Session["class"] = "class1"; in C#, you could then check that session variable using an if statement by doing:
if($_SESSION['class'] == "class1")
{
// show class 1
}
else
{
// Show class 2
}
Te above code will work in C# by replacing the $_SESSION['class'] with Session["class"] To show or hide a div, you could either do it server side by adding the different styles in problematically or you could use javascript, though I'm not sure how you'd gain access to session variables via JavaScript since they are server side. JQuery would be a good library to use for showing/hiding DIVs though.
I'd probably store the current state in a cookie if it were me. Then just display/hide as it fits the users current state.

Using a single shared element across multiple partial views

I have a basic ASP.Net MVC 3 application which has a number of controllers and a number of actions (and subsequently views)
A common feature of the application is to show a pop-up dialog window for basic user input. One of the key features of this dialog process is a faded mask that gets shown behind the dialog box.
Each of these dialog window controls is in a separate Partial View page.
Now, some view pages may use multiple dialog boxes, and therefore include multiple partial views in them - which as is would mean multiple instances of the "mask" element.
What I am trying to find a solution for is to only need to create one instance of a "mask" element regardless of the number of dialog partial views I include, and then the script in each partial dialog will have access to this element (so basically it just needs to be on the page somewhere)
The only real idea I have come up with so far is to add the "mask" element to the master page (or in the original view page) and this will mean it only gets added once. The problem here is that it will be added even when it is not needed (albeit one small single element)
I can live with this, but I would like to know if there is a better way to handle these kinds of scenarios?
A quick idea that came to mind is some kind of master page inheritance hierarchy, So I may have a DialogMasterPage that inherits from the standard current master page. How does that sound for an approach?
Thanks
To do something like this, where each module can register their need for a certain thing in the master page, you can use HttpContext to store a flag of whether you need to write the mask div, and just set that property in each partial. At the end of the master page, if the flag is set, you can then write the mask div if its set to true.
Obviously to make this cleaner you could wrap it all in an HtmlHelper extension or something.
My initial thought is for you to use something like jQuery UI where it handles the masking for you or if you are using something custom you can load the content for the dialog via ajax then show it in the single dialog on the master page.