ecom 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +35 -0
  5. data/app/assets/config/ecom_manifest.js +2 -0
  6. data/app/assets/javascripts/ecom/application.js +13 -0
  7. data/app/assets/javascripts/ecom/cart.js +2 -0
  8. data/app/assets/javascripts/ecom/categories.js +2 -0
  9. data/app/assets/javascripts/ecom/products.js +2 -0
  10. data/app/assets/stylesheets/ecom/application.css +15 -0
  11. data/app/assets/stylesheets/ecom/cart.css +4 -0
  12. data/app/assets/stylesheets/ecom/categories.css +4 -0
  13. data/app/assets/stylesheets/ecom/products.css +4 -0
  14. data/app/assets/stylesheets/scaffold.css +84 -0
  15. data/app/controllers/ecom/application_controller.rb +5 -0
  16. data/app/controllers/ecom/cart_controller.rb +47 -0
  17. data/app/controllers/ecom/categories_controller.rb +62 -0
  18. data/app/controllers/ecom/products_controller.rb +62 -0
  19. data/app/helpers/ecom/application_helper.rb +4 -0
  20. data/app/helpers/ecom/cart_helper.rb +4 -0
  21. data/app/helpers/ecom/categories_helper.rb +4 -0
  22. data/app/helpers/ecom/products_helper.rb +4 -0
  23. data/app/jobs/ecom/application_job.rb +4 -0
  24. data/app/mailers/ecom/application_mailer.rb +6 -0
  25. data/app/models/ecom/application_record.rb +5 -0
  26. data/app/models/ecom/category.rb +6 -0
  27. data/app/models/ecom/line_item.rb +21 -0
  28. data/app/models/ecom/product.rb +15 -0
  29. data/app/models/ecom/purchase.rb +13 -0
  30. data/app/models/ecom/user.rb +40 -0
  31. data/app/uploaders/ecom/image_uploader.rb +51 -0
  32. data/app/views/ecom/cart/show.html.erb +30 -0
  33. data/app/views/ecom/categories/_form.html.erb +22 -0
  34. data/app/views/ecom/categories/edit.html.erb +6 -0
  35. data/app/views/ecom/categories/index.html.erb +27 -0
  36. data/app/views/ecom/categories/new.html.erb +5 -0
  37. data/app/views/ecom/categories/show.html.erb +9 -0
  38. data/app/views/ecom/products/_form.html.erb +37 -0
  39. data/app/views/ecom/products/edit.html.erb +6 -0
  40. data/app/views/ecom/products/index.html.erb +10 -0
  41. data/app/views/ecom/products/new.html.erb +5 -0
  42. data/app/views/ecom/products/show.html.erb +27 -0
  43. data/app/views/layouts/ecom/application.html.erb +14 -0
  44. data/config/initializers/devise.rb +274 -0
  45. data/config/initializers/line_items.rb +1 -0
  46. data/config/initializers/product.rb +1 -0
  47. data/config/initializers/purchase.rb +1 -0
  48. data/config/locales/devise.en.yml +62 -0
  49. data/config/locales/en.yml +5 -0
  50. data/config/routes.rb +15 -0
  51. data/lib/ecom/engine.rb +6 -0
  52. data/lib/ecom/version.rb +3 -0
  53. data/lib/ecom.rb +5 -0
  54. data/lib/generators/ecom/install_generator.rb +10 -0
  55. data/lib/tasks/ecom_tasks.rake +4 -0
  56. metadata +146 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e0f8f75b165ff36e90775be93346597239fdd9c9
