lotus_admin 1.5.2 → 1.5.7

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
  SHA256:
3
- metadata.gz: 1a6d6f7dab65888fc3cc1d0c1823baa23eb80d80605bc11c292bccff92f2242a
4
- data.tar.gz: 72edd101b774056720d793cbab45c79f52519add43976762c1a32f1962719037
3
+ metadata.gz: 405663dd13d84a5fd217a3fc71842b5c63d22bc856cb65c15cb13e327ce179d3
4
+ data.tar.gz: c7814206b4315499b7fda282ac5f5f16907d9aef34da98ce0f99688df1125a32
5
5
  SHA512:
6
- metadata.gz: 442cdf1f5eaf5ee45be321bfdf1dcbd0cf503101abf3a1f441e98521bb3d70a37b802e6526319edac810f46932ece767d389290fb379a27ff73ba87f917ed2f2
7
- data.tar.gz: 7427bb13393baf8774e1be6bdc0613bccec45baaac602fb718e8abdedc659c4219bef7ad0b09b94a6c8a0e3bc7da890271635a2d6ca836b01513819512fb9f7c
6
+ metadata.gz: 5c63ad4deab968e1c514c7d918ffc7a8fa6e712af61f91a40c8cd7a0e5724fd1f302c21ea3cfb9cb56bd683ba4364d189870e653acc288001cf2d2bf71090f8b
7
+ data.tar.gz: 6b7746e4d804def2a2b49fcf1254a3ec53bd4e4740fcac24bd7ea7907d54c21a801da5b6f273da96915aec227bbf834aa70924a166a4114558a7f83fc0a9e1da
@@ -12,14 +12,13 @@ $ ->
12
12
  }
13
13
 
14
14
  setup_datepickers = (container)->
15
- container.find('.input-group.date, .form-control.date').datetimepicker
15
+ container.find('.input-group.date').datetimepicker
16
16
  format: 'YYYY-MM-DD',
17
17
  icons: icons
18
18
 
19
- container.find('.input-group.datetime, .form-control.datetime').datetimepicker
19
+ container.find('.input-group.datetime').datetimepicker
20
20
  format: 'YYYY-MM-DD hh:mm a',
21
- icons: icons,
22
- debug: true
21
+ icons: icons
23
22
 
24
23
  # On page load
25
24
  setup_datepickers($('body'))
@@ -32,7 +32,7 @@ class LotusAdmin::ResourceController < LotusAdmin::AuthenticatedController
32
32
  format.html
33
33
 
34
34
  if block.present?
35
- block.call
35
+ block.call(format)
36
36
  else
37
37
  if resource.save
38
38
  redirect_to after_create_redirect, notice: "Created new #{ resource_class.model_name.human } successfully"
@@ -56,13 +56,17 @@ class LotusAdmin::ResourceController < LotusAdmin::AuthenticatedController
56
56
  def update(&block)
57
57
  authorize(resource) if using_pundit?
58
58
 
59
- if block.present?
60
- block.call
61
- else
62
- if resource.update(permitted_params)
63
- redirect_to after_update_redirect, notice: "Updated #{ resource_class.model_name.human } successfully"
59
+ respond_to do |format|
60
+ format.html
61
+
62
+ if block.present?
63
+ block.call(format)
64
64
  else
65
- render :edit
65
+ if resource.update(permitted_params)
66
+ redirect_to after_update_redirect, notice: "Updated #{ resource_class.model_name.human } successfully"
67
+ else
68
+ render :edit
69
+ end
66
70
  end
67
71
  end
68
72
  end
@@ -77,20 +81,34 @@ class LotusAdmin::ResourceController < LotusAdmin::AuthenticatedController
77
81
  end
78
82
  end
79
83
 
80
- def show
84
+ def show(&block)
81
85
  authorize(resource) if using_pundit?
86
+
87
+ respond_to do |format|
88
+ format.html
89
+
90
+ block.call(format) if block.present?
91
+ end
82
92
  end
83
93
 
84
- def destroy
94
+ def destroy(&block)
85
95
  authorize(resource) if using_pundit?
86
96
 
