groundworkcss-rails 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/breadcrumbs_helper.rb~ +5 -0
- data/app/helpers/flash_block_helper.rb~ +18 -0
- data/app/helpers/flash_helper.rb~ +21 -0
- data/app/helpers/groundwork_flash_helper.rb~ +21 -0
- data/app/helpers/modal_helper.rb~ +42 -0
- data/app/helpers/social_glyph_helper.rb~ +12 -0
- data/lib/generators/groundworkcss/install/install_generator.rb~ +44 -0
- data/lib/generators/groundworkcss/install/templates/application.css.scss~ +8 -0
- data/lib/generators/groundworkcss/install/templates/application.css~ +7 -0
- data/lib/generators/groundworkcss/install/templates/application.js~ +10 -0
- data/lib/generators/groundworkcss/install/templates/groundwork-and-overrides.scss~ +12 -0
- data/lib/generators/groundworkcss/install/templates/groundwork-overrides.scss~ +7 -0
- data/lib/generators/groundworkcss/install/templates/groundwork.coffee~ +0 -0
- data/lib/generators/groundworkcss/install/templates/groundwork.js~ +1 -0
- data/lib/generators/groundworkcss/layout/layout_generator.rb~ +21 -0
- data/lib/generators/groundworkcss/layout/templates/_header.html.erb~ +24 -0
- data/lib/generators/groundworkcss/layout/templates/_sidebar.html.erb~ +18 -0
- data/lib/generators/groundworkcss/layout/templates/layout.html.erb~ +44 -0
- data/lib/groundworkcss/rails/bootstrap.rb~ +2 -0
- data/lib/groundworkcss/rails/engine.rb~ +30 -0
- data/lib/groundworkcss/rails/version.rb +1 -1
- data/lib/groundworkcss/rails/version.rb~ +1 -1
- data/lib/twitter-bootstrap-rails.rb~ +10 -0
- data/vendor/assets/javascripts/groundwork-hook.js +2 -0
- data/vendor/assets/javascripts/groundwork-hook.js~ +3 -0
- data/vendor/assets/javascripts/groundwork.js~ +8 -0
- data/vendor/assets/javascripts/groundworkcss/groundwork.js~ +7 -0
- data/vendor/assets/stylesheets/groundworkcss-scss/_font-awesome.scss~ +534 -0
- data/vendor/assets/stylesheets/groundworkcss-scss/_grid.scss +101 -21
- data/vendor/assets/stylesheets/groundworkcss-scss/_helpers.scss +62 -27
- data/vendor/assets/stylesheets/groundworkcss-scss/_mixins.scss +0 -9
- data/vendor/assets/stylesheets/groundworkcss-scss/_modals.scss +3 -3
- data/vendor/assets/stylesheets/groundworkcss-scss/_reset.scss +3 -2
- data/vendor/assets/stylesheets/groundworkcss-scss/_responsive.scss +2 -6
- data/vendor/assets/stylesheets/groundworkcss-scss/_social-icons.scss~ +92 -0
- data/vendor/assets/stylesheets/groundworkcss-scss/groundwork.scss +3 -9
- metadata +324 -307
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.modals.coffee +0 -161
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.popover.coffee +0 -198
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.popover.js +0 -10
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.responsiveTables.coffee +0 -56
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.responsiveTables.js +0 -10
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.responsiveText.coffee +0 -32
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.responsiveText.js +0 -10
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.tooltip.coffee +0 -121
- data/vendor/assets/javascripts/groundworkcss/plugins/coffee/jquery.tooltip.js +0 -10
@@ -0,0 +1,18 @@
|
|
1
|
+
module FlashBlockHelper
|
2
|
+
def flash_block
|
3
|
+
output = ''
|
4
|
+
flash.each do |type, message|
|
5
|
+
output += flash_container(type, message)
|
6
|
+
end
|
7
|
+
|
8
|
+
raw(output)
|
9
|
+
end
|
10
|
+
|
11
|
+
def flash_container(type, message)
|
12
|
+
# Types: important, success, warning, error
|
13
|
+
#<p class="warning message">This is a warning message.</p>
|
14
|
+
raw(content_tag(:p, :class => "message #{type}") do
|
15
|
+
message
|
16
|
+
end)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GroundworkFlashHelper
|
2
|
+
ALERT_TYPES = [:error, :success, :warning]
|
3
|
+
|
4
|
+
def groundwork_flash
|
5
|
+
flash_messages = []
|
6
|
+
flash.each do |type, message|
|
7
|
+
next if message.blank?
|
8
|
+
|
9
|
+
type = :success if type == :notice
|
10
|
+
type = :error if type == :alert
|
11
|
+
next unless ALERT_TYPES.include?(type)
|
12
|
+
|
13
|
+
Array(message).each do |msg|
|
14
|
+
text = content_tag(:p,
|
15
|
+
msg.html_safe, :class => "message #{type}")
|
16
|
+
flash_messages << text if message
|
17
|
+
end
|
18
|
+
end
|
19
|
+
flash_messages.join("\n").html_safe
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GroundworkFlashHelper
|
2
|
+
ALERT_TYPES = [:error, :success, :warning]
|
3
|
+
|
4
|
+
def bootstrap_flash
|
5
|
+
flash_messages = []
|
6
|
+
flash.each do |type, message|
|
7
|
+
next if message.blank?
|
8
|
+
|
9
|
+
type = :success if type == :notice
|
10
|
+
type = :error if type == :alert
|
11
|
+
next unless ALERT_TYPES.include?(type)
|
12
|
+
|
13
|
+
Array(message).each do |msg|
|
14
|
+
text = content_tag(:p,
|
15
|
+
msg.html_safe, :class => "message #{type}")
|
16
|
+
flash_messages << text if message
|
17
|
+
end
|
18
|
+
end
|
19
|
+
flash_messages.join("\n").html_safe
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module ModalHelper
|
2
|
+
def modal_dialog(options = {}, escape = true, &block)
|
3
|
+
default_options = {:class => "bootstrap-modal modal"}
|
4
|
+
content_tag :div, nil, options.merge(default_options), escape, &block
|
5
|
+
end
|
6
|
+
|
7
|
+
def modal_header(options = {}, escape = true, &block)
|
8
|
+
default_options = {:class => 'modal-header'}
|
9
|
+
content_tag :div, nil, options.merge(default_options), escape do
|
10
|
+
raw("<button class=\"close\" data-dismiss=\"modal\">×</button>" + capture(&block))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def modal_body(options = {}, escape = true, &block)
|
15
|
+
default_options = {:class => 'modal-body'}
|
16
|
+
content_tag :div, nil, options.merge(default_options), escape, &block
|
17
|
+
end
|
18
|
+
|
19
|
+
def modal_footer(options = {}, escape = true, &block)
|
20
|
+
default_options = {:class => 'modal-footer'}
|
21
|
+
content_tag :div, nil, options.merge(default_options), escape, &block
|
22
|
+
end
|
23
|
+
|
24
|
+
def modal_toggle(content_or_options = nil, options = {}, &block)
|
25
|
+
if block_given?
|
26
|
+
options = content_or_options if content_or_options.is_a?(Hash)
|
27
|
+
default_options = {:class => 'btn', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
|
28
|
+
|
29
|
+
content_tag :a, nil, default_options, true, &block
|
30
|
+
else
|
31
|
+
default_options = {:class => 'btn', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
|
32
|
+
content_tag :a, content_or_options, default_options, true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def modal_cancel_button content, options = {}
|
37
|
+
default_options = {:class => "btn bootstrap-modal-cancel-button"}
|
38
|
+
|
39
|
+
content_tag_string "a", content, default_options.merge(options)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module SocialGlyphHelper
|
2
|
+
# ==== Examples
|
3
|
+
# social_glyph(:dropbox, :large)
|
4
|
+
# # => <i class="social-icon dropbox large"></i>
|
5
|
+
# social_glyph(:dropbox)
|
6
|
+
# # => <i class="social-icon dropbox"></i>
|
7
|
+
|
8
|
+
def social_glyph(icon, size)
|
9
|
+
content_tag :i, nil, :class => "social-icon #{icon} #{size unless size.nil?}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Groundworkcss
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
desc "This generator installs GroundworkCSS to Asset Pipeline"
|
9
|
+
argument :stylesheets_type, :type => :string, :default => 'less', :banner => '*less or static'
|
10
|
+
|
11
|
+
def add_assets
|
12
|
+
|
13
|
+
if File.exist?('app/assets/javascripts/application.js')
|
14
|
+
insert_into_file "app/assets/javascripts/application.js", "//= require groundwork\n", :after => "jquery_ujs\n"
|
15
|
+
else
|
16
|
+
copy_file "application.js", "app/assets/javascripts/application.js"
|
17
|
+
end
|
18
|
+
|
19
|
+
if File.exist?('app/assets/stylesheets/application.css')
|
20
|
+
style_require_block = " *= require groundwork-and-overrides\n"
|
21
|
+
insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
|
22
|
+
else
|
23
|
+
copy_file "application.css", "app/assets/stylesheets/application.css"
|
24
|
+
end
|
25
|
+
|
26
|
+
copy_file "groundwork-and-overrides.scss", "app/assets/stylesheets/groundwork-and-overrides.scss"
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_javascript
|
31
|
+
if use_coffeescript?
|
32
|
+
copy_file "groundwork.coffee", "app/assets/javascripts/groundwork.js.coffee"
|
33
|
+
else
|
34
|
+
copy_file "groundwork.js", "app/assets/javascripts/groundwork.js"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def use_coffeescript?
|
40
|
+
::Rails.configuration.app_generators.rails[:javascript_engine] == :coffee
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require groundworkscss/groundwork
|
7
|
+
*= require_tree .
|
8
|
+
*/
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require twitter/bootstrap
|
10
|
+
//= require_tree .
|
@@ -0,0 +1,12 @@
|
|
1
|
+
$socialPath: "../assets/groundworkcss/social-icons" !default;
|
2
|
+
$fontAwesomePath: "../assets/groundworkcss" !default;
|
3
|
+
|
4
|
+
@import "groundworkcss-scss/groundwork";
|
5
|
+
|
6
|
+
body {
|
7
|
+
background: url("pw_maze_white.png");
|
8
|
+
}
|
9
|
+
|
10
|
+
header{
|
11
|
+
background: white;
|
12
|
+
}
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Groundworkcss
|
4
|
+
module Generators
|
5
|
+
class LayoutGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
desc "This generator generates layout file with navigation."
|
8
|
+
argument :layout_name, :type => :string, :default => "application"
|
9
|
+
attr_reader :app_name, :container_class
|
10
|
+
|
11
|
+
def generate_layout
|
12
|
+
app = ::Rails.application
|
13
|
+
@app_name = app.class.to_s.split("::").first
|
14
|
+
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
15
|
+
template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
|
16
|
+
copy_file "_sidebar.html.#{ext}", "app/views/layouts/_sidebar.html.#{ext}"
|
17
|
+
copy_file "_header.html.#{ext}", "app/views/layouts/_sidebar.html.#{ext}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<header class="white band padded">
|
2
|
+
<div class="container pad-top">
|
3
|
+
<div class="row">
|
4
|
+
<div class="one third padded">
|
5
|
+
|
6
|
+
<h1 class="responsive">
|
7
|
+
<a href="#">
|
8
|
+
<%= ::Rails.application.class.to_s.split("::").first %>
|
9
|
+
</a>
|
10
|
+
</h1>
|
11
|
+
|
12
|
+
</div>
|
13
|
+
<div class="two thirds padded">
|
14
|
+
<nav class="inline pull-right pad-top">
|
15
|
+
<ul>
|
16
|
+
<li><a href="#">Link 1</a></li>
|
17
|
+
<li><a href="#">Link 2</a></li>
|
18
|
+
<li><a href="#">Link 3</a></li>
|
19
|
+
</ul>
|
20
|
+
</nav>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</header>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if content_for?(:nav) || content_for?(:sidebar)%>
|
2
|
+
<aside class="one fifth padded border-right">
|
3
|
+
<% if content_for? :nav %>
|
4
|
+
<h3>Navigation</h3>
|
5
|
+
<nav>
|
6
|
+
<ul>
|
7
|
+
<%= yield :nav%>
|
8
|
+
</ul>
|
9
|
+
</nav>
|
10
|
+
<%end%>
|
11
|
+
|
12
|
+
<br/>
|
13
|
+
|
14
|
+
<% if content_for? :sidebar%>
|
15
|
+
<%= yield :sidebar%>
|
16
|
+
<%end%>
|
17
|
+
</aside>
|
18
|
+
<%end%>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
|
7
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name %>" %></title>
|
8
|
+
<%%= csrf_meta_tags %>
|
9
|
+
|
10
|
+
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
11
|
+
<!--[if lt IE 9]>
|
12
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
|
13
|
+
<![endif]-->
|
14
|
+
<%%= stylesheet_link_tag "application", :media => "all" %>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
|
18
|
+
<%%= render :partial => "layouts/header"%>
|
19
|
+
|
20
|
+
<div class="container">
|
21
|
+
<div class="row">
|
22
|
+
<%%= render :partial => "layouts/sidebar"%>
|
23
|
+
|
24
|
+
<section class="
|
25
|
+
<%%if content_for?(:sidebar) || content_for?(:nav)%>
|
26
|
+
four fifths
|
27
|
+
<%%end%>
|
28
|
+
padded">
|
29
|
+
|
30
|
+
<%%= groundwork_flash %>
|
31
|
+
|
32
|
+
<%%= yield %>
|
33
|
+
|
34
|
+
</section>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<footer class="footer align-center">
|
38
|
+
<p>© Company 2013</p>
|
39
|
+
</footer>
|
40
|
+
|
41
|
+
</div> <!-- /container -->
|
42
|
+
<%%= javascript_include_tag "application" %>
|
43
|
+
</body>
|
44
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../../../app/helpers/flash_block_helper.rb'
|
4
|
+
require File.dirname(__FILE__) + '/../../../app/helpers/glyph_helper.rb'
|
5
|
+
require File.dirname(__FILE__) + '/../../../app/helpers/social_glyph_helper.rb'
|
6
|
+
|
7
|
+
module Groundworkcss
|
8
|
+
module Rails
|
9
|
+
class Engine < ::Rails::Engine
|
10
|
+
initializer 'groundworkcss-rails.setup',
|
11
|
+
:after => 'less-rails.after.load_config_initializers',
|
12
|
+
:group => :all do |app|
|
13
|
+
if defined?(Less)
|
14
|
+
app.config.less.paths << File.join(config.root, 'vendor', 'toolkit')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
initializer 'groundworkcss-rails.setup_helpers' do |app|
|
19
|
+
app.config.to_prepare do
|
20
|
+
ActionController::Base.send :include, BreadCrumbs
|
21
|
+
ActionController::Base.send :helper, FlashBlockHelper
|
22
|
+
ActionController::Base.send :helper, ModalHelper
|
23
|
+
ActionController::Base.send :helper, GlyphHelper
|
24
|
+
ActionController::Base.send :helper, SocialGlyphHelper
|
25
|
+
#ActionController::Base.send :helper_method, :render_breadcrumbs
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
//= require_tree ./libs
|
2
|
+
//= require ./plugins/jquery.modals.js
|
3
|
+
//= require ./plugins/jquery.orbit-1.4.0.js
|
4
|
+
//= require ./plugins/jquery.popover.js
|
5
|
+
//= require ./plugins/jquery.responsiveTables.js
|
6
|
+
//= require ./plugins/jquery.responsiveText.js
|
7
|
+
//= require ./plugins/jquery.tooltip.js
|
8
|
+
//= require ./groundwork_ujs.js
|
@@ -0,0 +1,7 @@
|
|
1
|
+
//= require_tree ./libs
|
2
|
+
//= require ./plugins/jquery.modals.js
|
3
|
+
//= require ./plugins/jquery.orbit-1.4.0.js
|
4
|
+
//= require ./plugins/jquery.popover.js
|
5
|
+
//= require ./plugins/jquery.responsiveTables.js
|
6
|
+
//= require ./plugins/jquery.responsiveText.js
|
7
|
+
//= require ./plugins/jquery.tooltip.js
|