noa-layout 0.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 (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +8 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +47 -0
  6. data/Rakefile +7 -0
  7. data/app/assets/javascripts/noa/layout/bootstrap.js +4 -0
  8. data/app/assets/stylesheets/noa/layout/bootstrap.css +6 -0
  9. data/app/assets/stylesheets/noa/layout/bootstrap/layout.css.scss +44 -0
  10. data/app/helpers/noa/layout/base_helper.rb +68 -0
  11. data/app/views/layouts/noa/layout/_sidebar.html.erb +1 -0
  12. data/app/views/layouts/noa/layout/base.html.erb +40 -0
  13. data/app/views/layouts/noa/layout/bootstrap.html.erb +42 -0
  14. data/lib/generators/noa/layout/install_generator.rb +9 -0
  15. data/lib/noa/layout.rb +8 -0
  16. data/lib/noa/layout/engine.rb +6 -0
  17. data/lib/noa/layout/version.rb +5 -0
  18. data/noa-layout.gemspec +26 -0
  19. data/spec/dummy/README.rdoc +28 -0
  20. data/spec/dummy/Rakefile +6 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  24. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  25. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  26. data/spec/dummy/app/mailers/.keep +0 -0
  27. data/spec/dummy/app/models/.keep +0 -0
  28. data/spec/dummy/app/models/concerns/.keep +0 -0
  29. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  30. data/spec/dummy/bin/bundle +3 -0
  31. data/spec/dummy/bin/rails +4 -0
  32. data/spec/dummy/bin/rake +4 -0
  33. data/spec/dummy/config.ru +4 -0
  34. data/spec/dummy/config/application.rb +27 -0
  35. data/spec/dummy/config/boot.rb +9 -0
  36. data/spec/dummy/config/database.yml +25 -0
  37. data/spec/dummy/config/environment.rb +5 -0
  38. data/spec/dummy/config/environments/development.rb +27 -0
  39. data/spec/dummy/config/environments/production.rb +80 -0
  40. data/spec/dummy/config/environments/test.rb +36 -0
  41. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  43. data/spec/dummy/config/initializers/inflections.rb +16 -0
  44. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  45. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  46. data/spec/dummy/config/initializers/session_store.rb +3 -0
  47. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  48. data/spec/dummy/config/locales/en.yml +23 -0
  49. data/spec/dummy/config/routes.rb +2 -0
  50. data/spec/dummy/db/development.sqlite3 +0 -0
  51. data/spec/dummy/db/schema.rb +23 -0
  52. data/spec/dummy/db/test.sqlite3 +0 -0
  53. data/spec/dummy/lib/assets/.keep +0 -0
  54. data/spec/dummy/log/.keep +0 -0
  55. data/spec/dummy/log/development.log +1259 -0
  56. data/spec/dummy/log/test.log +849 -0
  57. data/spec/dummy/public/404.html +27 -0
  58. data/spec/dummy/public/422.html +26 -0
  59. data/spec/dummy/public/500.html +26 -0
  60. data/spec/dummy/public/favicon.ico +0 -0
  61. data/spec/spec_helper.rb +15 -0
  62. metadata +175 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fe9d6f9fbdbf8e27fb6479009fa1adff7c2f6528
4
+ data.tar.gz: 4eed6cc6da677fed1b48fdaec2e34bba80c724ce
5
+ SHA512:
6
+ metadata.gz: 31cbc99314e6019829b6192080276d8601276fd42f8dfe4906c708547b152710d1f63a503a86f77d60dacae7f4141c40972460ba813a9227b955635f30dad186
7
+ data.tar.gz: 061fb14b0203277021c2379deed243d64a9c987694f56f3d031c27134615e375705224082bf1e94d3a5fe70a42d8b531b10c8b50b7990822a57cce73fc66b645
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rails", "4.0.0.beta1"
6
+ gem "spork-rails", github: "A-gen/spork-rails"
7
+ gem "database_cleaner", github: "bmabey/database_cleaner"
8
+ gem "noa-developer", github: "jarijokinen/noa-developer"
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jari Jokinen
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.
@@ -0,0 +1,47 @@
1
+ # Noa::Layout
2
+
3
+ Layout module for [Noa](https://github.com/jarijokinen/noa).
4
+
5
+ Layout module provides basic layouts for different purposes. It also provides
6
+ several layout-related helper methods.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem "noa-layout"
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install noa-layout
21
+
22
+ ## Usage
23
+
24
+ Use layouts as usual inside your controllers:
25
+
26
+ layout "noa/layout/[LAYOUT_NAME]"
27
+
28
+ ## Generators
29
+
30
+ List all available layouts:
31
+
32
+ rails generate noa:layout:list
33
+
34
+ Copy a layout into your local app/views/layouts/ directory:
35
+
36
+ rails generate noa:layout:install LAYOUT_NAME
37
+
38
+ ## Support
39
+
40
+ If you have any issues with Noa, or if you like to report a bug, please create
41
+ an [issue on GitHub](https://github.com/jarijokinen/noa/issues).
42
+
43
+ ## License
44
+
45
+ MIT License. Copyright (c) 2013 Jari Jokinen. See
46
+ [LICENSE](https://github.com/jarijokinen/noa/blob/master/LICENSE.txt) for
47
+ further details.
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ desc "Run RSpec"
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
@@ -0,0 +1,4 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require twitter/bootstrap
4
+ //= require turbolinks
@@ -0,0 +1,6 @@
1
+ /*
2
+ = require twitter-bootstrap-static/bootstrap
3
+ = require twitter-bootstrap-static/fontawesome
4
+ = require formtastic-bootstrap
5
+ = require noa/layout/bootstrap/layout
6
+ */
@@ -0,0 +1,44 @@
1
+ textarea {
2
+ width: 98%;
3
+ }
4
+ input[type=text] {
5
+ width: 98%;
6
+ }
7
+ #header {
8
+ padding: 15px 0;
9
+ }
10
+ #header h1 {
11
+ color: #fff;
12
+ background: #000;
13
+ display: inline-block;
14
+ font-size: 26px;
15
+ font-weight: bold;
16
+ line-height: 1;
17
+ margin: 0;
18
+ padding: 10px;
19
+ }
20
+ #header h1 a {
21
+ color: #fff;
22
+ background: #000;
23
+ display: inline;
24
+ line-height: 1;
25
+ margin: 0;
26
+ padding: 0;
27
+ text-decoration: none;
28
+ }
29
+ #sidebar h2 {
30
+ color: #fff;
31
+ background: #000;
32
+ display: inline-block;
33
+ font-size: 16px;
34
+ font-weight: bold;
35
+ line-height: 1;
36
+ margin: 0 0 15px 0;
37
+ padding: 10px;
38
+ }
39
+ #footer {
40
+ border-top: 1px solid #ccc;
41
+ font-size: 12px;
42
+ padding: 5px 0 15px 0;
43
+ margin-top: 15px;
44
+ }
@@ -0,0 +1,68 @@
1
+ module Noa
2
+ module Layout
3
+ module BaseHelper
4
+ def layout_title
5
+ if @title.blank?
6
+ noa_application_name
7
+ else
8
+ "#{@title} | #{noa_application_name}"
9
+ end
10
+ end
11
+
12
+ def layout_logo
13
+ content_tag(:h1) do
14
+ link_to_unless_current(noa_application_name, root_path) do
15
+ noa_application_name
16
+ end
17
+ end
18
+ end
19
+
20
+ def layout_page_title
21
+ unless @title.blank?
22
+ if defined?(Twitter::Bootstrap::Rails)
23
+ content_tag(:div, content_tag(:h1, @title), class: "page-header")
24
+ else
25
+ content_tag(:h1, @title)
26
+ end
27
+ end
28
+ end
29
+
30
+ def layout_copyright(author = nil, href = nil)
31
+ author ||= noa_application_name
32
+ content_tag(:div, id: "copyright") do
33
+ "© #{Time.now.year} ".html_safe +
34
+ (href ? link_to(author, href) : author)
35
+ end
36
+ end
37
+
38
+ def layout_flash
39
+ if defined?(Twitter::Bootstrap::Rails)
40
+ html = Array.new
41
+ flash.each do |key, msg|
42
+ case key.to_s
43
+ when "alert"
44
+ flash_class = "alert-error"
45
+ when "notice"
46
+ flash_class = "alert-info"
47
+ else
48
+ flash_class = key.to_s
49
+ end
50
+ close_button =
51
+ '<button type="button" class="close" data-dismiss="alert">&times;</button>'
52
+ html << content_tag(:div,
53
+ close_button.html_safe + ' ' + msg.html_safe,
54
+ class: ["alert", flash_class, "fade", "in"]
55
+ )
56
+ end
57
+ html.join.html_safe
58
+ else
59
+ html = Array.new
60
+ flash.each do |name, msg|
61
+ html << content_tag(:div, msg, class: name)
62
+ end
63
+ html.join("\n").html_safe
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1 @@
1
+ Sidebar partial
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= layout_title %></title>
5
+ <meta charset="utf-8" />
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
+ <meta name="viewport" content="width=device-width" />
8
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
9
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
10
+ <%= csrf_meta_tags %>
11
+ </head>
12
+ <body>
13
+ <header id="header">
14
+ <%= layout_logo %>
15
+ </header>
16
+ <section id="main">
17
+ <section id="content">
18
+ <%= layout_flash %>
19
+ <%= layout_page_title %>
20
+ <%= yield %>
21
+ </section>
22
+ <aside id="sidebar">
23
+ <%=
24
+ if yield(:sidebar).blank?
25
+ begin
26
+ render("sidebar")
27
+ rescue ActionView::MissingTemplate
28
+ ""
29
+ end
30
+ else
31
+ yield(:sidebar)
32
+ end
33
+ %>
34
+ </aside>
35
+ </section>
36
+ <footer id="footer">
37
+ <%= layout_copyright %>
38
+ </footer>
39
+ </body>
40
+ </html>
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= layout_title %></title>
5
+ <meta charset="utf-8" />
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
+ <meta name="viewport" content="width=device-width" />
8
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
9
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
10
+ <%= csrf_meta_tags %>
11
+ </head>
12
+ <body>
13
+ <div class="container">
14
+ <header id="header">
15
+ <%= layout_logo %>
16
+ </header>
17
+ <section id="main" class="row">
18
+ <section id="content" class="span8">
19
+ <%= layout_flash %>
20
+ <%= layout_page_title %>
21
+ <%= yield %>
22
+ </section>
23
+ <aside id="sidebar" class="span4">
24
+ <%=
25
+ if yield(:sidebar).blank?
26
+ begin
27
+ render("sidebar")
28
+ rescue ActionView::MissingTemplate
29
+ ""
30
+ end
31
+ else
32
+ yield(:sidebar)
33
+ end
34
+ %>
35
+ </aside>
36
+ </section>
37
+ <footer id="footer">
38
+ <%= layout_copyright %>
39
+ </footer>
40
+ </div>
41
+ </body>
42
+ </html>
@@ -0,0 +1,9 @@
1
+ module Noa
2
+ module Layout
3
+ class InstallGenerator < Rails::Generators::Base
4
+ def self.source_root
5
+ @source_root ||= File.join(__dir__, "templates")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ require "noa/core"
2
+ require "noa/layout/engine"
3
+ require "noa/layout/version"
4
+
5
+ module Noa
6
+ module Layout
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module Noa
2
+ module Layout
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Noa
2
+ module Layout
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "noa/layout/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "noa-layout"
8
+ spec.version = Noa::Layout::VERSION
9
+ spec.authors = ["Jari Jokinen"]
10
+ spec.email = ["info@jarijokinen.com"]
11
+ spec.description = "Layout module for Noa"
12
+ spec.summary = "Layout module for Noa"
13
+ spec.homepage = "https://github.com/jarijokinen/noa-layout"
14
+ spec.license = "MIT"
15
+
16
+ spec.platform = Gem::Platform::RUBY
17
+ spec.required_ruby_version = ">= 2.0.0"
18
+
19
+ spec.files = `git ls-files`.split($/)
20
+ spec.test_files = spec.files.grep(%r{^spec/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "noa-core", "0.0.1"
24
+
25
+ spec.add_development_dependency "noa-developer"
26
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1,16 @@
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
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .