Skip to content

Commit

Permalink
Merge pull request #9723 from nextcloud/css4-variables
Browse files Browse the repository at this point in the history
Css4 variables migration
  • Loading branch information
MorrisJobke authored Jun 20, 2018
2 parents 9d37c19 + b188b2d commit 9b6f235
Show file tree
Hide file tree
Showing 41 changed files with 609 additions and 471 deletions.
30 changes: 15 additions & 15 deletions apps/comments/css/autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
left: 0;
display: none;
margin-top: 18px;
background: $color-main-background;
color: $color-main-text;
border: 1px solid $color-border;
border-radius: $border-radius;
box-shadow: 0 0 5px $color-box-shadow;
background: var(--color-main-background);
color: var(--color-main-text);
border: 1px solid var(--color-border);
border-radius: var(--border-radius);
box-shadow: 0 0 5px var(--color-box-shadow);
min-width: 120px;
z-index: 11110 !important;
}
Expand All @@ -22,14 +22,14 @@
padding: 5px;
margin: 5px;
cursor: pointer;
border-bottom: solid 1px $color-border;
color: $color-main-text;
border-bottom: solid 1px var(--color-border);
color: var(--color-main-text);
font-size: 11px;
font-weight: bold;
}

.atwho-view .atwho-header .small {
color: $color-main-text;
color: var(--color-main-text);
float: right;
padding-top: 2px;
margin-right: -5px;
Expand All @@ -42,18 +42,18 @@
}

.atwho-view .cur {
background: $color-primary;
color: $color-primary-text;
background: var(--color-primary);
color: var(--color-primary-text);
}
.atwho-view .cur small {
color: $color-primary-text;
color: var(--color-primary-text);
}
.atwho-view strong {
color: $color-main-text;
color: var(--color-main-text);
font-weight: normal;
}
.atwho-view .cur strong {
color: $color-primary-text;
color: var(--color-primary-text);
font-weight: normal;
}
.atwho-view ul {
Expand All @@ -67,11 +67,11 @@
.atwho-view ul li {
display: block;
padding: 5px 10px;
border-bottom: 1px solid $color-border;
border-bottom: 1px solid var(--color-border);
cursor: pointer;
}
.atwho-view small {
font-size: smaller;
color: $color-main-text;
color: var(--color-main-text);
font-weight: normal;
}
2 changes: 1 addition & 1 deletion apps/comments/css/comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}

#commentsTabView .comments .comment {
border-top: 1px solid $color-border;
border-top: 1px solid var(--color-border);
}

#commentsTabView .comment .avatar,
Expand Down
2 changes: 1 addition & 1 deletion apps/files/css/detailsView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
}

#app-sidebar .file-details {
color: $color-text-details;
color: var(--color-text-maxcontrast);
}

#app-sidebar .action-favorite {
Expand Down
24 changes: 12 additions & 12 deletions apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
.newFileMenu .error,
.newFileMenu .error + .icon-confirm,
#fileList .error {
color: $color-error;
border-color: $color-error;
color: var(--color-error);
border-color: var(--color-error);
}

/* FILE TABLE */
Expand Down Expand Up @@ -71,7 +71,7 @@
}

.app-files #app-content.dir-drop {
background-color: $color-main-background !important;
background-color: var(--color-main-background) !important;
}

.file-drag #filestable tbody tr, .file-drag #filestable tbody tr:hover{
Expand Down Expand Up @@ -140,12 +140,12 @@
#filestable tbody tr.searchresult,
table tr.mouseOver td {
transition: background-color 0.3s ease;
background-color: nc-darken($color-main-background, 3%);
background-color: var(--color-background-dark);
}
tbody a { color: $color-main-text; }
tbody a { color: var(--color-main-text); }

span.conflict-path, span.extension, span.uploading, td.date {
color: $color-text-details;
color: var(--color-text-maxcontrast);
}
span.conflict-path, span.extension {
-webkit-transition: opacity 300ms;
Expand All @@ -159,11 +159,11 @@ tr:focus span.conflict-path,
tr:hover span.extension,
tr:focus span.extension {
opacity: 1;
color: $color-text-details;
color: var(--color-text-maxcontrast);
}

table th, table th a {
color: $color-text-details;
color: var(--color-text-maxcontrast);
}
table.multiselect th a {
color: #000;
Expand Down Expand Up @@ -208,7 +208,7 @@ table th:focus .sort-indicator.hidden {

table th,
table td {
border-bottom: 1px solid $color-border;
border-bottom: 1px solid var(--color-border);
text-align: left;
font-weight: normal;
}
Expand Down Expand Up @@ -625,7 +625,7 @@ table.dragshadow td.size {
left: 0;
right: 0;
bottom: 0;
background-color: $color-main-background;
background-color: var(--color-main-background);
background-repeat: no-repeat no-repeat;
background-position: 50%;
opacity: 0.7;
Expand Down Expand Up @@ -703,11 +703,11 @@ table.dragshadow td.size {

.quota-container {
height: 5px;
border-radius: $border-radius;
border-radius: var(--border-radius);

div {
height: 100%;
background-color: $color-primary;
background-color: var(--color-primary);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions apps/files/css/upload.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
left: 0px;
position: absolute;
overflow: hidden;
background-color: $color-primary;
background-color: var(--color-primary);
}
#uploadprogressbar .label {
top: 6px;
Expand All @@ -61,14 +61,14 @@
font-weight: normal;
}
#uploadprogressbar .label.inner {
color: $color-primary-text;
color: var(--color-primary-text);
position: absolute;
display: block;
width: 200px;
}
#uploadprogressbar .label.outer {
position: relative;
color: $color-main-text;
color: var(--color-main-text);
}
#uploadprogressbar .desktop {
display: block;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/css/public.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ thead {

#header .header-shared-by {
display: inline-block;
color: $color-primary-text;
color: var(--color-primary-text);
position: relative;
top: -10px;
font-weight: 300;
Expand Down
8 changes: 8 additions & 0 deletions apps/theming/css/settings-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,11 @@
background-size: contain;
}
}

/* transition effects for theming value changes */
#header {
transition: background-color 500ms linear;
svg, img {
transition: 500ms filter linear;
}
}
8 changes: 4 additions & 4 deletions apps/theming/css/theming.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,28 @@
@if variable_exists('theming-logo-mime') and $theming-logo-mime != '' {
#theming-preview-logo,
#header .logo {
background-image: url(#{$image-logo});
background-image: $image-logo;
background-size: contain;
}
#body-login #header .logo {
margin-bottom: 22px;
}
} @else {
#theming-preview-logo {
background-image: url(#{$image-logo});
background-image: $image-logo;
}
}

@if variable_exists('theming-background-mime') and $theming-background-mime != '' {
#body-login,
#firstrunwizard .firstrunwizard-header,
#theming-preview {
background-image: url(#{$image-login-background});
background-image: $image-login-background;
background-color: $color-primary;
}
} @else {
#theming-preview {
background-image: url(#{$image-login-background});
background-image: $image-login-background;
background-color: $color-primary;
}
}
Expand Down
12 changes: 6 additions & 6 deletions apps/theming/lib/Controller/ThemingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ public function updateStylesheet($setting, $value) {
$this->themingDefaults->set($setting, $value);

// reprocess server scss for preview
$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, 'core/css/server.scss', 'core');
$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, 'core/css/css-variables.scss', 'core');

return new DataResponse(
[
'data' =>
[
'message' => $this->l10n->t('Saved'),
'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/server.scss'))
'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/css-variables.scss'))
],
'status' => 'success'
]
Expand Down Expand Up @@ -302,7 +302,7 @@ public function uploadImage(): DataResponse {

$this->themingDefaults->set($key.'Mime', $image['type']);

$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, 'core/css/server.scss', 'core');
$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, 'core/css/css-variables.scss', 'core');

return new DataResponse(
[
Expand All @@ -311,7 +311,7 @@ public function uploadImage(): DataResponse {
'name' => $name,
'url' => $this->imageManager->getImageUrl($key),
'message' => $this->l10n->t('Saved'),
'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/server.scss'))
'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/css-variables.scss'))
],
'status' => 'success'
]
Expand All @@ -328,7 +328,7 @@ public function uploadImage(): DataResponse {
public function undo(string $setting): DataResponse {
$value = $this->themingDefaults->undo($setting);
// reprocess server scss for preview
$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, 'core/css/server.scss', 'core');
$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, 'core/css/css-variables.scss', 'core');

