bootswatch_rails 3.2.0.43 → 3.3.0.1

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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/generate.sh +1 -1
  3. data/lib/bootswatch_rails/engine.rb +27 -2
  4. data/lib/bootswatch_rails/version.rb +4 -4
  5. data/lib/generators/bootswatch_rails/install/install_generator.rb +27 -8
  6. data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/application.html.erb +1 -8
  7. data/lib/generators/bootswatch_rails/install/templates/application.js +23 -0
  8. data/lib/generators/bootswatch_rails/install/templates/head.html.erb +16 -11
  9. data/lib/generators/bootswatch_rails/sorcery/sorcery_generator.rb +1 -1
  10. data/vendor/assets/stylesheets/cerulean.css +266 -118
  11. data/vendor/assets/stylesheets/cosmo.css +272 -120
  12. data/vendor/assets/stylesheets/custom.css +275 -127
  13. data/vendor/assets/stylesheets/cyborg.css +271 -119
  14. data/vendor/assets/stylesheets/darkly.css +271 -119
  15. data/vendor/assets/stylesheets/flatly.css +271 -119
  16. data/vendor/assets/stylesheets/journal.css +267 -119
  17. data/vendor/assets/stylesheets/lumen.css +271 -119
  18. data/vendor/assets/stylesheets/paper.css +267 -119
  19. data/vendor/assets/stylesheets/readable.css +267 -119
  20. data/vendor/assets/stylesheets/sandstone.css +271 -124
  21. data/vendor/assets/stylesheets/simplex.css +267 -119
  22. data/vendor/assets/stylesheets/slate.css +267 -119
  23. data/vendor/assets/stylesheets/spacelab.css +267 -119
  24. data/vendor/assets/stylesheets/superhero.css +271 -119
  25. data/vendor/assets/stylesheets/united.css +267 -119
  26. data/vendor/assets/stylesheets/yeti.css +271 -119
  27. metadata +3 -3
  28. data/vendor/assets/stylesheets/amelia.css +0 -6286
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17c04c6d5d38256f8b147ba8a594f005ffa9675e
4
- data.tar.gz: cee591c5b6b1506bdb5e48497a4829fee86b08d0
3
+ metadata.gz: e5ab991aeefb9e0f9f94bd1770a88fff5d261118
4
+ data.tar.gz: cdd6fa031c64bac29026a74dc5093362b3fd9bdb
5
5
  SHA512:
6
- metadata.gz: e3001fc7b7b1e3359cf47c40b97e62ad36682d1e237e66fc30d0f74aca10e27aa64508e73e4a58a9fcb93acd168e72c98733e3889d5116b1b085be14048062f4
7
- data.tar.gz: 7f53cb1906d49693470dedfd663fc86eb9d99e0ac3c51cd10421f6f26f4162ad23184428c989f3d793480bf78535e5be5fea8fdde1e6b4260e6733fc5e5d51c3
6
+ metadata.gz: c5f457f23fa82daa60321973aa974de4a3feb9f1cc6e2c7115e2ff7fe4370f1f61936cbc1e6fa5330ecfc7ac45b43db876af048d15d4f2a8519d5a903a34a834
7
+ data.tar.gz: fe94dda766ccd6c3a6583c2f16ce80241e0232694205a9525615b5f3216a8cfdb02928b51ba0924dbadf2bb69f6fcbe06de9b5f302e52420a108c94ae2c3ec18
data/generate.sh CHANGED
@@ -48,7 +48,7 @@ done
48
48
  _engine="lib/bootswatch_rails/engine.rb"
49
49
  if [ -s $_engine ] ; then
50
50
  rm -f /tmp/engine.tmp
51
- sed -e "/assets.precompile/s/=.*/= %w(bootstrap.js $_themes_css)/" $_engine >/tmp/engine.tmp
51
+ sed -e "/assets.precompile/s/=.*/= %w($_themes_css)/" $_engine >/tmp/engine.tmp
52
52
  if cmp -s /tmp/engine.tmp $_engine ; then
53
53
  rm -f /tmp/engine.tmp
54
54
  else
@@ -1,7 +1,32 @@
1
+ require_relative "version"
2
+
1
3
  module BootswatchRails
