Skip to content

Commit

Permalink
Merge pull request #231 from younginnovations/1307-guide-page-ui
Browse files Browse the repository at this point in the history
1307-guide-page-ui
  • Loading branch information
man-git007 authored Mar 22, 2021
2 parents 832e0f3 + 1b5688b commit 4ecc5eb
Show file tree
Hide file tree
Showing 47 changed files with 2,975 additions and 175 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apk --update add \
php5-dom \
php5-curl \
php5-xml \
php5-gd \
supervisor \
git \
curl \
Expand Down Expand Up @@ -93,6 +94,12 @@ RUN composer dump-autoload --optimize \
&& chmod -R 777 /var/www/olc/storage \
&& chmod -R 777 /var/www/olc/public \
&& touch /var/www/olc/.env \
&& cp /var/www/olc/public/fonts/opensans.afm /var/www/olc/vendor/tecnickcom/tcpdf/fonts \
&& cp /var/www/olc/public/fonts/opensans.php /var/www/olc/vendor/tecnickcom/tcpdf/fonts \
&& cp /var/www/olc/public/fonts/opensans.z /var/www/olc/vendor/tecnickcom/tcpdf/fonts \
&& cp /var/www/olc/public/fonts/opensansb.afm /var/www/olc/vendor/tecnickcom/tcpdf/fonts \
&& cp /var/www/olc/public/fonts/opensansb.php /var/www/olc/vendor/tecnickcom/tcpdf/fonts \
&& cp /var/www/olc/public/fonts/opensansb.z /var/www/olc/vendor/tecnickcom/tcpdf/fonts \
#country site -- Tunisia / tn
&& mkdir -p /var/www/country-tn \
&& cp -R /var/container_init/site_content/. /var/www/country-tn \
Expand Down
24 changes: 22 additions & 2 deletions app/Http/Controllers/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Http\Services\LocalizationService;
use App\Http\Services\Page\PageService;
use Laravel\Lumen\Routing\Controller as BaseController;
use Spipu\Html2Pdf\Html2Pdf;

/**
* Class PageController
Expand All @@ -24,17 +25,19 @@ class PageController extends BaseController
* @var ResearchAndAnalysisService
*/
private $researchAndAnalysisService;

private $pageToPDF;
/**
* @param PageService $page
* @param LocalizationService $lang
* @param ResearchAndAnalysisService $researchAndAnalysisService
*/
public function __construct(PageService $page, LocalizationService $lang, ResearchAndAnalysisService $researchAndAnalysisService)
public function __construct(PageService $page, LocalizationService $lang, ResearchAndAnalysisService $researchAndAnalysisService,Html2Pdf $pageToPDF)
{
$this->page = $page;
$this->lang = $lang;
$this->researchAndAnalysisService = $researchAndAnalysisService;
$this->pageToPDF=$pageToPDF;
view()->share('currentLang', $lang->getCurrentLang());
}

/**
Expand Down Expand Up @@ -195,6 +198,23 @@ public function guides()
return view('page.guides', compact('page', 'hideSearchBar'));
}

/**
* Downloads pdf file
*
* @throws \Spipu\Html2Pdf\Exception\Html2PdfException
* @throws \Throwable
*/
public function guidesDownload()
{
$guidePage= view('page.guide-download')->render();
// $this->pageToPDF->setTestIsImage(false);
$this->pageToPDF->setDefaultFont('OpenSans');
$this->pageToPDF->writeHTML($guidePage);

//D is for download
$this->pageToPDF->output('guide-page.pdf', 'D');
}

/**
* Research and analysis page
*
Expand Down
13 changes: 13 additions & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ function () use ($app) {
$app->get('how-to-use', ['as' => 'how-to-use', 'uses' => 'PageController@howToUse']);
$app->get('research-and-analysis', ['as' => 'research-and-analysis', 'uses' => 'PageController@researchAndAnalysis']);


/*
|--------------------------------------------------------------------------
| Download Pages
|--------------------------------------------------------------------------
|
*/
$app->get('guides/download', ['as' => 'guides.download', 'uses' => 'PageController@guidesDownload']);





/*
|--------------------------------------------------------------------------
| Auth
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"barryvdh/laravel-debugbar": "^2.2",
"barryvdh/laravel-snappy": "^0.3.1",
"vsmoraes/laravel-pdf": "^1.0",
"daltcore/lara-pdf-merger": "^2.0.6"
"daltcore/lara-pdf-merger": "^2.0.6",
"spipu/html2pdf": "^5.2"
},
"require-dev":{
"phpunit/phpunit": "~4.0",
Expand Down
121 changes: 119 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions public/css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Errno::ENOENT: No such file or directory @ rb_sysopen - resources/sass/login.scss
Backtrace:
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin/compiler.rb:454:in `read'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin/compiler.rb:454:in `update_stylesheet'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin/compiler.rb:209:in `each'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin/compiler.rb:294:in `watch'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/plugin.rb:109:in `method_missing'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/exec/sass_scss.rb:358:in `watch_or_update'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/exec/sass_scss.rb:51:in `process_result'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/exec/base.rb:50:in `parse'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/lib/sass/exec/base.rb:18:in `parse!'
/Library/Ruby/Gems/2.3.0/gems/sass-3.7.4/bin/sass:13:in `<top (required)>'
/usr/local/bin/sass:22:in `load'
/usr/local/bin/sass:22:in `<main>'
*/
body:before {
white-space: pre;
font-family: monospace;
content: "Errno::ENOENT: No such file or directory @ rb_sysopen - resources/sass/login.scss"; }
Loading

0 comments on commit 4ecc5eb

Please sign in to comment.