cruj_cruj_cruj 0.0.7 → 0.0.8
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: abd10d9dd9512c48b4392aa8fac01fd911439d42
|
4
|
+
data.tar.gz: 389b98169692d6b6a589e1629125c07f9be99a75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67d75ae4e65847a3161ccb1abc9a97e5ee079b3a61bf0f589a704636d5f772fbad9f27abf5b6e8e2ab873ba6f6ddc9363103afd360a33fe112888a09aa83c03
|
7
|
+
data.tar.gz: 86df7de85d8892a4c9f3266745a1a2309fc9aec77e93f06632e18907414a6a0970ecd6bdbbea59556792db08ecf4be1c506ecfa0e29839497b03f8d4216c0d97
|
@@ -1,8 +1,16 @@
|
|
1
1
|
class CrujCrujCrujController < ApplicationController
|
2
2
|
include ActionView::Helpers::NumberHelper
|
3
3
|
|
4
|
-
before_action :before_index, only: [:index]
|
4
|
+
before_action :before_index , only: [:index]
|
5
|
+
before_action :before_new , only: [:new]
|
6
|
+
before_action :before_create, only: [:create]
|
7
|
+
before_action :before_edit , only: [:edit]
|
8
|
+
before_action :before_update, only: [:update]
|
9
|
+
before_action :before_destroy, only: [:destroy]
|
10
|
+
|
5
11
|
before_action :find_all_resources, only: [:index]
|
12
|
+
before_action :build_resource , only: [:new, :create]
|
13
|
+
before_action :find_resource , only: [:edit, :update, :destroy]
|
6
14
|
|
7
15
|
helper_method :namespace_url, :namespaces, :model_class, :snake_case_model_name,
|
8
16
|
:resource_url,
|
@@ -12,6 +20,40 @@ class CrujCrujCrujController < ApplicationController
|
|
12
20
|
:filter_for
|
13
21
|
|
14
22
|
def index; end
|
23
|
+
def new; end
|
24
|
+
|
25
|
+
def create
|
26
|
+
if @resource.save
|
27
|
+
redirect_to(action: :index, notice: l("#{snake_case_model_name}_create_success_message"))
|
28
|
+
else
|
29
|
+
render action: 'new'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def edit; end
|
34
|
+
|
35
|
+
def update
|
36
|
+
if @resource.update_attributes(params[snake_case_model_name])
|
37
|
+
redirect_to(action: :index, notice: l("#{snake_case_model_name}_edit_success_message"))
|
38
|
+
else
|
39
|
+
render action: 'edit'
|
40
|
+
end
|
41
|
+
rescue ActiveRecord::RecordNotFound
|
42
|
+
render_404
|
43
|
+
end
|
44
|
+
|
45
|
+
def destroy
|
46
|
+
@resource.destroy
|
47
|
+
redirect_to action: :index, notice: l("#{snake_case_model_name}_delete_success_message")
|
48
|
+
end
|
49
|
+
|
50
|
+
def export_template
|
51
|
+
@q = model_class.ransack(params[:q])
|
52
|
+
@q.sorts = default_sort if @q.sorts.blank?
|
53
|
+
|
54
|
+
filename = CrujCrujCruj::Services::ImportRules.export_template(form_fields, @q.result)
|
55
|
+
send_file(filename, filename: l(:export_template_filename), type: "application/vnd.ms-excel")
|
56
|
+
end
|
15
57
|
|
16
58
|
def import
|
17
59
|
if params[:file].blank?
|
@@ -28,17 +70,14 @@ class CrujCrujCrujController < ApplicationController
|
|
28
70
|
redirect_to atribuicao_automaticas_url, flash: { import_errors: errors.join('<br />') }
|
29
71
|
end
|
30
72
|
|
31
|
-
def export_template
|
32
|
-
@q = model_class.ransack(params[:q])
|
33
|
-
@q.sorts = default_sort if @q.sorts.blank?
|
34
|
-
|
35
|
-
filename = CrujCrujCruj::Services::ImportRules.export_template(form_fields, @q.result(distinct: true))
|
36
|
-
send_file(filename, filename: l(:export_template_filename), type: "application/vnd.ms-excel")
|
37
|
-
end
|
38
|
-
|
39
73
|
protected
|
40
74
|
|
41
75
|
def before_index; end
|
76
|
+
def before_new; end
|
77
|
+
def before_create; end
|
78
|
+
def before_edit; end
|
79
|
+
def before_update; end
|
80
|
+
def before_destroy; end
|
42
81
|
|
43
82
|
def find_all_resources
|
44
83
|
@q = model_class.ransack(params[:q])
|
@@ -46,6 +85,16 @@ class CrujCrujCrujController < ApplicationController
|
|
46
85
|
@resources = @q.result.page(params[:page])
|
47
86
|
end
|
48
87
|
|
88
|
+
def build_resource
|
89
|
+
@resource = model_class.new(params[snake_case_model_name])
|
90
|
+
end
|
91
|
+
|
92
|
+
def find_resource
|
93
|
+
@resource = model_class.find(params[:id])
|
94
|
+
rescue ActiveRecord::RecordNotFound
|
95
|
+
render_404
|
96
|
+
end
|
97
|
+
|
49
98
|
def form_fields
|
50
99
|
[]
|
51
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cruj_cruj_cruj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Campos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ransack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,6 +111,8 @@ files:
|
|
111
111
|
- app/views/cruj_cruj_cruj/_filters.html.erb
|
112
112
|
- app/views/cruj_cruj_cruj/_import_export_template.html.erb
|
113
113
|
- app/views/cruj_cruj_cruj/_list_table.html.erb
|
114
|
+
- app/views/cruj_cruj_cruj/edit.html.erb
|
115
|
+
- app/views/cruj_cruj_cruj/new.html.erb
|
114
116
|
- app/views/layouts/cruj_cruj_cruj/application.html.erb
|
115
117
|
- config/locales/pt-BR.yml
|
116
118
|
- config/routes.rb
|