October: [FeatureRequest] Fork component partial to theme partials

Created on 6 Sep 2016  路  11Comments  路  Source: octobercms/october

This issue suggests adding a simple fork button to the components inspector, that copies the default component markup to the correct location in the themes partial directory to override the default markup. This makes it significantly easier to follow the process described here, especially becasue you dont have to leave the october backend.

The UI proposal might look as shown on the following image:
screenshot 2016-09-04 22 21 09

The actual implementation requires some changes to the javascript of the inspector, @daftspunk suggestied using the events api provided, but Im unsure if is capable of a modification like this.

Accepted In Progress Enhancement help wanted

Most helpful comment

@vosco88 I still think it would be a great addition, however, I wasn't able to do it (too much javascript rework involved). But it should be possible and I still think it is a nice to have feature.

All 11 comments

Been wanting to do this for a while now, thanks @alxy!

@LukeTowers Is this feature still wanted? I could try to have a look at it. Where could I find the code (either js or handlers) for the funcionality that is currently in october when you do 'Ctrl + double click' on the word 'component' in code editor the code is copied to the page/partial so I was thinking starting there.

I thought it had been?

@vosco88 I still think it would be a great addition, however, I wasn't able to do it (too much javascript rework involved). But it should be possible and I still think it is a nice to have feature.

As mentioned I could have a go at this. But do any of you @alxy @LukeTowers know where I could find the code that does the 'Ctrl+doubleclick' on component word and it forks the component partial into the code so I could get some inspiration. :)

@LukeTowers I was digging around a bit, the current functionality is that you do Ctrl+doubleclick on the word component in your layout or partial and the code is forked to your partial.

I discovered there is a hidden fork button in the editor toolbar
image
There is even a code for the funcionality in october.cmspage.js so I want to ask if this was a preparation for this feature or was intended for something else?

Because if we could use this button it would be really simple to implement with I think just some small changes to the javascript, and the workflow for the users would look like this (on top of what is already present with Ctrl + doubleclick):

  1. Select the word component in the layout
  2. Click the fork button in the toolbar

EDIT: I think you can close this one, the fork button in the toolbar does exactly what is requested in this feature request. When you select component in your layout, the fork button is shown and when you click it it forks the partial. So to me this is in and working. Sorry for the long post. Maybe be would be worth it to mention it somewhere in the documentation?

@vosco88 thanks for looking into this. I'm going to leave it open for now because I would prefer that the fork icon was by the close icon in the popup instead of in the editor. Personally I was trying to use this feature a couple months ago but couldn't remember where the button was / what the keyboard combo was and wasn't able to figure it out with a couple minutes of trying so that tells me that the current UX is not great.

@vosco88 Yeah, this has been working ever since (I remember). My proposal was to actually create the (override) partials, and not just extend the component in its current location - which is not really suitable for bigger projects.

@alxy ok I misunderstood what was this about, have better idea now
@LukeTowers what about having the fork button next to the close button on the actual inspector card and not in the popover? something like this:
image
It would save a click when you will not change the alias name, it might even be a bit easier to implement as we could give the button all data it needs when the component is created (e.g alias or component class) instead of looking for the data when it would be clicked, and use data api to fork the files.
Or what is the reason behind having it in the popover?

I don't mind having it in the short version (just the card), but it would be ideal to have it in both. Especially on mobile where it would be a bit tight to hit it without hitting the "x"

This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling.

Was this page helpful?
0 / 5 - 0 ratings