Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Theme] Support for screenshots #4837

Merged
merged 5 commits into from
Apr 21, 2016
Merged

Conversation

pamil
Copy link
Contributor

@pamil pamil commented Apr 20, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets -
License MIT

@adamelso
Copy link
Contributor

Ah, the one thing that was missing from my April Fool's PR #4669 👍 . Speaking of, while working on it I couldn't see how to add the theme via the admin. I had to manually create a database record, then update the current channel to reference it.

*
* @return BinaryFileResponse
*/
public function streamScreenshotAction($themeId, $screenshotNumber)
Copy link
Contributor

@aramalipoor aramalipoor Apr 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about $screenshotCode? e.g. homepage, product, cart, etc. which can be equivalent to it's filename screenshots/CODE.jpg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main issue here is that we can have both screenshots/backend/product.jpg and screenshots/frontend/product.jpg at the same time. main.jpg also is a valid screenshot path as it's the file in theme root directory

Copy link
Contributor

@aramalipoor aramalipoor Apr 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about restricting the convention like:

/screenshots/main.jpg
/screenshots/backend-product.jpg
/screenshots/frontend-product.jpg
  • Only one-level directory
  • Screenshots under /screenshots
  • Code is the same as filename (+extension?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether we should enforce that convention, what do you think about referencing to the screenshots by a hash generated from their paths?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what I was looking for in this was that we can somehow provide a developer-friendly way to ask for a screenshot. e.g. In themes tables lets show homepage.jpg. Hmmm, it needs more thinking I guess.

@@ -89,6 +90,20 @@ private function addOptionalParentsList(ArrayNodeDefinition $rootNodeDefinition)
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
private function addOptionalScreenshotsList(ArrayNodeDefinition $rootNodeDefinition)
{
$parentsNodeDefinition = $rootNodeDefinition->children()->arrayNode('screenshots');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$screenshotsNodeDefinition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too good at copypasting 😿

@pjedrzejewski
Copy link
Member

Nice!

@pamil pamil changed the title [WIP] [Theme] Support for screenshots [Theme] Support for screenshots Apr 21, 2016
try {
return new BinaryFileResponse($screenshotPath);
} catch (FileNotFoundException $exception) {
throw new NotFoundHttpException(sprintf('Screenshot "%s" does not exist', $screenshotPath), $exception);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dot at the end of exception message :)

@pjedrzejewski pjedrzejewski merged commit fdb14b0 into Sylius:master Apr 21, 2016
@pjedrzejewski
Copy link
Member

Thanks Kamil!

@pamil pamil deleted the theme/screenshots branch April 21, 2016 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants