Skip to content

Commit 2f92a0a

Browse files
authored
Merge pull request #329 from LibreSign/feat/preview
feat: preview
2 parents 6e30665 + d39622d commit 2f92a0a

File tree

9 files changed

+86
-38
lines changed

9 files changed

+86
-38
lines changed

.github/workflows/preview.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy PR previews
2+
3+
on: pull_request
4+
5+
concurrency: preview-${{ github.ref }}
6+
7+
jobs:
8+
deploy-preview:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Setup Node
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
16+
- name: Set up php 8.3
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 8.3
20+
- name: Set up PHP dependencie
21+
run: composer i
22+
- name: Change config.php
23+
run: |
24+
sed -i "s|libresign.coop|libresign.github.io|g" CNAME
25+
sed -i "s|baseUrl' => '/'|baseUrl' => '/site-preview/pr-preview/pr-${{ github.event.pull_request.number }}/'|g" config.php
26+
cat config.php|grep baseUrl
27+
sed -i "/'matomo_container'/d" config.production.php
28+
- name: Run composer command
29+
run: composer prod
30+
31+
- name: Deploy preview
32+
uses: rossjrw/pr-preview-action@v1
33+
with:
34+
source-dir: ./build_production/
35+
pages-base-url: libresign.github.io/site-preview
36+
deploy-repository: LibreSign/site-preview
37+
preview-branch: main
38+
token: ${{ secrets.PREVIEW_TOKEN }}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"tightenco/jigsaw": "^1.7",
77
"gregwar/captcha": "^1.2",
88
"libresign/espeak": "dev-main",
9-
"elaborate-code/jigsaw-localization": "dev-fix/use-package-default-locale",
9+
"elaborate-code/jigsaw-localization": "dev-main",
1010
"nesbot/carbon": "^3.3",
1111
"samdark/sitemap": "^2.4"
1212
},

composer.lock

Lines changed: 23 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/_assets/js/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ require('aos/dist/aos.css');
1818

1919
// === logo change
2020
if (ud_header.classList.contains("sticky")) {
21-
logo.src = "/assets/images/logo/logo-2.svg";
21+
logo.src = window.baseUrl + "/assets/images/logo/logo-2.svg";
2222
} else {
23-
logo.src = "/assets/images/logo/logo.svg";
23+
logo.src = window.baseUrl + "/assets/images/logo/logo.svg";
2424
}
2525

2626
// show or hide the back-top-top button
@@ -90,4 +90,4 @@ require('aos/dist/aos.css');
9090
document.querySelector(".back-to-top").onclick = () => {
9191
scrollTo(document.documentElement);
9292
};
93-
})();
93+
})();

source/_layouts/footer.blade.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="row">
1717
<div class="col-xl-3 col-lg-4 col-md-6">
1818
<div class="ud-widget">
19-
<a href="{{ locale_path($page, $page->baseUrl) }}#home" class="ud-footer-logo">
19+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}#home" class="ud-footer-logo">
2020
<img src="{{ $page->baseUrl }}assets/images/logo/logo.svg" alt="logo" />
2121
</a>
2222
<p class="ud-widget-desc">
@@ -89,7 +89,7 @@
8989
<div class="col-md-8">
9090
<ul class="ud-footer-bottom-left">
9191
<li>
92-
<a href="{{ locale_path($page, $page->baseUrl) }}privacy-policy">{{ $page->t("Privacy policy")}}</a>
92+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}privacy-policy">{{ $page->t("Privacy policy")}}</a>
9393
</li>
9494
</ul>
9595
</div>
@@ -120,7 +120,10 @@
120120
</script>
121121