87
- if resource.destroy
88
- flash[:notice] = "#{ resource_class.model_name.human } has been removed"
89
- else
90
- flash[:error] = "There was an error removing that #{ resource_class.model_name.human }"
91
- end
97
+ respond_to do |format|
98
+ format.html
92
99
 
93
- redirect_to after_destroy_redirect
100
+ if block.present?
101
+ block.call(format)
102
+ else
103
+ if resource.destroy
104
+ flash[:notice] = "#{ resource_class.model_name.human } has been removed"
105
+ else
106
+ flash[:error] = "There was an error removing that #{ resource_class.model_name.human }"
107
+ end
108
+
109
+ redirect_to after_destroy_redirect
110
+ end
111
+ end
94
112
  end
95
113
 
96
114
  private
@@ -12,7 +12,7 @@ module LotusAdmin
12
12
  filter :last_sign_in_at
13
13
 
14
14
  def create
15
- super do
15
+ super do |format|
16
16
  resource.password = Devise.friendly_token.first(8)
17
17
 
18
18
  if resource.save
@@ -0,0 +1,22 @@
1
+ class CurrencyInput < SimpleForm::Inputs::Base
2
+ def input(wrapper_options)
3
+ currency = options.delete(:currency) || default_currency
4
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
5
+
6
+ content_tag(:div, input_group(currency, merged_input_options), class: "input-group")
7
+ end
8
+
9
+ private
10
+
11
+ def input_group(currency, merged_input_options)
12
+ "#{currency_addon(currency)} #{@builder.text_field(attribute_name, merged_input_options)}".html_safe
13
+ end
14
+
15
+ def currency_addon(currency)
16
+ content_tag(:span, currency, class: "input-group-addon")
17
+ end
18
+
19
+ def default_currency
20
+ "$"
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ class DateTimeInput < SimpleForm::Inputs::Base
2
+ def input(wrapper_options)
3
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
4
+
5
+ content_tag(:div, input_group(merged_input_options), class: "input-group datetime")
6
+ end
7
+
8
+ private
9
+
10
+ def input_group(merged_input_options)
11
+ "#{calendar_addon} #{@builder.text_field(attribute_name, merged_input_options)}".html_safe
12
+ end
13
+
14
+ def calendar_addon
15
+ content_tag(:span, calendar_icon, class: "input-group-addon")
16
+ end
17
+
18
+ def calendar_icon
19
+ @builder.template.fa_icon(:calendar)
20
+ end
21
+
22
+ def input_html_options
23
+ super.merge({
24
+ class: 'datetime',
25
+ value: @builder.object.public_send(attribute_name)&.strftime('%Y-%m-%d %l:%M %P')
26
+ })
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  #filter-modal.modal.fade
2
- .modal-dialog
2
+ .modal-dialog.modal-lg
3
3
  .modal-content
4
4
  = search_form_for ransack_object, url: collection_path, class: 'filter-form' do |f|
5
5
  .modal-header
@@ -9,8 +9,10 @@
9
9
  %h4.modal-title= t('lotus_admin.filters.modal.title')
10
10
 
11
11
  .modal-body
12
- - filters.each do |filter|
13
- = filter.render(f)
12
+ - filters.in_groups_of(2, false).each do |group|
13
+ .row
14
+ - group.each do |filter|
15
+ .col-sm-6= filter.render(f)
14
16
 
15
17
  .modal-footer
16
18
  = link_to t('lotus_admin.filters.modal.reset_btn'), collection_path, class: 'btn btn-link pull-left'
@@ -1,3 +1,3 @@
1
1
  module LotusAdmin
2
- VERSION = '1.5.2'
2
+ VERSION = '1.5.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotus_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Millsaps-Brewer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -405,7 +405,9 @@ files:
405
405
  - app/helpers/lotus_admin/panel_helpers.rb
406
406
  - app/helpers/lotus_admin/render_helpers.rb
407
407
  - app/helpers/lotus_admin/sidebar_helpers.rb
408
+ - app/inputs/currency_input.rb
408
409
  - app/inputs/date_picker_input.rb
410
+ - app/inputs/date_time_input.rb
409
411
  - app/jobs/lotus_admin/application_job.rb
410
412
  - app/mailers/lotus_admin/application_mailer.rb
411
413
  - app/mailers/lotus_admin/user_mailer.rb