Skip to content

Add button for exporting a theme from the demo site #152

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

Closed
wants to merge 3 commits into from
Closed

Add button for exporting a theme from the demo site #152

wants to merge 3 commits into from

Conversation

komen205
Copy link
Contributor

@komen205 komen205 commented Oct 3, 2021

Description

Hey! I created this working solution, please let me know if it's appropriated. This is not a final solution.

I created json_decode.php file so JS sends the properties json and php exports it to the text area.
It was the only working solution that I could make it work.
HTML and CSS is not final, please let me know where you want me to export it.

Let me know what changes I can make and if I'm going the right path.

Fixes #144

Type of change

  • Bug fix (added a non-breaking change which fixes an issue)
  • New feature (added a non-breaking change which adds functionality)
  • Updated documentation (updated the readme, templates, or other repo files)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • Tested locally with a valid username
  • Tested locally with an invalid username
  • Ran tests with composer test
  • Added or updated test cases to test new features

Checklist:

  • I have checked to make sure no other pull requests are open for this issue
  • The code is properly formatted and is consistent with the existing code style
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [X ] My changes generate no new warnings

Screenshots

image

@komen205 komen205 marked this pull request as draft October 3, 2021 14:04
@komen205 komen205 marked this pull request as ready for review October 3, 2021 14:07
@komen205 komen205 marked this pull request as draft October 3, 2021 14:07
@komen205 komen205 marked this pull request as ready for review October 3, 2021 16:16
@DenverCoder1
Copy link
Owner

I'm having trouble testing this since it seems the code is no longer on the comparing branch.

Maybe try reopening this with a new branch?

image

Comment on lines +1 to +4
<?php declare (strict_types = 1);
$_POST = json_decode(file_get_contents("php://input"), true);
var_export($_POST['json'],false);
?>
Copy link
Owner

Choose a reason for hiding this comment

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

There should be no need for fetching any webpages to output the export data.

All it needs to do is create a string in the required format, which can be done with JavaScript code.

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 was thinking about that, but don't we have to format the string to PHP format? Like change the : to =>

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, but there's no reason you can't use JavaScript to make the string have => in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So do we want to export just like JSON? "{"property":"#123123"} Is that ok?

Copy link
Owner

Choose a reason for hiding this comment

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

Consider the following code:

const props = {"property":"#123123", "property2":"#123456"}
const output = "[\n" + Object.keys(props).map((key) => `\t"${key}" => "${props[key]}",\n`).join("") + "]";
console.log(output);

You may want to change it up a bit, but basically in a way like this, you can convert JSON into a string that resembles PHP array format.

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.

Add button for exporting a theme from the demo site
2 participants