4
+ module ActionViewExtensions
5
+ OFFLINE = (Rails.env.development? or Rails.env.test?)
6
+
7
+ def bootswatch_link_tag(theme = nil, options = {})
8
+ theme ||= BootswatchRails::THEMES[BootswatchRails::DEFAULT].to_s
9
+ return stylesheet_link_tag(theme) if !options.delete(:force) and OFFLINE
10
+ bootswatch_url = "//maxcdn.bootstrapcdn.com/bootswatch/<%= BootswatchRails::BOOTSTRAP %>/#{theme}/bootstrap.min.css"
11
+ fontawesome_url = "//maxcdn.bootstrapcdn.com/font-awesome/<%= BootswatchRails::FONT_AWESOME %>/css/font-awesome.min.css"
12
+ stylesheet_link_tag(bootswatch_url) + "\n " + stylesheet_link_tag(fontawesome_url)
13
+ end
14
+
15
+ def bootstrap_include_tag(options = {})
16
+ return javascript_include_tag(:bootstrap, options) if !options.delete(:force) and OFFLINE
17
+ bootstrap_url = "//maxcdn.bootstrapcdn.com/bootstrap/#{BootswatchRails::BOOTSTRAP}/js/bootstrap.min.js"
18
+ [ javascript_include_tag(bootstrap_url, options),
19
+ javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(:bootstrap, options).gsub('<','%3C')}'))")
20
+ ].join("\n").html_safe
21
+ end
22
+ end
23
+
2
24
  class Engine < Rails::Engine
3
- initializer "BootswatchRails themes" do |app|
4
- app.config.assets.precompile += %w(bootstrap.js amelia.css cerulean.css cosmo.css custom.css cyborg.css darkly.css flatly.css journal.css lumen.css paper.css readable.css sandstone.css simplex.css slate.css spacelab.css superhero.css united.css yeti.css)
25
+ initializer "BootswatchRails" do |app|
26
+ ActiveSupport.on_load(:action_view) do
27
+ include BootswatchRails::ActionViewExtensions
28
+ end
29
+ app.config.assets.precompile += %w(cerulean.css cosmo.css custom.css cyborg.css darkly.css flatly.css journal.css lumen.css paper.css readable.css sandstone.css simplex.css slate.css spacelab.css superhero.css united.css yeti.css)
5
30
  app.config.assets.paths << File.expand_path('../../../vendor/assets/fonts', __FILE__)
6
31
  end
7
32
  end
@@ -1,8 +1,8 @@
1
1
  module BootswatchRails
2
- BOOTSTRAP = "3.2.0"
2
+ BOOTSTRAP = "3.3.0"
3
3
  FONT_AWESOME = "4.2.0"
4
- VERSION = "3.2.0.43"
4
+ VERSION = "3.3.0.1"
5
5
 
6
- THEMES = [:amelia, :cerulean, :cosmo, :custom, :cyborg, :darkly, :flatly, :journal, :lumen, :paper, :readable, :sandstone, :simplex, :slate, :spacelab, :superhero, :united, :yeti]
7
- DEFAULT = 1
6
+ THEMES = [:cerulean, :cosmo, :custom, :cyborg, :darkly, :flatly, :journal, :lumen, :paper, :readable, :sandstone, :simplex, :slate, :spacelab, :superhero, :united, :yeti]
7
+ DEFAULT = 0
8
8
  end
@@ -4,11 +4,17 @@ module BootswatchRails
4
4
  desc "Setup application to use bootswatch.com"
5
5
  class_option :turbolinks, type: :boolean, default: false,
6
6
  desc: 'Activate turbolinks (off by default)'
7
+ class_option :ui, type: :boolean, default: false,
8
+ desc: 'Include jQuery-ui (requires jquery-ui gem)'
9
+ class_option :cdn, type: :string, default: 'none',
10
+ banner: 'none, google, microsoft, jquery or yandex',
11
+ desc: 'Use CDN (requires jquery[-ui]-rails-cdn gems)'
7
12
  source_root File.expand_path("../templates", __FILE__)
8
13
 
9
14
  def update_application_controller
10
15
  file = "app/controllers/application_controller.rb"
11
16
  inject_into_file file, "\n\n private", after: /protect_from_forgery.*$/
