blacklight 3.1.2 → 3.2.0pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -2
- data/README.md +7 -2
- data/VERSION +1 -1
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/blacklight/blacklight.js +23 -1
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +369 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +117 -0
- data/app/assets/stylesheets/blacklight/_folder.css.scss +38 -0
- data/app/assets/stylesheets/blacklight/_formatting.css.scss +164 -0
- data/app/assets/stylesheets/blacklight/_header.css.scss +36 -0
- data/app/assets/stylesheets/blacklight/_layout.css.scss +79 -0
- data/app/assets/stylesheets/blacklight/_print.css.scss +54 -0
- data/app/assets/stylesheets/blacklight/_search_history.css.scss +44 -0
- data/app/assets/stylesheets/blacklight/_susy_framework.css.scss +228 -0
- data/app/assets/stylesheets/blacklight/blacklight.css.scss +27 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +48 -0
- data/app/controllers/bookmarks_controller.rb +2 -1
- data/app/controllers/folder_controller.rb +4 -0
- data/app/controllers/saved_searches_controller.rb +4 -0
- data/app/controllers/search_history_controller.rb +4 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +64 -104
- data/app/helpers/blacklight/catalog_helper_behavior.rb +4 -4
- data/app/helpers/blacklight/facets_helper_behavior.rb +52 -5
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +14 -59
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +56 -0
- data/app/helpers/search_history_constraints_helper.rb +3 -0
- data/app/models/record_mailer.rb +1 -2
- data/app/views/_flash_msg.html.erb +4 -5
- data/app/views/_user_util_links.html.erb +3 -1
- data/app/views/bookmarks/index.html.erb +2 -2
- data/app/views/catalog/_bookmark_control.html.erb +6 -6
- data/app/views/catalog/_facet_layout.html.erb +4 -0
- data/app/views/catalog/_facet_limit.html.erb +20 -33
- data/app/views/catalog/_facets.html.erb +1 -5
- data/app/views/catalog/_folder_control.html.erb +5 -5
- data/app/views/catalog/_index_default.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +4 -3
- data/app/views/catalog/_show_default.html.erb +1 -1
- data/app/views/catalog/_show_tools.html.erb +6 -6
- data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
- data/app/views/catalog/index.atom.builder +2 -2
- data/app/views/catalog/index.rss.builder +1 -1
- data/app/views/catalog/opensearch.xml.builder +10 -0
- data/app/views/catalog/show.html.erb +1 -1
- data/app/views/folder/_tools.html.erb +4 -4
- data/app/views/layouts/blacklight.html.erb +25 -37
- data/app/views/record_mailer/email_record.text.erb +1 -1
- data/app/views/record_mailer/sms_record.text.erb +2 -2
- data/app/views/search_history/index.html.erb +1 -1
- data/blacklight.gemspec +11 -9
- data/lib/{generators/blacklight/templates/SolrMarc.jar → SolrMarc.jar} +0 -0
- data/lib/blacklight.rb +5 -3
- data/lib/blacklight/catalog.rb +3 -4
- data/lib/blacklight/configurable.rb +54 -39
- data/lib/blacklight/configuration.rb +126 -0
- data/lib/blacklight/configuration/fields.rb +142 -0
- data/lib/blacklight/configuration/search_field.rb +12 -0
- data/lib/blacklight/configuration/solr_field.rb +12 -0
- data/lib/blacklight/configuration/sort_field.rb +17 -0
- data/lib/blacklight/controller.rb +16 -14
- data/lib/blacklight/engine.rb +1 -1
- data/lib/blacklight/global_configurable.rb +46 -0
- data/lib/blacklight/search_fields.rb +21 -54
- data/lib/blacklight/solr/document.rb +13 -3
- data/lib/blacklight/solr_helper.rb +88 -52
- data/lib/blacklight/utils.rb +18 -0
- data/lib/generators/blacklight/assets_generator.rb +14 -20
- data/lib/generators/blacklight/blacklight_generator.rb +14 -6
- data/lib/generators/blacklight/jetty_generator.rb +1 -1
- data/lib/generators/blacklight/templates/assets/standard.css.scss +51 -0
- data/lib/generators/blacklight/templates/catalog_controller.rb +148 -0
- data/lib/generators/blacklight/templates/config/blacklight_config.rb +2 -239
- data/lib/generators/blacklight/templates/config/sass.rb +5 -0
- data/lib/generators/blacklight/templates/solr_conf/schema.xml +514 -164
- data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +1591 -323
- data/lib/generators/blacklight/templates/solr_document.rb +2 -0
- data/lib/railties/all_tests.rake +36 -3
- data/lib/railties/blacklight_cucumber.rake +6 -4
- data/lib/railties/blacklight_rspec.rake +5 -4
- data/test_support/bin/run-tests.sh +2 -13
- data/test_support/bin/test.sh +30 -23
- data/test_support/features/did_you_mean.feature +14 -13
- data/test_support/features/step_definitions/saved_searches_steps.rb +1 -1
- data/test_support/features/step_definitions/search_steps.rb +4 -4
- data/test_support/spec/controllers/application_controller_spec.rb +3 -13
- data/test_support/spec/controllers/catalog_controller_spec.rb +102 -24
- data/test_support/spec/controllers/folder_controller_spec.rb +7 -1
- data/test_support/spec/helpers/blacklight_helper_spec.rb +45 -34
- data/test_support/spec/helpers/facets_helper_spec.rb +68 -0
- data/test_support/spec/helpers/html_head_helper_spec.rb +37 -0
- data/test_support/spec/helpers/{render_constraints_helper_spec.rb → search_history_constraints_helper_spec.rb} +26 -7
- data/test_support/spec/lib/blacklight_configurable_spec.rb +92 -0
- data/test_support/spec/lib/blacklight_configuration_spec.rb +295 -0
- data/test_support/spec/lib/{configurable_spec.rb → global_configurable_spec.rb} +2 -2
- data/test_support/spec/lib/search_fields_spec.rb +26 -29
- data/test_support/spec/{helpers → lib}/solr_helper_spec.rb +268 -287
- data/test_support/spec/lib/tasks/solr_marc_task_spec.rb +1 -1
- data/test_support/spec/lib/utils_spec.rb +58 -0
- data/test_support/spec/models/solr_docment_spec.rb +4 -8
- data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +27 -170
- data/test_support/spec/views/catalog/_index_default.erb_spec.rb +38 -20
- data/test_support/spec/views/catalog/_show_default.erb_spec.rb +38 -19
- data/test_support/spec/views/catalog/index.atom.builder_spec.rb +19 -1
- metadata +148 -145
- data/app/assets/stylesheets/blacklight/blacklight.css +0 -493
- data/app/assets/stylesheets/yui.css +0 -31
- data/app/views/catalog/opensearch.xml.erb +0 -11
- data/doc/Atom-Responses.md +0 -90
- data/doc/CUSTOMIZING.md +0 -121
- data/doc/Extending-blacklight-with-the-document-extension-framework.md +0 -1
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -131
- data/doc/Features.md +0 -147
- data/doc/Integration-with-Rails-Footnotes.md +0 -20
- data/doc/Pagination.md +0 -38
- data/doc/Quickstart.md +0 -97
- data/doc/Upgrading-Guide.md +0 -98
- data/doc/User-Authentication.md +0 -54
- data/doc/Using-a-custom-solr-uniquekey-field.md +0 -36
- data/lib/blacklight/comma_link_renderer.rb +0 -28
- data/lib/railties/jetty_solr_server.rb +0 -108
- data/test_support/spec/views/catalog/show.html.erb_spec.rb +0 -101
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ul.folderTools
|
|
2
|
+
{
|
|
3
|
+
@include border-radius(0 0 4px 4px);
|
|
4
|
+
background-color: $search_ui_bg_color;
|
|
5
|
+
border-color: $search_ui_border_color;
|
|
6
|
+
border-style:solid;
|
|
7
|
+
border-width:0 1px 1px;
|
|
8
|
+
margin:0;
|
|
9
|
+
padding:0.66em;
|
|
10
|
+
|
|
11
|
+
li
|
|
12
|
+
{
|
|
13
|
+
display:inline-block;
|
|
14
|
+
margin:0 10px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
li form
|
|
18
|
+
{
|
|
19
|
+
display:inline;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
li.refworks form input.submit
|
|
23
|
+
{
|
|
24
|
+
display:none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ul.tools
|
|
29
|
+
{
|
|
30
|
+
margin:0;
|
|
31
|
+
padding:0;
|
|
32
|
+
|
|
33
|
+
li
|
|
34
|
+
{
|
|
35
|
+
display:inline;
|
|
36
|
+
margin:0 10px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#login form,p,fieldset,table,pre
|
|
2
|
+
{
|
|
3
|
+
margin-bottom:1em;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
a:hover
|
|
7
|
+
{
|
|
8
|
+
color:#029;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
a:link,a:visited,a:active
|
|
12
|
+
{
|
|
13
|
+
border-bottom:1px dotted #aaa;
|
|
14
|
+
color:#2e4f81;
|
|
15
|
+
text-decoration:none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
abbr,acronym
|
|
19
|
+
{
|
|
20
|
+
border-bottom:1px dotted #000;
|
|
21
|
+
cursor:help;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
blockquote,ul,ol,dl
|
|
25
|
+
{
|
|
26
|
+
margin:1em;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
caption
|
|
30
|
+
{
|
|
31
|
+
margin-bottom:.5em;
|
|
32
|
+
text-align:center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
dl dd
|
|
36
|
+
{
|
|
37
|
+
margin-left:1em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
em
|
|
41
|
+
{
|
|
42
|
+
font-style:italic;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
form div.row
|
|
46
|
+
{
|
|
47
|
+
clear:both;
|
|
48
|
+
margin-bottom:.5em;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
form div.row label
|
|
52
|
+
{
|
|
53
|
+
float:left;
|
|
54
|
+
margin-right:.5em;
|
|
55
|
+
text-align:right;
|
|
56
|
+
width:120px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
form div.row.submit
|
|
60
|
+
{
|
|
61
|
+
margin-left:130px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
form.per_page
|
|
65
|
+
{
|
|
66
|
+
float:right;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
form.sort
|
|
70
|
+
{
|
|
71
|
+
display:inline;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
h1
|
|
75
|
+
{
|
|
76
|
+
font-size:138.5%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
h1,h2,h3
|
|
80
|
+
{
|
|
81
|
+
margin:1em 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
h1,h2,h3,h4,h5,h6,strong
|
|
85
|
+
{
|
|
86
|
+
font-weight:700;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
h2
|
|
90
|
+
{
|
|
91
|
+
font-size:123.1%;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
h3
|
|
95
|
+
{
|
|
96
|
+
font-size:108%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
hr
|
|
100
|
+
{
|
|
101
|
+
background-color:#ccc;
|
|
102
|
+
border:none;
|
|
103
|
+
height:1px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
input
|
|
107
|
+
{
|
|
108
|
+
padding:.1em;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
input[type=text],input[type=password],textarea
|
|
112
|
+
{
|
|
113
|
+
width:11.9em;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
label
|
|
117
|
+
{
|
|
118
|
+
color:#555;
|
|
119
|
+
font-weight:700;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ol li
|
|
123
|
+
{
|
|
124
|
+
list-style:decimal outside;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
ol,ul,dl
|
|
128
|
+
{
|
|
129
|
+
margin-left:2em;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
select,input,button,textarea
|
|
133
|
+
{
|
|
134
|
+
font:1em Verdana, "Lucida Grande", "Lucida Sans Unicode", "Arial Unicode MS", Arial, sans-serif;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
table.zebra .zebra_stripe,ul.zebra .zebra_stripe
|
|
138
|
+
{
|
|
139
|
+
background-color:#F1F5FA;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
textarea
|
|
143
|
+
{
|
|
144
|
+
height:15em;
|
|
145
|
+
width:30em;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
th
|
|
149
|
+
{
|
|
150
|
+
font-weight:700;
|
|
151
|
+
text-align:center;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
th,td
|
|
155
|
+
{
|
|
156
|
+
border:1px solid #000;
|
|
157
|
+
padding:.5em;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
ul li
|
|
161
|
+
{
|
|
162
|
+
list-style:disc outside;
|
|
163
|
+
}
|
|
164
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.first h1
|
|
2
|
+
{
|
|
3
|
+
margin:0;
|
|
4
|
+
padding:0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
h1.site_title
|
|
8
|
+
{
|
|
9
|
+
background:transparent asset_url($logo_url,image) no-repeat top left;
|
|
10
|
+
height:35px;
|
|
11
|
+
margin:0;
|
|
12
|
+
width:120px;
|
|
13
|
+
|
|
14
|
+
a
|
|
15
|
+
{
|
|
16
|
+
border:0;
|
|
17
|
+
display:block;
|
|
18
|
+
height:35px;
|
|
19
|
+
overflow:hidden;
|
|
20
|
+
text-decoration:none;
|
|
21
|
+
text-indent:-9999px;
|
|
22
|
+
width:120px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
h1.site_title a:link,h1.site_title a:visited,h1.site_title a:hover,h1.site_title a:active
|
|
27
|
+
{
|
|
28
|
+
border:0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
h2.search
|
|
32
|
+
{
|
|
33
|
+
display:inline;
|
|
34
|
+
margin:0;
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
@import "blacklight/susy_framework";
|
|
2
|
+
@import "compass/utilities";
|
|
3
|
+
|
|
4
|
+
/* Generic layout stuff */
|
|
5
|
+
.hide
|
|
6
|
+
{
|
|
7
|
+
display:none
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Global */
|
|
11
|
+
body
|
|
12
|
+
{
|
|
13
|
+
background: asset_url('blacklight/bg.png',image) repeat-x top left;
|
|
14
|
+
background-color: #707070;
|
|
15
|
+
font: 0.7em Verdana, "Lucida Grande", "Lucida Sans Unicode", "Arial Unicode MS", Arial, sans-serif;
|
|
16
|
+
line-height: 1.4;
|
|
17
|
+
margin: 0px;
|
|
18
|
+
padding: 15px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Header Container Layout */
|
|
22
|
+
#page
|
|
23
|
+
{
|
|
24
|
+
@include container;
|
|
25
|
+
background: #fff asset_url('blacklight/border.png',image) repeat-x top left;
|
|
26
|
+
margin: 0px auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#hd
|
|
30
|
+
{
|
|
31
|
+
@include full;
|
|
32
|
+
@include clearfix;
|
|
33
|
+
padding: 2em 0 2em 0;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
#logo
|
|
37
|
+
{
|
|
38
|
+
@include columns(12,24);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#user_util_links
|
|
42
|
+
{
|
|
43
|
+
text-align: right;
|
|
44
|
+
@include columns(12,24);
|
|
45
|
+
@include omega(24);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#bd
|
|
50
|
+
{
|
|
51
|
+
@include full;
|
|
52
|
+
@include clearfix;
|
|
53
|
+
margin-bottom: 2em;
|
|
54
|
+
|
|
55
|
+
#main
|
|
56
|
+
{
|
|
57
|
+
@include prefix(1,24);
|
|
58
|
+
@include columns(18,24);
|
|
59
|
+
@include omega(24);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#sidebar
|
|
63
|
+
{
|
|
64
|
+
@include columns(5,24);
|
|
65
|
+
@include clearfix;
|
|
66
|
+
|
|
67
|
+
p
|
|
68
|
+
{
|
|
69
|
+
padding-top: 2em;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#ft {
|
|
75
|
+
@include full;
|
|
76
|
+
@include clearfix;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@media print {
|
|
2
|
+
#bd
|
|
3
|
+
{
|
|
4
|
+
padding:0;
|
|
5
|
+
position:relative;
|
|
6
|
+
width:100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#hd
|
|
10
|
+
{
|
|
11
|
+
margin:0;
|
|
12
|
+
padding:0 0 2em;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#page
|
|
16
|
+
{
|
|
17
|
+
background:none;
|
|
18
|
+
border:0;
|
|
19
|
+
margin:0;
|
|
20
|
+
padding:0;
|
|
21
|
+
width:100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
* html #documents
|
|
25
|
+
{
|
|
26
|
+
width:75%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
* html #page
|
|
30
|
+
{
|
|
31
|
+
left:0;
|
|
32
|
+
position:absolute;
|
|
33
|
+
top:0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
* html #search
|
|
37
|
+
{
|
|
38
|
+
left:1em;
|
|
39
|
+
position:absolute;
|
|
40
|
+
top:-4em;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body
|
|
44
|
+
{
|
|
45
|
+
background:none;
|
|
46
|
+
margin:0;
|
|
47
|
+
padding:0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
html
|
|
51
|
+
{
|
|
52
|
+
background:#fff;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/* Search History */
|
|
6
|
+
.search_history
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
.query > a
|
|
10
|
+
{
|
|
11
|
+
display: block;
|
|
12
|
+
border-bottom: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.constraint
|
|
16
|
+
{
|
|
17
|
+
display: block;
|
|
18
|
+
text-indent: -2em;
|
|
19
|
+
padding-left: 2em;
|
|
20
|
+
margin-right: 2em;
|
|
21
|
+
|
|
22
|
+
.search
|
|
23
|
+
{
|
|
24
|
+
padding-right: 0.5em;
|
|
25
|
+
padding-left: 0.5em;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:last-child
|
|
29
|
+
{
|
|
30
|
+
margin-right: 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
td
|
|
35
|
+
{
|
|
36
|
+
vertical-align: top;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.filterName, .label
|
|
40
|
+
{
|
|
41
|
+
color: gray;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// Imports -------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@import "compass/utilities/general/clearfix";
|
|
4
|
+
@import "compass/utilities/general/float";
|
|
5
|
+
@import "compass/layout/grid-background";
|
|
6
|
+
|
|
7
|
+
// Variables -----------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
// Your basic settings for the grid.
|
|
10
|
+
$total-cols : 12 !default;
|
|
11
|
+
$col-width : 4em !default;
|
|
12
|
+
$gutter-width : 1em !default;
|
|
13
|
+
$side-gutter-width : $gutter-width !default;
|
|
14
|
+
|
|
15
|
+
// Controls for right-to-left or bi-directional sites.
|
|
16
|
+
$from-direction : left !default;
|
|
17
|
+
|
|
18
|
+
// The direction that +omega elements are floated by deafult.
|
|
19
|
+
$omega-float : opposite-position($from-direction) !default;
|
|
20
|
+
|
|
21
|
+
// Functions -----------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
// Return the width of 'n' columns plus 'n - 1' gutters
|
|
24
|
+
// plus page padding in non-nested contexts
|
|
25
|
+
@function columns-width(
|
|
26
|
+
$n: false
|
|
27
|
+
) {
|
|
28
|
+
$sg: 0;
|
|
29
|
+
@if not $n {
|
|
30
|
+
$n: $total-cols;
|
|
31
|
+
$sg: $side-gutter-width;
|
|
32
|
+
}
|
|
33
|
+
$columns-width: ($n*$col-width) + (ceil($n - 1)*$gutter-width) + ($sg*2);
|
|
34
|
+
@return $columns-width;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Return the percentage for the target in a given context
|
|
38
|
+
@function percent-width(
|
|
39
|
+
$t,
|
|
40
|
+
$c
|
|
41
|
+
) {
|
|
42
|
+
$perc: ($t / $c) * 100%;
|
|
43
|
+
@return $perc;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Return the percentage width of 'n' columns in a context of 'c'
|
|
47
|
+
@function columns(
|
|
48
|
+
$n,
|
|
49
|
+
$c: false
|
|
50
|
+
) {
|
|
51
|
+
$columns: percent-width(columns-width($n), columns-width($c));
|
|
52
|
+
@return $columns;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Return the percentage width of a single gutter in a context of 'c'
|
|
56
|
+
@function gutter(
|
|
57
|
+
$c: false
|
|
58
|
+
) {
|
|
59
|
+
$gutter: percent-width($gutter-width, columns-width($c));
|
|
60
|
+
@return $gutter;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Return the percentage width of a single side gutter in a context of 'c'
|
|
64
|
+
@function side-gutter(
|
|
65
|
+
$c: false
|
|
66
|
+
) {
|
|
67
|
+
$side-gutter: percent-width($side-gutter-width, columns-width($c));
|
|
68
|
+
@return $side-gutter;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Return the percentage width of a single column in a context of 'c'
|
|
72
|
+
@function column(
|
|
73
|
+
$c: false
|
|
74
|
+
) {
|
|
75
|
+
$column: percent-width($col-width, columns-width($c));
|
|
76
|
+
@return $column;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Base Mixin ----------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
// Set the outer grid-containing element(s).
|
|
82
|
+
@mixin container() {
|
|
83
|
+
@include pie-clearfix;
|
|
84
|
+
margin: auto;
|
|
85
|
+
width: columns-width();
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Column Mixins -------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
// Set +columns() on any column element, even nested ones.
|
|
92
|
+
// The first agument [required] is the number of columns to span.
|
|
93
|
+
// The second argument is the context (columns spanned by parent).
|
|
94
|
+
// - Context is required on any nested elements.
|
|
95
|
+
// - Context MUST NOT be declared on a top-level element.
|
|
96
|
+
// By default a grid-column is floated left with a right gutter.
|
|
97
|
+
// - Override those with +float("right"), +alpha or +omega
|
|
98
|
+
@mixin columns(
|
|
99
|
+
$n,
|
|
100
|
+
$context : false,
|
|
101
|
+
$from : $from-direction
|
|
102
|
+
) {
|
|
103
|
+
$to : opposite-position($from);
|
|
104
|
+
// the column is floated left
|
|
105
|
+
@include float($from);
|
|
106
|
+
// the width of the column is set as a percentage of the context
|
|
107
|
+
width: columns($n, $context);
|
|
108
|
+
// the right gutter is added as a percentage of the context
|
|
109
|
+
margin-#{$to}: gutter($context);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// @include `reset-column` to reset a column element to default block behavior
|
|
113
|
+
@mixin reset-column(
|
|
114
|
+
$from : $from-direction
|
|
115
|
+
) {
|
|
116
|
+
$to : opposite-position($from);
|
|
117
|
+
@include reset-float;
|
|
118
|
+
width: auto;
|
|
119
|
+
margin-#{$to}: auto;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@mixin un-column(
|
|
123
|
+
$from : $from-direction
|
|
124
|
+
) {
|
|
125
|
+
@include reset-column($from);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// @include `full` on an element that will span it's entire context.
|
|
129
|
+
// There is no need for +columns, +alpha or +omega on a +full element.
|
|
130
|
+
@mixin full(
|
|
131
|
+
$nested: false
|
|
132
|
+
) {
|
|
133
|
+
clear: both;
|
|
134
|
+
@if not $nested {
|
|
135
|
+
margin: {
|
|
136
|
+
left: side-gutter();
|
|
137
|
+
right: side-gutter();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Padding Mixins ------------------------------------------------------------
|
|
143
|
+
|
|
144
|
+
// add empty colums as padding before an element.
|
|
145
|
+
@mixin prefix(
|
|
146
|
+
$n,
|
|
147
|
+
$context : false,
|
|
148
|
+
$from : $from-direction
|
|
149
|
+
) {
|
|
150
|
+
padding-#{$from}: columns($n, $context) + gutter($context);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// add empty colums as padding after an element.
|
|
154
|
+
@mixin suffix(
|
|
155
|
+
$n,
|
|
156
|
+
$context : false,
|
|
157
|
+
$from : $from-direction
|
|
158
|
+
) {
|
|
159
|
+
$to : opposite-position($from);
|
|
160
|
+
padding-#{$to}: columns($n, $context) + gutter($context);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// add empty colums as padding before and after an element.
|
|
164
|
+
@mixin pad(
|
|
165
|
+
$p : false,
|
|
166
|
+
$s : false,
|
|
167
|
+
$c : false,
|
|
168
|
+
$from : $from-direction
|
|
169
|
+
) {
|
|
170
|
+
@if $p {
|
|
171
|
+
@include prefix($p, $c, $from);
|
|
172
|
+
}
|
|
173
|
+
@if $s {
|
|
174
|
+
@include suffix($s, $c, $from);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Alpha & Omega Mixins ------------------------------------------------------
|
|
179
|
+
// I recommend that you pass the actual nested contexts (when nested) rather
|
|
180
|
+
// than a true/false argument for the sake of consistency. Effect is the same,
|
|
181
|
+
// but your code will be much more readable.
|
|
182
|
+
|
|
183
|
+
// @include on any element spanning the first column in non-nested context to
|
|
184
|
+
// take side-gutters into account.
|
|
185
|
+
@mixin alpha(
|
|
186
|
+
$nested : false,
|
|
187
|
+
$from : $from-direction
|
|
188
|
+
) {
|
|
189
|
+
@if not $nested {
|
|
190
|
+
margin-#{$from}: side-gutter();
|
|
191
|
+
} @else {
|
|
192
|
+
@warn "The alpha mixin is not needed in a nested context";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// @include on the last element of a row, in order to take side-gutters and
|
|
197
|
+
// the page edge into account. Set the $nested argument for nested columns.
|
|
198
|
+
@mixin omega(
|
|
199
|
+
$nested : false,
|
|
200
|
+
$from : $from-direction
|
|
201
|
+
) {
|
|
202
|
+
$to : opposite-position($from);
|
|
203
|
+
$hack : opposite-position($omega-float);
|
|
204
|
+
$sg : 0;
|
|
205
|
+
@if not $nested {
|
|
206
|
+
$sg: side-gutter();
|
|
207
|
+
}
|
|
208
|
+
@include float($omega-float);
|
|
209
|
+
margin-#{$to}: $sg;
|
|
210
|
+
@if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
|
|
211
|
+
#margin-#{$hack}: - $gutter-width;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Susy Grid Backgrounds -----------------------------------------------------
|
|
216
|
+
|
|
217
|
+
@mixin susy-grid-background {
|
|
218
|
+
@include column-grid-background($total-cols, $col-width, $gutter-width, $side-gutter-width, $force-fluid: true);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@mixin show-grid($img:false) {
|
|
222
|
+
@warn "show-grid is deprecated in favor of susy-grid-background.";
|
|
223
|
+
@if $img {
|
|
224
|
+
@warn "show-grid and susy-grid-background no longer use any images or take any arguments.";
|
|
225
|
+
}
|
|
226
|
+
@include susy-grid-background;
|
|
227
|
+
}
|
|
228
|
+
|