zadok 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +81 -0
- data/app/assets/javascripts/zadok/data_links.js +5 -0
- data/app/assets/javascripts/zadok.js +3 -0
- data/lib/zadok/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3809ee41de7fd6f6afd65683c8fdf13101775cc6ce79a3e3ac052ae8a21f048
|
4
|
+
data.tar.gz: a57466a599b93818f7f18b5314d6ede4b7ba87a7a9a810a987f14bc4e6312c9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40130f4dab7a6e6cd4c508daaf2cee58ca8f9df6945bb21617fa2995ddc67ade42e6380465af2d4b13d316827195d7e8af38cfc60d90e29db8f4fc48bcf051ad
|
7
|
+
data.tar.gz: 052ab875dc1053dcf0d363c9e83dda2dcd63360278ead47b8b62c02a193e1f99fc75aba3264d6c790097d5290f2e2cdedeba669bb659e3f4fcffa7ca953f43bf
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Zadok
|
2
|
+
**Why Zadok?**
|
3
|
+
|
4
|
+
Zadok was apoointed by kin David to manage his treasuries while he was on the run. This gem is made to manage your application resources. Also the name sounds catchy.
|
5
|
+
|
6
|
+
Some background information:
|
7
|
+
|
8
|
+
*"Zadok (Hebrew: צדוק Tsadoq, meaning "Righteous") or Zadoq is a legendary priest, said to be descended from Eleazar the son of Aaron (1 Chron 6:4-8).[1] He aided King David during the revolt of his son Absalom and was subsequently instrumental in bringing King Solomon to the throne. After Solomon's building of The First Temple in Jerusalem, Zadok was the first High Priest to serve there."*
|
9
|
+
|
10
|
+
Source: [Wikipedia](https://en.wikipedia.org/wiki/Zadok).
|
11
|
+
|
12
|
+
|
13
|
+
**Nehemiah 13:13**:
|
14
|
+
*"And I made treasurers over the treasuries, Shelemiah the priest, and Zadok the scribe, and of the Levites, Pedaiah: and next to them was Hanan the son of Zaccur, the son of Mattaniah: for they were counted faithful, and their office was to distribute unto their brethren."*
|
15
|
+
|
16
|
+
Source: [Bilbe.com](https://www.bible.com/bible/1/NEH.13.13)
|
17
|
+
|
18
|
+
## About this gem
|
19
|
+
|
20
|
+
I created this gem while working for [De Praktijk Index](https://www.depraktijkindex.nl). After having written several applications through the years I noticed that much of the functionallity is always the same (just simple CRUD). I wrote this gem to standardize this so I have to write less code when setting up a new application. Also this gem should help me in maintaining applications since a simple `bunle update zadok` would now be enough to update an application.
|
21
|
+
|
22
|
+
## Setup
|
23
|
+
|
24
|
+
Just run `gem install zadok` or add `gem "zadok"` to your Gemfile.
|
25
|
+
|
26
|
+
To use Zadok in a controller just inherit it:
|
27
|
+
```ruby
|
28
|
+
class SampleController < ZadokController
|
29
|
+
load_and_authorize_resource!
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
def sample_params
|
34
|
+
params.require(:sample).permit!
|
35
|
+
end
|
36
|
+
alias resource_params sample_params
|
37
|
+
|
38
|
+
def resource_name
|
39
|
+
"sample"
|
40
|
+
end
|
41
|
+
|
42
|
+
def resources
|
43
|
+
@samples
|
44
|
+
end
|
45
|
+
alias search_model resources
|
46
|
+
|
47
|
+
def resource
|
48
|
+
@sample
|
49
|
+
end
|
50
|
+
|
51
|
+
def filter_and_paginate_resources!
|
52
|
+
@samples = filtered_resources.paginate(page: page, per_page: per_page)
|
53
|
+
end
|
54
|
+
|
55
|
+
def filtered_resources
|
56
|
+
current_search.result
|
57
|
+
end
|
58
|
+
|
59
|
+
def filters_namespace
|
60
|
+
"Filters::Samples".constantize
|
61
|
+
end
|
62
|
+
|
63
|
+
def index_attributes
|
64
|
+
%i[id name]
|
65
|
+
end
|
66
|
+
|
67
|
+
def new_attributes
|
68
|
+
{
|
69
|
+
name: { type: :text_field }
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def edit_attributes
|
74
|
+
{
|
75
|
+
name: { type: :text_field }
|
76
|
+
}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
Then you should have full CRUD-functionallity for the Sample class.
|
data/lib/zadok/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zadok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Hooijer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap
|
@@ -189,6 +189,9 @@ files:
|
|
189
189
|
- ".rubocop.yml"
|
190
190
|
- Gemfile
|
191
191
|
- Gemfile.lock
|
192
|
+
- README.md
|
193
|
+
- app/assets/javascripts/zadok.js
|
194
|
+
- app/assets/javascripts/zadok/data_links.js
|
192
195
|
- app/controllers/zadok_controller.rb
|
193
196
|
- app/helpers/zadok_helper.rb
|
194
197
|
- app/views/zadok/edit.html.slim
|