siphon 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34c845861e6abe5b2263f3b80f9d141018488cde
|
4
|
+
data.tar.gz: 39d6aa3786df2ae75e6be3225d1494ae156ce805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4150765a974955d4324f8cab5858496343015e7fe8c4085d5af84b9000bc511d84195bb2f2c373e3a42f28976be02dfbbde09a304e47280e8c10df04a1f00040
|
7
|
+
data.tar.gz: b5052dc2ff65f240318b7120ce51157f3dab2d85bc395e071c9ea63e4f7bdb25b972e932dedabf8d79ceb1edf2f93d8a9fb8634ea72a17778d2a21975e2c54b6
|
@@ -4,4 +4,22 @@ class SiphonGenerator < Rails::Generators::NamedBase
|
|
4
4
|
def create_search_file
|
5
5
|
template "search.rb", File.join('app/siphon', class_path, "#{file_name}_search.rb")
|
6
6
|
end
|
7
|
+
|
8
|
+
def create_controller
|
9
|
+
template "controller.rb", File.join('app/controllers', class_path, "#{file_name.pluralize}_controller.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_view
|
13
|
+
template "view.rb", File.join('app/views', class_path, "#{file_name.pluralize}", "_search.html.haml")
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def class_mate
|
18
|
+
classy = begin
|
19
|
+
Object.const_get(class_name) ||
|
20
|
+
Object.const_get( file_name.classify)
|
21
|
+
rescue
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
7
25
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class <%= class_name.pluralize %>Controller < ApplicationController
|
2
|
+
# include Paramount::Controller
|
3
|
+
|
4
|
+
def new
|
5
|
+
@<%= file_name %> ||= <%= class_mate %>.new
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
def collection
|
10
|
+
@<%= file_name.pluralize %> ||= get_search.result.page(params[:page])
|
11
|
+
end
|
12
|
+
|
13
|
+
def resource
|
14
|
+
@<%= file_name %> ||= <%= class_mate %>.find(params[:id])
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_search
|
18
|
+
@<%= file_name %>_search ||= <%= class_mate %>Search.new(params[:<%= file_name %>_search])
|
19
|
+
end
|
20
|
+
|
21
|
+
def resource_params
|
22
|
+
params.require(:<%= file_name %>).permit!
|
23
|
+
end
|
24
|
+
|
25
|
+
def redirection(action:)
|
26
|
+
redirect_to [resource], notice: "Successfuly #{action} !"
|
27
|
+
end
|
28
|
+
end
|
data/lib/siphon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: siphon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Sistovaris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -128,7 +128,9 @@ files:
|
|
128
128
|
- Rakefile
|
129
129
|
- TODO.md
|
130
130
|
- lib/generators/siphon_generator.rb
|
131
|
+
- lib/generators/templates/controller.rb
|
131
132
|
- lib/generators/templates/search.rb
|
133
|
+
- lib/generators/templates/view.rb
|
132
134
|
- lib/siphon.rb
|
133
135
|
- lib/siphon/adapter.rb
|
134
136
|
- lib/siphon/base.rb
|