4
+ data.tar.gz: 1890e78e5944a22db2a28d7235e8a7bda07a7060
5
+ SHA512:
6
+ metadata.gz: 3494b5e6fb2990fb2a22bde69c439103534440531b6007dfffbd9e8e2f6bad75ba27d8479515c44d0f4f1c3f9eae24baf5b3e5359914bcc9040fa08983363193
7
+ data.tar.gz: 3cc55de3046e1a04c1ac9418cce9e7c6997542f05e12c815a49549e738803286c4f651913bbfe313a960b07901ee072fd185bd352bdaa857db12f60720b2bb50
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Adam Falck
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Ecom
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ecom'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install ecom
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,35 @@
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 = 'Ecom'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ load 'rails/tasks/statistics.rake'
20
+
21
+
22
+
23
+ require 'bundler/gem_tasks'
24
+
25
+ require 'rake/testtask'
26
+
27
+ Rake::TestTask.new(:test) do |t|
28
+ t.libs << 'lib'
29
+ t.libs << 'test'
30
+ t.pattern = 'test/**/*_test.rb'
31
+ t.verbose = false
32
+ end
33
+
34
+
35
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/ecom .js
2
+ //= link_directory ../stylesheets/ecom .css
@@ -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 any plugin's vendor/assets/javascripts directory 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. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
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,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,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,15 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -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,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,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,84 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ }
5
+
6
+ body, p, ol, ul, td {
7
+ font-family: verdana, arial, helvetica, sans-serif;
8
+ font-size: 13px;
9
+ line-height: 18px;
10
+ margin: 33px;
11
+ }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px;
17
+ }
18
+
19
+ a {
20
+ color: #000;
21
+ }
22
+
23
+ a:visited {
24
+ color: #666;
25
+ }
26
+
27
+ a:hover {
28
+ color: #fff;
29
+ background-color: #000;
30
+ }
31
+
32
+ th {
33
+ padding-bottom: 5px;
34
+ }
35
+
36
+ td {
37
+ padding-bottom: 7px;
38
+ padding-left: 5px;
39
+ padding-right: 5px;
40
+ }
41
+
42
+ div.field,
43
+ div.actions {
44
+ margin-bottom: 10px;
45
+ }
46
+
47
+ #notice {
48
+ color: green;
49
+ }
50
+
51
+ .field_with_errors {
52
+ padding: 2px;
53
+ background-color: red;
54
+ display: table;
55
+ }
56
+
57
+ #error_explanation {
58
+ width: 450px;
59
+ border: 2px solid red;
60
+ padding: 7px;
61
+ padding-bottom: 0;
62
+ margin-bottom: 20px;
63
+ background-color: #f0f0f0;
64
+ }
65
+
66
+ #error_explanation h2 {
67
+ text-align: left;
68
+ font-weight: bold;
69
+ padding: 5px 5px 5px 15px;
70
+ font-size: 12px;
71
+ margin: -7px;
72
+ margin-bottom: 0;
73
+ background-color: #c00;
74
+ color: #fff;
75
+ }
76
+
77
+ #error_explanation ul li {
78
+ font-size: 12px;
79
+ list-style: square;
80
+ }
81
+
82
+ label {
83
+ display: block;
84
+ }
@@ -0,0 +1,5 @@
1
+ module Ecom
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,47 @@
1
+ require_dependency "ecom/application_controller"
2
+
3
+ module Ecom
4
+ class CartController < ApplicationController
5
+ before_filter :authenticate_user!
6
+ before_filter :get_cart_value
7
+
8
+ def add
9
+ @cart.save
10
+ session[:cart_id] = @cart.id
11
+ product = Product.find(params[:id])
12
+ item = LineItem.new
13
+ item.make_items(@cart.id, product.id, product.base_price)
14
+ @cart.recalculate_price!
15
+ flash[:notice] = "Product Added to Cart"
16
+ redirect_to cart_path
17
+ end
18
+
19
+ def remove
20
+ item = @cart.line_items.find(params[:id])
21
+ item.destroy
22
+ @cart.recalculate_price!
23
+ flash[:notice] = "Product Deleted from Cart"
24
+ redirect_to cart_path
25
+ end
26
+
27
+ def checkout
28
+ @cart.checkout!
29
+ session.delete(:cart_id)
30
+ flash[:notice] = "Thank your for the Order! We will e-mail you with the shipping info."
31
+ redirect_to root_path
32
+ end
33
+
34
+ protected
35
+
36
+ def get_cart_value
37
+ if session[:cart_id].nil?
38
+ @cart = Purchase.create
39
+ session[:cart_id] = @cart.id
40
+ @cart
41
+ else
42
+ Purchase.find(session[:cart_id])
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "ecom/application_controller"
2
+
3
+ module Ecom
4
+ class CategoriesController < ApplicationController
5
+ before_action :set_category, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /categories
8
+ def index
9
+ @categories = Category.all
10
+ end
11
+
12
+ # GET /categories/1
13
+ def show
14
+ end
15
+
16
+ # GET /categories/new
17
+ def new
18
+ @category = Category.new
19
+ end
20
+
21
+ # GET /categories/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /categories
26
+ def create
27
+ @category = Category.new(category_params)
28
+
29
+ if @category.save
30
+ redirect_to @category, notice: 'Category was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /categories/1
37
+ def update
38
+ if @category.update(category_params)
39
+ redirect_to @category, notice: 'Category was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /categories/1
46
+ def destroy
47
+ @category.destroy
48
+ redirect_to categories_url, notice: 'Category was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_category
54
+ @category = Category.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def category_params
59
+ params.require(:category).permit(:title)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "ecom/application_controller"
2
+
3
+ module Ecom
4
+ class ProductsController < ApplicationController
5
+ before_action :set_product, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /products
8
+ def index
9
+ @products = Product.all
10
+ end
11
+
12
+ # GET /products/1
13
+ def show
14
+ end
15
+
16
+ # GET /products/new
17
+ def new
18
+ @product = Product.new
19
+ end
20
+
21
+ # GET /products/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /products
26
+ def create
27
+ @product = Product.new(product_params)
28
+
29
+ if @product.save
30
+ redirect_to @product, notice: 'Product was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /products/1
37
+ def update
38
+ if @product.update(product_params)
39
+ redirect_to @product, notice: 'Product was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /products/1
46
+ def destroy
47
+ @product.destroy
48
+ redirect_to products_url, notice: 'Product was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_product
54
+ @product = Product.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def product_params
59
+ params.require(:product).permit(:name, :description, :size, :base_price)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,4 @@
1
+ module Ecom
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Ecom
2
+ module CartHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Ecom
2
+ module CategoriesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Ecom
2
+ module ProductsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Ecom
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Ecom
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Ecom
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module Ecom
2
+ class Category
3
+ include Mongoid::Document
4
+ field :title, type: String
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ module Ecom
2
+ class LineItem
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ field :purchase_id, type: String
7
+ field :product_id, type: String
8
+ field :price, type: Float
9
+
10
+ belongs_to :purchase
11
+ belongs_to :product
12
+
13
+ def make_items(purchase_id, product_id, price)
14
+ item = LineItem.new
15
+ item.purchase_id = purchase_id
16
+ item.product_id = product_id
17
+ item.price = price
18
+ item.save
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ module Ecom
2
+ class Product
3
+ include Mongoid::Document
4
+ include Mongoid::Slug
5
+
6
+ field :name, type: String
7
+ field :description, type: String
8
+ field :base_price, type: Float
9
+ field :sku, type: String
10
+
11
+ slug :name, history: true
12
+ belongs_to :category
13
+ mount_uploader :image, ImageUploader
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module Ecom
2
+ class Purchase
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ field :user_id, type: String
7
+ field :checked_out_at, type: Time
8
+ field :total_price, type: Float
9
+
10
+ has_many :line_items, :dependent => :destroy
11
+
12
+ end
13
+ end
@@ -0,0 +1,40 @@
1
+ module Ecom
2
+ class User
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+ # Include default devise modules. Others available are:
6
+ # :confirmable, :lockable, :timeoutable and :omniauthable
7
+ devise :database_authenticatable, :registerable,
8
+ :recoverable, :rememberable, :trackable, :validatable
9
+
10
+ ## Database authenticatable
11
+ field :email, type: String, default: ""
12
+ field :encrypted_password, type: String, default: ""
13
+
14
+ ## Recoverable
15
+ field :reset_password_token, type: String
16
+ field :reset_password_sent_at, type: Time
17
+
18
+ ## Rememberable
19
+ field :remember_created_at, type: Time
20
+
21
+ ## Trackable
22
+ field :sign_in_count, type: Integer, default: 0
23
+ field :current_sign_in_at, type: Time
24
+ field :last_sign_in_at, type: Time
25
+ field :current_sign_in_ip, type: String
26
+ field :last_sign_in_ip, type: String
27
+
28
+ ## Confirmable
29
+ # field :confirmation_token, type: String
30
+ # field :confirmed_at, type: Time
31
+ # field :confirmation_sent_at, type: Time
32
+ # field :unconfirmed_email, type: String # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ # field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
36
+ # field :unlock_token, type: String # Only if unlock strategy is :email or :both
37
+ # field :locked_at, type: Time
38
+ has_many :purchases, :dependent => :destroy
39
+ end
40
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ class ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ # include CarrierWave::RMagick
7
+ # include CarrierWave::MiniMagick
8
+
9
+ # Choose what kind of storage to use for this uploader:
10
+ storage :file
11
+ # storage :fog
12
+
13
+ # Override the directory where uploaded files will be stored.
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ def store_dir
16
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
17
+ end
18
+
19
+ # Provide a default URL as a default if there hasn't been a file uploaded:
20
+ # def default_url
21
+ # # For Rails 3.1+ asset pipeline compatibility:
22
+ # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
23
+ #
24
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
25
+ # end
26
+
27
+ # Process files as they are uploaded:
28
+ # process :scale => [200, 300]
29
+ #
30
+ # def scale(width, height)
31
+ # # do something
32
+ # end
33
+
34
+ # Create different versions of your uploaded files:
35
+ # version :thumb do
36
+ # process :resize_to_fit => [50, 50]
37
+ # end
38
+
39
+ # Add a white list of extensions which are allowed to be uploaded.
40
+ # For images you might use something like this:
41
+ # def extension_white_list
42
+ # %w(jpg jpeg gif png)
43
+ # end
44
+
45
+ # Override the filename of the uploaded files:
46
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
47
+ # def filename
48
+ # "something.jpg" if original_filename
49
+ # end
50
+
51
+ end
@@ -0,0 +1,30 @@
1
+ <h1>Shopping Cart</h1>
2
+
3
+ <% unless @cart.line_items.any? %>
4
+ <p>You don't have any items in your cart. <%= link_to "Go Add Some", products_path %>
5
+ <% end %>
6
+
7
+ <table width="100%">
8
+ <tr>
9
+ <th>Product</th>
10
+ <th>Price</th>
11
+ </tr>
12
+ <% for line_item in @cart.line_items %>
13
+ <tr>
14
+ <td><%= line_item.product.name %></td>
15
+ <td><%= number_to_currency line_item.price %></td>
16
+ <td><%= link_to "Remove", remove_from_cart_path(line_item), :method => :post %></td>
17
+ </tr>
18
+ <% end %>
19
+ <tr>
20
+ <td>Total:</td>
21
+ <td><%= number_to_currency @cart.total_price %></td>
22
+ </tr>
23
+ </table>
24
+
25
+ <hr />
26
+ <%= form_tag checkout_path, :style => "text-align: right" do |f| %>
27
+ <%= link_to "Continue Shopping", root_path %>
28
+ or
29
+ <%= submit_tag "Checkout"%>
30
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <%= form_for(category) do |f| %>
2
+ <% if category.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(category.errors.count, "error") %> prohibited this category from being saved:</h2>
5
+
6
+ <ul>
7
+ <% category.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %>
16
+ <%= f.text_field :title %>
17
+ </div>
18
+
19
+ <div class="actions">
20
+ <%= f.submit %>
21
+ </div>
22
+ <% end %>