bread 0.0.3 → 0.0.4

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/Gemfile +17 -2
  4. data/LICENSE.txt +0 -0
  5. data/README.md +0 -0
  6. data/Rakefile +34 -1
  7. data/bread.gemspec +0 -0
  8. data/lib/bread/commands/config_command.rb +15 -0
  9. data/lib/bread/commands/controller_layout_command.rb +44 -0
  10. data/lib/bread/commands/crumb_to_command.rb +23 -0
  11. data/lib/bread/commands/ivars_command.rb +16 -0
  12. data/lib/bread/config.rb +30 -0
  13. data/lib/bread/controller.rb +4 -9
  14. data/lib/bread/crumb.rb +24 -0
  15. data/lib/bread/helper.rb +12 -19
  16. data/lib/bread/version.rb +1 -1
  17. data/lib/bread.rb +8 -1
  18. data/lib/generators/bread/USAGE +2 -0
  19. data/lib/generators/bread/install_generator.rb +12 -0
  20. data/lib/generators/bread/templates/skeleton.rb +15 -0
  21. data/test/bread_test.rb +7 -0
  22. data/test/dummy/README.rdoc +28 -0
  23. data/test/dummy/Rakefile +6 -0
  24. data/test/dummy/app/assets/javascripts/application.js +13 -0
  25. data/test/dummy/app/assets/javascripts/products.js +2 -0
  26. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  27. data/test/dummy/app/assets/stylesheets/products.css +4 -0
  28. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  29. data/test/dummy/app/controllers/application_controller.rb +5 -0
  30. data/test/dummy/app/controllers/concerns/.keep +0 -0
  31. data/test/dummy/app/controllers/products_controller.rb +79 -0
  32. data/test/dummy/app/helpers/application_helper.rb +2 -0
  33. data/test/dummy/app/helpers/products_helper.rb +2 -0
  34. data/test/dummy/app/mailers/.keep +0 -0
  35. data/test/dummy/app/models/.keep +0 -0
  36. data/test/dummy/app/models/concerns/.keep +0 -0
  37. data/test/dummy/app/models/product.rb +2 -0
  38. data/test/dummy/app/views/layouts/application.html.erb +22 -0
  39. data/test/dummy/app/views/products/_form.html.erb +25 -0
  40. data/test/dummy/app/views/products/edit.html.erb +6 -0
  41. data/test/dummy/app/views/products/index.html.erb +29 -0
  42. data/test/dummy/app/views/products/new.html.erb +5 -0
  43. data/test/dummy/app/views/products/show.html.erb +14 -0
  44. data/test/dummy/bin/bundle +3 -0
  45. data/test/dummy/bin/rails +4 -0
  46. data/test/dummy/bin/rake +4 -0
  47. data/test/dummy/config/application.rb +23 -0
  48. data/test/dummy/config/boot.rb +9 -0
  49. data/test/dummy/config/breadcrumbs.rb +18 -0
  50. data/test/dummy/config/database.yml +25 -0
  51. data/test/dummy/config/environment.rb +5 -0
  52. data/test/dummy/config/environments/development.rb +27 -0
  53. data/test/dummy/config/environments/production.rb +80 -0
  54. data/test/dummy/config/environments/test.rb +36 -0
  55. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  57. data/test/dummy/config/initializers/inflections.rb +16 -0
  58. data/test/dummy/config/initializers/mime_types.rb +5 -0
  59. data/test/dummy/config/initializers/secret_token.rb +12 -0
  60. data/test/dummy/config/initializers/session_store.rb +3 -0
  61. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/test/dummy/config/locales/en.yml +23 -0
  63. data/test/dummy/config/routes.rb +12 -0
  64. data/test/dummy/config.ru +4 -0
  65. data/test/dummy/db/development.sqlite3 +0 -0
  66. data/test/dummy/db/migrate/20140203163238_create_products.rb +10 -0
  67. data/test/dummy/db/schema.rb +23 -0
  68. data/test/dummy/db/test.sqlite3 +0 -0
  69. data/test/dummy/lib/assets/.keep +0 -0
  70. data/test/dummy/log/.keep +0 -0
  71. data/test/dummy/log/development.log +886 -0
  72. data/test/dummy/log/test.log +14262 -0
  73. data/test/dummy/public/404.html +27 -0
  74. data/test/dummy/public/422.html +26 -0
  75. data/test/dummy/public/500.html +26 -0
  76. data/test/dummy/public/favicon.ico +0 -0
  77. data/test/dummy/test/controllers/products_controller_test.rb +50 -0
  78. data/test/dummy/test/fixtures/products.yml +9 -0
  79. data/test/dummy/test/helpers/products_helper_test.rb +4 -0
  80. data/test/dummy/test/models/product_test.rb +7 -0
  81. data/test/integration/navigation_test.rb +10 -0
  82. data/test/test_helper.rb +15 -0
  83. metadata +137 -5
  84. data/lib/bread/command.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c70a548e086d12632268d085db36d20684c3cf
