Skip to content

Commit 195f6d3

Browse files
committed
Massive code rewrite
1 parent a7334db commit 195f6d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+239
-351
lines changed

.gitattributes

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.gitignore export-ignore
2+
/.gitattributes export-ignore
3+
/.editorconfig export-ignore
4+
/config.rb export-ignore
5+
/package.json export-ignore
6+
/scss export-ignore
7+
*.map export-ignore

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*Thumbs.db
2+
*web.config
3+
*.log
4+
*.buildpath
5+
*.project
6+
*.settings
7+
*.idea
8+
*.DS_Store
9+
*._.DS_Store
10+
*.codekit*
11+
*.sublime-*
12+
*.sass-cache
13+
*prepros.cfg

Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source "https://rubygems.org"
2+
3+
gem "sass", "~> 3.4.0"
4+
gem "compass", "~> 1.0"

Gemfile.lock

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
chunky_png (1.3.5)
5+
compass (1.0.3)
6+
chunky_png (~> 1.2)
7+
compass-core (~> 1.0.2)
8+
compass-import-once (~> 1.0.5)
9+
rb-fsevent (>= 0.9.3)
10+
rb-inotify (>= 0.9)
11+
sass (>= 3.3.13, < 3.5)
12+
compass-core (1.0.3)
13+
multi_json (~> 1.0)
14+
sass (>= 3.3.0, < 3.5)
15+
compass-import-once (1.0.5)
16+
sass (>= 3.2, < 3.5)
17+
ffi (1.9.10)
18+
multi_json (1.11.2)
19+
rb-fsevent (0.9.6)
20+
rb-inotify (0.9.5)
21+
ffi (>= 0.5.0)
22+
sass (3.4.20)
23+
24+
PLATFORMS
25+
ruby
26+
27+
DEPENDENCIES
28+
compass (~> 1.0)
29+
sass (~> 3.4.0)
30+
31+
BUNDLED WITH
32+
1.11.2

LICENSE

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015, core
1+
Copyright (c) 2015, coreiho
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without
@@ -11,7 +11,7 @@ modification, are permitted provided that the following conditions are met:
1111
this list of conditions and the following disclaimer in the documentation
1212
and/or other materials provided with the distribution.
1313

14-
* Neither the name of silverstripe-patternlab nor the names of its
14+
* Neither the name of silverstripe-styleguide nor the names of its
1515
contributors may be used to endorse or promote products derived from
1616
this software without specific prior written permission.
1717

@@ -25,4 +25,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2525
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2626
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2727
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28-

_config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*
66
* @return string
77
**/
8-
define('PATTERN_DIR', ltrim(Director::makeRelative(realpath(__DIR__)), DIRECTORY_SEPARATOR));
8+
define('STYLEGUIDE_DIR', ltrim(Director::makeRelative(realpath(__DIR__)), DIRECTORY_SEPARATOR));

_config/routes.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
Name: patternroutes
2+
Name: styleguideroutes
33
---
44
Director:
55
rules:
6-
'patterns': 'PatternLab'
6+
'styleguide': 'StyleGuide'

code/controllers/PatternLab.php

-50
This file was deleted.

code/controllers/StyleGuide.php

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
e<?php
2+
3+
/**
4+
* @package styleguide
5+
*/
6+
class StyleGuide extends Controller
7+
{
8+
private static $allowed_actions = array(
9+
'index'
10+
);
11+
12+
public function index()
13+
{
14+
if(Director::isLive() && !Permission::check('CMS_ACCESS_CMSMain')) {
15+
return Security::permissionFailure($this);
16+
}
17+
18+
Requirements::css(STYLEGUIDE_DIR . '/css/styleguide.css');
19+
20+
return $this->renderWith(array(
21+
__CLASS__,
22+
'Page'
23+
));
24+
}
25+
26+
public function getStyles()
27+
{
28+
$config = SiteConfig::current_site_config();
29+
if ($config->Theme) {
30+
Config::inst()->update('SSViewer', 'theme_enabled', true);
31+
Config::inst()->update('SSViewer', 'theme', $config->Theme);
32+
}
33+
$theme = $config->Theme;
34+
35+
$manifest = SS_TemplateLoader::instance()->getManifest();
36+
37+
$templates = array();
38+
39+
// Debug::dump($manifest->getTemplates());
40+
foreach($manifest->getTemplates() as $templateName => $templateInfo) {
41+
$themeexists = $theme && isset($templateInfo['themes'][$theme]) && isset($templateInfo['themes'][$theme]['Styles']);
42+
43+
if ((isset($templateInfo['Styles']) || $themeexists) && !isset($templates[$templateName])) {
44+
$templates[$templateName] = array(
45+
'ID' => trim($templateName),
46+
'Name' => trim(str_replace('_', ' ',$templateName)),
47+
'Layout' => $this->renderWith(array($templateName))
48+
);
49+
}
50+
}
51+
52+
// ksort($templates);
53+
54+
return new ArrayList($templates);
55+
}
56+
}

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "coreiho/silverstripe-patternlab",
3-
"description": "Pattern lab",
2+
"name": "coreiho/silverstripe-styleguide",
3+
"description": "Style Guide",
44
"type": "silverstripe-module",
5-
"keywords": ["silverstripe", "patterns", "testing"],
5+
"keywords": ["silverstripe", "style", "guide", "development"],
66
"license": "BSD-3-Clause",
77
"authors": [
88
{
@@ -16,6 +16,6 @@
1616
"silverstripe/cms": "3.*"
1717
},
1818
"extra": {
19-
"installer-name": "pattern-lab"
19+
"installer-name": "styleguide"
2020
}
2121
}