122122
<!-- ====== All Javascript Files ====== -->
123-
<script defer src="{{ mix('js/main.js', 'assets/build') }}"></script>
123+
<script>
124+
window.baseUrl = "{{ $page->baseUrl === '/' ? '' : $page->baseUrl }}";
125+
</script>
126+
<script defer src="{{ $page->baseUrl . mix('js/main.js', 'assets/build') }}"></script>
124127
<script>
125128
document.getElementById('back-to-top').onclick = function(e) {
126129
e.preventDefault()

source/_layouts/header.blade.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="row">
44
<div class="col-lg-12">
55
<nav class="navbar navbar-expand-lg">
6-
<a class="navbar-brand" href="{{ locale_path($page, $page->baseUrl) }}">
6+
<a class="navbar-brand" href="{{ $page->baseUrl . locale_path($page, '') }}">
77
<img src="{{ $page->baseUrl }}assets/images/logo/logo.svg" alt="Logo" />
88
</a>
99
<button class="navbar-toggler" title="{{$page->t("Toggle navigation menu")}}">
@@ -15,32 +15,32 @@
1515
<div class="navbar-collapse">
1616
<ul id="nav" class="navbar-nav mx-auto">
1717
<li class="nav-item">
18-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}#home">{{$page->t("Home")}}</a>
18+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, '') }}#home">{{$page->t("Home")}}</a>
1919
</li>
2020
<li class="nav-item">
21-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}#features">{{$page->t("Features")}}</a>
21+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, '') }}#features">{{$page->t("Features")}}</a>
2222
</li>
2323
<li class="nav-item">
24-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}#about">{{ $page->t("About") }}</a>
24+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, '') }}#about">{{ $page->t("About") }}</a>
2525
</li>
2626
<li class="nav-item">
27-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}pricing">{{ $page->t('Pricing')}}</a>
27+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, 'pricing') }}">{{ $page->t('Pricing')}}</a>
2828
</li>
2929
<li class="nav-item">
30-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}#target_audience">{{ $page->t("Target audience") }}</a>
30+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, '') }}#target_audience">{{ $page->t("Target audience") }}</a>
3131
</li>
3232
<li class="nav-item">
33-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}#contact">{{ $page->t("Contact") }}</a>
33+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, '') }}#contact">{{ $page->t("Contact") }}</a>
3434
</li>
3535
<li class="nav-item">
36-
<a class="ud-menu-scroll" href="{{ locale_path($page, $page->baseUrl) }}posts">{{ $page->t("Posts") }}</a>
36+
<a class="ud-menu-scroll" href="{{ rtrim($page->baseUrl, '/') . locale_path($page, 'posts') }}">{{ $page->t("Posts") }}</a>
3737
</li>
3838
<li class="nav-item nav-item-has-children">
3939
<a href="javascript:void(0)">{{ $page->t('Language') }}</a>
4040
<ul class="ud-submenu">
4141
@foreach($page->locales as $localeCode => $localeName)
4242
<li class="ud-submenu-item">
43-
<a class="ud-submenu-link" href="{{ translate_url($page, $localeCode) }}">{{ $localeName }}</a>
43+
<a class="ud-submenu-link" href="/{{ translate_url($page, $localeCode) }}">{{ $localeName }}</a>
4444
</li>
4545
@endforeach
4646
</ul>

source/_layouts/main.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
/>
3636

3737
<!-- ===== All CSS files ===== -->
38-
<link rel="stylesheet" href="{{ mix('css/main.css', 'assets/build') }}">
38+
<link rel="stylesheet" href="{{ $page->baseUrl . mix('css/main.css', 'assets/build') }}">
3939
<link rel="stylesheet" href="{{ $page->baseUrl }}assets/build/css/ud-styles.css" />
4040
</head>
4141
<body>

source/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</p>
1717
<ul class="ud-hero-buttons">
1818
<li>
19-
<a href="{{ locale_path($page, $page->baseUrl) }}contact-us" class="ud-main-btn ud-white-btn mt-1">
19+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}" class="ud-main-btn ud-white-btn mt-1">
2020
{{ $page->t('Talk to sales') }}
2121
</a>
2222
</li>
@@ -192,7 +192,7 @@ class="shape shape-2"
192192
<img src="{{ $page->baseUrl }}assets/images/mobile_libresign.png" alt="print_main_screen"/>
193193
</div>
194194
<div class="col-lg-12 d-flex justify-content-center mt-5">
195-
<a href="{{ locale_path($page, $page->baseUrl) }}contact-us" class="ud-main-btn ud-border-btn">
195+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}contact-us" class="ud-main-btn ud-border-btn">
196196
{{ $page->t('Talk to sales') }}
197197
</a>
198198
</div>

source/pricing.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class="ud-single-pricing first-item{{ $content->isActive ? ' active' : ''}} wow
4343
</div>
4444
@endif
4545
<div class="ud-pricing-footer">
46-
<a href="{{ locale_path($page, $page->baseUrl) }}contact-us" class="ud-main-btn ud-border-btn">
46+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}contact-us" class="ud-main-btn ud-border-btn">
4747
{{ $page->t('Under Consultation') }}
4848
</a>
4949
</div>
@@ -89,7 +89,7 @@ class="ud-single-pricing first-item{{ $content->isActive ? ' active' : ''}} wow
8989
</div>
9090

9191
<div class="ud-pricing-footer text-center mt-5">
92-
<a href="{{ locale_path($page, $page->baseUrl) }}contact-us" class="ud-main-btn ud-white-btn mt-1">
92+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}contact-us" class="ud-main-btn ud-white-btn mt-1">
9393
{{ $page->t('Under Consultation') }}
9494
</a>
9595
</div>
@@ -127,7 +127,7 @@ class="ud-single-pricing first-item{{ $content->isActive ? ' active' : ''}} wow
127127
</div>
128128
</div>
129129
<div class="ud-pricing-footer text-center mt-5">
130-
<a href="{{ locale_path($page, $page->baseUrl) }}contact-us" class="ud-main-btn ud-white-btn mt-1">
130+
<a href="{{ $page->baseUrl . locale_path($page, 'contact-us') }}contact-us" class="ud-main-btn ud-white-btn mt-1">
131131
{{ $page->t('Under Consultation') }}
132132
</a>
133133
</div>

0 commit comments

Comments
 (0)