4
- data.tar.gz: 24710cc8a156a08c27b67482f1eca136c8fada26
3
+ metadata.gz: 0e8027cf13f5a7e44e18d3f34c45603caf4bf29e
4
+ data.tar.gz: c2683c97974e9b483bf1ad3e6cef4a941cf16a7e
5
5
  SHA512:
6
- metadata.gz: 32f26af12aeb8a01177abd148e840eb02e2d8bd1b3a2e8b355561ad9ba6b0a6312f6141271f8b6cde4d83b5b6f689c7d378236c893edd554f6e7867d7e0dc83f
7
- data.tar.gz: fcc37eabb4d552435c055c67ec59a1dca7c8202e1e347db0d6917318516d22fac6c623d2d108ef2a1330c39339d17caef2866cb1ee0a4fbe3555203f92a56707
6
+ metadata.gz: fe0369dcd7ccb742df886727440cb5d2713cd6addcce04b40cec45278d9e1f9e9c0c57e179fe0015396fead0ac242efa16b223af3e9043b03970717cd4adeeb0
7
+ data.tar.gz: 048f1ef5da222f6be35be27b4a44677f1005bd3910d5d3da382db0921567868102d8a815e4ef4ed143225fb0bb320180588afa1b0ea5ebbe3b6c6472e3bb6712
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
@@ -1,4 +1,19 @@
1
- source 'https://rubygems.org'
1
+ # source 'http://gems.dev.helloinnovation.com'
2
+ source "https://rubygems.org"
2
3
 
3
- # Specify your gem's dependencies in bread.gemspec
4
+ # Declare your gem's dependencies in permissions.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
4
7
  gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
13
+
14
+ # To use debugger
15
+ # gem 'debugger'
16
+ gem 'rails', '4.0.0' # June 25, 2013
17
+ gem 'sqlite3'
18
+ gem 'turn'
19
+ gem 'colorize'
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -1 +1,34 @@
1
- require "bundler/gem_tasks"
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Permissions'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+
34
+ task default: :test
data/bread.gemspec CHANGED
File without changes
@@ -0,0 +1,15 @@
1
+ module Bread
2
+ class ConfigCommand
3
+
4
+ attr_reader :crumb_definitions
5
+
6
+ def initialize
7
+ @crumb_definitions = {}
8
+ end
9
+
10
+ def key(key_name, &block)
11
+ @crumb_definitions[key_name] = block
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,44 @@
1
+ module Bread
2
+ class ControllerLayoutCommand
3
+
4
+ attr_reader :keys
5
+
6
+ def initialize(controller)
7
+ IvarsCommand.new(controller).ivars.each do |key, ivar|
8
+ self.instance_variable_set(key, ivar)
9
+ end
10
+
11
+ @controller = controller
12
+ @actions = {}
13
+ @keys = []
14
+ end
15
+
16
+ def actions(*action_names, &block)
17
+ action_names.each do |action_name|
18
+ @actions[action_name] = block
19
+ is_current_action = action_name.to_s == @controller.action_name
20
+
21
+ if is_current_action
22
+ self.instance_eval(&block)
23
+ # teria que ter um break aqui, que tambem pare todos os registros de proximas actions =D
24
+ end
25
+ end
26
+ end
27
+
28
+ def crumbs(*keys)
29
+ parent = nil
30
+ if keys.last.is_a? Hash
31
+ options = keys.last
32
+ keys.delete(options)
33
+ #raise "Unexpected options: #{}"
34
+ parent = options[:parent]
35
+ end
36
+ @keys = keys + @keys
37
+ if parent
38
+ blk = @actions[parent]
39
+ instance_eval(&blk)
40
+ end
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,23 @@
1
+ module Bread
2
+ class CrumbToCommand
3
+
4
+ include ActionDispatch::Routing::UrlFor
5
+
6
+ attr_reader :crumb
7
+
8
+ def initialize(controller, key, &block)
9
+ @key = key
10
+
11
+ IvarsCommand.new(controller).ivars.each do |key, ivar|
12
+ instance_variable_set(key, ivar)
13
+ end
14
+
15
+ instance_eval(&block)
16
+ end
17
+
18
+ def crumb_to(title, path, options={})
19
+ @crumb = Crumb.new(options)
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ module Bread
2
+ class IvarsCommand
3
+
4
+ attr_reader :ivars
5
+
6
+ def initialize(target)
7
+ @ivars = {}
8
+
9
+ ivars_keys = target.instance_variables.select { |key| not key.to_s.starts_with?('@_') }
10
+ ivars_keys.each do |key|
11
+ @ivars[key] = target.instance_variable_get(key)
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ module Bread
2
+ class Config
3
+ include Singleton
4
+
5
+ attr_reader :crumb_definitions
6
+
7
+ def reload!
8
+ config_file = Rails.root.join "config/breadcrumbs.rb"
9
+ if File.exists? config_file
10
+ load config_file
11
+ else
12
+ puts "ACHEI NAO".on_red
13
+ # `rails g bread:install`
14
+ # self.reload!
15
+ end
16
+ end
17
+
18
+ def config(&block)
19
+ cmd = ConfigCommand.new
20
+ cmd.instance_eval(&block)
21
+ @crumb_definitions = cmd.crumb_definitions
22
+ end
23
+
24
+
25
+
26
+
27
+
28
+
29
+ end
30
+ end
@@ -6,18 +6,13 @@ module Bread
6
6
  attr_reader :bread_block