config.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
css_dir = "css"
2+
sass_dir = "scss"
3+
output_style = :compressed
4+
sourcemap = true
5+
line_comments = false

css/patternlab.css

-3
This file was deleted.

css/patternlab.css.map

-1
This file was deleted.

css/styleguide.css

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/styleguide.css.map

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/templates/Patterns/Atoms/Checkbox.ss

-8
This file was deleted.

samples/templates/Patterns/Atoms/OrderedList.ss

-12
This file was deleted.

samples/templates/Patterns/Atoms/Radio.ss

-8
This file was deleted.

scss/patternlab.scss scss/styleguide.scss

+33-21
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
$grey: #808080;
2+
$dark-grey: #222;
3+
$white: #fff;
24

3-
.patternMaster{
5+
.styleGuideMaster{
46
border: 1px solid $grey;
57
padding: 1em;
8+
position: fixed;
9+
top: 0;
10+
right: 0;
11+
bottom: 0;
12+
left: 0;
13+
z-index: 9999;
14+
background-color: $white;
15+
overflow: auto;
616
}
717

8-
.patternList{
9-
padding: 0px;
10-
margin: 0px;
11-
background: #222 none repeat scroll 0% 0%;
12-
color: #FFF;
18+
.styleGuideNav{
19+
position: fixed;
20+
top: 0;
21+
bottom: 0;
22+
left: 0;
23+
width: 20%;
24+
z-index: 9999;
25+
padding: 2em 0;
26+
margin: 0;
27+
background: $dark-grey none repeat scroll 0% 0%;
28+
color: $white;
1329
font-family: "HelveticaNeue","Helvetica","Arial",sans-serif;
1430
text-transform: uppercase;
15-
width: 100%;
31+
overflow: auto;
1632
&:after{
1733
content: "";
1834
clear: both;
@@ -32,38 +48,34 @@ $grey: #808080;
3248
cursor: pointer;
3349
&:hover,
3450
&:focus{
35-
color: #FFF;
36-
background: rgba(255, 255, 255, 0.05) none repeat scroll 0% 0%;
51+
color: $white;
52+
background: $dark-grey none repeat scroll 0% 0%;
3753
}
3854
}
3955
li{
4056
list-style: none;
4157
display: block;
42-
@media only screen and (min-width: 500px) {
43-
width: 50%;
44-
float: left;
45-
}
46-
@media only screen and (min-width: 1000px) {
47-
width: 33.3333%;
48-
}
49-
@media only screen and (min-width: 1500px) {
50-
width: 25%;
51-
}
5258
}
5359

5460
}
55-
.patternGroup{
61+
.styleGuideGroups{
62+
position: absolute;
63+
left: 20%;
64+
padding: 2em;
65+
}
66+
.styleGuideGroup{
5667
clear: both;
5768
&:after{
5869
content: '';
5970
display: block;
6071
clear: both;
6172
}
6273
}
63-
.patternTitle{
74+
.styleGuideTitle{
6475
margin: 2em 0px;
6576
font-family: "HelveticaNeue","Helvetica","Arial",sans-serif;
6677
font-size: 14px!important;
78+
text-transform: uppercase;
6779
font-weight: normal;
6880
padding: 1em 0px;
6981
border-bottom: 1px solid $grey;

templates/Layout/PatternLab.ss

-17
This file was deleted.

0 commit comments

Comments
 (0)