lego_spike_orders 0.1.0

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 +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/config/lego_spike_orders_manifest.js +1 -0
  6. data/app/assets/stylesheets/lego_spike_orders/application.css +15 -0
  7. data/app/controllers/lego_spike_orders/application_controller.rb +4 -0
  8. data/app/controllers/lego_spike_orders/purchase_orders_controller.rb +60 -0
  9. data/app/helpers/lego_spike_orders/application_helper.rb +4 -0
  10. data/app/helpers/lego_spike_orders/purchase_orders_helper.rb +4 -0
  11. data/app/jobs/lego_spike_orders/application_job.rb +4 -0
  12. data/app/mailers/lego_spike_orders/application_mailer.rb +6 -0
  13. data/app/models/lego_spike_orders/application_record.rb +5 -0
  14. data/app/models/lego_spike_orders/purchase_order.rb +4 -0
  15. data/app/views/layouts/lego_spike_orders/application.html.erb +15 -0
  16. data/app/views/lego_spike_orders/purchase_orders/_form.html.erb +42 -0
  17. data/app/views/lego_spike_orders/purchase_orders/_purchase_order.html.erb +27 -0
  18. data/app/views/lego_spike_orders/purchase_orders/edit.html.erb +10 -0
  19. data/app/views/lego_spike_orders/purchase_orders/index.html.erb +14 -0
  20. data/app/views/lego_spike_orders/purchase_orders/new.html.erb +9 -0
  21. data/app/views/lego_spike_orders/purchase_orders/show.html.erb +10 -0
  22. data/config/routes.rb +3 -0
  23. data/db/migrate/20240725102522_create_lego_spike_orders_purchase_orders.rb +13 -0
  24. data/lib/lego_spike_orders/engine.rb +5 -0
  25. data/lib/lego_spike_orders/version.rb +3 -0
  26. data/lib/lego_spike_orders.rb +6 -0
  27. data/lib/tasks/lego_spike_orders_tasks.rake +4 -0
  28. metadata +84 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 620e5aa81f5bb52b554028a0f0029eddb0e4da23717b95c19cf7f4f30e6a6d25