7
7
  def bread(&block)
8
8
  @bread_block = block
9
- before_filter :execute_bread_command
10
9
  end
11
10
  end
12
11
 
13
- attr_accessor :_bread_trees
14
-
15
- def _bread_trees
16
- @_bread_trees ||= {}
17
- end
18
-
19
- def execute_bread_command
20
- Command.new(self).instance_eval(&self.class.bread_block)
12
+ def bread_keys
13
+ cmd = ControllerLayoutCommand.new(self)
14
+ cmd.instance_eval(&self.class.bread_block)
15
+ cmd.keys
21
16
  end
22
17
 
23
18
  end
@@ -0,0 +1,24 @@
1
+ module Bread
2
+ class Crumb < Hash
3
+
4
+ def initialize(context, title, path, options)
5
+ @context = context
6
+ options.merge(title: title, path: path).each do |k, v|
7
+ self[k] = v
8
+ end
9
+ end
10
+
11
+ def title
12
+ self[:title]
13
+ end
14
+
15
+ def path
16
+ self[:path]
17
+ end
18
+
19
+ def current?
20
+ @context.current_page? path
21
+ end
22
+
23
+ end
24
+ end
data/lib/bread/helper.rb CHANGED
@@ -2,28 +2,21 @@ module Bread
2
2
  module Helper
3
3
 
4
4
  def bread
5
- return @bread if @bread
5
+ Config.instance.reload! # if should_reload?
6
6
 
7
- tmp = nil
8
- controller._bread_trees.each do |i_action, hash|
9
- if i_action.to_s == action_name
10
- tmp = hash
11
- break
12
- end
7
+ crumb_definitions = Config.instance.crumb_definitions
8
+ keys_for_current_action = controller.bread_keys
9
+
10
+ @crumbs = []
11
+ keys_for_current_action.map do |key|
12
+ crumbs_to_block = crumb_definitions[key] || :crumb_definitions_not_found
13
+ self.instance_eval(&crumbs_to_block)
13
14
  end
15
+ @crumbs
16
+ end
14
17
 
15
- @bread = if tmp.nil?
16
- puts "No Bread for this Action. Please check https://github.com/yakko/bread for more info".light_yellow
17
- []
18
- else
19
- list = []
20
- while tmp
21
- arr = controller.instance_eval(&tmp[:block])
22
- list << {title: arr.first, path: arr.second} if arr
23
- tmp = tmp[:parent]
24
- end
25
- list.reverse
26
- end
18
+ def crumb_to(title, path, options={})
19
+ @crumbs << Crumb.new(self, title, path, options)
27
20
  end
28
21
 
29
22
  end
data/lib/bread/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bread
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/bread.rb CHANGED
@@ -1,7 +1,14 @@
1
1
  require "bread/version"
2
- require "bread/command"
2
+
3
+ require "bread/commands/controller_layout_command"
4
+ require "bread/commands/config_command"
5
+ require "bread/commands/ivars_command"
6
+ require "bread/commands/crumb_to_command"
7
+
3
8
  require "bread/controller"
4
9
  require "bread/helper"
10
+ require "bread/crumb"
11
+ require "bread/config"
5
12
 
6
13
 
7
14
  module Bread
@@ -0,0 +1,2 @@
1
+ Description:
2
+ The bread:install generator creates your config/breadcrumbs.rb file.
@@ -0,0 +1,12 @@
1
+ module Bread
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def generate_install
7
+ template "skeleton.rb", "config/breadcrumbs.rb"
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,15 @@
1
+ Bread.config do
2
+
3
+ # # products
4
+ # key(:all_products) { bread_to("Contacts", :products, icon: 'list') }
5
+ # key(:make_product) { bread_to("Add", [:products, :new], icon: 'plus', target: '_blank') }
6
+ # key(:products_by_category) { bread_to(@category.name, [:products, :by_category, @category], icon: 'filter') }
7
+ # key(:view_product) { bread_to(@product.name, @product) }
8
+ # key(:change_product) { bread_to("Edit", [@product, :edit]) }
9
+ # key(:product_timeline) { bread_to("Timeline", [@product, :timeline]) }
10
+ # key(:product_year) { bread_to(@year, [@product, :timeline, @year]) }
11
+ # key(:product_month) { bread_to(@month, [@product, :timeline, @year, @month]) }
12
+ # key(:product_day) { bread_to(@day, [@product, :timeline, @year, @month, @day]) }
13
+ # key(:product_time) { bread_to(@time, [@product, :timeline, @year, @month, @day, @time]) }
14
+
15
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class BreadTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Bread
6
+ end
7
+ 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,13 @@
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_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
File without changes
@@ -0,0 +1,79 @@
1
+ class ProductsController < ApplicationController
2
+ before_action :set_product, only: [:show, :edit, :update, :destroy]
3
+
4
+
5
+
6
+ bread do
7
+ # alias_actions :new, :create
8
+ # alias_actions :edit, :update, :destroy
9
+
10
+ actions(:index) { crumbs :root, :all_products, parent: nil }
11
+ actions(:new, :create) { crumbs :make_product, parent: :index, lala: 1, lele: 2, lili: 3434 }
12
+ actions(:by_category) { crumbs :products_by_category, parent: :index }
13
+ actions(:show) do
14
+ parent = @category.present? ? :by_category : :index
15
+ crumbs(:view_product, parent: parent)
16
+ end
17
+ actions(:edit) { crumbs :change_product, parent: :show }
18
+ actions(:timeline) { crumbs :product_timeline, parent: :show }
19
+ end
20
+
21
+
22
+
23
+
24
+ # GET /products
25
+ def index
26
+ @products = Product.all
27
+ end
28
+
29
+ # GET /products/1
30
+ def show
31
+ @category = "lalala"
32
+ end
33
+
34
+ # GET /products/new
35
+ def new
36
+ @product = Product.new
37
+ end
38
+
39
+ # GET /products/1/edit
40
+ def edit
41
+ end
42
+
43
+ # POST /products
44
+ def create
45
+ @product = Product.new(product_params)
46
+
47
+ if @product.save
48
+ redirect_to @product, notice: 'Product was successfully created.'
49
+ else
50
+ render action: 'new'
51
+ end
52
+ end
53
+
54
+ # PATCH/PUT /products/1
55
+ def update
56
+ if @product.update(product_params)
57
+ redirect_to @product, notice: 'Product was successfully updated.'
58
+ else
59
+ render action: 'edit'
60
+ end
61
+ end
62
+
63
+ # DELETE /products/1
64
+ def destroy
65
+ @product.destroy
66
+ redirect_to products_url, notice: 'Product was successfully destroyed.'
67
+ end
68
+
69
+ private
70
+ # Use callbacks to share common setup or constraints between actions.
71
+ def set_product
72
+ @product = Product.find(params[:id])
73
+ end
74
+
75
+ # Only allow a trusted parameter "white list" through.
76
+ def product_params
77
+ params.require(:product).permit(:name, :category)
78
+ end
79
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module ProductsHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ class Product < ActiveRecord::Base
2
+ end
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%#= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%#= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <ul id="breadcrumbs">
12
+ <% bread.each do |crumb| %>
13
+ <li class="<%= 'active' if crumb.current? %>">
14
+ <%= link_to crumb.title, crumb.path, class: "icon icon-#{crumb[:icon]}" %>
15
+ </li>
16
+ <% end %>
17
+ </ul>
18
+
19
+ <%= yield %>
20
+
21
+ </body>
22
+ </html>
@@ -0,0 +1,25 @@
1
+ <%= form_for(@product) do |f| %>
2
+ <% if @product.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @product.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br>
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :category %><br>
20
+ <%= f.text_field :category %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>