I have N modules that use same dropdown list (data I take from the server),
I want do something generic when I write #display.X()
that display the dropdown that I created,
what's the best practice to do that?
that's ok write the code into Themes -> TheAdmin -> Views -> X.cshtml?
Related
So I have a part of my game where the character is selecting an area of the map. And it opening up a panel. I have made it so that happens but an=m now stuck on the other part of it. I want only certain area of the map to be intractable, so that I can bar the player from selecting areas of the map that they aren't ready for. I have no idea how to make game objects in the game uninteractable. I have looked on Stack overflow, Youtube an d the Unity API to no success. Can someone help me with that.
How to make things un-interactable will vary depending on your situation. I'll be presuming that you're map is broken up into a grid of sorts.
The basic setup would involve a bool, probably called 'CanAccessZone'.
Then you'll need a class, to store any access info and popup logic, by popup logic I mean make the element either non-interactable or show a popup, with the shown popup being dependant on 'CanAccessZone'. This class can then be set up by your Map class when the level is loaded, or you could let the popup class grab the necessary values from the Map class.
If you're using Unity's UI buttons for the map pieces, then you could set interactable to false, until you want to let the player access the zone. If you want to display a popup informing the player that they can't access the zone, then your button will be interactable, but the click will delegate to your popup logic method.
It's a similiar principle if you're using gameobjects as buttons. You'd be using any of the OnMouse events to handle click events. https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
Hopefully this'll lead you in the right direction.
I have a Widget a_i that relies on a base Widget b. b contains Javascript that a requires to work.
Currently, the widgets are included on a page like so:
getHomeR = defaultLayout $ do
b
a_1
a_2
I want to automatically include b if a_i is used but only do this once for any particular handler run.
Widget appears to use IO underneath - can I use this to set some kind of flag which allow b only to be included once? Is there already functionality to set some kind of flag that is exclusive to a single handler thread?
I think that's the purpose of widget, to allow to insert javascript only once. Your use case seemt to correspond to the described there. You should use addScript in a and it should be only added once.
Plone 4.3.1 + Dexterity (p.a.dexterity 2.0.8, p.dexterity 2.1.3)
Folder structure: /Plone/A/B
I want A to be visible to loggedin users, and B to be manageable by userx (meaning he/she can modify/add/etc).
Usual approach:
A -> sharing tab -> logged in -> can view
B -> sharing tab -> userx -> can add
Then you go to B and you can do everything BUT add content.
But, if you give userx 'Contributor' role on the portal, it works. So, the role that he/she needs on the context is 'Contributor'. Ok, let's check it!
Go to debug shell, traverse to folder, check local roles: everything's ok! The user has the local role.
After a lot of attempts and combinations of settings I found that this works:
A -> add new menu -> restrictions -> change "use parent settings" to "use site default"
B -> add new menu -> restrictions -> "use parent settings"
Aaaaand... it works!
If I remember well, it never worked like that? Is this a regression that has been fixed later?
I think this is the bug we fixed on plone.app.dexterity 2.1.2.
https://github.com/plone/plone.app.dexterity/pull/127
You can upgrade to this version also on Plone 4.3.
I have a simple ContactEditPanel which contains a form and a number of textfields. Up until now I included an AjaxSubmitLink in this panel which, if the form content is valid, saves/updates the Contact instance contained in the Panel model. So far so simple. However now I'd like to remove the link in order that I may, depending on the context in which I use the ContactEditPanel, place the submit link at different levels of my overall component hierarchy. For instance in one context I'd like to use to flip between ContactEditPanel and ContactViewPanel with a bar of actions above the current view (edit | save , cancel). Another context would be to use ContactEditPanel in a standalone way (maybe part of a multi-step process) with just a save link below.
I was contemplating refactoring my ContactEditPanel to extends FormComponentPanel rather than Panel as described here but I'm not sure whether this is the right approach and I'm having trouble wrapping my head around this.
Any help would be most appreciated!
Many Thanks,
A
Your using the panel like a FormComponent so extend FormComponentPanel, it will allow you to keep all the validation you write contained to the component and also allow you to reuse it as you wish.
Just think of it as you've created a new FormComponent, like a TextField or DropDownChoice.
Is there a hook or preprocess function that I can access to write my own theming function for a drupal menu (in this case, primary links)?
I have a rather complex menu structure that requires a little extra markup than I'm currently getting by just rendering the menu items in a block (involving sub-menus with a little custom markup) and really need to get access to build the menu's content variable myself, ideally from an array that has all the primary links and their children in scope.
While it may not be the best solution, it is one that worked quite quickly and painlessly:
Drupal keeps a cached version of all your menus in the cache_menu table, I ran a this query to retreive a serialized string containing all the contents of the menu:
SELECT data FROM menu_cache WHERE serialized = 1 AND cid LIKE 'links:primary_links:%';
Substitute primary_links for whatever the name of your menu is and call unserialize on $row->data to get a structured array of everything you should need to build a custom menu.
I call a function in hook_preprocess_block that swaps the content of the menu block with my own and everything seems to be working fine.