4
+ data.tar.gz: 689efa328a386255efbcc2e87754fcc8302d92529efc504e107c609fa5f4d58c
5
+ SHA512:
6
+ metadata.gz: cf694f302c1c0e2e760ed99dd071be20e7519e6e6c6ad5b2c85296227e0c6dd9a3ea6f9ef24e9e9cfa80fc4c2aef7b10c7405bf94a27647e07a29149601350e2
7
+ data.tar.gz: 5ce1f6ad033f8b8a6510591da3d10410d4c6aa79210bf49061926f5e53f26224bc197ead17008639896e32630dfec02a9eac2c9b93136b329f2bede0de4c75e0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright SujayPrabhu96
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
+ # LegoSpikeOrders
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 "lego_spike_orders"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install lego_spike_orders
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](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/lego_spike_orders .css
@@ -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
+ module LegoSpikeOrders
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,60 @@
1
+ module LegoSpikeOrders
2
+ class PurchaseOrdersController < ApplicationController
3
+ before_action :set_purchase_order, only: %i[ show edit update destroy ]
4
+
5
+ # GET /purchase_orders
6
+ def index
7
+ @purchase_orders = PurchaseOrder.all
8
+ end
9
+
10
+ # GET /purchase_orders/1
11
+ def show
12
+ end
13
+
14
+ # GET /purchase_orders/new
15
+ def new
16
+ @purchase_order = PurchaseOrder.new
17
+ end
18
+
19
+ # GET /purchase_orders/1/edit
20
+ def edit
21
+ end
22
+
23
+ # POST /purchase_orders
24
+ def create
25
+ @purchase_order = PurchaseOrder.new(purchase_order_params)
26
+
27
+ if @purchase_order.save
28
+ redirect_to @purchase_order, notice: "Purchase order was successfully created."
29
+ else
30
+ render :new, status: :unprocessable_entity
31
+ end
32
+ end
33
+
34
+ # PATCH/PUT /purchase_orders/1
35
+ def update
36
+ if @purchase_order.update(purchase_order_params)
37
+ redirect_to @purchase_order, notice: "Purchase order was successfully updated.", status: :see_other
38
+ else
39
+ render :edit, status: :unprocessable_entity
40
+ end
41
+ end
42
+
43
+ # DELETE /purchase_orders/1
44
+ def destroy
45
+ @purchase_order.destroy!
46
+ redirect_to purchase_orders_url, notice: "Purchase order was successfully destroyed.", status: :see_other
47
+ end
48
+
49
+ private
50
+ # Use callbacks to share common setup or constraints between actions.
51
+ def set_purchase_order
52
+ @purchase_order = PurchaseOrder.find(params[:id])
53
+ end
54
+
55
+ # Only allow a list of trusted parameters through.
56
+ def purchase_order_params
57
+ params.require(:purchase_order).permit(:order_number, :supplier, :order_date, :total_amount, :status)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,4 @@
1
+ module LegoSpikeOrders
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LegoSpikeOrders
2
+ module PurchaseOrdersHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LegoSpikeOrders
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module LegoSpikeOrders
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module LegoSpikeOrders
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module LegoSpikeOrders
2
+ class PurchaseOrder < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Lego spike orders</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "lego_spike_orders/application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,42 @@
1
+ <%= form_with(model: purchase_order) do |form| %>
2
+ <% if purchase_order.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(purchase_order.errors.count, "error") %> prohibited this purchase_order from being saved:</h2>
5
+
6
+ <ul>
7
+ <% purchase_order.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div>
15
+ <%= form.label :order_number, style: "display: block" %>
16
+ <%= form.text_field :order_number %>
17
+ </div>
18
+
19
+ <div>
20
+ <%= form.label :supplier, style: "display: block" %>
21
+ <%= form.text_field :supplier %>
22
+ </div>
23
+
24
+ <div>
25
+ <%= form.label :order_date, style: "display: block" %>
26
+ <%= form.date_field :order_date %>
27
+ </div>
28
+
29
+ <div>
30
+ <%= form.label :total_amount, style: "display: block" %>
31
+ <%= form.text_field :total_amount %>
32
+ </div>
33
+
34
+ <div>
35
+ <%= form.label :status, style: "display: block" %>
36
+ <%= form.text_field :status %>
37
+ </div>
38
+
39
+ <div>
40
+ <%= form.submit %>
41
+ </div>
42
+ <% end %>
@@ -0,0 +1,27 @@
1
+ <div id="<%= dom_id purchase_order %>">
2
+ <p>
3
+ <strong>Order number:</strong>
4
+ <%= purchase_order.order_number %>
5
+ </p>
6
+
7
+ <p>
8
+ <strong>Supplier:</strong>
9
+ <%= purchase_order.supplier %>
10
+ </p>
11
+
12
+ <p>
13
+ <strong>Order date:</strong>
14
+ <%= purchase_order.order_date %>
15
+ </p>
16
+
17
+ <p>
18
+ <strong>Total amount:</strong>
19
+ <%= purchase_order.total_amount %>
20
+ </p>
21
+
22
+ <p>
23
+ <strong>Status:</strong>
24
+ <%= purchase_order.status %>
25
+ </p>
26
+
27
+ </div>
@@ -0,0 +1,10 @@
1
+ <h1>Editing purchase order</h1>
2
+
3
+ <%= render "form", purchase_order: @purchase_order %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this purchase order", @purchase_order %> |
9
+ <%= link_to "Back to purchase orders", purchase_orders_path %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Purchase orders</h1>
4
+
5
+ <div id="purchase_orders">
6
+ <% @purchase_orders.each do |purchase_order| %>
7
+ <%= render purchase_order %>
8
+ <p>
9
+ <%= link_to "Show this purchase order", purchase_order %>
10
+ </p>
11
+ <% end %>
12
+ </div>
13
+
14
+ <%= link_to "New purchase order", new_purchase_order_path %>
@@ -0,0 +1,9 @@
1
+ <h1>New purchase order</h1>
2
+
3
+ <%= render "form", purchase_order: @purchase_order %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to purchase orders", purchase_orders_path %>
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @purchase_order %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this purchase order", edit_purchase_order_path(@purchase_order) %> |
7
+ <%= link_to "Back to purchase orders", purchase_orders_path %>
8
+
9
+ <%= button_to "Destroy this purchase order", @purchase_order, method: :delete %>
10
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ LegoSpikeOrders::Engine.routes.draw do
2
+ resources :purchase_orders
3
+ end
@@ -0,0 +1,13 @@
1
+ class CreateLegoSpikeOrdersPurchaseOrders < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :lego_spike_orders_purchase_orders do |t|
4
+ t.string :order_number
5
+ t.string :supplier
6
+ t.date :order_date
7
+ t.decimal :total_amount
8
+ t.string :status
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module LegoSpikeOrders
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace LegoSpikeOrders
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module LegoSpikeOrders
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "lego_spike_orders/version"
2
+ require "lego_spike_orders/engine"
3
+
4
+ module LegoSpikeOrders
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :lego_spike_orders do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lego_spike_orders
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - SujayPrabhu96
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 7.1.3.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 7.1.3.4
27
+ description: 'Lego spike orders: Description of LegoSpikeOrders.'
28
+ email:
29
+ - prabhusujay@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - app/assets/config/lego_spike_orders_manifest.js
38
+ - app/assets/stylesheets/lego_spike_orders/application.css
39
+ - app/controllers/lego_spike_orders/application_controller.rb
40
+ - app/controllers/lego_spike_orders/purchase_orders_controller.rb
41
+ - app/helpers/lego_spike_orders/application_helper.rb
42
+ - app/helpers/lego_spike_orders/purchase_orders_helper.rb
43
+ - app/jobs/lego_spike_orders/application_job.rb
44
+ - app/mailers/lego_spike_orders/application_mailer.rb
45
+ - app/models/lego_spike_orders/application_record.rb
46
+ - app/models/lego_spike_orders/purchase_order.rb
47
+ - app/views/layouts/lego_spike_orders/application.html.erb
48
+ - app/views/lego_spike_orders/purchase_orders/_form.html.erb
49
+ - app/views/lego_spike_orders/purchase_orders/_purchase_order.html.erb
50
+ - app/views/lego_spike_orders/purchase_orders/edit.html.erb
51
+ - app/views/lego_spike_orders/purchase_orders/index.html.erb
52
+ - app/views/lego_spike_orders/purchase_orders/new.html.erb
53
+ - app/views/lego_spike_orders/purchase_orders/show.html.erb
54
+ - config/routes.rb
55
+ - db/migrate/20240725102522_create_lego_spike_orders_purchase_orders.rb
56
+ - lib/lego_spike_orders.rb
57
+ - lib/lego_spike_orders/engine.rb
58
+ - lib/lego_spike_orders/version.rb
59
+ - lib/tasks/lego_spike_orders_tasks.rake
60
+ homepage:
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ allowed_push_host: https://rubygems.org
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubygems_version: 3.4.10
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: 'Lego spike orders: Summary of LegoSpikeOrders.'
84
+ test_files: []