if (strpos($setting, 'Mime') !== -1) {
$imageKey = str_replace('Mime', '', $setting);
Expand All @@ -341,7 +341,7 @@ public function undo(string $setting): DataResponse {
[
'value' => $value,
'message' => $this->l10n->t('Saved'),
'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/server.scss'))
'serverCssUrl' => $this->urlGenerator->linkTo('', $this->scssCacher->getCachedSCSS('core', '/core/css/css-variables.scss'))
],
'status' => 'success'
]
Expand Down
4 changes: 2 additions & 2 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ public function getScssVariables() {
'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'"
];

$variables['image-logo'] = "'".$this->imageManager->getImageUrl('logo')."'";
$variables['image-logo'] = "url('".$this->imageManager->getImageUrl('logo')."')";
$variables['image-logoheader'] = "'".$this->imageManager->getImageUrl('logoheader')."'";
$variables['image-favicon'] = "'".$this->imageManager->getImageUrl('favicon')."'";
$variables['image-login-background'] = "'".$this->imageManager->getImageUrl('background')."'";
$variables['image-login-background'] = "url('".$this->imageManager->getImageUrl('background')."')";
$variables['image-login-plain'] = 'false';

if ($this->config->getAppValue('theming', 'color', null) !== null) {
Expand Down
30 changes: 15 additions & 15 deletions apps/theming/tests/Controller/ThemingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,20 @@ public function testUpdateStylesheetSuccess($setting, $value, $message) {
$this->scssCacher
->expects($this->once())
->method('getCachedSCSS')
->with('core', '/core/css/server.scss')
->willReturn('/core/css/someHash-server.scss');
->with('core', '/core/css/css-variables.scss')
->willReturn('/core/css/someHash-css-variables.scss');
$this->urlGenerator
->expects($this->once())
->method('linkTo')
->with('', '/core/css/someHash-server.scss')
->willReturn('/nextcloudWebroot/core/css/someHash-server.scss');
->with('', '/core/css/someHash-css-variables.scss')
->willReturn('/nextcloudWebroot/core/css/someHash-css-variables.scss');

$expected = new DataResponse(
[
'data' =>
[
'message' => $message,
'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-server.scss',
'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-css-variables.scss',
],
'status' => 'success',
]
Expand Down Expand Up @@ -604,21 +604,21 @@ public function testUndo() {
$this->scssCacher
->expects($this->once())
->method('getCachedSCSS')
->with('core', '/core/css/server.scss')
->willReturn('/core/css/someHash-server.scss');
->with('core', '/core/css/css-variables.scss')
->willReturn('/core/css/someHash-css-variables.scss');
$this->urlGenerator
->expects($this->once())
->method('linkTo')
->with('', '/core/css/someHash-server.scss')
->willReturn('/nextcloudWebroot/core/css/someHash-server.scss');
->with('', '/core/css/someHash-css-variables.scss')
->willReturn('/nextcloudWebroot/core/css/someHash-css-variables.scss');

$expected = new DataResponse(
[
'data' =>
[
'value' => 'MyValue',
'message' => 'Saved',
'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-server.scss',
'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-css-variables.scss',
],
'status' => 'success'
]
Expand Down Expand Up @@ -648,13 +648,13 @@ public function testUndoDelete($value, $filename) {
$this->scssCacher
->expects($this->once())
->method('getCachedSCSS')
->with('core', '/core/css/server.scss')
->willReturn('/core/css/someHash-server.scss');
->with('core', '/core/css/css-variables.scss')
->willReturn('/core/css/someHash-css-variables.scss');
$this->urlGenerator
->expects($this->once())
->method('linkTo')
->with('', '/core/css/someHash-server.scss')
->willReturn('/nextcloudWebroot/core/css/someHash-server.scss');
->with('', '/core/css/someHash-css-variables.scss')
->willReturn('/nextcloudWebroot/core/css/someHash-css-variables.scss');
$this->imageManager->expects($this->once())
->method('delete')
->with($filename);
Expand All @@ -665,7 +665,7 @@ public function testUndoDelete($value, $filename) {
[
'value' => $value,
'message' => 'Saved',
'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-server.scss',
'serverCssUrl' => '/nextcloudWebroot/core/css/someHash-css-variables.scss',
],
'status' => 'success'
]
Expand Down
Loading

0 comments on commit 9b6f235

Please sign in to comment.