Access Session in Leaf template - vapor

I have a question regarding the Leaf template engine.
How can I access the Session values in the Leaf Template?
For instance to loop through Flash messages like in Laravel: https://laravel.com/docs/5.3/redirects#redirecting-with-flashed-session-data
I can't find a solution to accomplish this.
Thanks in advance

The latest version of Vapor includes the request by default when rendering views. Therefore you'll be able to access the session using
#(request.session) // in the latest version of Vapor

Related

How do you set the due date using the D2L REST API?

I need to be able to create a new assignment with a due date and to be able to update an existing assignment with a due date. I have gone through the documentation on the website but its still not clear to me how we would need to do that. Any advice would be appreciated.
I believe that, when you use the API route to create a new dropbox folder on the LMS you provide the due date (among other properties) in the JSON structure you provide the call. This is also true of the route to update a dropbox folder's properties.

Customizing redmine issue entry

Well, the powers that be would like Redmine to be aware of the data in one of our other systems so issues can be auto assigned to staff based on our business application's parcel id's.
Until now we had a call tracking system written from scratch. I'd like to bastardize Redmine since it comes so close to meeting all user requirements. I think if I get pointed in the right direction I can hook into Redmine some already written javascript and already existing webservices to pull the necessary data to display it on a Redmine ticket at the time of ticket creation. I know that Redmine is highly customizable, but I don't know where to begin. I already checked for existing plugins to do this and I found none.
Any help would be greatly appreciated.
I hope I understand what you want.
You can add custom_field or write a migration to add a new column to table issues and patch issue form (you can use redmine hooks http://www.redmine.org/projects/redmine/wiki/Hooks_List). I prefer second way because it does not depend on Redmine settings.
You should add in plugin a route and method into issues_controller. This action will get AJAX request with ParcelID from the view (issue form) and proxy it to external server. The response should be user email (I think only this info is common for users in Redmine and External server). The action should find appropriate user in Redmine and return user_id to the view.
Patch issue form: add new input Parcel ID and add JS code. JS code should send AJAX after ParcelID loses focus and setup Assignee if request returns user_id.
some notes:
I don't think that you will manage to communicate with external server directly (without controller) because Server can return own user_id or user_email but view will not manage to setup Assignee using this attributes.
I think it is necessary to care about performance because JS code will start at least two requests (View<->Redmine, Redmine<->External Server)
hope it helps you

Umbraco Accessing Author Email

I am trying to output the node's creator or author email via Razor.
I notice Umbraco has a pagefield built in for "creatorName" and I have tried to use this to find the user, and then access the email, but I'm having no luck. I've had a look at the Member and Membership APIs but most of the examples are outdated or expired and I am using v6.
Could anyone point me in the right direction for this please? (or is it even possible?)
Note: users and members are different, and have a different API.
You probably want something like:
#{ var u = new User(currentPage.CreatorID); }
#u.Email;
Note: This will query the database for the user data.
This is for 4.x but I Think 6.x is the same. (or at least backwards compatible)

NEO4J Rest API: Create or update

I'm using neo4j 1.8.2. My nodes have a property that I used as an identifier. Is possible update the other properties if a node with that identifier exists or create it otherwise using only one request?
You should index that property and use the index to search for the node and create if not present or update otherwise. See the doc here
It would require two requests though, I'm not sure you can do it only with one using the REST API. You'd probably need to write your extension or plugin (doc here) and perhaps use the
pessimistic locking if you really need a single request.

Orbeon: getting all input fields to display

I'm trying to use Orbeon 3.9 CE to create an editor for XML documents. I've hit a problem in that the xforms fields I've created for the various attributes don't show up in the web form if the existing input XML document does not have them. I've searched Stack Overflow and the Orbeon doc and wiki but haven't been able to find a setting to fix this.
This is implemented according to the specification: if the ref resolves to an empty sequence (or "empty nodeset" in the XPath 1.0 parlance used by the XForms 1.1 spec), then the control is considered non-relevant. There is no provision for having the node created automatically if missing. So this would need to be done either:
Outside of XForms, in a phase of pre-precessing of the XML to add missing element or attributes.
In XForms, after the instance is loaded, by inserting nodes in the instance as appropriate.
Unless you need to add just a few nodes, the first option is most likely more appropriate.
#avernet's response is correct.
Somebody asked a similar question on this thread.
The recommendation I made was to create an XBL component to handle this automatically. I suggested a first version of such a component, more as a suggestion than as a final, usable solution. But that might help you.

Resources