bootswatch_rails 3.1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/Makefile +25 -0
- data/README.md +44 -0
- data/Rakefile +2 -0
- data/bootswatch_rails.gemspec +27 -0
- data/generate.sh +79 -0
- data/lib/bootswatch_rails/engine.rb +9 -0
- data/lib/bootswatch_rails/version.rb +5 -0
- data/lib/bootswatch_rails.rb +5 -0
- data/lib/generators/bootswatch_rails/install/install_generator.rb +46 -0
- data/lib/generators/bootswatch_rails/install/templates/app/assets/images/Rails_logo_80.jpg +0 -0
- data/lib/generators/bootswatch_rails/install/templates/app/helpers/application_helper.rb +21 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_flash.html.erb +9 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_footer.html.erb +12 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_head.html.erb +19 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_navbar_left.html.erb +1 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_navbar_right.html.erb +1 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_sidebar.html.erb +1 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_topnav.html.erb +25 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/application.html.erb +27 -0
- data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/centered.html.erb +19 -0
- data/lib/generators/bootswatch_rails/install/templates/config/initializers/simple_form_horizontal.rb +15 -0
- data/lib/generators/bootswatch_rails/install/templates/config/locales/simple_form.de.yml +13 -0
- data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/_form.html.erb +30 -0
- data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/edit.html.erb +3 -0
- data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/index.html.erb +43 -0
- data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/new.html.erb +3 -0
- data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/show.html.erb +31 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/stylesheets/amelia.css +5889 -0
- data/vendor/assets/stylesheets/cerulean.css +5896 -0
- data/vendor/assets/stylesheets/cosmo.css +5902 -0
- data/vendor/assets/stylesheets/custom.css +5781 -0
- data/vendor/assets/stylesheets/cyborg.css +5888 -0
- data/vendor/assets/stylesheets/darkly.css +6000 -0
- data/vendor/assets/stylesheets/flatly.css +5978 -0
- data/vendor/assets/stylesheets/journal.css +5849 -0
- data/vendor/assets/stylesheets/lumen.css +6118 -0
- data/vendor/assets/stylesheets/readable.css +5899 -0
- data/vendor/assets/stylesheets/simplex.css +5886 -0
- data/vendor/assets/stylesheets/slate.css +6135 -0
- data/vendor/assets/stylesheets/spacelab.css +5935 -0
- data/vendor/assets/stylesheets/superhero.css +5967 -0
- data/vendor/assets/stylesheets/united.css +5790 -0
- data/vendor/assets/stylesheets/yeti.css +6087 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e68d5b97e95b7a3dc52063a133a0fb73317685e
|
4
|
+
data.tar.gz: caa120b4d873b49dcdf06b957e1b4caf691607ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9bec300dba8b83547b349dd861c86c5bf20f44ae78b700bdaf18422347a0e0291a8d233b83e229284db8404ff97c2d64949937d8f052e5593545160b66bbe7b0
|
7
|
+
data.tar.gz: 06e915645038edecd7996194b90fc3f85dab09ca435f7eedec4b0986baa211c88c25334a7eb0b9362a9f5c0eb20c02db9c5b546d8ece0a622f45fa46285a4920
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.gitmodules
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Volker Wiegand
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Volker Wiegand
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# vim: set ts=8 tw=0 noet :
|
2
|
+
#
|
3
|
+
# Makefile for building the Gem
|
4
|
+
#
|
5
|
+
|
6
|
+
GEMNAME := bootswatch_rails
|
7
|
+
|
8
|
+
all: build
|
9
|
+
|
10
|
+
update:
|
11
|
+
./generate.sh -u
|
12
|
+
|
13
|
+
build:
|
14
|
+
./generate.sh
|
15
|
+
git add lib
|
16
|
+
git add vendor
|
17
|
+
-git commit -a -m "Prepare for initial commit"
|
18
|
+
rake build
|
19
|
+
-sudo gem uninstall ${GEMNAME} --all --force
|
20
|
+
sudo rake install
|
21
|
+
|
22
|
+
clean:
|
23
|
+
-sudo gem uninstall ${GEMNAME} --all --force
|
24
|
+
sudo rm -rf pkg
|
25
|
+
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# BootswatchRails
|
2
|
+
|
3
|
+
This gem helps to bootstrap a project using bootswatch.com assets.
|
4
|
+
|
5
|
+
Bootswatch.com is a derivative work based on Twitter Bootstrap version 3
|
6
|
+
that comes with a bunch of precompiled stylesheets. In my projects I use
|
7
|
+
bootstrap-sass as the gem providing the Bootstrap javascripts, while I
|
8
|
+
access the precompiled stylesheets (including fonts) via Bootswatch.
|
9
|
+
|
10
|
+
Bootswatch_rails uses simple_form and currently this is hard coded. The
|
11
|
+
installer configures simple_form to prefer horizontal forms.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'bootswatch_rails'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install bootswatch_rails
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Basically just run 'rails generate bootswatch_rails:install`
|
30
|
+
|
31
|
+
TODO: include more information!
|
32
|
+
|
33
|
+
## Testing
|
34
|
+
|
35
|
+
Since I have no experience with test driven development (yet), this is
|
36
|
+
still an empty spot. Any help is highly appreciated.
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it ( https://github.com/[my-github-username]/bootswatch_rails/fork )
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bootswatch_rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bootswatch_rails"
|
8
|
+
spec.version = BootswatchRails::VERSION
|
9
|
+
spec.authors = ["Volker Wiegand"]
|
10
|
+
spec.email = ["volker.wiegand@cvw.de"]
|
11
|
+
spec.summary = "Add bootswatch.com themes to the Rails asset pipeline"
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = "https://github.com/volkerwiegand/bootswatch_rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 1.9.3'
|
22
|
+
spec.add_dependency 'railties', '~> 4.0'
|
23
|
+
spec.add_dependency 'bootstrap-sass', '~> 3.1'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
27
|
+
end
|
data/generate.sh
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# vim: set ts=8 tw=0 noet :
|
3
|
+
|
4
|
+
#################################################################################
|
5
|
+
######
|
6
|
+
###### Get bootswatch.com stylesheet and font files
|
7
|
+
######
|
8
|
+
#################################################################################
|
9
|
+
|
10
|
+
git submodule foreach git pull || exit 1
|
11
|
+
|
12
|
+
_assets="vendor/assets"
|
13
|
+
mkdir -p $_assets/stylesheets $_assets/fonts || exit 1
|
14
|
+
|
15
|
+
_themes_css=""
|
16
|
+
_themes_raw=""
|
17
|
+
for _file in $(ls -1 bootswatch/*/bootstrap.css) ; do
|
18
|
+
_file=${_file#bootswatch/}
|
19
|
+
_theme=${_file%/bootstrap.css}
|
20
|
+
_src="bootswatch/$_file"
|
21
|
+
_dst="$_assets/stylesheets/$_theme.css"
|
22
|
+
rm -f /tmp/css.tmp
|
23
|
+
sed -e 's#\.\./fonts/#/assets/#g' $_src >/tmp/css.tmp || exit 1
|
24
|
+
if cmp -s /tmp/css.tmp $_dst ; then
|
25
|
+
rm -f /tmp/css.tmp
|
26
|
+
else
|
27
|
+
echo "copy: $_theme.css"
|
28
|
+
mv /tmp/css.tmp $_dst || exit 1
|
29
|
+
fi
|
30
|
+
if [ -z "$_themes_css" ] ; then
|
31
|
+
_themes_css="$_theme.css"
|
32
|
+
else
|
33
|
+
_themes_css="$_themes_css $_theme.css"
|
34
|
+
fi
|
35
|
+
if [ -z "$_themes_raw" ] ; then
|
36
|
+
_themes_raw=":$_theme"
|
37
|
+
else
|
38
|
+
_themes_raw="$_themes_raw, :$_theme"
|
39
|
+
fi
|
40
|
+
done
|
41
|
+
|
42
|
+
_engine="lib/bootswatch_rails/engine.rb"
|
43
|
+
if [ -s $_engine ] ; then
|
44
|
+
rm -f /tmp/engine.tmp
|
45
|
+
sed -e "/assets.precompile/s/=.*/= %w($_themes_css)/" \
|
46
|
+
$_engine >/tmp/engine.tmp || exit 1
|
47
|
+
if cmp -s /tmp/engine.tmp $_engine ; then
|
48
|
+
rm -f /tmp/engine.tmp
|
49
|
+
else
|
50
|
+
echo "edit: $_engine"
|
51
|
+
mv /tmp/engine.tmp $_engine || exit 1
|
52
|
+
fi
|
53
|
+
fi
|
54
|
+
|
55
|
+
_version="lib/bootswatch_rails/version.rb"
|
56
|
+
if [ -s $_version ] ; then
|
57
|
+
rm -f /tmp/version.tmp
|
58
|
+
sed -e "/THEMES/s/=.*/= [$_themes_raw]/" \
|
59
|
+
$_version >/tmp/version.tmp || exit 1
|
60
|
+
if cmp -s /tmp/version.tmp $_version ; then
|
61
|
+
rm -f /tmp/version.tmp
|
62
|
+
else
|
63
|
+
echo "edit: $_version"
|
64
|
+
mv /tmp/version.tmp $_version || exit 1
|
65
|
+
fi
|
66
|
+
fi
|
67
|
+
|
68
|
+
for _file in bootswatch/fonts/*.* ; do
|
69
|
+
_file=${_file##*/}
|
70
|
+
_src="bootswatch/fonts/$_file"
|
71
|
+
_dst="$_assets/fonts/$_file"
|
72
|
+
if ! cmp -s $_src $_dst ; then
|
73
|
+
echo "copy: $_file"
|
74
|
+
cp $_src $_dst || exit 1
|
75
|
+
fi
|
76
|
+
done
|
77
|
+
|
78
|
+
exit 0
|
79
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module BootswatchRails
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
initializer "BootswatchRails themes" do |app|
|
4
|
+
app.config.assets.precompile += %w(amelia.css cerulean.css cosmo.css custom.css cyborg.css darkly.css flatly.css journal.css lumen.css readable.css simplex.css slate.css spacelab.css superhero.css united.css yeti.css)
|
5
|
+
app.config.assets.paths << File.expand_path('../../../vendor/assets/fonts', __FILE__)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module BootswatchRails
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc "Setup application to use bootswatch.com"
|
5
|
+
class_option :bootstrap, type: :boolean, default: true,
|
6
|
+
desc: 'Add bootstrap to application.js'
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
|
9
|
+
def update_javascripts
|
10
|
+
return unless options.bootstrap?
|
11
|
+
inside "app/assets/javascripts" do
|
12
|
+
inject_into_file "application.js", after: /require jquery_ujs$/ do
|
13
|
+
"\n//= require bootstrap"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def update_application_controller
|
19
|
+
inside "app/controllers" do
|
20
|
+
file = "application_controller.rb"
|
21
|
+
inject_into_file file, after: /protect_from_forgery.*$/ do
|
22
|
+
"\n\n private"
|
23
|
+
end
|
24
|
+
lines = [
|
25
|
+
"",
|
26
|
+
" def current_theme",
|
27
|
+
" @current_theme ||= current_user ? current_user.theme : '#{BootswatchRails::THEMES[BootswatchRails::DEFAULT].to_s}'",
|
28
|
+
" end",
|
29
|
+
" helper_method :current_theme",
|
30
|
+
""
|
31
|
+
]
|
32
|
+
inject_into_file file, before: /^end$/ do
|
33
|
+
lines.join("\n")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def copy_directories
|
39
|
+
directory "app", force: true
|
40
|
+
directory "config"
|
41
|
+
directory "lib", force: true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ApplicationHelper
|
2
|
+
def app_name
|
3
|
+
"Demo Application"
|
4
|
+
end
|
5
|
+
|
6
|
+
def brand_logo
|
7
|
+
image_tag("Rails_logo_80.jpg")
|
8
|
+
end
|
9
|
+
|
10
|
+
def copyright_year
|
11
|
+
Time.now.year
|
12
|
+
end
|
13
|
+
|
14
|
+
def copyright_text
|
15
|
+
"Copyright Holder"
|
16
|
+
end
|
17
|
+
|
18
|
+
def copyright_link
|
19
|
+
"http://www.example.com/"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%- flash.each do |name, msg| -%>
|
2
|
+
<%- if msg.is_a?(String) -%>
|
3
|
+
<div class="alert alert-<%= name.to_s == 'notice' ? 'success' : 'danger' %>">
|
4
|
+
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
5
|
+
<%= content_tag :div, msg, id: "flash_#{name}" %>
|
6
|
+
</div>
|
7
|
+
<%- end -%>
|
8
|
+
<%- end -%>
|
9
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<head>
|
2
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
3
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
4
|
+
|
5
|
+
<title><%= content_for?(:title) ? yield(:title) : app_name %></title>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
8
|
+
<%= stylesheet_link_tag current_theme, 'data-turbolinks-track' => true %>
|
9
|
+
|
10
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
11
|
+
|
12
|
+
<!--[if lt IE 9]>
|
13
|
+
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
14
|
+
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
15
|
+
<![endif]-->
|
16
|
+
|
17
|
+
<%= csrf_meta_tags %>
|
18
|
+
</head>
|
19
|
+
|
data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_navbar_left.html.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<li><%= link_to 'Left', '#' %></li>
|
data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/_navbar_right.html.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<li><%= link_to 'Right', '#' %></li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h4>Sidebar</h4>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header">
|
4
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
5
|
+
<span class="sr-only">Toggle navigation</span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
<span class="icon-bar"></span>
|
8
|
+
<span class="icon-bar"></span>
|
9
|
+
</button>
|
10
|
+
<a class="navbar-brand" href="#">
|
11
|
+
<%= link_to brand_logo, copyright_link %>
|
12
|
+
</a>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="navbar-collapse collapse">
|
16
|
+
<ul class="nav navbar-nav navbar-left">
|
17
|
+
<%= render 'layouts/navbar_left' %>
|
18
|
+
</ul>
|
19
|
+
<ul class="nav navbar-nav navbar-right">
|
20
|
+
<%= render 'layouts/navbar_right' %>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</nav>
|
25
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="de">
|
3
|
+
<%= render 'layouts/head' %>
|
4
|
+
|
5
|
+
<body>
|
6
|
+
<%= render 'layouts/topnav' %>
|
7
|
+
|
8
|
+
<div class="container" id="main-content">
|
9
|
+
<%- if user_signed_in? -%>
|
10
|
+
<div class="row">
|
11
|
+
<div class="col-md-9">
|
12
|
+
<%= render 'layouts/flash' %>
|
13
|
+
<%= yield %>
|
14
|
+
</div>
|
15
|
+
<div class="well col-md-3">
|
16
|
+
<%= render 'layouts/sidebar' %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<%- else -%>
|
20
|
+
<%= render 'layouts/flash' %>
|
21
|
+
<%= yield %>
|
22
|
+
<%- end -%>
|
23
|
+
|
24
|
+
<%= render 'layouts/footer' %>
|
25
|
+
</div>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="de">
|
3
|
+
<%= render 'layouts/head' %>
|
4
|
+
|
5
|
+
<body>
|
6
|
+
<%= render 'layouts/topnav' %>
|
7
|
+
|
8
|
+
<div class="container" id="main-content">
|
9
|
+
<div class="row">
|
10
|
+
<div class="col-md-6 col-md-offset-3">
|
11
|
+
<%= render 'layouts/flash' %>
|
12
|
+
<%= yield %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<%= render 'layouts/footer' %>
|
17
|
+
</div>
|
18
|
+
</body>
|
19
|
+
</html>
|
data/lib/generators/bootswatch_rails/install/templates/config/initializers/simple_form_horizontal.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
SimpleForm.setup do |config|
|
2
|
+
config.form_class = 'simple_form form-horizontal'
|
3
|
+
config.default_wrapper = :horizontal_form
|
4
|
+
config.input_mappings = {
|
5
|
+
/picture/ => :file,
|
6
|
+
/document/ => :file,
|
7
|
+
}
|
8
|
+
config.wrapper_mappings = {
|
9
|
+
check_boxes: :horizontal_radio_and_checkboxes,
|
10
|
+
radio_buttons: :horizontal_radio_and_checkboxes,
|
11
|
+
file: :horizontal_file_input,
|
12
|
+
boolean: :horizontal_boolean
|
13
|
+
}
|
14
|
+
config.error_notification_class = 'alert alert-danger'
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
de:
|
2
|
+
simple_form:
|
3
|
+
"yes": 'ja'
|
4
|
+
"no": 'nein'
|
5
|
+
required:
|
6
|
+
text: 'Pflichtfeld'
|
7
|
+
mark: '*'
|
8
|
+
# You can uncomment the line below if you need to overwrite the whole required html.
|
9
|
+
# When using html, text and mark won't be used.
|
10
|
+
# html: '<abbr title="required">*</abbr>'
|
11
|
+
error_notification:
|
12
|
+
default_message: "Beim Speichern sind Fehler aufgetreten:"
|
13
|
+
|
data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/_form.html.erb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<%- attributes.each do |attribute| -%>
|
5
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
6
|
+
<%- if attribute.name.include?("picture") -%>
|
7
|
+
<%%= f.input :<%= attribute.name %>_cache, as: :hidden %>
|
8
|
+
<%%- if @<%= singular_table_name %>.<%= attribute.name %>? -%>
|
9
|
+
<div class="form-group">
|
10
|
+
<div class="col-sm-offset-3 col-sm-9">
|
11
|
+
<%%= image_tag(@<%= singular_table_name %>.<%= attribute.name %>_url(:thumb)) %>
|
12
|
+
|
13
|
+
<label for="<%= singular_table_name %>_remove_<%= attribute.name %>">
|
14
|
+
<%%= f.check_box :remove_<%= attribute.name %> %>
|
15
|
+
<%%= t('headers.destroy', name: t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>')) %>
|
16
|
+
</label>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<%%- end -%>
|
20
|
+
<%- end -%>
|
21
|
+
<%- end -%>
|
22
|
+
|
23
|
+
<%%= f.button :submit, class: 'btn btn-primary' %>
|
24
|
+
<%%- if @<%= singular_table_name %>.new_record? -%>
|
25
|
+
<%%= link_to t('actions.back.index'), <%= index_helper %>_path, class: 'btn btn-default' %>
|
26
|
+
<%%- else -%>
|
27
|
+
<%%= link_to t('actions.back.show'), @<%= singular_table_name %>, class: 'btn btn-default' %>
|
28
|
+
<%%= link_to t('actions.back.index'), <%= index_helper %>_path, class: 'btn btn-default' %>
|
29
|
+
<%%- end -%>
|
30
|
+
<%% end %>
|
data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/index.html.erb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
<h2><%%= t('headers.index', name: t('activerecord.models.<%= singular_table_name %>.other')) %></h2>
|
2
|
+
|
3
|
+
<table class="table table-striped table-hover">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<% attributes.each do |attribute| -%>
|
7
|
+
<th><%%= t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>') %></th>
|
8
|
+
<% end -%>
|
9
|
+
<th class="form-actions"><%%= t('actions.title') %></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
15
|
+
<tr>
|
16
|
+
<% attributes.each do |attribute| -%>
|
17
|
+
<td>
|
18
|
+
<%- if attribute.name.include?("picture") -%>
|
19
|
+
<%%= image_tag(<%= singular_table_name %>.<%= attribute.name %>_url(:thumb).to_s) %>
|
20
|
+
<%- elsif attribute.type == :boolean -%>
|
21
|
+
<%%= <%= singular_table_name %>.<%= attribute.name %> ? t('simple_form.yes') : t('simple_form.no') %>
|
22
|
+
<%- elsif attribute.type == :belongs_to -%>
|
23
|
+
<%%= <%= singular_table_name %>.<%= attribute.name %>.name %>
|
24
|
+
<%- else -%>
|
25
|
+
<%%= <%= singular_table_name %>.<%= attribute.name %> %>
|
26
|
+
<%- end -%>
|
27
|
+
</td>
|
28
|
+
<% end -%>
|
29
|
+
<td>
|
30
|
+
<%%= link_to t('actions.show'), <%= singular_table_name %>, class: 'btn btn-default btn-xs' %>
|
31
|
+
<br>
|
32
|
+
<%%= link_to t('actions.edit'), [:edit, <%= singular_table_name %>], class: 'btn btn-default btn-xs' %>
|
33
|
+
<br>
|
34
|
+
<%%= link_to t('actions.destroy'), <%= singular_table_name %>, method: :delete, data: { confirm: t('actions.confirm') }, class: 'btn btn-danger btn-xs' %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
<%% end %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<br>
|
42
|
+
|
43
|
+
<%%= link_to t('actions.add', name: t('activerecord.models.<%= singular_table_name %>.one')), new_<%= singular_table_name %>_path, class: 'btn btn-primary' %>
|
data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/show.html.erb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
<h2><%%= t('headers.show', name: t('activerecord.models.<%= singular_table_name %>.one')) %></h2>
|
2
|
+
|
3
|
+
<table class="table table-striped table-hover">
|
4
|
+
<tbody>
|
5
|
+
<% attributes.each do |attribute| -%>
|
6
|
+
<tr>
|
7
|
+
<td>
|
8
|
+
<%%= t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>') %>
|
9
|
+
</td>
|
10
|
+
<td>
|
11
|
+
<%- if attribute.name.include?("picture") -%>
|
12
|
+
<p>
|
13
|
+
<%%= link_to "Anzeigen in Originalgröße", '#' %>
|
14
|
+
</p>
|
15
|
+
<%%= image_tag(@<%= singular_table_name %>.<%= attribute.name %>_url(:display)) %>
|
16
|
+
<%- elsif attribute.type == :boolean -%>
|
17
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %> ? t('simple_form.yes') : t('simple_form.no') %>
|
18
|
+
<%- elsif attribute.type == :belongs_to -%>
|
19
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %>.name %>
|
20
|
+
<%- else -%>
|
21
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
22
|
+
<%- end -%>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end -%>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<%%= link_to t('actions.edit'), [:edit, @<%= singular_table_name %>], class: 'btn btn-primary' %>
|
30
|
+
<%%= link_to t('actions.back.index'), <%= index_helper %>_path, class: 'btn btn-default' %>
|
31
|
+
<%%= link_to t('actions.destroy'), @<%= singular_table_name %>, method: :delete, data: { confirm: t('actions.confirm') }, class: 'btn btn-danger' %>
|
Binary file
|