Skip to content

Commit

Permalink
Implement new look and feel
Browse files Browse the repository at this point in the history
- Using Sass and Tailwind CSS
- Moves templates to resources/views
- Simplifies admin interface / removes redundant features
  • Loading branch information
Dustin Wheeler committed Nov 7, 2017
1 parent 117b371 commit 96decb7
Show file tree
Hide file tree
Showing 124 changed files with 18,064 additions and 11,373 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ indent_size = 2
[*.yml]
indent_size = 2

[*.scss]
indent_size = 2

[Makefile]
indent_style = tab
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/.idea
/.vagrant
/node_modules/
/cache/
/coverage/
/vendor/*
/tests/coverage/*
/templates/compilation_cache
/resources/views/compilation_cache
/htmlpurifier_cache
.DS_Store
opencfp.iml
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Current release: v1.0.9
* [User Management](#user-management)
* [Clear Caches](#clear-caches)
* [Scripts to Rule Them All](#scripts-rule-all)
* [Compiling Frontend Assets](#compiling-frontend-assets)
* [Testing](#testing)
* [Troubleshooting](#troubleshooting)

Expand Down Expand Up @@ -639,6 +640,29 @@ no phpunit.xml is found in the root.
$ script/test
```

## [Compiling Frontend Assets](#compiling-frontend-assets)

OpenCFP ships with a pre-compiled CSS file. However, we now include the Sass / PostCSS used to compile front-end assets. You are free to modify these source files to change brand colors or modify your instance however you see fit. Remember, you can do **nothing** and take advantage of the pre-compiled CSS we ship. You only need these instructions if you want to customize or contribute to the look and feel of OpenCFP. Let's take a look at this new workflow for OpenCFP.

Install Node dependencies using `npm` or `yarn`.

```bash
# If you have a recent version of Node.js + npm that doesn't suck...
npm install

# If you love Facebook and balls of string...
yarn install

# If you're really awesome, do both...
don't do both
```
Now dependencies are installed and we're ready to compile assets. Check out the `scripts` section of `package.json`. A normal development workflow is to run either `npm run watch` or `npm run watch-poll` (for OS that don't have `fs-events`) and begin work. When you make changes to Sass files, Webpack will recompile assets, but it doesn't compress the output. To do that, run `npm run prod` (an alias for `npm run production`). This will run the same compilation, but will compress the output.

The main `app.scss` file is at [`resources/assets/sass/app.scss`](resources/assets/sass/app.scss). We use [Laravel Mix](https://github.com/JeffreyWay/laravel-mix) to compile our Sass. Mix is configurable to run without Laravel, so we take advantage of that because it really makes dealing with Webpack a lot simpler. Our Mix configuration is at [`webpack.mix.js`](webpack.mix.js). In it, we run our `app.scss` through a Sass compilation step, we copy FontAwesome icons and finally run the compiled CSS through [Tailwind CSS](https://tailwindcss.com), a PostCSS plugin.

TailwindCSS is a new utility-first CSS framework that uses CSS class composition to piece together interfaces. Check out [their documentation](https://tailwindcss.com/docs/what-is-tailwind/) for more information on how to use the framework. We use it extensively across OpenCFP and it saves a lot of time and keeps us from having to maintain *too much* CSS. If you take a look through our `app.scss`, you'll see a lot of calls to [`@apply`](https://tailwindcss.com/docs/functions-and-directives#apply). This is NOT a Sass construct. It's a TailwindCSS function used to mixin existing classes into our custom CSS.

## [Testing](#testing)

There is a test suite that uses PHPUnit in the /tests directory. To set up
Expand Down
2 changes: 1 addition & 1 deletion classes/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function uploadPath()
*/
public function templatesPath()
{
return $this->basePath() . '/templates';
return $this->basePath() . '/resources/views';
}

/**
Expand Down
1 change: 1 addition & 0 deletions classes/Domain/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static function fields()
'info' => ['type' => 'text'],
'bio' => ['type' => 'text'],
'photo_path' => ['type' => 'string', 'length' => 255],
'has_made_profile' => ['type' => 'smallint', 'value' => 0],
];
}

Expand Down
5 changes: 5 additions & 0 deletions classes/Domain/Speaker/SpeakerProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public function __construct($speaker)
$this->speaker = $speaker;
}

public function needsProfile()
{
return $this->speaker->has_made_profile == 0;
}

/**
* Returns a collection of the speaker's talks.
*
Expand Down
13 changes: 13 additions & 0 deletions classes/Domain/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,17 @@

class ValidationException extends \Exception
{
private $errors;

public static function withErrors(array $errors = [])
{
$instance = new static('There was an error.');
$instance->errors = $errors;
return $instance;
}

public function errors()
{
return $this->errors;
}
}
151 changes: 0 additions & 151 deletions classes/Http/Controller/Admin/AdminsController.php

This file was deleted.

73 changes: 0 additions & 73 deletions classes/Http/Controller/Admin/ReviewController.php

This file was deleted.

Loading

0 comments on commit 96decb7

Please sign in to comment.