-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
about dialog for selected components (incomplete)
- Loading branch information
Showing
24 changed files
with
474 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace FormTools; | ||
|
||
|
||
|
||
class Request | ||
{ | ||
|
||
// extremely simple first kick at the can for getting a file from a URL | ||
public static function getUrl($url) | ||
{ | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
curl_setopt($ch, CURLOPT_URL, $url); | ||
$result = curl_exec($ch); | ||
curl_close($ch); | ||
|
||
return $result; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
/** | ||
* This is used for the new (React) client-side code. It provides as much info of the current user, depending on whether | ||
* they're logged in or not, plus localization strings and other general info. | ||
*/ | ||
require_once("../library.php"); | ||
|
||
use FormTools\Core; | ||
use FormTools\Request; | ||
|
||
Core::init(); | ||
|
||
$data = array( | ||
"error" => "unknown_action" | ||
); | ||
|
||
switch ($_GET["action"]) { | ||
case "init": | ||
$data = array( | ||
"is_logged_in" => Core::$user->isLoggedIn(), | ||
"i18n" => Core::$L, | ||
"constants" => array( | ||
"root_dir" => Core::getRootDir(), | ||
"root_url" => Core::getRootUrl(), | ||
"data_source_url" => Core::getFormToolsDataSource(), | ||
"core_version" => Core::getCoreVersion() | ||
) | ||
); | ||
if ($data["is_logged_in"]) { | ||
$data["user"] = array( | ||
"account_id" => Core::$user->getAccountId(), | ||
"username" => Core::$user->getUsername() | ||
); | ||
} | ||
break; | ||
|
||
case "get_component_info": | ||
if (!in_array($_GET["type"], array("core", "api", "module", "theme")) || empty($_GET["component"]) || !is_string($_GET["component"])) { | ||
break; | ||
} | ||
|
||
$url = Core::getFormToolsDataSource(); | ||
switch ($_GET["type"]) { | ||
case "core": | ||
$url .= "/core/core.json"; | ||
break; | ||
case "api": | ||
$url .= "/api/api.json"; | ||
break; | ||
case "module": | ||
$url .= "/modules/{$_GET["component"]}.json"; | ||
break; | ||
case "theme": | ||
$url .= "/themes/{$_GET["component"]}.json"; | ||
break; | ||
} | ||
|
||
$data = json_decode(Request::getUrl($url)); | ||
break; | ||
} | ||
|
||
|
||
header("Content-Type: text/javascript"); | ||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | ||
|
||
echo json_encode($data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './Changelog.scss'; | ||
import { formatDatetime } from '../../core/helpers'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import DeleteIcon from '@material-ui/icons/Delete'; | ||
import VersionBadge from './VersionBadge'; | ||
|
||
|
||
const Changelog = ({ data }) => ( | ||
<table className={styles.changelog}> | ||
<tbody> | ||
<tr> | ||
<th className={styles.colVersion}>Version</th> | ||
<th className={styles.colReleaseDate}>Release Date</th> | ||
<th>Release Notes</th> | ||
<th className={styles.colGithubMilestone}></th> | ||
</tr> | ||
{data.map(({ version, release_date, desc }, i) => ( | ||
<tr key={i}> | ||
<td className={styles.colVersion}> | ||
<VersionBadge label={version} /> | ||
</td> | ||
<td className={styles.colReleaseDate}>{formatDatetime(release_date)}</td> | ||
<td>{desc}</td> | ||
<td> | ||
{/*<IconButton aria-label="Delete">*/} | ||
{/*<DeleteIcon />*/} | ||
{/*</IconButton>*/} | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
|
||
Changelog.propTypes = { | ||
data: PropTypes.array | ||
}; | ||
|
||
export default Changelog; |
16 changes: 16 additions & 0 deletions
16
src/scripts/components/CompatibleComponents/Changelog.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.changelog { | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
|
||
.colVersion { | ||
width: 80px; | ||
} | ||
.colReleaseDate { | ||
width: 180px; | ||
} | ||
.colGithubMilestone { | ||
width: 30px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import styles from './VersionBadge.scss'; | ||
|
||
const VersionBadge = ({ label }) => ( | ||
<span className={`badge ${styles.badge}`}> | ||
{label} | ||
</span> | ||
); | ||
|
||
export default VersionBadge; |
9 changes: 9 additions & 0 deletions
9
src/scripts/components/CompatibleComponents/VersionBadge.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.badge { | ||
display: inline-block; | ||
padding: 0 6px; | ||
border-radius: 3px; | ||
font-size: 9px; | ||
line-height: 16px; | ||
background-color: #01a0e4; | ||
color: white; | ||
} |
Oops, something went wrong.