IMPR: Some basic react improvements

This commit is contained in:
Tony Air 2021-03-03 23:11:59 +07:00
parent 97c1f0402f
commit d269968f85
8 changed files with 70 additions and 55 deletions

View File

@ -9,27 +9,7 @@ SilverStripe\Control\Director:
SilverStripe\GraphQL\Controller: SilverStripe\GraphQL\Controller:
cors: cors:
Enabled: true Enabled: true
Allow-Origin: Allow-Origin: '*'
- '127.0.0.1:3001'
- 'localhost:3001'
- 'http://127.0.0.1'
- 'http://127.0.0.1:3001'
- 'http://127.0.0.1:3000'
- 'https://127.0.0.1'
- 'https://127.0.0.1:3001'
- 'https://127.0.0.1:3000'
- 'http://localhost'
- 'http://localhost:3001'
- 'http://localhost:3000'
- 'https://localhost'
- 'https://localhost:3001'
- 'https://localhost:3000'
- 'twma.pro'
- 'tony.twma.pro'
- 'http://twma.pro'
- 'https://twma.pro'
- 'http://tony.twma.pro'
- 'https://tony.twma.pro'
Allow-Headers: 'Authorization, Content-Type, Content-Language, apikey' Allow-Headers: 'Authorization, Content-Type, Content-Language, apikey'
Allow-Methods: 'GET, PUT, DELETE, OPTIONS, POST' Allow-Methods: 'GET, PUT, DELETE, OPTIONS, POST'
#Allow-Credentials: 'true' #Allow-Credentials: 'true'

View File

@ -4,7 +4,7 @@ After:
- webapp-options-elements - webapp-options-elements
--- ---
SilverStripe\View\SSViewer: SilverStripe\View\SSViewer:
source_file_comments: true source_file_comments: false
themes: themes:
- '$public' - '$public'
- '$default' - '$default'

View File

@ -1,6 +1,7 @@
// Add your site-wide, but not content editor typography styling // Add your site-wide, but not content editor typography styling
.bg-dark { .bg-dark {
h1, h1,
h2, h2,
h3, h3,
@ -23,4 +24,8 @@
@include clearfix; @include clearfix;
@import './types/editor'; @import './types/editor';
img {
border: 0;
}
} }

View File

@ -1,5 +1,6 @@
@import '~@a2nt/ss-bootstrap-ui-webpack-boilerplate-react/src/scss/_components/_ui.bootstrap'; @import '~@a2nt/ss-bootstrap-ui-webpack-boilerplate-react/src/scss/_components/_ui.bootstrap';
@import '~@a2nt/ss-bootstrap-ui-webpack-boilerplate-react/src/scss/_components/_ui.main'; @import '~@a2nt/ss-bootstrap-ui-webpack-boilerplate-react/src/scss/_components/_ui.main';
@import '~@a2nt/ss-bootstrap-ui-webpack-boilerplate-react/src/scss/_components/_ui.main.ss';
// Your custom variables // Your custom variables
@import '_variables'; @import '_variables';

View File

@ -18,7 +18,7 @@ use SilverStripe\Security\Member;
class SocialExtension extends DataExtension class SocialExtension extends DataExtension
{ {
private static $db = [ private static $db = [
'PhoneNumber' => 'Varchar(255)', //'PhoneNumber' => 'Varchar(255)',
]; ];
private static $has_one = [ private static $has_one = [
@ -28,7 +28,7 @@ class SocialExtension extends DataExtension
'Instagram' => Link::class, 'Instagram' => Link::class,
'Twitter' => Link::class, 'Twitter' => Link::class,
'PublicEmail' => Link::class, 'PublicEmail' => Link::class,
//'PhoneNumber' => Link::class, 'PhoneNumber' => Link::class,
]; ];
public function updateCMSFields(FieldList $fields) public function updateCMSFields(FieldList $fields)
@ -50,11 +50,10 @@ class SocialExtension extends DataExtension
$fields->findOrMakeTab('Root.Social'); $fields->findOrMakeTab('Root.Social');
$fields->addFieldsToTab('Root.Social', [ $fields->addFieldsToTab('Root.Social', [
TextField::create('PhoneNumber'),
LinkField::create('PublicEmailID', 'Public Email') LinkField::create('PublicEmailID', 'Public Email')
->setAllowedTypes(['Email']), ->setAllowedTypes(['Email']),
/*LinkField::create('PhoneNumberID', 'Phone Number') LinkField::create('PhoneNumberID', 'Phone Number')
->setAllowedTypes(['Phone']),*/ ->setAllowedTypes(['Phone']),
]); ]);
$fields->addFieldsToTab('Root.Social', $linkFields); $fields->addFieldsToTab('Root.Social', $linkFields);

View File

@ -0,0 +1,16 @@
<div id="$Name" class="form__field field<% if $extraClass %> $extraClass<% end_if %>">
<% if $Title %><label class="field__label field__label-left left" for="$ID">$Title</label><% end_if %>
<div class="field__content middleColumn">
$Field
</div>
<% if $Title && $RightTitle %>
<div class="field__label field__label-right right">$RightTitle</div>
<% else_if $RightTitle %>
<label class="field__label field__label-right right" for="$ID">$RightTitle</label>
<% end_if %>
<% if $Message %><span class="field__alert alert alert-{$MessageType} message $MessageType">$Message</span><% end_if %>
<% if $Description %><span class="field__description description">$Description</span><% end_if %>
</div>

View File

@ -1,12 +1,19 @@
# Redirect to HTTPS RewriteEngine On
#RewriteEngine On
#RewriteCond %{HTTPS} off # Redirect to no-WWW
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
# Redirect to WWW # Redirect to WWW
#RewriteCond %{HTTP_HOST} !^www\. [NC] #RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] #RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect to HTTPS
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{HTTPS} off
#RewriteCond %{SERVER_PORT} 80
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# SPDY protocol # SPDY protocol
#Header add Alternate-Protocol "443:npn-spdy/3" #Header add Alternate-Protocol "443:npn-spdy/3"
@ -17,7 +24,7 @@
# Header set Set-Cookie HttpOnly;Secure # Header set Set-Cookie HttpOnly;Secure
# Submit domain to https://hstspreload.org/ # Submit domain to https://hstspreload.org/
#Header add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" Header add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
# XSS-protection # XSS-protection
#Header add X-Frame-Options "SAMEORIGIN" #Header add X-Frame-Options "SAMEORIGIN"

View File

@ -1,12 +1,19 @@
# Redirect to HTTPS RewriteEngine On
#RewriteEngine On
#RewriteCond %{HTTPS} off # Redirect to no-WWW
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
# Redirect to WWW # Redirect to WWW
#RewriteCond %{HTTP_HOST} !^www\. [NC] #RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] #RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect to HTTPS
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{HTTPS} off
#RewriteCond %{SERVER_PORT} 80
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# SPDY protocol # SPDY protocol
#Header add Alternate-Protocol "443:npn-spdy/3" #Header add Alternate-Protocol "443:npn-spdy/3"
@ -17,7 +24,7 @@
# Header set Set-Cookie HttpOnly;Secure # Header set Set-Cookie HttpOnly;Secure
# Submit domain to https://hstspreload.org/ # Submit domain to https://hstspreload.org/
#Header add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" Header add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
# XSS-protection # XSS-protection
#Header add X-Frame-Options "SAMEORIGIN" #Header add X-Frame-Options "SAMEORIGIN"