Skip to content

Commit

Permalink
Add yiistrap css and grunt for compiling less
Browse files Browse the repository at this point in the history
  • Loading branch information
crisu83 committed Jun 18, 2013
1 parent 4ebffa3 commit d48d068
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ nbproject
# mac deployment helpers
switch

# Node modules
node_modules

# Composer files
composer*
vendor/*
Expand Down
31 changes: 31 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// The wrapper function
module.exports = function(grunt) {

// Project and task configuration
grunt.initConfig({
less: {
development: {
files: {
"assets/css/yiistrap.css": "assets/less/yiistrap.less"
}
},
production: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
"assets/css/yiistrap.min.css": "assets/less/yiistrap.less"
}
}
}
});

// Load plugins
grunt.loadNpmTasks('grunt-contrib-less');

// Define tasks
grunt.registerTask('default', ['less']);

};
87 changes: 87 additions & 0 deletions assets/css/yiistrap.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
line-height: 0;
}
.clearfix:after {
clear: both;
}
.hide-text {
font: NaN a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.grid-view {
font-size: 13px;
}
.grid-view .table th > .sort-link {
color: #333;
display: block;
font-size: 14px;
font-weight: bold;
position: relative;
}
.grid-view .table th > .sort-link:hover {
text-decoration: none;
}
.grid-view .table th > .sort-link .caret {
display: none;
position: absolute;
right: 5px;
top: 8px;
}
.grid-view .table th > .sort-link.asc .caret {
display: block;
}
.grid-view .table th > .sort-link.desc .caret {
border-bottom: 4px solid #000;
border-top: none;
display: block;
}
.grid-view .table .filters > td .filter-container {
padding: 0 16px 0 0;
}
.grid-view .table .filters > td .filter-container input[type="text"] {
margin-bottom: 0;
width: 100%;
}
.grid-view .table tr.selected td {
background: #eee;
}
.grid-view .table td {
vertical-align: middle;
}
.grid-view .table .checkbox-column {
width: 15px;
}
.grid-view .table .number-column {
text-align: right;
}
.grid-view .table .button-column {
text-align: right;
min-width: 50px;
}
.grid-view .empty {
font-style: italic;
}
.grid-view.grid-view-loading {
background: url(../images/loader.gif) no-repeat 100% 10px;
}
span.required {
color: #b94a48;
font-weight: bold;
}
1 change: 1 addition & 0 deletions assets/css/yiistrap.min.css

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

Binary file added assets/img/loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions assets/less/yiistrap.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
@import "variables.less";
@import "mixins.less";

// Grid view
// -------------------------

.grid-view {
font-size: 13px;

.table {
th > .sort-link {
color: #333;
display: block;
font-size: 14px;
font-weight: bold;
position: relative;

&:hover {
text-decoration: none;
}

.caret {
display: none;
position: absolute;
right: 5px;
top: 8px;
}

&.asc .caret {
display: block;
}

&.desc .caret {
border-bottom: 4px solid #000;
border-top: none;
display: block;
}
}


.filters {
> td {
.filter-container {
padding: 0 16px 0 0; // compensate for the margin on the input

input[type="text"] {
margin-bottom: 0;
width: 100%;
}
}
}
}

tr.selected td {
background: #eee;
}

td {
vertical-align: middle;
}

.checkbox-column {
width: 15px;
}

.number-column {
text-align: right;
}

.button-column {
text-align: right;
min-width: 50px;
}
}

.empty {
font-style: italic;
}

&.grid-view-loading {
background: url(../images/loader.gif) no-repeat 100% 10px;
}
}

// Form
// -------------------------

span.required {
color: #b94a48;
font-weight: bold;
}
17 changes: 17 additions & 0 deletions components/TbApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,30 @@ public function registerResponsiveCss($url = null)
$cs->registerCssFile($url);
}

/**
* Registers the Yiistrap CSS.
* @param string $url the URL to the CSS file to register.
*/
public function registerYiistrapCss($url = null)
{
if ($url === null)
{
$fileName = YII_DEBUG ? 'yiistrap.css' : 'yiistrap.min.css';
$url = $this->getAssetsUrl() . '/css/' . $fileName;
}
/** @var CClientScript $cs */
$cs = Yii::app()->getClientScript();
$cs->registerCssFile($url);
}

/**
* Registers all Bootstrap CSS files.
*/
public function registerAllCss()
{
$this->registerCoreCss();
$this->registerResponsiveCss();
$this->registerYiistrapCss();
}

/**
Expand Down
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "yiistrap",
"version": "1.0.0",
"author": "Christoffer Niska <christoffer.niska@gmail.com>",
"description": "Yiistrap, Twitter Bootstrap for Yii.",
"contributors": [
{
"name": "Christoffer Niska",
"email": "christoffer.niska@gmail.com",
"homepage": "http://www.cniska.net/"
},
{
"name": "Antonio Ramirez",
"email": "ramirez.cobos@gmail.com",
"homepage": "http://www.ramirezcobos.com/"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Crisu83/yiistrap.git"
},
"keywords": [
"yii",
"yiistrap",
"bootstrap"
],
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-less": "~0.6.1",
"grunt-contrib-watch": "~0.4.4"
}
}

0 comments on commit d48d068

Please sign in to comment.