bhf 0.10.12 → 0.10.13
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 +4 -4
- data/README.md +0 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/bhf/application.js +26 -26
- data/app/assets/javascripts/bhf/classes/Ajaxify.js +4 -4
- data/app/assets/javascripts/bhf/classes/ArrayFields.js +3 -3
- data/app/assets/javascripts/bhf/classes/FormHelper.js +4 -4
- data/app/assets/javascripts/bhf/classes/MultipleFields.js +2 -2
- data/app/assets/javascripts/bhf/classes/PlatformHelper.js +2 -2
- data/app/assets/javascripts/bhf/classes/QuickEdit.js +18 -18
- data/app/assets/javascripts/bhf/classes/QuickEditStack.js +3 -3
- data/app/assets/javascripts/bhf/classes/Request_bhf.js +2 -3
- data/app/assets/javascripts/bhf/classes/Setlatlng.js +8 -9
- data/app/assets/javascripts/bhf/locales/Locale.de-DE.js +0 -1
- data/app/assets/javascripts/bhf/mootools_ujs.js +81 -26
- data/app/assets/stylesheets/bhf/application.css.sass +1 -1
- data/app/controllers/bhf/embed_entries_controller.rb +3 -3
- data/app/controllers/bhf/entries_controller.rb +17 -15
- data/app/controllers/bhf/pages_controller.rb +3 -3
- data/app/helpers/bhf/application_helper.rb +2 -2
- data/app/helpers/bhf/entries_helper.rb +6 -6
- data/app/helpers/bhf/frontend_helper.rb +3 -3
- data/app/helpers/bhf/pages_helper.rb +5 -5
- data/app/views/bhf/entries/_form.html.haml +4 -4
- data/app/views/bhf/entries/_validation_errors.html.haml +1 -1
- data/app/views/bhf/entries/edit.html.haml +1 -1
- data/app/views/bhf/entries/new.html.haml +1 -1
- data/app/views/bhf/form/belongs_to/_radio.html.haml +5 -5
- data/app/views/bhf/form/belongs_to/_select.html.haml +3 -3
- data/app/views/bhf/form/column/_boolean.html.haml +1 -1
- data/app/views/bhf/form/column/_date.html.haml +1 -1
- data/app/views/bhf/form/column/_hash.html.haml +1 -1
- data/app/views/bhf/form/column/_hidden.html.haml +1 -1
- data/app/views/bhf/form/column/_markdown.html.haml +1 -1
- data/app/views/bhf/form/column/_multiple_fields.html.haml +1 -1
- data/app/views/bhf/form/column/_number.html.haml +1 -1
- data/app/views/bhf/form/column/_paperclip.html.haml +3 -3
- data/app/views/bhf/form/column/_password.html.haml +1 -1
- data/app/views/bhf/form/column/_static.html.haml +1 -1
- data/app/views/bhf/form/column/_string.html.haml +1 -1
- data/app/views/bhf/form/column/_text.html.haml +1 -1
- data/app/views/bhf/form/column/_wysiwyg.html.haml +1 -1
- data/app/views/bhf/form/embeds_many/_static.html.haml +3 -3
- data/app/views/bhf/form/has_and_belongs_to_many/_check_box.html.haml +3 -3
- data/app/views/bhf/form/has_and_belongs_to_many/_static.html.haml +1 -1
- data/app/views/bhf/form/has_many/_static.html.haml +1 -1
- data/app/views/bhf/helper/_field_errors.html.haml +1 -1
- data/app/views/bhf/helper/_flash.html.haml +1 -1
- data/app/views/bhf/helper/_frontend_edit.html.haml +1 -1
- data/app/views/bhf/helper/_info.html.haml +1 -1
- data/app/views/bhf/helper/_node.html.haml +1 -1
- data/app/views/bhf/pages/_platform.html.haml +2 -2
- data/app/views/bhf/pages/_search.html.haml +2 -4
- data/app/views/bhf/pages/show.html.haml +1 -1
- data/app/views/bhf/table/column/_array.html.haml +1 -1
- data/app/views/bhf/table/column/_boolean.html.haml +1 -1
- data/app/views/bhf/table/column/_date.html.haml +1 -1
- data/app/views/bhf/table/column/_empty.html.haml +1 -1
- data/app/views/bhf/table/column/_extern_link.html.haml +1 -1
- data/app/views/bhf/table/column/_file.html.haml +1 -1
- data/app/views/bhf/table/column/_hash.html.haml +1 -1
- data/app/views/bhf/table/column/_image.html.haml +1 -1
- data/app/views/bhf/table/column/_number.html.haml +1 -1
- data/app/views/bhf/table/column/_paperclip.html.haml +1 -1
- data/app/views/bhf/table/column/_primary_key.html.haml +1 -1
- data/app/views/bhf/table/column/_string.html.haml +1 -1
- data/app/views/bhf/table/column/_text.html.haml +1 -1
- data/app/views/bhf/table/column/{_thumbmail.haml → _thumbnail.html.haml} +0 -0
- data/app/views/bhf/table/column/_type.html.haml +1 -1
- data/app/views/bhf/table/embeds_many/_default.html.haml +1 -1
- data/app/views/bhf/table/embeds_one/_default.html.haml +1 -1
- data/app/views/bhf/table/has_and_belongs_to_many/_default.html.haml +1 -1
- data/app/views/bhf/table/has_many/_default.html.haml +1 -1
- data/app/views/bhf/table/has_one/_default.html.haml +1 -1
- data/app/views/layouts/bhf/application.haml +4 -5
- data/app/views/layouts/bhf/quick_edit.haml +1 -1
- data/bhf.gemspec +5 -6
- data/config/locales/de.yml +2 -2
- data/config/locales/en.yml +2 -2
- data/config/locales/pt.yml +2 -2
- data/config/routes.rb +5 -5
- data/lib/bhf/action_view/form_builder.rb +3 -3
- data/lib/bhf/action_view/form_options.rb +5 -5
- data/lib/bhf/active_record/base.rb +5 -5
- data/lib/bhf/mongoid/document.rb +8 -8
- data/lib/bhf/platform/attribute/abstract.rb +12 -12
- data/lib/bhf/platform/attribute/column.rb +4 -4
- data/lib/bhf/platform/attribute/reflection.rb +11 -11
- data/lib/bhf/platform/base.rb +14 -14
- data/lib/bhf/platform/pagination.rb +3 -3
- data/lib/bhf/settings/base.rb +4 -4
- data/lib/bhf/settings/platform.rb +4 -4
- data/lib/bhf/settings/yaml_parser.rb +1 -1
- data/lib/bhf.rb +5 -5
- data/lib/rails/generators/bhf/templates/initializer.rb +3 -3
- data/test/database.yml +2 -2
- data/test/test_helper.rb +4 -4
- metadata +4 -5
- data/Getting_Started.md +0 -32
|
@@ -18,17 +18,17 @@ provides:
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
window.addEvent('domready', function(){
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
rails.csrf = {
|
|
23
23
|
token: rails.getCsrf('token'),
|
|
24
24
|
param: rails.getCsrf('param')
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
rails.applyEvents();
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
(function($){
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
window.rails = {
|
|
33
33
|
/**
|
|
34
34
|
* If el is passed as argument, events will only be applied to
|
|
@@ -39,7 +39,7 @@ window.addEvent('domready', function(){
|
|
|
39
39
|
var apply = function(selector, action, callback){
|
|
40
40
|
el.addEvent(action + ':relay(' + selector + ')', callback);
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
apply('form[data-remote="true"]', 'submit', rails.handleRemote);
|
|
44
44
|
apply('a[data-remote="true"], input[data-remote="true"]', 'click', rails.handleRemote);
|
|
45
45
|
apply('a[data-method][data-remote!=true]', 'click', function(event){
|
|
@@ -52,19 +52,19 @@ window.addEvent('domready', function(){
|
|
|
52
52
|
display: 'none'
|
|
53
53
|
}
|
|
54
54
|
}).inject(this, 'after');
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
var methodInput = Element('input', {
|
|
57
57
|
type: 'hidden',
|
|
58
58
|
name: '_method',
|
|
59
59
|
value: this.get('data-method')
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
var csrfInput = Element('input', {
|
|
63
63
|
type: 'hidden',
|
|
64
64
|
name: rails.csrf.param,
|
|
65
65
|
value: rails.csrf.token
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
form.adopt(methodInput, csrfInput).submit();
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -73,12 +73,12 @@ window.addEvent('domready', function(){
|
|
|
73
73
|
return rails.confirmed(this);
|
|
74
74
|
});
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
getCsrf: function(name){
|
|
78
78
|
var meta = document.getElement('meta[name=csrf-' + name + ']');
|
|
79
79
|
return (meta ? meta.get('content') : null);
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
confirmed: function(el){
|
|
83
83
|
var confirmMessage = el.get('data-confirm');
|
|
84
84
|
if(confirmMessage && !confirm(confirmMessage)){
|
|
@@ -86,7 +86,7 @@ window.addEvent('domready', function(){
|
|
|
86
86
|
}
|
|
87
87
|
return true;
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
disable: function(el){
|
|
91
91
|
var button = el.get('data-disable-with') ? el : el.getElement('[data-disable-with]');
|
|
92
92
|
if (button){
|
|
@@ -103,21 +103,23 @@ window.addEvent('domready', function(){
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
handleRemote: function(event){
|
|
108
108
|
event.preventDefault();
|
|
109
109
|
if(rails.confirmed(this)){
|
|
110
|
-
this.
|
|
110
|
+
if (this.get('data-type') === 'json') {
|
|
111
|
+
this.request = new Request.RailsJSON(this);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.request = new Request.Rails(this);
|
|
115
|
+
}
|
|
111
116
|
rails.disable(this);
|
|
112
117
|
this.request.send();
|
|
113
118
|
}
|
|
114
119
|
}
|
|
115
120
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Extends: Request,
|
|
120
|
-
|
|
121
|
+
|
|
122
|
+
var _reqestClassMethods = {
|
|
121
123
|
initialize: function(element, options){
|
|
122
124
|
this.el = element;
|
|
123
125
|
this.parent(Object.merge({
|
|
@@ -126,7 +128,7 @@ window.addEvent('domready', function(){
|
|
|
126
128
|
}, options));
|
|
127
129
|
this.addRailsEvents();
|
|
128
130
|
},
|
|
129
|
-
|
|
131
|
+
|
|
130
132
|
send: function(options) {
|
|
131
133
|
this.el.fireEvent('ajax:before');
|
|
132
134
|
if (this.el.get('tag') === 'form'){
|
|
@@ -135,26 +137,79 @@ window.addEvent('domready', function(){
|
|
|
135
137
|
this.parent(options);
|
|
136
138
|
this.el.fireEvent('ajax:after', this.xhr);
|
|
137
139
|
},
|
|
138
|
-
|
|
140
|
+
|
|
139
141
|
addRailsEvents: function(){
|
|
140
142
|
this.addEvent('request', function(){
|
|
141
143
|
this.el.fireEvent('ajax:loading', this.xhr);
|
|
142
144
|
});
|
|
143
|
-
|
|
145
|
+
|
|
144
146
|
this.addEvent('success', function(){
|
|
145
147
|
this.el.fireEvent('ajax:success', this.xhr);
|
|
146
148
|
});
|
|
147
|
-
|
|
149
|
+
|
|
148
150
|
this.addEvent('complete', function(){
|
|
149
151
|
this.el.fireEvent('ajax:complete', this.xhr);
|
|
150
152
|
this.el.fireEvent('ajax:loaded', this.xhr);
|
|
151
153
|
});
|
|
152
|
-
|
|
154
|
+
|
|
153
155
|
this.addEvent('failure', function(){
|
|
154
156
|
this.el.fireEvent('ajax:failure', this.xhr);
|
|
155
157
|
});
|
|
156
158
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
var _reqestClassMethods = {
|
|
162
|
+
initialize: function(element, options){
|
|
163
|
+
this.el = element;
|
|
164
|
+
this.parent(Object.merge({
|
|
165
|
+
method: this.el.get('method') || this.el.get('data-method') || 'get',
|
|
166
|
+
url: this.el.get('action') || this.el.get('href')
|
|
167
|
+
}, options));
|
|
168
|
+
|
|
169
|
+
if (rails.csrf.token) {
|
|
170
|
+
Object.append(this.headers, {
|
|
171
|
+
'X-CSRF-Token': rails.csrf.token
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.addRailsEvents();
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
send: function(options) {
|
|
179
|
+
this.el.fireEvent('ajax:before');
|
|
180
|
+
if (this.el.get('tag') === 'form'){
|
|
181
|
+
this.options.data = this.el;
|
|
182
|
+
}
|
|
183
|
+
this.parent(options);
|
|
184
|
+
this.el.fireEvent('ajax:after', this.xhr);
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
addRailsEvents: function(){
|
|
188
|
+
this.addEvent('request', function(){
|
|
189
|
+
this.el.fireEvent('ajax:loading', this.xhr);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
this.addEvent('success', function(){
|
|
193
|
+
this.el.fireEvent('ajax:success', this.xhr);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
this.addEvent('complete', function(){
|
|
197
|
+
this.el.fireEvent('ajax:complete', this.xhr);
|
|
198
|
+
this.el.fireEvent('ajax:loaded', this.xhr);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
this.addEvent('failure', function(){
|
|
202
|
+
this.el.fireEvent('ajax:failure', this.xhr);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
Request.RailsJSON = new Class(Object.merge({
|
|
208
|
+
Extends: Request.JSON
|
|
209
|
+
}, _reqestClassMethods));
|
|
210
|
+
|
|
211
|
+
Request.Rails = new Class(Object.merge({
|
|
212
|
+
Extends: Request
|
|
213
|
+
}, _reqestClassMethods));
|
|
214
|
+
|
|
215
|
+
})(document.id);
|
|
@@ -17,7 +17,7 @@ class Bhf::EmbedEntriesController < Bhf::EntriesController
|
|
|
17
17
|
if @object.save
|
|
18
18
|
manage_many_to_many
|
|
19
19
|
after_save
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
if @quick_edit
|
|
22
22
|
render json: object_to_bhf_hash, status: :ok
|
|
23
23
|
else
|
|
@@ -70,7 +70,7 @@ class Bhf::EmbedEntriesController < Bhf::EntriesController
|
|
|
70
70
|
@object = @model.bhf_new_embed(params[:entry_id], @permited_params)
|
|
71
71
|
after_load
|
|
72
72
|
end
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
def redirect_after_save(flash)
|
|
75
75
|
if params[:return_to_new]
|
|
76
76
|
redirect_to new_entry_embed_path(@platform.name, @model.get_embedded_parent(params[:entry_id])), flash
|
|
@@ -79,4 +79,4 @@ class Bhf::EmbedEntriesController < Bhf::EntriesController
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
end
|
|
82
|
+
end
|
|
@@ -5,21 +5,21 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
5
5
|
|
|
6
6
|
def new
|
|
7
7
|
@form_url = entries_path(@platform.name)
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
render layout: 'bhf/quick_edit' if @quick_edit
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def edit
|
|
13
13
|
render file: 'public/404.html', layout: false and return unless @object
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
@form_url = entry_path(@platform.name, @object)
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
render layout: 'bhf/quick_edit' if @quick_edit
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
def show
|
|
21
21
|
render file: 'public/404.html', layout: false and return unless @object
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
respond_to do |format|
|
|
24
24
|
format.html
|
|
25
25
|
format.json { render json: @object }
|
|
@@ -51,7 +51,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
51
51
|
|
|
52
52
|
def update
|
|
53
53
|
render file: 'public/404.html', layout: false and return unless @object
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
before_save
|
|
56
56
|
if @object.update_attributes(@permited_params)
|
|
57
57
|
manage_many_to_many
|
|
@@ -73,7 +73,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
73
73
|
render :edit, r_settings
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
def duplicate
|
|
78
78
|
new_record = @object.dup
|
|
79
79
|
new_record.before_bhf_duplicate(@object) if new_record.respond_to?(:before_bhf_duplicate)
|
|
@@ -84,21 +84,23 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
84
84
|
redirect_to(page_url(@platform.page_name, anchor: "#{@platform.name}_platform"), notice: set_message('duplicate.error', @model))
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
def sort
|
|
89
89
|
params[:order].each do |order|
|
|
90
90
|
@model.
|
|
91
91
|
find(order[1].gsub("_#{@platform.name}", '')).
|
|
92
92
|
update_attribute(@platform.sortable_property, order[0].to_i)
|
|
93
93
|
end
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
head :ok
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def destroy
|
|
99
|
-
@object.destroy
|
|
99
|
+
object = @object.destroy
|
|
100
100
|
if @quick_edit
|
|
101
|
-
|
|
101
|
+
respond_to do |f|
|
|
102
|
+
f.json { render status: :ok, json: object }
|
|
103
|
+
end
|
|
102
104
|
else
|
|
103
105
|
redirect_back_or_default(page_url(@platform.page_name, anchor: "#{@platform.name}_platform"), notice: set_message('destory.success', @model))
|
|
104
106
|
end
|
|
@@ -108,11 +110,11 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
108
110
|
|
|
109
111
|
def object_to_bhf_hash
|
|
110
112
|
extra_data = {
|
|
111
|
-
to_bhf_s: @object.to_bhf_s,
|
|
113
|
+
to_bhf_s: @object.to_bhf_s,
|
|
112
114
|
object_id: @object.send(@object.class.bhf_primary_key).to_s
|
|
113
115
|
}
|
|
114
116
|
extra_data.merge!(@object.to_bhf_hash) if @object.respond_to?(:to_bhf_hash)
|
|
115
|
-
|
|
117
|
+
|
|
116
118
|
@platform.columns.each_with_object(extra_data) do |column, hash|
|
|
117
119
|
column_value = @object.send(column.name)
|
|
118
120
|
unless column.macro == :column && column_value.blank?
|
|
@@ -151,7 +153,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
151
153
|
relation_array = @object.send(relation)
|
|
152
154
|
reflection.klass.unscoped.find(ids.keys).each do |relation_obj|
|
|
153
155
|
has_relation = relation_array.include?(relation_obj)
|
|
154
|
-
|
|
156
|
+
|
|
155
157
|
if ids[relation_obj.send(relation_obj.class.bhf_primary_key).to_s].blank?
|
|
156
158
|
if has_relation
|
|
157
159
|
relation_array.delete(relation_obj)
|
|
@@ -184,7 +186,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
|
184
186
|
def set_quick_edit
|
|
185
187
|
@quick_edit = request.xhr?
|
|
186
188
|
end
|
|
187
|
-
|
|
189
|
+
|
|
188
190
|
def redirect_after_save(flash)
|
|
189
191
|
if params[:return_to_edit]
|
|
190
192
|
redirect_to edit_entry_path(@platform.name, @object), flash
|
|
@@ -15,7 +15,7 @@ class Bhf::PagesController < Bhf::ApplicationController
|
|
|
15
15
|
|
|
16
16
|
@platforms = platform_options.each_with_object([]) do |opts, obj|
|
|
17
17
|
platform = find_platform(opts.keys[0])
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
next if platform.table_hide?
|
|
20
20
|
paginate_platform_objects(platform)
|
|
21
21
|
obj << platform
|
|
@@ -42,7 +42,7 @@ class Bhf::PagesController < Bhf::ApplicationController
|
|
|
42
42
|
unless p[:page].blank?
|
|
43
43
|
page = p[:page].to_i
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
per_page = platform.pagination.offset_per_page
|
|
47
47
|
unless p[:per_page].blank?
|
|
48
48
|
per_page = p[:per_page].to_i
|
|
@@ -55,4 +55,4 @@ class Bhf::PagesController < Bhf::ApplicationController
|
|
|
55
55
|
platform.get_objects(p, page_params)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
end
|
|
58
|
+
end
|
|
@@ -20,7 +20,7 @@ module Bhf
|
|
|
20
20
|
def delete_t(platform)
|
|
21
21
|
t("bhf.helpers.entry.models.#{platform.model_name}.delete", platform_title: platform.title_singular.titleize, default: t('bhf.helpers.entry.delete')).html_safe
|
|
22
22
|
end
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
def find_smallest_size_url_for_file(file)
|
|
25
25
|
if file.exists?(:thumb)
|
|
26
26
|
file.url(:thumb)
|
|
@@ -34,6 +34,6 @@ module Bhf
|
|
|
34
34
|
def type_is_image?(type)
|
|
35
35
|
Bhf.configuration.paperclip_image_types.include?(type)
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
module Bhf
|
|
2
2
|
module EntriesHelper
|
|
3
3
|
include Bhf::ActionView::FormOptions
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
def node(f, field, &block)
|
|
6
6
|
render partial: 'bhf/helper/node', locals: {f: f, field: field, input: with_output_buffer(&block)}
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def definition_item(object, column, &block)
|
|
10
10
|
render partial: 'bhf/helper/definition_item', locals: {object: object, column: column, content: with_output_buffer(&block)}
|
|
11
11
|
end
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
def reflection_node(f, field, &block)
|
|
14
14
|
return if !f.object.respond_to?(field.reflection.name) || (field.form_type == :static && f.object.new_record? && f.object.send(field.reflection.name).blank?)
|
|
15
15
|
render partial: 'bhf/helper/reflection_node', locals: {
|
|
16
16
|
f: f, field: field, input: with_output_buffer(&block)
|
|
17
17
|
}
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
def reflection_title(f, field, count = 2)
|
|
21
21
|
title = f.object.class.human_attribute_name(field.reflection.name)
|
|
22
22
|
if field.link
|
|
@@ -24,6 +24,6 @@ module Bhf
|
|
|
24
24
|
end
|
|
25
25
|
title
|
|
26
26
|
end
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
end
|
|
29
|
-
end
|
|
29
|
+
end
|
|
@@ -5,11 +5,11 @@ module Bhf
|
|
|
5
5
|
return unless session[Bhf.configuration.session_auth_name.to_s] == true
|
|
6
6
|
|
|
7
7
|
options[:platform_name] ||= object.class.to_s.pluralize.downcase
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
if object.respond_to?(:'bhf_can_edit?', true)
|
|
10
10
|
return unless object.bhf_can_edit?(options)
|
|
11
11
|
end
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
area = if options[:area]
|
|
14
14
|
options[:area]
|
|
15
15
|
elsif object.respond_to?(:bhf_area, true)
|
|
@@ -20,4 +20,4 @@ module Bhf
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
end
|
|
23
|
-
end
|
|
23
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Bhf
|
|
2
2
|
module PagesHelper
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
def get_value(key, p)
|
|
5
5
|
return unless p.is_a?(Hash)
|
|
6
6
|
|
|
7
7
|
return p[key[0]][key[1]] if key.is_a?(Array) && p[key[0]].is_a?(Hash) && p[key[0]][key[1]].is_a?(String) #omg
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
p[key] if p[key] && p[key].is_a?(String)
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -26,9 +26,9 @@ module Bhf
|
|
|
26
26
|
def order_class(order_by, platform_name)
|
|
27
27
|
params_platfrom = params[platform_name] ? params[platform_name] : {}
|
|
28
28
|
return unless params_platfrom['order'] == order_by
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
params_platfrom['direction'] == 'desc' ? 'sorted desc' : 'sorted asc'
|
|
31
31
|
end
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
end
|
|
34
|
-
end
|
|
34
|
+
end
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
- if f.object.errors.any?
|
|
5
5
|
= render partial: 'bhf/entries/validation_errors', locals: {f: f}
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
- @platform.fields.each do |field|
|
|
8
8
|
= render partial: "bhf/form/#{field.macro}/#{field.form_type}", locals: {f: f, field: field}
|
|
9
9
|
|
|
10
10
|
- unless @quick_edit
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
- if params[:return_to]
|
|
13
13
|
= hidden_field :return, :to, name: :return_to, value: params[:return_to]
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
.node
|
|
16
16
|
.label
|
|
17
17
|
.input
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
= f.submit t('bhf.helpers.form.buttons.and_edit'), name: :return_to_edit, class: 'alt_button'
|
|
22
22
|
- unless @platform.hide_create
|
|
23
23
|
= f.submit t('bhf.helpers.form.buttons.and_add'), name: :return_to_new, class: 'alt_button'
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
= link_to t('bhf.helpers.entry.cancel'), params[:return_to] ? params[:return_to] : page_path(@platform.page_name), class: 'cancel', data: ( {no_turbolink: true} if params[:return_to])
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
%h5= t 'bhf.helpers.validation.header', error: pluralize(f.object.errors.count, t('bhf.helpers.validation.error')), name: f.object.class.model_name.human
|
|
3
3
|
%ul
|
|
4
4
|
- f.object.errors.each do |name, message|
|
|
5
|
-
%li= f.error_label name, message
|
|
5
|
+
%li= f.error_label name, message
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
%h3= edit_t @platform
|
|
2
|
-
= render 'bhf/entries/form'
|
|
2
|
+
= render 'bhf/entries/form'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
%h3= new_t @platform
|
|
2
|
-
= render 'bhf/entries/form'
|
|
2
|
+
= render 'bhf/entries/form'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
- data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
|
|
1
|
+
- data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
|
|
2
2
|
- fk = field.db_name
|
|
3
3
|
= reflection_node f, field do
|
|
4
4
|
.quick_edit_block
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
= label_tag "belongs_to_#{fk}_#{obj.id}", obj.to_bhf_s
|
|
13
13
|
- if field.link && ! field.link.hide_delete
|
|
14
14
|
= link_to '×'.html_safe, entry_path(field.link.name, obj), method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
.quick_edit_template{type: 'text/template'}
|
|
17
17
|
%li
|
|
18
18
|
= f.radio_button fk, '{object_id}', id: "belongs_to_#{fk}_{object_id}", class: 'js_remove_disabled', disabled: true
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
= label_tag "belongs_to_#{fk}_#{obj.id}", obj.to_bhf_s
|
|
23
23
|
- if field.link && ! field.link.hide_delete
|
|
24
24
|
= link_to '×'.html_safe, entry_path(field.link.name, '{object_id}'), method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
|
|
27
27
|
- if field.link && ! field.link.hide_create
|
|
28
|
-
= link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit'
|
|
28
|
+
= link_to '+', new_entry_path(field.link.name), class: 'js_add_field plus_button qe_button quick_edit'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
- data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
|
|
1
|
+
- data_source ||= field.link ? field.link.get_objects : field.reflection.klass.all
|
|
2
2
|
- fk = field.db_name
|
|
3
3
|
.node
|
|
4
4
|
.label= f.label fk, reflection_title(f, field, 1)
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
- select_options ||= options_from_collection_for_select_with_html_attrs(data_source, :id, :to_bhf_s, f.object.send(fk), Proc.new {|obj| {data: {edit: edit_entry_path(field.link.name, obj), delete: entry_path(field.link.name, obj)}}})
|
|
10
10
|
- else
|
|
11
11
|
- select_options ||= options_from_collection_for_select(data_source, :id, :to_bhf_s, f.object.send(fk))
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
= f.select fk, select_options, {include_blank: true}, {class: ('quick_edit_inject quick_edit_select' if field.link)}
|
|
14
14
|
= render partial: 'bhf/helper/field_errors', locals: {f: f, field: fk}
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
- if field.link && ! field.link.hide_edit
|
|
17
17
|
= link_to edit_t(field.link), '', class: 'js_edit_field icon edit quick_edit'
|
|
18
18
|
- if field.link && ! field.link.hide_delete
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.check_box field.name
|
|
2
|
+
= f.check_box field.name
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_field field.name, class: "picker #{field.type}", value: f.object.send(field.name) ? l(f.object.send(field.name), format: t("bhf.helpers.input.date_format.#{field.type}")) : nil
|
|
2
|
+
= f.text_field field.name, class: "picker #{field.type}", value: f.object.send(field.name) ? l(f.object.send(field.name), format: t("bhf.helpers.input.date_format.#{field.type}")) : nil
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.object.send(field.name).inspect
|
|
2
|
+
= f.object.send(field.name).inspect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
= f.hidden_field field.name
|
|
1
|
+
= f.hidden_field field.name
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_area field.name, class: ('wmd_editor' unless @quick_edit)
|
|
2
|
+
= f.text_area field.name, class: ('wmd_editor' unless @quick_edit)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_field field.name, class: 'multiple_field', data: {spliter: (f.object.send("#{field.name}_spliter") if f.object.respond_to?(:"#{field.name}_spliter"))}
|
|
2
|
+
= f.text_field field.name, class: 'multiple_field', data: {spliter: (f.object.send("#{field.name}_spliter") if f.object.respond_to?(:"#{field.name}_spliter"))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_field field.name, class: 'number'
|
|
2
|
+
= f.text_field field.name, class: 'number'
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
= node f, field do
|
|
4
4
|
- file = f.object.send(field.name)
|
|
5
5
|
- if file.file?
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
- if type_is_image?(file.content_type)
|
|
8
8
|
= link_to image_tag(find_smallest_size_url_for_file(file), class: 'uploaded_image'), file.url
|
|
9
9
|
- else
|
|
10
10
|
= link_to file.original_filename, file.url, class: 'uploaded_file'
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
- if f.object.respond_to?(:"#{field.name}_destroy")
|
|
13
13
|
.file_delete
|
|
14
14
|
= f.check_box "#{field.name}_destroy"
|
|
15
15
|
= f.label "#{field.name}_destroy", t('bhf.helpers.file.delete')
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
%a.qe_button.ninja_file_field_holder.default_form_align{data: {empty_field_text: t('bhf.helpers.form.file_field.select')}}
|
|
18
18
|
%span.h_text= t('bhf.helpers.form.file_field.select')
|
|
19
19
|
= f.file_field field.name, class: 'ninja_file_field'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.password_field field.name
|
|
2
|
+
= f.password_field field.name
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_field field.name
|
|
2
|
+
= f.text_field field.name
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_area field.name
|
|
2
|
+
= f.text_area field.name
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
= node f, field do
|
|
2
|
-
= f.text_area field.name, class: 'wysiwyg'
|
|
2
|
+
= f.text_area field.name, class: 'wysiwyg'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
= ref_object.to_bhf_s
|
|
13
13
|
- if field.link && ! field.link.hide_delete
|
|
14
14
|
= link_to '×'.html_safe, entry_embed_path(field.link.name, f.object, ref_object), method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
.quick_edit_template{type: 'text/template'}
|
|
17
17
|
%li.quick_edit_entry
|
|
18
18
|
- if field.link && ! field.link.hide_edit
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
= '{to_bhf_s}'
|
|
22
22
|
- if field.link && ! field.link.hide_delete
|
|
23
23
|
= link_to '×'.html_safe, entry_embed_path(field.link.name, f.object, '{object_id}'), method: :delete, class: 'qe_delete js_delete', remote: true, data: {confirm: t('bhf.helpers.promts.confirm', platform_title: field.link.title_singular)}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
- if ! is_one && field.link && ! field.link.hide_create
|
|
26
|
-
= link_to '+', new_entry_embed_path(field.link.name, f.object), class: 'js_add_field plus_button qe_button quick_edit default_form_align'
|
|
26
|
+
= link_to '+', new_entry_embed_path(field.link.name, f.object), class: 'js_add_field plus_button qe_button quick_edit default_form_align'
|