17
+
12
18
  lines = [
13
19
  "",
14
20
  " def default_theme",
@@ -17,7 +23,7 @@ module BootswatchRails
17
23
  " helper_method :default_theme",
18
24
  "",
19
25
  " def current_theme",
20
- " @current_theme = current_user.theme if current_user.present?",
26
+ " @current_theme = current_user.theme if logged_in?",
21
27
  " @current_theme ||= default_theme",
22
28
  " end",
23
29
  " helper_method :current_theme",
@@ -26,6 +32,22 @@ module BootswatchRails
26
32
  inject_into_file file, lines.join("\n"), before: /^end$/
27
33
  end
28
34
 
35
+ def copy_application_js
36
+ file = "app/assets/javascripts/application.js"
37
+ remove_file file
38
+ template "application.js", file
39
+ end
40
+
41
+ def setup_assets_precompile
42
+ return unless options.cdn?
43
+ initializer "bootswatch_assets.rb" do
44
+ assets = "jquery.js"
45
+ assets += " jquery-ui.js" if options.ui?
46
+ assets += " bootstrap.js"
47
+ "Rails.application.config.assets.precompile += %w( #{assets} )"
48
+ end
49
+ end
50
+
29
51
  def copy_directories
30
52
  directory "app", force: true
31
53
  directory "config"
@@ -36,13 +58,10 @@ module BootswatchRails
36
58
  template "head.html.erb", "app/views/layouts/_head.html.erb"
37
59
  end
38
60
 
39
- def remove_turbolinks
40
- return if options.turbolinks?
41
- # comment_lines "Gemfile", /gem 'turbolinks/
42
- file = "app/assets/javascripts/application.js"
43
- gsub_file file, /^\/\/= require turbolinks\s/, ""
44
- file = "app/views/layouts/_head.html.erb"
45
- gsub_file file, /, 'data-turbolinks-track' => true/, ""
61
+ protected
62
+
63
+ def turbolinks
64
+ options.turbolinks? ? ", 'data-turbolinks-track' => true" : ""
46
65
  end
47
66
  end
48
67
  end
@@ -7,20 +7,13 @@
7
7
 
8
8
  <div class="container" id="main-content">
9
9
  <div class="row">
10
- <%- if current_user -%>
11
10
  <div class="col-md-9">
12
11
  <%= render 'layouts/flash' %>
13
12
  <%= yield %>
14
13
  </div>
15
- <div class="well col-md-3">
14
+ <div class="col-md-3 well">
16
15
  <%= render 'layouts/sidebar' %>
17
16
  </div>
18
- <%- else -%>
19
- <div class="col-md-12">
20
- <%= render 'layouts/flash' %>
21
- <%= yield %>
22
- </div>
23
- <%- end -%>
24
17
  </div>
25
18
  </div>
26
19
 
@@ -0,0 +1,23 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ <%- unless options.cdn? -%>
14
+ //= require jquery
15
+ <%- if options.ui? -%>
16
+ //= require jquery-ui
17
+ <%- end -%>
18
+ <%- end -%>
19
+ //= require jquery_ujs
20
+ <%- unless options.cdn? -%>
21
+ //= require bootstrap
22
+ <%- end -%>
23
+ //= require_tree .
@@ -4,17 +4,22 @@
4
4
 
5
5
  <title><%%= content_for?(:title) ? yield(:title) : app_name %></title>
6
6
 
7
- <%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
8
- <%%- if Rails.env.production? -%>
9
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootswatch/<%= BootswatchRails::BOOTSTRAP %>/<%%= current_theme %>/bootstrap.min.css">
10
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/<%= BootswatchRails::FONT_AWESOME %>/css/font-awesome.min.css">
11
- <%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
12
- <script src="//maxcdn.bootstrapcdn.com/bootstrap/<%= BootswatchRails::BOOTSTRAP %>/js/bootstrap.min.js"></script>
13
- <%%- else -%>
14
- <%%= stylesheet_link_tag current_theme, 'data-turbolinks-track' => true %>
15
- <%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
16
- <%%= javascript_include_tag 'bootstrap', 'data-turbolinks-track' => true %>
17
- <%%- end -%>
7
+ <%%= stylesheet_link_tag 'application', media: 'all'<%= turbolinks %> %>
8
+ <%- if options.cdn != "none" -%>
9
+ <%%= bootswatch_link_tag current_theme %>
10
+ <%- else -%>
11
+ <%%= stylesheet_link_tag current_theme<%= turbolinks %> %>
12
+ <%- end -%>
13
+ <%- if options.cdn != "none" -%>
14
+ <%%= jquery_include_tag :<%= options.cdn %><%= turbolinks %> %>
15
+ <%- if options.ui? -%>
16
+ <%%= jquery_ui_include_tag :<%= options.cdn %><%= turbolinks %> %>
17
+ <%- end -%>
18
+ <%- end -%>
19
+ <%%= javascript_include_tag 'application'<%= turbolinks %> %>
20
+ <%- if options.cdn != "none" -%>
21
+ <%%= bootstrap_include_tag<%= turbolinks %> %>
22
+ <%- end -%>
18
23
 
19
24
  <!--[if lt IE 9]>
20
25
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
@@ -141,7 +141,7 @@ module BootswatchRails
141
141
  " end",
142
142
  "",
143
143
  " def current_sysadm?",
144
- " current_#{name}.present? and current_#{name}.sysadm",
144
+ " logged_in? and current_#{name}.sysadm",
145
145
  " end",
146
146
  " helper_method :current_sysadm?",
147
147
  ""