common_core_js 0.3.5 → 0.3.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c741cb686a2b2cdbaf0c78412ef5733e82e048d6cd94507675a14288464b617
|
4
|
+
data.tar.gz: fb86d6cabe810f86faca72ecc1a7cf6045bb24df6fd6124de82289ec70d4386c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff7ba81411119d30bc13f18b0fcbdc5bf2d27353758d8795d1d8184a766636fa47faae4f3a9eee294e51ff6ed4a148817065ff51d8f0eef4407bee162e8a971
|
7
|
+
data.tar.gz: 0b863a346bc88ff5e12f3a942183f8a9f37c527721545a8a353cd16d957d24a176ce0f9751f333906c208b5a0484b367b1cc21096391c5db10e15ae825c76ec3
|
@@ -410,16 +410,16 @@ module CommonCore
|
|
410
410
|
#{col.to_s.humanize}\n"
|
411
411
|
end
|
412
412
|
when :string
|
413
|
-
limit ||=
|
414
|
-
if limit <
|
413
|
+
limit ||= 256
|
414
|
+
if limit < 256
|
415
415
|
field_output(col, nil, limit)
|
416
416
|
else
|
417
417
|
text_area_output(col, limit)
|
418
418
|
end
|
419
419
|
|
420
420
|
when :text
|
421
|
-
limit ||=
|
422
|
-
if limit <
|
421
|
+
limit ||= 256
|
422
|
+
if limit < 256
|
423
423
|
field_output(col, nil, limit)
|
424
424
|
else
|
425
425
|
text_area_output(col, limit)
|
@@ -428,15 +428,15 @@ module CommonCore
|
|
428
428
|
when :datetime
|
429
429
|
".row
|
430
430
|
%div{class: \"form-group col-md-4 \#{'alert-danger' if #{singular}.errors.details.keys.include?(:#{col.to_s})}\"}
|
431
|
-
= datetime_field_localized(f, :#{col.to_s}, @#{singular}.#{col.to_s}, '#{col.to_s.humanize}', #{@auth
|
431
|
+
= datetime_field_localized(f, :#{col.to_s}, @#{singular}.#{col.to_s}, '#{col.to_s.humanize}', #{@auth ? @auth+'.timezone' : 'nil'})"
|
432
432
|
when :date
|
433
433
|
".row
|
434
434
|
%div{class: \"form-group col-md-4 \#{'alert-danger' if #{singular}.errors.details.keys.include?(:#{col.to_s})}\"}
|
435
|
-
= date_field_localized(f, :#{col.to_s}, @#{singular}.#{col.to_s}, '#{col.to_s.humanize}', #{@auth
|
435
|
+
= date_field_localized(f, :#{col.to_s}, @#{singular}.#{col.to_s}, '#{col.to_s.humanize}', #{@auth ? @auth+'.timezone' : 'nil'})"
|
436
436
|
when :time
|
437
437
|
".row
|
438
438
|
%div{class: \"form-group col-md-4 \#{'alert-danger' if #{singular}.errors.details.keys.include?(:#{col.to_s})}\"}
|
439
|
-
= time_field_localized(f, :#{col.to_s}, @#{singular}.#{col.to_s}, '#{col.to_s.humanize}', #{@auth
|
439
|
+
= time_field_localized(f, :#{col.to_s}, @#{singular}.#{col.to_s}, '#{col.to_s.humanize}', #{@auth ? @auth+'.timezone' : 'nil'})"
|
440
440
|
|
441
441
|
end
|
442
442
|
|
@@ -499,7 +499,7 @@ module CommonCore
|
|
499
499
|
when :datetime
|
500
500
|
" %td
|
501
501
|
- unless #{singular}.#{col}.nil?
|
502
|
-
= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p ') +
|
502
|
+
= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p ') + timezonize(current_timezone)
|
503
503
|
- else
|
504
504
|
%span.alert-danger
|
505
505
|
MISSING
|
@@ -515,7 +515,7 @@ module CommonCore
|
|
515
515
|
when :time
|
516
516
|
" %td
|
517
517
|
- unless #{singular}.#{col}.nil?
|
518
|
-
= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%l:%M %p ') +
|
518
|
+
= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%l:%M %p ') + timezonize(current_timezone)
|
519
519
|
- else
|
520
520
|
%span.alert-danger
|
521
521
|
MISSING
|
@@ -527,6 +527,14 @@ module CommonCore
|
|
527
527
|
end
|
528
528
|
|
529
529
|
|
530
|
+
def controller_descends_from
|
531
|
+
if defined?(@namespace.titlecase + "::BaseController")
|
532
|
+
@namespace.titlecase + "::BaseController"
|
533
|
+
else
|
534
|
+
"ApplicationController"
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
530
538
|
|
531
539
|
private # thor does something fancy like sending the class all of its own methods during some strange run sequence
|
532
540
|
# does not like public methods
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class <%= controller_class_name %> <
|
1
|
+
class <%= controller_class_name %> < <%= controller_descends_from %>
|
2
2
|
<% unless @auth_identifier.nil? %>
|
3
3
|
before_action :authenticate_<%= auth_identifier %>!
|
4
4
|
|
@@ -6,7 +6,7 @@ class <%= controller_class_name %> < ApplicationController
|
|
6
6
|
<% if any_nested? %> <% @nested_args.each do |arg| %>
|
7
7
|
before_action :load_<%= arg %><% end %> <% end %>
|
8
8
|
before_action :load_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
|
9
|
-
|
9
|
+
helper :common_core
|
10
10
|
|
11
11
|
<% if any_nested? %><% nest_chain = [] %> <% @nested_args.each do |arg| %>
|
12
12
|
<% if nest_chain.empty?
|
@@ -22,7 +22,6 @@ class <%= controller_class_name %> < ApplicationController
|
|
22
22
|
def load_<%= singular_name %>
|
23
23
|
@<%= singular_name %> = <%= object_scope %>.find(params[:id])
|
24
24
|
end
|
25
|
-
include CommonCoreJs::ControllerHelpers
|
26
25
|
|
27
26
|
def index
|
28
27
|
@<%= plural_name %> = <%= object_scope %><% if model_has_strings? %>.where(<%=class_name %>.arel_table[:email].matches("%#{@__general_string}%"))<% end %>.page(params[:page])
|
@@ -41,7 +40,7 @@ class <%= controller_class_name %> < ApplicationController
|
|
41
40
|
end
|
42
41
|
|
43
42
|
def create
|
44
|
-
modified_params = modify_date_inputs_on_params(<%=singular_name %>_params.dup<% if !create_merge_params.empty? %>.merge!(<%= create_merge_params
|
43
|
+
modified_params = modify_date_inputs_on_params(<%=singular_name %>_params.dup<% if !create_merge_params.empty? %>.merge!(<%= create_merge_params %>)<%end%> , <%= @auth ? @auth : "nil" %>)
|
45
44
|
@<%=singular_name %> = <%=class_name %>.create(modified_params)
|
46
45
|
respond_to do |format|
|
47
46
|
if @<%= singular_name %>.save
|
@@ -66,7 +65,7 @@ class <%= controller_class_name %> < ApplicationController
|
|
66
65
|
|
67
66
|
def update
|
68
67
|
respond_to do |format|
|
69
|
-
if !@<%=singular_name %>.update(modify_date_inputs_on_params(<%= singular %>_params
|
68
|
+
if !@<%=singular_name %>.update(modify_date_inputs_on_params(<%= singular %>_params ))
|
70
69
|
flash[:alert] = "<%=singular_name.titlecase %> could not be saved"
|
71
70
|
end
|
72
71
|
format.js {}
|