zadok 0.0.3 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80be127d6e485b131d9355545ed3cf56c063dea95145c6faa9729362aad06e24
4
- data.tar.gz: 06cdad2d838bfaaf9e42c619eede2fb84c9ad161c540a34b5fcc9d6fc6e4288b
3
+ metadata.gz: 681f00af0d3fc67f4f4bdbf2d8b48cf7a64f10de783a3f6c5d0693b3e74d3ac7
4
+ data.tar.gz: 7025bb3fd0e2f8e8f679a0a6adfe2c9e85d68c3f652d3c1bfbb3c85af7aab1db
5
5
  SHA512:
6
- metadata.gz: 53402ccfed01a035bfb60f7f32ae9daa61834c8ef7a64cd81c778d58627edfc5bd9d786a8363f0d9b0f3642d02da0aa8b28031c9231a46330005852c9f7d2c1c
7
- data.tar.gz: a0c3a5bb653b81aab1f4d52c36c410d6cb9459e0037bcb3a895f6bf0142b738144894d9fb90290ef09d55fb144cac5d0b2f3ec8946b89f5921ab175116181ba6
6
+ metadata.gz: db58e21d79f67ee8306b04d3b0d2379ea7f214d40073e47b15f5651dd549885cc21140b2bc20654243db034a5921ff790239c3937869224d14aa5fcabb590ef7
7
+ data.tar.gz: 69abdc23689ffa6172ff99013f31da1381a0e87a4ead5ebe0bb8d1625c4353c8cd98c10f6d04fefc23ebc0724b79c515d9ea2a6cf9c619f13046a033baf90470
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zadok (0.0.2)
4
+ zadok (0.0.3)
5
5
  bootstrap (~> 4.0.0.beta2.1)
6
6
  cancancan (~> 2.0)
7
7
  font-awesome-rails (~> 4.7)
@@ -188,7 +188,7 @@ PLATFORMS
188
188
  ruby
189
189
 
190
190
  DEPENDENCIES
191
- rubocop
191
+ rubocop (~> 0.51)
192
192
  zadok!
193
193
 
194
194
  BUNDLED WITH
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ZadokController < ApplicationController
4
+ helper_method :edit_attributes
5
+ helper_method :index_attributes
6
+ helper_method :new_attributes
7
+ helper_method :resource
8
+ helper_method :resource_name
9
+ helper_method :resources
10
+ helper_method :show_attributes
11
+
12
+ def show
13
+ render "zadok/show"
14
+ end
15
+
16
+ def index
17
+ filter_and_paginate_resources!
18
+ render "zadok/index"
19
+ end
20
+
21
+ def new
22
+ render "zadok/new"
23
+ end
24
+
25
+ def create
26
+ if resource.save
27
+ flash.now[:success] = t("#{resource_name.pluralize}.create_success")
28
+ flash.keep(:success)
29
+ redirect_to url_for(controller: resource_name.pluralize, action: :index)
30
+ else
31
+ flash.now[:danger] = resource.errors.full_messages.join("<br />")
32
+ render "zadok/new"
33
+ end
34
+ end
35
+
36
+ def edit
37
+ render "zadok/edit"
38
+ end
39
+
40
+ def update
41
+ if resource.update(resource_params)
42
+ flash.now[:success] = t("#{resource_name.pluralize}.update_success")
43
+ else
44
+ flash.now[:danger] = resource.errors.full_messages.join("<br />")
45
+ end
46
+ render "zadok/edit"
47
+ end
48
+
49
+ def destroy
50
+ if resource.destroy
51
+ flash.now[:success] = t("#{resource_name.pluralize}.destroy_success")
52
+ flash.keep(:success)
53
+ else
54
+ flash.now[:danger] = resource.errors.full_messages.join("<br />")
55
+ flash.keep(:danger)
56
+ end
57
+ redirect_to url_for(controller: resource_name.pluralize, action: :index)
58
+ end
59
+
60
+ protected
61
+
62
+ def permitted_params
63
+ params.permit(:page, :per_page, q: %i[s search_model])
64
+ end
65
+
66
+ def resource_params
67
+ raise "resource_params method not implemented"
68
+ end
69
+
70
+ def resource_name
71
+ raise "resource_name method not implemented"
72
+ end
73
+
74
+ def resources
75
+ raise "resources method not implemented"
76
+ end
77
+
78
+ def filter_and_paginate_resources!
79
+ raise "filter_and_paginate_resources! method not implemented"
80
+ end
81
+
82
+ def resource
83
+ raise "resource method not implemented"
84
+ end
85
+
86
+ def show_attributes
87
+ raise "show_attributes method not implemented"
88
+ end
89
+
90
+ def index_attributes
91
+ raise "index_attributes method not implemented"
92
+ end
93
+
94
+ def new_attributes
95
+ raise "new_attributes method not implemented"
96
+ end
97
+
98
+ def edit_attributes
99
+ raise "edit_attributes method not implemented"
100
+ end
101
+ end
data/lib/zadok/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zadok
4
- VERSION = "0.0.3"
4
+ VERSION = "0.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zadok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leon Hooijer
@@ -189,6 +189,7 @@ files:
189
189
  - ".rubocop.yml"
190
190
  - Gemfile
191
191
  - Gemfile.lock
192
+ - app/controllers/zadok_controller.rb
192
193
  - lib/zadok.rb
193
194
  - lib/zadok/engine.rb
194
195
  - lib/zadok/version.rb