pixelforce_cms 0.9.5 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/pixelforce_cms/install_generator.rb +1 -0
- data/lib/generators/pixelforce_cms/templates/Gemfile +2 -5
- data/lib/generators/pixelforce_cms/templates/application/_head.html.haml +23 -6
- data/lib/generators/pixelforce_cms/templates/application.html.haml +9 -31
- data/lib/generators/pixelforce_cms/templates/css/application/application.css +1 -3
- data/lib/generators/pixelforce_cms/templates/css/application/index.css.scss +1 -0
- data/lib/generators/pixelforce_cms/templates/css/application/variables.css.scss +24 -9
- data/lib/generators/pixelforce_cms/templates/css/style.css.scss +85 -57
- data/lib/generators/pixelforce_cms/templates/css/style.responsive.css.scss +23 -1
- data/lib/generators/pixelforce_cms/templates/javascripts/application.js +6 -18
- data/lib/generators/pixelforce_cms/templates/javascripts/respond.js +353 -0
- data/lib/pixelforce_cms/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc3a7debc151ec93c1c778dd7c6e86d29014f93
|
4
|
+
data.tar.gz: e5a19a50b8a91b1d6987c7d724ee676b0f5b2cb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 430061e5efaa8597c43ca4d73d73556fa6d6bb6e60d3188ca5bdcc727fc612d8b61ab0e67bd8d7359914dda12a1f73399bea37d66f2d0ecc0e44cea865f640f6
|
7
|
+
data.tar.gz: 8e3b08ef4fb1c162890c962b8786f2b35a6744d9ee1584c89f3b06e14d0f3074a30c5af15ff4803fe86020a799913e44e50505f027da44cf604cab3223f5d079
|
@@ -11,6 +11,7 @@ module PixelforceCms
|
|
11
11
|
def copy_assets
|
12
12
|
if options.assets?
|
13
13
|
copy_file "javascripts/application.js", "app/assets/javascripts/application.js"
|
14
|
+
copy_file "javascripts/respond.js", "vendor/assets/javascripts/respond.js"
|
14
15
|
copy_file "css/style.css.scss", 'app/assets/stylesheets/style.css.scss'
|
15
16
|
copy_file "css/style.responsive.css.scss", 'app/assets/stylesheets/style.responsive.css.scss'
|
16
17
|
copy_file "css/application/application.css", "app/assets/stylesheets/application/application.css"
|
@@ -38,16 +38,12 @@ group :assets do
|
|
38
38
|
#Bootstrap
|
39
39
|
gem "therubyracer"
|
40
40
|
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
|
41
|
-
gem '
|
42
|
-
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
|
43
|
-
:github => 'anjlab/bootstrap-rails'
|
41
|
+
gem 'bootstrap-sass', '~> 3.0.3.0'
|
44
42
|
|
45
43
|
gem 'jquery-ui-rails'
|
46
44
|
gem 'fancybox2-rails', '~> 0.2.4'
|
47
45
|
end
|
48
46
|
|
49
|
-
gem 'jquery-rails'
|
50
|
-
|
51
47
|
group :development, :test do
|
52
48
|
gem 'quiet_assets'
|
53
49
|
gem 'rspec'
|
@@ -60,6 +56,7 @@ group :development, :test do
|
|
60
56
|
gem 'thin'
|
61
57
|
end
|
62
58
|
|
59
|
+
gem "font-awesome-rails"
|
63
60
|
gem 'sass'
|
64
61
|
gem 'html5-rails'
|
65
62
|
gem 'jquery-rails'
|
@@ -1,21 +1,38 @@
|
|
1
1
|
%head
|
2
|
+
/[if lt IE 9]
|
3
|
+
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
2
4
|
%meta{:charset => 'UTF-8'}
|
3
|
-
|
4
|
-
|
5
|
+
/[if IE]
|
6
|
+
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
|
7
|
+
- if current_page?(root_url)
|
8
|
+
- @title_tag = 'Free Classified Advertising Platform for Swapping Unwanted Items for Beer | Swap4Beer'
|
9
|
+
- else
|
10
|
+
- @title_tag = 'Swap4Beer | Swapping Unwanted Items for Beer'
|
11
|
+
= display_meta_tags site: @title_tag,
|
5
12
|
keywords: '',
|
6
|
-
description: '
|
13
|
+
description: 'SWAP4BEER is a free classified ad platform for swapping your unwanted items for beer - Mates Rates Classifieds!',
|
7
14
|
separator: '|',
|
8
15
|
reverse: true
|
9
16
|
|
10
17
|
%meta{content: "PixelForce Systems", :name => "author"}
|
11
|
-
%meta{:content => "Copyright
|
18
|
+
%meta{:content => "Copyright AURA Health #{Date.today.year}. All Rights Reserved.", :name => "Copyright"}
|
19
|
+
|
20
|
+
%meta#viewport{content: "width=720", name: "viewport"}
|
21
|
+
:javascript
|
22
|
+
(function(doc) {
|
23
|
+
var viewport = document.getElementById('viewport');
|
24
|
+
if ( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) {
|
25
|
+
doc.getElementById("viewport").setAttribute("content", "initial-scale=0.5");
|
26
|
+
} else if ( navigator.userAgent.match(/iPad/i) ) {
|
27
|
+
doc.getElementById("viewport").setAttribute("content", "initial-scale=0.8");
|
28
|
+
}
|
29
|
+
}(document));
|
12
30
|
|
13
|
-
%meta{:content => "width=640", :name => "viewport"}
|
14
31
|
%link{:href => "/favicon.ico", :rel => "shortcut icon"}
|
32
|
+
/ %link{href: "http://fonts.googleapis.com/css?family=Open+Sans:300,400,700", rel: "stylesheet", type: "text/css"}
|
15
33
|
|
16
34
|
= render 'stylesheets'
|
17
35
|
= javascript_include_tag 'polyfills'
|
18
|
-
|
19
36
|
= csrf_meta_tag
|
20
37
|
|
21
38
|
/[if lt IE 9]
|
@@ -1,34 +1,12 @@
|
|
1
1
|
!!!
|
2
|
-
|
3
|
-
|
4
|
-
%
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
description: 'Website description',
|
9
|
-
separator: '|',
|
10
|
-
reverse: true
|
11
|
-
|
12
|
-
%meta{content: "PixelForce Systems", :name => "author"}
|
13
|
-
%meta{:content => "Copyright Sitename #{Date.today.year}. All Rights Reserved.", :name => "Copyright"}
|
14
|
-
|
15
|
-
%meta{:content => "width=640", :name => "viewport"}
|
16
|
-
%link{:href => "/favicon.ico", :rel => "shortcut icon"}
|
17
|
-
|
18
|
-
%link{:href => "http://fonts.googleapis.com/css?family=Roboto:400,700,300", :rel => "stylesheet", :type => "text/css"}
|
19
|
-
%link{:href => "http://fonts.googleapis.com/css?family=Roboto+Condensed:300,700", :rel => "stylesheet", :type => "text/css"}
|
20
|
-
= stylesheet_link_tag :application, media: 'all'
|
21
|
-
= csrf_meta_tags
|
22
|
-
|
23
|
-
/[if lt IE 9]
|
24
|
-
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
25
|
-
|
26
|
-
%body{ :class => controller.controller_name }
|
27
|
-
#main-content
|
28
|
-
.container
|
29
|
-
= render 'application/header'
|
2
|
+
- html_tag class: 'no-js', lang: 'en' do
|
3
|
+
= render 'head'
|
4
|
+
%body{ class: "#{ controller.controller_name }" }
|
5
|
+
#main
|
6
|
+
= render 'chromeframe'
|
7
|
+
= render 'header'
|
30
8
|
= yield
|
31
|
-
|
9
|
+
= render 'footer'
|
32
10
|
|
33
|
-
|
34
|
-
|
11
|
+
= render 'javascripts'
|
12
|
+
= yield :js
|
@@ -8,17 +8,32 @@
|
|
8
8
|
//----------------------------------------------
|
9
9
|
// Html5 Boilerplate overrides
|
10
10
|
//----------------------------------------------
|
11
|
-
$font-
|
11
|
+
$font-heading: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
12
|
+
$font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
12
13
|
|
13
|
-
$
|
14
|
-
$
|
15
|
-
|
16
|
-
$
|
14
|
+
$font-color: #333;
|
15
|
+
$link-color: #0e3c5d;
|
16
|
+
|
17
|
+
$font-highlight-color: #e32a29;
|
17
18
|
|
18
19
|
$white: #fff;
|
19
|
-
$gray: #
|
20
|
-
$light-gray: #
|
20
|
+
$gray: #999;
|
21
|
+
$light-gray: #e5e5e5;
|
22
|
+
$dark-gray: #333;
|
23
|
+
|
24
|
+
$red: #e32a29;
|
25
|
+
$blue: #0e3c5d;
|
26
|
+
$orange: #ffa200;
|
27
|
+
$green: #70da65;
|
28
|
+
|
29
|
+
$radius: 8px;
|
30
|
+
$gutter: 20px;
|
31
|
+
$min-width: 0;
|
21
32
|
|
22
|
-
$placeholder: #ddd;
|
23
33
|
|
24
|
-
|
34
|
+
//----------------------------------------------
|
35
|
+
// Bootstrap overrides
|
36
|
+
//----------------------------------------------
|
37
|
+
|
38
|
+
$btn-danger-bg: $red;
|
39
|
+
$btn-primary-bg: $blue;
|
@@ -1,82 +1,110 @@
|
|
1
|
-
html, body { height:100%; }
|
1
|
+
html, body { height: 100%; }
|
2
2
|
body {
|
3
|
-
|
4
|
-
|
3
|
+
position: relative;
|
4
|
+
font: 14px/1.4 $font-body;
|
5
5
|
color: $font-color;
|
6
|
-
width:100%;
|
6
|
+
width: 100%;
|
7
|
+
min-width: $min-width;
|
7
8
|
}
|
8
|
-
|
9
9
|
h1, h2, h3 {
|
10
|
-
font-family: $font-
|
11
|
-
|
12
|
-
|
10
|
+
font-family: $font-heading;
|
11
|
+
line-height: 1.3;
|
12
|
+
margin-top: 0;
|
13
13
|
}
|
14
|
-
h4, h5 {
|
15
|
-
|
16
|
-
|
14
|
+
h4, h5, h6 { font-family: $font-heading; font-weight: bold; }
|
15
|
+
h3 { margin-bottom: $gutter/1.5; }
|
16
|
+
h4 { @extend .font-xlarge; }
|
17
|
+
h5 { @extend .font-large; }
|
18
|
+
h6 { @extend .font-medium; }
|
19
|
+
a, button, .btn-link, input[type="submit"] {
|
17
20
|
outline: 0 !important;
|
18
|
-
color: $link-color;
|
19
|
-
text-shadow:none;
|
20
|
-
&:hover {
|
21
|
-
color: $link-color;
|
22
|
-
text-decoration:underline;
|
23
|
-
i { text-decoration:none; }
|
24
|
-
}
|
25
21
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
img { max-width: 100%; }
|
23
|
+
|
24
|
+
ul {
|
25
|
+
&.fa-ul li {
|
26
|
+
margin-bottom: $gutter/2.5;
|
27
|
+
.fa { margin-right: 5px; }
|
30
28
|
}
|
31
29
|
}
|
32
30
|
|
33
31
|
hr {
|
34
|
-
|
35
|
-
|
36
|
-
border:0;
|
37
|
-
border-bottom:1px ridge rgba(0,0,0,0.1);
|
32
|
+
margin: $gutter 0;
|
33
|
+
border-top: 1px solid $light-gray;
|
38
34
|
}
|
39
35
|
|
40
|
-
|
41
|
-
|
42
|
-
a:link {-webkit-tap-highlight-color: $link-color;}
|
43
|
-
|
44
|
-
ins {background-color: $link-color; color: $white; text-decoration: none;}
|
45
|
-
mark {background-color: $link-color; color: $white; font-style: italic; font-weight: bold;}
|
46
|
-
|
47
|
-
.w_auto { width:auto !important; }
|
48
|
-
|
49
|
-
.padd { padding:20px 25px; }
|
50
|
-
.padd-s { padding:15px; }
|
51
|
-
.padd-n { padding:0 !important; }
|
36
|
+
mark { background: none; color: $font-highlight-color; }
|
37
|
+
abbr[title] { border: 0; }
|
52
38
|
|
53
|
-
.block { display:block
|
54
|
-
.inline-block { display:inline-block
|
55
|
-
.inline { display:inline !important; }
|
39
|
+
.block { display:block; }
|
40
|
+
.inline-block { display:inline-block; }
|
56
41
|
.relative { position:relative; }
|
57
42
|
.mb { margin-bottom: $gutter !important; }
|
43
|
+
.mb-s { margin-bottom: $gutter/2 !important; }
|
44
|
+
.mb-ss { margin-bottom: $gutter/4 !important; }
|
45
|
+
.mb-c { margin-bottom:0 !important; }
|
58
46
|
.mc { margin:0 !important; }
|
59
|
-
.ma { margin:0 auto; }
|
47
|
+
.ma { margin:0 auto !important; }
|
60
48
|
|
61
|
-
.
|
49
|
+
.padd-sm { padding: $gutter/2;}
|
50
|
+
.padd-side { padding: 0 $gutter;}
|
51
|
+
.padd { padding: $gutter;}
|
52
|
+
.padd-lg { padding: $gutter*2;}
|
53
|
+
.bordered { border:1px solid #ddd; }
|
54
|
+
|
55
|
+
.caps { text-transform: uppercase; }
|
56
|
+
.font-light { font-weight: 300; }
|
57
|
+
.font-normal { font-weight:normal !important; }
|
58
|
+
|
59
|
+
.w_3 { width:3% !important; }
|
60
|
+
.w_5 { width:5% !important; }
|
61
|
+
.w_10 { width:10% !important; }
|
62
|
+
.w_20 { width:20% !important; }
|
63
|
+
.w_25 { width:25% !important; }
|
64
|
+
.w_30 { width:30% !important; }
|
65
|
+
.w_33 { width:33% !important; }
|
66
|
+
.w_40 { width:40% !important; }
|
67
|
+
.w_50 { width:50% !important; }
|
68
|
+
.w_60 { width:60% !important; }
|
69
|
+
.w_70 { width:70% !important; }
|
70
|
+
.w_80 { width:80% !important; }
|
71
|
+
.w_90 { width:90% !important; }
|
72
|
+
.w_auto { width:auto !important; }
|
73
|
+
|
74
|
+
.font-mini { font-size:11px !important; }
|
62
75
|
.font-small { font-size:13px !important; }
|
63
|
-
.font-medium { font-size:
|
64
|
-
.font-large { font-size:
|
65
|
-
.font-xlarge { font-size:
|
66
|
-
.font-
|
67
|
-
.font-
|
68
|
-
.
|
76
|
+
.font-medium { font-size:16px !important; }
|
77
|
+
.font-large { font-size:18px !important; }
|
78
|
+
.font-xlarge { font-size:22px !important; }
|
79
|
+
.font-2xlarge { font-size:28px !important; }
|
80
|
+
.font-3xlarge { font-size:36px !important; }
|
81
|
+
.font-4xlarge { font-size:50px !important; }
|
82
|
+
.font-5xlarge { font-size:60px !important; }
|
69
83
|
|
84
|
+
.text-primary { color: $blue !important; }
|
85
|
+
.text-danger { color: $red !important; }
|
86
|
+
.text-inverse { color: #fff !important; }
|
87
|
+
.text-black { color: black !important; }
|
88
|
+
|
89
|
+
.pull-none { float: none; }
|
90
|
+
.media > .pull-left { margin-right: $gutter*2; }
|
91
|
+
.media > .pull-right { margin-left: $gutter*2; }
|
70
92
|
|
71
93
|
#main {
|
72
|
-
|
73
|
-
|
74
|
-
height:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
94
|
+
width: 100%;
|
95
|
+
overflow: hidden;
|
96
|
+
min-height: 900px;
|
97
|
+
background: WhiteSmoke;
|
98
|
+
border-bottom: 1px solid $light-gray;
|
99
|
+
& > section { padding: 0 $gutter $gutter; }
|
100
|
+
}
|
101
|
+
|
102
|
+
.search-box {
|
103
|
+
background: $blue;
|
104
|
+
color: white;
|
105
|
+
padding: 25px $gutter;
|
106
|
+
a { color: white; }
|
79
107
|
}
|
80
108
|
|
81
109
|
@import 'style.responsive';
|
82
|
-
@import '
|
110
|
+
@import 'layouts/*';
|
@@ -1,6 +1,28 @@
|
|
1
|
-
@media (
|
1
|
+
@media (min-width: 992px) {
|
2
2
|
}
|
3
3
|
|
4
|
+
@media (min-width: 768px) {
|
5
|
+
}
|
4
6
|
|
7
|
+
@media (max-width: 991px) {
|
8
|
+
.font-2xlarge { font-size:26px !important; }
|
9
|
+
.font-3xlarge { font-size:32px !important; }
|
10
|
+
.font-4xlarge { font-size:38px !important; }
|
11
|
+
.font-5xlarge { font-size:46px !important; }
|
12
|
+
}
|
5
13
|
@media (max-width: 767px) {
|
14
|
+
#main { padding-bottom: 0; }
|
15
|
+
.container { padding: 0; }
|
16
|
+
.font-medium { font-size:15px !important; }
|
17
|
+
.font-large { font-size:17px !important; }
|
18
|
+
.font-xlarge { font-size:20px !important; }
|
19
|
+
.font-2xlarge { font-size:24px !important; }
|
20
|
+
.font-3xlarge { font-size:28px !important; }
|
21
|
+
.font-4xlarge { font-size:32px !important; }
|
22
|
+
.font-5xlarge { font-size:38px !important; }
|
23
|
+
.row {
|
24
|
+
margin-bottom: 0;
|
25
|
+
overflow-x: hidden;
|
26
|
+
& > div[class*="col-"] { margin-bottom: $gutter; }
|
27
|
+
}
|
6
28
|
}
|
@@ -10,23 +10,11 @@
|
|
10
10
|
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
11
|
// GO AFTER THE REQUIRES BELOW.
|
12
12
|
//
|
13
|
+
|
14
|
+
//= require h5bp
|
15
|
+
//= require respond
|
13
16
|
//= require jquery
|
14
17
|
//= require jquery_ujs
|
15
|
-
//= require
|
16
|
-
//= require
|
17
|
-
//= require
|
18
|
-
|
19
|
-
|
20
|
-
$(function() {
|
21
|
-
|
22
|
-
$('a[rel=fancybox]').fancybox({
|
23
|
-
type: 'ajax',
|
24
|
-
maxWidth : 800,
|
25
|
-
maxHeight : 600,
|
26
|
-
fitToView : true,
|
27
|
-
width : '70%',
|
28
|
-
height : '70%',
|
29
|
-
autoSize : true
|
30
|
-
});
|
31
|
-
|
32
|
-
});
|
18
|
+
//= require jquery.ui.all
|
19
|
+
//= require bootstrap
|
20
|
+
//= require layout
|
@@ -0,0 +1,353 @@
|
|
1
|
+
/* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
|
2
|
+
(function( w ){
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
//exposed namespace
|
7
|
+
var respond = {};
|
8
|
+
w.respond = respond;
|
9
|
+
|
10
|
+
//define update even in native-mq-supporting browsers, to avoid errors
|
11
|
+
respond.update = function(){};
|
12
|
+
|
13
|
+
//define ajax obj
|
14
|
+
var requestQueue = [],
|
15
|
+
xmlHttp = (function() {
|
16
|
+
var xmlhttpmethod = false;
|
17
|
+
try {
|
18
|
+
xmlhttpmethod = new w.XMLHttpRequest();
|
19
|
+
}
|
20
|
+
catch( e ){
|
21
|
+
xmlhttpmethod = new w.ActiveXObject( "Microsoft.XMLHTTP" );
|
22
|
+
}
|
23
|
+
return function(){
|
24
|
+
return xmlhttpmethod;
|
25
|
+
};
|
26
|
+
})(),
|
27
|
+
|
28
|
+
//tweaked Ajax functions from Quirksmode
|
29
|
+
ajax = function( url, callback ) {
|
30
|
+
var req = xmlHttp();
|
31
|
+
if (!req){
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
req.open( "GET", url, true );
|
35
|
+
req.onreadystatechange = function () {
|
36
|
+
if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
callback( req.responseText );
|
40
|
+
};
|
41
|
+
if ( req.readyState === 4 ){
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
req.send( null );
|
45
|
+
},
|
46
|
+
isUnsupportedMediaQuery = function( query ) {
|
47
|
+
return query.replace( respond.regex.minmaxwh, '' ).match( respond.regex.other );
|
48
|
+
};
|
49
|
+
|
50
|
+
//expose for testing
|
51
|
+
respond.ajax = ajax;
|
52
|
+
respond.queue = requestQueue;
|
53
|
+
respond.unsupportedmq = isUnsupportedMediaQuery;
|
54
|
+
respond.regex = {
|
55
|
+
media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
|
56
|
+
keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
|
57
|
+
comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
|
58
|
+
urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
|
59
|
+
findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
|
60
|
+
only: /(only\s+)?([a-zA-Z]+)\s?/,
|
61
|
+
minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
|
62
|
+
maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
|
63
|
+
minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,
|
64
|
+
other: /\([^\)]*\)/g
|
65
|
+
};
|
66
|
+
|
67
|
+
//expose media query support flag for external use
|
68
|
+
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches;
|
69
|
+
|
70
|
+
//if media queries are supported, exit here
|
71
|
+
if( respond.mediaQueriesSupported ){
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
|
75
|
+
//define vars
|
76
|
+
var doc = w.document,
|
77
|
+
docElem = doc.documentElement,
|
78
|
+
mediastyles = [],
|
79
|
+
rules = [],
|
80
|
+
appendedEls = [],
|
81
|
+
parsedSheets = {},
|
82
|
+
resizeThrottle = 30,
|
83
|
+
head = doc.getElementsByTagName( "head" )[0] || docElem,
|
84
|
+
base = doc.getElementsByTagName( "base" )[0],
|
85
|
+
links = head.getElementsByTagName( "link" ),
|
86
|
+
|
87
|
+
lastCall,
|
88
|
+
resizeDefer,
|
89
|
+
|
90
|
+
//cached container for 1em value, populated the first time it's needed
|
91
|
+
eminpx,
|
92
|
+
|
93
|
+
// returns the value of 1em in pixels
|
94
|
+
getEmValue = function() {
|
95
|
+
var ret,
|
96
|
+
div = doc.createElement('div'),
|
97
|
+
body = doc.body,
|
98
|
+
originalHTMLFontSize = docElem.style.fontSize,
|
99
|
+
originalBodyFontSize = body && body.style.fontSize,
|
100
|
+
fakeUsed = false;
|
101
|
+
|
102
|
+
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
103
|
+
|
104
|
+
if( !body ){
|
105
|
+
body = fakeUsed = doc.createElement( "body" );
|
106
|
+
body.style.background = "none";
|
107
|
+
}
|
108
|
+
|
109
|
+
// 1em in a media query is the value of the default font size of the browser
|
110
|
+
// reset docElem and body to ensure the correct value is returned
|
111
|
+
docElem.style.fontSize = "100%";
|
112
|
+
body.style.fontSize = "100%";
|
113
|
+
|
114
|
+
body.appendChild( div );
|
115
|
+
|
116
|
+
if( fakeUsed ){
|
117
|
+
docElem.insertBefore( body, docElem.firstChild );
|
118
|
+
}
|
119
|
+
|
120
|
+
ret = div.offsetWidth;
|
121
|
+
|
122
|
+
if( fakeUsed ){
|
123
|
+
docElem.removeChild( body );
|
124
|
+
}
|
125
|
+
else {
|
126
|
+
body.removeChild( div );
|
127
|
+
}
|
128
|
+
|
129
|
+
// restore the original values
|
130
|
+
docElem.style.fontSize = originalHTMLFontSize;
|
131
|
+
if( originalBodyFontSize ) {
|
132
|
+
body.style.fontSize = originalBodyFontSize;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
//also update eminpx before returning
|
137
|
+
ret = eminpx = parseFloat(ret);
|
138
|
+
|
139
|
+
return ret;
|
140
|
+
},
|
141
|
+
|
142
|
+
//enable/disable styles
|
143
|
+
applyMedia = function( fromResize ){
|
144
|
+
var name = "clientWidth",
|
145
|
+
docElemProp = docElem[ name ],
|
146
|
+
currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
|
147
|
+
styleBlocks = {},
|
148
|
+
lastLink = links[ links.length-1 ],
|
149
|
+
now = (new Date()).getTime();
|
150
|
+
|
151
|
+
//throttle resize calls
|
152
|
+
if( fromResize && lastCall && now - lastCall < resizeThrottle ){
|
153
|
+
w.clearTimeout( resizeDefer );
|
154
|
+
resizeDefer = w.setTimeout( applyMedia, resizeThrottle );
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
lastCall = now;
|
159
|
+
}
|
160
|
+
|
161
|
+
for( var i in mediastyles ){
|
162
|
+
if( mediastyles.hasOwnProperty( i ) ){
|
163
|
+
var thisstyle = mediastyles[ i ],
|
164
|
+
min = thisstyle.minw,
|
165
|
+
max = thisstyle.maxw,
|
166
|
+
minnull = min === null,
|
167
|
+
maxnull = max === null,
|
168
|
+
em = "em";
|
169
|
+
|
170
|
+
if( !!min ){
|
171
|
+
min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
172
|
+
}
|
173
|
+
if( !!max ){
|
174
|
+
max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
175
|
+
}
|
176
|
+
|
177
|
+
// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
|
178
|
+
if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
|
179
|
+
if( !styleBlocks[ thisstyle.media ] ){
|
180
|
+
styleBlocks[ thisstyle.media ] = [];
|
181
|
+
}
|
182
|
+
styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
//remove any existing respond style element(s)
|
188
|
+
for( var j in appendedEls ){
|
189
|
+
if( appendedEls.hasOwnProperty( j ) ){
|
190
|
+
if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){
|
191
|
+
head.removeChild( appendedEls[ j ] );
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
195
|
+
appendedEls.length = 0;
|
196
|
+
|
197
|
+
//inject active styles, grouped by media type
|
198
|
+
for( var k in styleBlocks ){
|
199
|
+
if( styleBlocks.hasOwnProperty( k ) ){
|
200
|
+
var ss = doc.createElement( "style" ),
|
201
|
+
css = styleBlocks[ k ].join( "\n" );
|
202
|
+
|
203
|
+
ss.type = "text/css";
|
204
|
+
ss.media = k;
|
205
|
+
|
206
|
+
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
|
207
|
+
//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
|
208
|
+
head.insertBefore( ss, lastLink.nextSibling );
|
209
|
+
|
210
|
+
if ( ss.styleSheet ){
|
211
|
+
ss.styleSheet.cssText = css;
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
ss.appendChild( doc.createTextNode( css ) );
|
215
|
+
}
|
216
|
+
|
217
|
+
//push to appendedEls to track for later removal
|
218
|
+
appendedEls.push( ss );
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
//find media blocks in css text, convert to style blocks
|
223
|
+
translate = function( styles, href, media ){
|
224
|
+
var qs = styles.replace( respond.regex.comments, '' )
|
225
|
+
.replace( respond.regex.keyframes, '' )
|
226
|
+
.match( respond.regex.media ),
|
227
|
+
ql = qs && qs.length || 0;
|
228
|
+
|
229
|
+
//try to get CSS path
|
230
|
+
href = href.substring( 0, href.lastIndexOf( "/" ) );
|
231
|
+
|
232
|
+
var repUrls = function( css ){
|
233
|
+
return css.replace( respond.regex.urls, "$1" + href + "$2$3" );
|
234
|
+
},
|
235
|
+
useMedia = !ql && media;
|
236
|
+
|
237
|
+
//if path exists, tack on trailing slash
|
238
|
+
if( href.length ){ href += "/"; }
|
239
|
+
|
240
|
+
//if no internal queries exist, but media attr does, use that
|
241
|
+
//note: this currently lacks support for situations where a media attr is specified on a link AND
|
242
|
+
//its associated stylesheet has internal CSS media queries.
|
243
|
+
//In those cases, the media attribute will currently be ignored.
|
244
|
+
if( useMedia ){
|
245
|
+
ql = 1;
|
246
|
+
}
|
247
|
+
|
248
|
+
for( var i = 0; i < ql; i++ ){
|
249
|
+
var fullq, thisq, eachq, eql;
|
250
|
+
|
251
|
+
//media attr
|
252
|
+
if( useMedia ){
|
253
|
+
fullq = media;
|
254
|
+
rules.push( repUrls( styles ) );
|
255
|
+
}
|
256
|
+
//parse for styles
|
257
|
+
else{
|
258
|
+
fullq = qs[ i ].match( respond.regex.findStyles ) && RegExp.$1;
|
259
|
+
rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
|
260
|
+
}
|
261
|
+
|
262
|
+
eachq = fullq.split( "," );
|
263
|
+
eql = eachq.length;
|
264
|
+
|
265
|
+
for( var j = 0; j < eql; j++ ){
|
266
|
+
thisq = eachq[ j ];
|
267
|
+
|
268
|
+
if( isUnsupportedMediaQuery( thisq ) ) {
|
269
|
+
continue;
|
270
|
+
}
|
271
|
+
|
272
|
+
mediastyles.push( {
|
273
|
+
media : thisq.split( "(" )[ 0 ].match( respond.regex.only ) && RegExp.$2 || "all",
|
274
|
+
rules : rules.length - 1,
|
275
|
+
hasquery : thisq.indexOf("(") > -1,
|
276
|
+
minw : thisq.match( respond.regex.minw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
|
277
|
+
maxw : thisq.match( respond.regex.maxw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
|
278
|
+
} );
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
applyMedia();
|
283
|
+
},
|
284
|
+
|
285
|
+
//recurse through request queue, get css text
|
286
|
+
makeRequests = function(){
|
287
|
+
if( requestQueue.length ){
|
288
|
+
var thisRequest = requestQueue.shift();
|
289
|
+
|
290
|
+
ajax( thisRequest.href, function( styles ){
|
291
|
+
translate( styles, thisRequest.href, thisRequest.media );
|
292
|
+
parsedSheets[ thisRequest.href ] = true;
|
293
|
+
|
294
|
+
// by wrapping recursive function call in setTimeout
|
295
|
+
// we prevent "Stack overflow" error in IE7
|
296
|
+
w.setTimeout(function(){ makeRequests(); },0);
|
297
|
+
} );
|
298
|
+
}
|
299
|
+
},
|
300
|
+
|
301
|
+
//loop stylesheets, send text content to translate
|
302
|
+
ripCSS = function(){
|
303
|
+
|
304
|
+
for( var i = 0; i < links.length; i++ ){
|
305
|
+
var sheet = links[ i ],
|
306
|
+
href = sheet.href,
|
307
|
+
media = sheet.media,
|
308
|
+
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
309
|
+
|
310
|
+
//only links plz and prevent re-parsing
|
311
|
+
if( !!href && isCSS && !parsedSheets[ href ] ){
|
312
|
+
// selectivizr exposes css through the rawCssText expando
|
313
|
+
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
314
|
+
translate( sheet.styleSheet.rawCssText, href, media );
|
315
|
+
parsedSheets[ href ] = true;
|
316
|
+
} else {
|
317
|
+
if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) ||
|
318
|
+
href.replace( RegExp.$1, "" ).split( "/" )[0] === w.location.host ){
|
319
|
+
// IE7 doesn't handle urls that start with '//' for ajax request
|
320
|
+
// manually add in the protocol
|
321
|
+
if ( href.substring(0,2) === "//" ) { href = w.location.protocol + href; }
|
322
|
+
requestQueue.push( {
|
323
|
+
href: href,
|
324
|
+
media: media
|
325
|
+
} );
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
makeRequests();
|
331
|
+
};
|
332
|
+
|
333
|
+
//translate CSS
|
334
|
+
ripCSS();
|
335
|
+
|
336
|
+
//expose update for re-running respond later on
|
337
|
+
respond.update = ripCSS;
|
338
|
+
|
339
|
+
//expose getEmValue
|
340
|
+
respond.getEmValue = getEmValue;
|
341
|
+
|
342
|
+
//adjust on resize
|
343
|
+
function callMedia(){
|
344
|
+
applyMedia( true );
|
345
|
+
}
|
346
|
+
|
347
|
+
if( w.addEventListener ){
|
348
|
+
w.addEventListener( "resize", callMedia, false );
|
349
|
+
}
|
350
|
+
else if( w.attachEvent ){
|
351
|
+
w.attachEvent( "onresize", callMedia );
|
352
|
+
}
|
353
|
+
})(this);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelforce_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/generators/pixelforce_cms/templates/edit.html.haml
|
76
76
|
- lib/generators/pixelforce_cms/templates/index.html.haml
|
77
77
|
- lib/generators/pixelforce_cms/templates/javascripts/application.js
|
78
|
+
- lib/generators/pixelforce_cms/templates/javascripts/respond.js
|
78
79
|
- lib/generators/pixelforce_cms/templates/new.html.haml
|
79
80
|
- lib/generators/pixelforce_cms/templates/pages_controller.rb
|
80
81
|
- lib/generators/pixelforce_cms/templates/recipes/base.rb
|
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.2.2
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: ''
|