lotus_admin 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/app/assets/javascripts/lotus_admin/application.js +5 -0
- data/app/assets/javascripts/lotus_admin/datepickers.js.coffee +31 -0
- data/app/assets/javascripts/lotus_admin/filters.js.coffee +17 -0
- data/app/assets/stylesheets/lotus_admin/application.css.scss +1 -0
- data/app/assets/stylesheets/lotus_admin/components/_all.scss +2 -0
- data/app/assets/stylesheets/lotus_admin/components/_datepicker.scss +28 -0
- data/app/assets/stylesheets/lotus_admin/components/_filters.scss +5 -0
- data/app/assets/stylesheets/lotus_admin/components/_forms.scss +4 -0
- data/app/controllers/concerns/lotus_admin/exposure.rb +6 -4
- data/app/controllers/concerns/lotus_admin/filterable_controller.rb +40 -0
- data/app/controllers/concerns/lotus_admin/resourceful_controller.rb +17 -0
- data/app/controllers/lotus_admin/application_controller.rb +3 -0
- data/app/controllers/lotus_admin/authenticated_controller.rb +2 -0
- data/app/helpers/lotus_admin/filter_helpers.rb +23 -0
- data/app/helpers/lotus_admin/form_helpers.rb +7 -3
- data/app/helpers/lotus_admin/render_helpers.rb +7 -0
- data/app/inputs/date_picker_input.rb +28 -0
- data/app/models/lotus_admin/filters/configuration.rb +201 -0
- data/app/views/lotus_admin/shared/_index.html.haml +16 -0
- data/app/views/lotus_admin/shared/filters/_modal.html.haml +17 -0
- data/app/views/lotus_admin/shared/filters/_results_banner.html.haml +6 -0
- data/config/locales/filters.en.yml +7 -0
- data/lib/lotus_admin/configuration.rb +6 -0
- data/lib/lotus_admin/version.rb +1 -1
- data/lib/lotus_admin.rb +4 -0
- metadata +86 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8228038c5b61febcfeee7306c78be057b48d0da9
|
4
|
+
data.tar.gz: 8a1720486228e5de812f47457e477b9db4a4baf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1c9914c1ad413b283116277377eb0bb5997e04d81f6fb4f134f69794890733eeb66171275b220c1636967dc2eb3a7701871676264c20094326e28eaf522f3f5
|
7
|
+
data.tar.gz: 8a87778cdc9b1dab765577060bbbc68b1617716ae1c65011e6ff6a43257fd3b51b8ddf4d9f51bd2a49a00da99ccbbe3b7e7e7abe7bf0a529b79e5859d64b4654
|
data/README.md
CHANGED
@@ -20,6 +20,15 @@ You will need to define these secrets.
|
|
20
20
|
|
21
21
|
### Setup
|
22
22
|
|
23
|
+
Manually configure ranack to use simple form, before rails boots.
|
24
|
+
```ruby
|
25
|
+
# config/application.rb
|
26
|
+
require_relative 'boot'
|
27
|
+
ENV['RANSACK_FORM_BUILDER'] = '::SimpleForm::FormBuilder'
|
28
|
+
|
29
|
+
require 'rails/all'
|
30
|
+
```
|
31
|
+
|
23
32
|
```ruby
|
24
33
|
# Gemfile
|
25
34
|
gem 'lotus_admin', '~> 0.1.0'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
$ ->
|
2
|
+
icons = {
|
3
|
+
time: 'fa fa-clock-o',
|
4
|
+
date: 'fa fa-calendar',
|
5
|
+
up: 'fa fa-arrow-up',
|
6
|
+
down: 'fa fa-arrow-down',
|
7
|
+
previous: 'fa fa-arrow-left',
|
8
|
+
next: 'fa fa-arrow-right',
|
9
|
+
today: 'fa fa-home',
|
10
|
+
clear: 'fa fa-trash',
|
11
|
+
close: 'fa fa-remove'
|
12
|
+
}
|
13
|
+
|
14
|
+
setup_datepickers = (container)->
|
15
|
+
container.find('.input-group.date, .form-control.date').datetimepicker
|
16
|
+
format: 'YYYY-MM-DD',
|
17
|
+
icons: icons
|
18
|
+
|
19
|
+
container.find('.input-group.datetime, .form-control.datetime').datetimepicker
|
20
|
+
format: 'YYYY-MM-DD hh:mm a',
|
21
|
+
icons: icons,
|
22
|
+
debug: true
|
23
|
+
|
24
|
+
# On page load
|
25
|
+
setup_datepickers($('body'))
|
26
|
+
|
27
|
+
# On modal load
|
28
|
+
$('.modal').on 'shown.bs.modal', (e)->
|
29
|
+
setTimeout ->
|
30
|
+
setup_datepickers($(e.target))
|
31
|
+
, 1000
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$ ->
|
2
|
+
change_integer_predicate_input_name = (predicate_select)->
|
3
|
+
$form_group = predicate_select.closest('.form-group')
|
4
|
+
attribute = $form_group.data('attribute-name')
|
5
|
+
predicate = predicate_select.val()
|
6
|
+
|
7
|
+
input_name = "q[#{ attribute }_#{ predicate }]"
|
8
|
+
$form_group.find(".form-control:not(.filter-predicate-select)").attr("name", input_name)
|
9
|
+
|
10
|
+
$('.filter-predicate-select').change (e)->
|
11
|
+
change_integer_predicate_input_name $(e.target)
|
12
|
+
|
13
|
+
$.each $('.filter-predicate-select'), (idx, el)->
|
14
|
+
change_integer_predicate_input_name($(el))
|
15
|
+
|
16
|
+
$('#filter-modal form').on 'submit', (e)->
|
17
|
+
$('#filter-modal').addClass('loading')
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.bootstrap-datetimepicker-widget {
|
2
|
+
&.dropdown-menu {
|
3
|
+
width: auto;
|
4
|
+
}
|
5
|
+
|
6
|
+
table td {
|
7
|
+
border-radius: 0;
|
8
|
+
}
|
9
|
+
|
10
|
+
.picker-switch.accordion-toggle {
|
11
|
+
table td {
|
12
|
+
span {
|
13
|
+
background: $brand-primary;
|
14
|
+
border-radius: 0;
|
15
|
+
color: #fff;
|
16
|
+
&:after {
|
17
|
+
content: " Time";
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
&:hover {
|
22
|
+
span {
|
23
|
+
background: lighten($brand-primary, 10%);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -5,16 +5,18 @@ module LotusAdmin
|
|
5
5
|
class_methods do
|
6
6
|
def let(attribute_name, &block)
|
7
7
|
|
8
|
+
method_name = attribute_name.to_s.gsub('?', '')
|
9
|
+
|
8
10
|
# instance setter method
|
9
|
-
define_method("#{
|
10
|
-
instance_variable_set("@#{
|
11
|
+
define_method("#{ method_name }=") do |value|
|
12
|
+
instance_variable_set("@#{ method_name }", value)
|
11
13
|
end
|
12
14
|
|
13
15
|
# instance method to meomize the block result
|
14
16
|
define_method(attribute_name) do
|
15
|
-
instance_variable_get("@#{
|
17
|
+
instance_variable_get("@#{ method_name }") || begin
|
16
18
|
value = instance_eval(&block)
|
17
|
-
public_send("#{
|
19
|
+
public_send("#{ method_name }=", value)
|
18
20
|
|
19
21
|
value
|
20
22
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module LotusAdmin
|
2
|
+
module FilterableController
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
helper FilterHelpers
|
7
|
+
|
8
|
+
class_attribute :filters_enabled
|
9
|
+
self.filters_enabled = false
|
10
|
+
|
11
|
+
class_attribute :_beginning_of_scope_chain, instance_accessor: false
|
12
|
+
beginning_of_scope_chain {}
|
13
|
+
|
14
|
+
let(:filters) { self.class.filters_config }
|
15
|
+
let(:apply_filters?) do
|
16
|
+
params.fetch(:q, {}).to_unsafe_h.any? { |_,v| !v.blank? }
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:filters_enabled?) { self.class.filters_enabled }
|
20
|
+
let(:ransack_object) { instance_exec(&self.class._beginning_of_scope_chain).ransack(params[:q]) }
|
21
|
+
let(:collection) { paginate(ransack_object.result) }
|
22
|
+
end
|
23
|
+
|
24
|
+
class_methods do
|
25
|
+
def filter(name, options={})
|
26
|
+
self.filters_enabled = true
|
27
|
+
|
28
|
+
filters_config << Filters::Configuration.new(new.resource_class, name, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def filters_config
|
32
|
+
@filters_config ||= []
|
33
|
+
end
|
34
|
+
|
35
|
+
def beginning_of_scope_chain(&block)
|
36
|
+
self._beginning_of_scope_chain = block
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module LotusAdmin::ResourcefulController
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
class_attribute :_resource_class, instance_accessor: false
|
6
|
+
|
7
|
+
let(:menu_identifier) { "#{ resource_class.model_name.route_key }_index" }
|
8
|
+
let(:resource_class) { self.class._resource_class }
|
9
|
+
let(:collection_path) { url_for(resource_class) }
|
10
|
+
end
|
11
|
+
|
12
|
+
class_methods do
|
13
|
+
def manages(model_class)
|
14
|
+
self._resource_class = model_class
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -4,12 +4,15 @@ module LotusAdmin
|
|
4
4
|
|
5
5
|
include Exposure
|
6
6
|
|
7
|
+
helper FontAwesome::Rails::IconHelper
|
8
|
+
|
7
9
|
helper LotusAdmin::ApplicationHelper
|
8
10
|
helper LotusAdmin::FormHelpers
|
9
11
|
helper LotusAdmin::LinkHelpers
|
10
12
|
helper LotusAdmin::PaginationHelpers
|
11
13
|
helper LotusAdmin::PanelHelpers
|
12
14
|
helper LotusAdmin::SidebarHelpers
|
15
|
+
helper LotusAdmin::RenderHelpers
|
13
16
|
|
14
17
|
private
|
15
18
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class LotusAdmin::AuthenticatedController < LotusAdmin::ApplicationController
|
2
2
|
include LotusAdmin::PermittedParams
|
3
|
+
include LotusAdmin::FilterableController
|
4
|
+
include LotusAdmin::ResourcefulController
|
3
5
|
|
4
6
|
before_action :authenticate_administrator!
|
5
7
|
around_action :use_user_time_zone, if: :administrator_signed_in?
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module LotusAdmin
|
2
|
+
module FilterHelpers
|
3
|
+
def render_filter_modal
|
4
|
+
return unless filters_enabled?
|
5
|
+
|
6
|
+
render 'lotus_admin/shared/filters/modal'
|
7
|
+
end
|
8
|
+
|
9
|
+
def render_filters_results_banner
|
10
|
+
return unless apply_filters?
|
11
|
+
|
12
|
+
render 'lotus_admin/shared/filters/results_banner'
|
13
|
+
end
|
14
|
+
|
15
|
+
def filter_search_btn
|
16
|
+
return unless filters_enabled?
|
17
|
+
|
18
|
+
link_to '#', class: LotusAdmin.configuration.filter_search_btn_css_classes, data: { toggle: :modal, target: '#filter-modal' } do
|
19
|
+
fa_icon(:search)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -13,13 +13,17 @@ module LotusAdmin
|
|
13
13
|
label = "Create #{ resource.class.model_name.human }"
|
14
14
|
label = "Save Changes" if resource.persisted?
|
15
15
|
|
16
|
-
|
17
|
-
label.html_safe + content_tag(:i, nil, class: 'zmdi zmdi-arrow-forward')
|
18
|
-
end
|
16
|
+
material_form_button(label)
|
19
17
|
end
|
20
18
|
|
21
19
|
def material_form_cancel(path)
|
22
20
|
link_to 'Cancel', path, class: 'btn btn-link'
|
23
21
|
end
|
22
|
+
|
23
|
+
def material_form_button(label)
|
24
|
+
button_tag class: 'btn btn-success' do
|
25
|
+
label.html_safe + content_tag(:i, nil, class: 'zmdi zmdi-arrow-forward')
|
26
|
+
end
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class DatePickerInput < 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 date")
|
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: 'date',
|
25
|
+
value: @builder.object.public_send(attribute_name)&.strftime('%Y-%m-%d')
|
26
|
+
})
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
module LotusAdmin
|
2
|
+
class Filters::Configuration
|
3
|
+
attr_reader :method, :resource_class
|
4
|
+
|
5
|
+
NUMBER_PREDICATE_FILTER_OPTIONS = [['Greater Than', 'gteq'], ['Equals', 'eq'], ['Less Than', 'lteq']].freeze
|
6
|
+
STRING_PREDICATE_FILTER_OPTIONS = [['Contains', 'cont'], ['Equals', 'eq'], ['Starts With', 'start'], ['Ends With', 'end']].freeze
|
7
|
+
DATE_PREDICATE_FILTER_OPTIONS = [['After', 'gteq'], ['Exactly', 'eq'], ['Before', 'lteq']].freeze
|
8
|
+
|
9
|
+
# By default, a filter type will be selected based upon the attribute type
|
10
|
+
#
|
11
|
+
# For example, a date will get a datepicker, a datetime gets a datetime picker
|
12
|
+
# A string gets a text search, and a numerical field gets a number search
|
13
|
+
#
|
14
|
+
# To provide a select dropdown, such as filtering on an association, simply
|
15
|
+
# provide a collection attribute (as a Proc to be evaluated in the view context)
|
16
|
+
#
|
17
|
+
# Examples:
|
18
|
+
#
|
19
|
+
# filter :id (numeric)
|
20
|
+
# filter :device_id (numeric)
|
21
|
+
# filter :device_id, collection: ->{ [[1, 'device']] } (select)
|
22
|
+
# filter :created_at (datetime)
|
23
|
+
# filter :created_at, as: :date (date)
|
24
|
+
# filter :name (string)
|
25
|
+
|
26
|
+
def initialize(resource_class, method, options={})
|
27
|
+
@resource_class = resource_class
|
28
|
+
@method = method
|
29
|
+
@options = options
|
30
|
+
end
|
31
|
+
|
32
|
+
def label
|
33
|
+
@label ||= translate_label
|
34
|
+
end
|
35
|
+
|
36
|
+
def render(f)
|
37
|
+
case as
|
38
|
+
when :number
|
39
|
+
render_number_input_group(f)
|
40
|
+
when :select, :grouped_select
|
41
|
+
render_collection(f)
|
42
|
+
when :datetime
|
43
|
+
render_date_or_time_input_group(f, true)
|
44
|
+
when :date
|
45
|
+
render_date_or_time_input_group(f, false)
|
46
|
+
when :boolean
|
47
|
+
render_boolean_input_group(f)
|
48
|
+
when :string
|
49
|
+
render_string_input_group(f)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def input_options(view_ctx = nil)
|
54
|
+
input_options = {
|
55
|
+
collection: collection(view_ctx),
|
56
|
+
input_html: input_html_options,
|
57
|
+
as: as,
|
58
|
+
label: label
|
59
|
+
}
|
60
|
+
|
61
|
+
input_options.delete(:collection) if input_options[:collection].nil?
|
62
|
+
input_options.merge!(@options.fetch(:input_options, {}))
|
63
|
+
|
64
|
+
input_options
|
65
|
+
end
|
66
|
+
|
67
|
+
def datepicker?
|
68
|
+
@options.fetch(:datepicker, false)
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def predicate_select(f)
|
74
|
+
input_name = "#{ method }_predicate"
|
75
|
+
selected_value = f.template.params.fetch(input_name, nil)
|
76
|
+
|
77
|
+
filter_options = case as
|
78
|
+
when :number then NUMBER_PREDICATE_FILTER_OPTIONS
|
79
|
+
when :string then STRING_PREDICATE_FILTER_OPTIONS
|
80
|
+
when :date, :datetime then DATE_PREDICATE_FILTER_OPTIONS
|
81
|
+
end
|
82
|
+
|
83
|
+
f.template.select_tag("#{ method }_predicate", f.template.options_for_select(filter_options, selected: selected_value), class: 'form-control select filter-predicate-select')
|
84
|
+
end
|
85
|
+
|
86
|
+
def input_html_options
|
87
|
+
options = @options.fetch(:input_html, {})
|
88
|
+
options.merge!(class: 'datepicker', data: { field: :date }) if datepicker?
|
89
|
+
|
90
|
+
options
|
91
|
+
end
|
92
|
+
|
93
|
+
def as
|
94
|
+
# Allow for specifying a :grouped_select for instance
|
95
|
+
unless @options[:collection].blank?
|
96
|
+
return @options.fetch(:as, :select)
|
97
|
+
end
|
98
|
+
|
99
|
+
default_type = case attribute_type
|
100
|
+
when :integer, :decimal then :number
|
101
|
+
when :datetime then :datetime
|
102
|
+
when :date then :date
|
103
|
+
when :boolean then :boolean
|
104
|
+
else
|
105
|
+
:string
|
106
|
+
end
|
107
|
+
|
108
|
+
@options.fetch(:as, default_type)
|
109
|
+
end
|
110
|
+
|
111
|
+
def translate_label
|
112
|
+
I18n.t(method_name.parameterize(separator: '_'), scope: "lotus_admin.filters.config.#{ resource_class.model_name.i18n_key }", default: method_name.titleize)
|
113
|
+
end
|
114
|
+
|
115
|
+
def collection(view_ctx)
|
116
|
+
return if @options[:collection].nil?
|
117
|
+
|
118
|
+
@options[:as] ||= :select
|
119
|
+
|
120
|
+
if view_ctx.nil?
|
121
|
+
@options[:collection].call
|
122
|
+
else
|
123
|
+
view_ctx.instance_exec(&@options[:collection])
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def method_name
|
128
|
+
method.to_s
|
129
|
+
end
|
130
|
+
|
131
|
+
def attribute_type
|
132
|
+
@attribute_type ||= resource_class.type_for_attribute(method_name).type
|
133
|
+
end
|
134
|
+
|
135
|
+
def render_number_input_group(f)
|
136
|
+
render_form_group_with_predicate_and_input(f) do |value|
|
137
|
+
f.template.text_field_tag(input_name, value, class: 'form-control string')
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def render_string_input_group(f)
|
142
|
+
render_form_group_with_predicate_and_input(f) do |value|
|
143
|
+
f.template.text_field_tag(input_name, value, class: 'form-control string')
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def render_collection(f)
|
148
|
+
f.input(method, input_options(f.template))
|
149
|
+
end
|
150
|
+
|
151
|
+
def render_date_or_time_input_group(f, include_time = false)
|
152
|
+
data_field_name = :date
|
153
|
+
data_field_name = :datetime if include_time
|
154
|
+
|
155
|
+
render_form_group_with_predicate_and_input(f) do |value|
|
156
|
+
f.template.content_tag(:div, class: "input-group #{ data_field_name }") do
|
157
|
+
f.template.text_field_tag(input_name, value, class: 'form-control string') +
|
158
|
+
f.template.content_tag(:span, class: 'input-group-addon') do
|
159
|
+
f.template.fa_icon(:calendar)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def render_boolean_input_group(f)
|
166
|
+
f.input("#{ method_name }_eq", as: :select, label: translate_label)
|
167
|
+
end
|
168
|
+
|
169
|
+
def render_form_group_with_predicate_and_input(f, &block)
|
170
|
+
f.template.content_tag(:div, class: 'form-group', data: { attribute_name: method_name }) do
|
171
|
+
f.template.label_tag(method, label, for: input_id) +
|
172
|
+
f.template.content_tag(:div, class: 'row') do
|
173
|
+
f.template.content_tag(:div, class: 'col-sm-4') do
|
174
|
+
predicate_select(f)
|
175
|
+
end +
|
176
|
+
f.template.content_tag(:div, class: 'col-sm-8') do
|
177
|
+
value = find_predicate_input_value(f)
|
178
|
+
|
179
|
+
block.call(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def find_predicate_input_value(f)
|
186
|
+
_, value = f.template.params.fetch(:q, {}).to_unsafe_h.find do |k,_|
|
187
|
+
k.starts_with?(method_name)
|
188
|
+
end
|
189
|
+
|
190
|
+
value
|
191
|
+
end
|
192
|
+
|
193
|
+
def input_name
|
194
|
+
"q[#{ method_name }]"
|
195
|
+
end
|
196
|
+
|
197
|
+
def input_id
|
198
|
+
['q', method_name].join('_')
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
= render_filter_modal
|
2
|
+
|
3
|
+
.block-header
|
4
|
+
%h2= page_title!(title)
|
5
|
+
|
6
|
+
%ul.actions
|
7
|
+
- if filters_enabled?
|
8
|
+
%li= filter_search_btn
|
9
|
+
= yield(:action_items)
|
10
|
+
|
11
|
+
.card
|
12
|
+
.card-body
|
13
|
+
= capture_haml(&renderer)
|
14
|
+
|
15
|
+
= render_filters_results_banner
|
16
|
+
= pagination(collection)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#filter-modal.modal.fade
|
2
|
+
.modal-dialog
|
3
|
+
.modal-content
|
4
|
+
= search_form_for ransack_object, url: collection_path, class: 'filter-form' do |f|
|
5
|
+
.modal-header
|
6
|
+
%button.close{type: 'button', "data-dismiss" => :modal}
|
7
|
+
%span ×
|
8
|
+
|
9
|
+
%h4.modal-title= t('lotus_admin.filters.modal.title')
|
10
|
+
|
11
|
+
.modal-body
|
12
|
+
- filters.each do |filter|
|
13
|
+
= filter.render(f)
|
14
|
+
|
15
|
+
.modal-footer
|
16
|
+
= link_to t('lotus_admin.filters.modal.reset_btn'), collection_path, class: 'btn btn-link pull-left'
|
17
|
+
= material_form_button t('lotus_admin.filters.modal.submit_btn')
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module LotusAdmin
|
2
2
|
class Configuration
|
3
|
+
attr_accessor :filter_search_btn_css_classes
|
4
|
+
|
3
5
|
def routes(&block)
|
4
6
|
routing_options.push(block)
|
5
7
|
end
|
@@ -7,5 +9,9 @@ module LotusAdmin
|
|
7
9
|
def routing_options
|
8
10
|
@routing_options ||= []
|
9
11
|
end
|
12
|
+
|
13
|
+
def filter_search_btn_css_classes
|
14
|
+
@filter_search_btn_css_classes ||= %w(btn btn-default filter-toggle-btn btn-js)
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
data/lib/lotus_admin/version.rb
CHANGED
data/lib/lotus_admin.rb
CHANGED
@@ -5,12 +5,16 @@ require 'simple_form'
|
|
5
5
|
|
6
6
|
require 'haml'
|
7
7
|
require 'sass-rails'
|
8
|
+
require 'coffee-rails'
|
8
9
|
require 'uglifier'
|
9
10
|
require 'font-awesome-rails'
|
10
11
|
require 'bootstrap-sass'
|
12
|
+
require 'momentjs-rails'
|
13
|
+
require 'bootstrap3-datetimepicker-rails'
|
11
14
|
require 'jquery-rails'
|
12
15
|
require 'page_title_helper'
|
13
16
|
require 'kaminari'
|
17
|
+
require 'ransack'
|
14
18
|
|
15
19
|
require 'lotus_admin/configuration'
|
16
20
|
|
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: 0.
|
4
|
+
version: 0.3.0
|
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: 2018-03-
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.3.6
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: coffee-rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.2'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.2'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: font-awesome-rails
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,34 @@ dependencies:
|
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '4.7'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: momentjs-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.17.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.17.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: bootstrap3-datetimepicker-rails
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '4.17'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '4.17'
|
139
181
|
- !ruby/object:Gem::Dependency
|
140
182
|
name: page_title_helper
|
141
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +206,20 @@ dependencies:
|
|
164
206
|
- - "~>"
|
165
207
|
- !ruby/object:Gem::Version
|
166
208
|
version: '1.0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: ransack
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '1.8'
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '1.8'
|
167
223
|
- !ruby/object:Gem::Dependency
|
168
224
|
name: pg
|
169
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +304,20 @@ dependencies:
|
|
248
304
|
- - "~>"
|
249
305
|
- !ruby/object:Gem::Version
|
250
306
|
version: '1.6'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: capybara
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - "~>"
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '2.6'
|
314
|
+
type: :development
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - "~>"
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '2.6'
|
251
321
|
description: Bootstrap 3 Material Design Simple Admin Interface.
|
252
322
|
email:
|
253
323
|
- matt@madebylotus.com
|
@@ -261,16 +331,22 @@ files:
|
|
261
331
|
- app/assets/config/lotus_admin_manifest.js
|
262
332
|
- app/assets/images/lotus_admin/profile-menu.png
|
263
333
|
- app/assets/javascripts/lotus_admin/application.js
|
334
|
+
- app/assets/javascripts/lotus_admin/datepickers.js.coffee
|
335
|
+
- app/assets/javascripts/lotus_admin/filters.js.coffee
|
264
336
|
- app/assets/stylesheets/lotus_admin/_variables.scss
|
265
337
|
- app/assets/stylesheets/lotus_admin/application.css.scss
|
266
338
|
- app/assets/stylesheets/lotus_admin/components/_alerts.scss
|
267
339
|
- app/assets/stylesheets/lotus_admin/components/_all.scss
|
340
|
+
- app/assets/stylesheets/lotus_admin/components/_datepicker.scss
|
268
341
|
- app/assets/stylesheets/lotus_admin/components/_devise.scss
|
342
|
+
- app/assets/stylesheets/lotus_admin/components/_filters.scss
|
269
343
|
- app/assets/stylesheets/lotus_admin/components/_forms.scss
|
270
344
|
- app/assets/stylesheets/lotus_admin/components/_tables.scss
|
271
345
|
- app/controllers/concerns/lotus_admin/devise_controllers.rb
|
272
346
|
- app/controllers/concerns/lotus_admin/exposure.rb
|
347
|
+
- app/controllers/concerns/lotus_admin/filterable_controller.rb
|
273
348
|
- app/controllers/concerns/lotus_admin/permitted_params.rb
|
349
|
+
- app/controllers/concerns/lotus_admin/resourceful_controller.rb
|
274
350
|
- app/controllers/lotus_admin/application_controller.rb
|
275
351
|
- app/controllers/lotus_admin/authenticated_controller.rb
|
276
352
|
- app/controllers/lotus_admin/confirmations_controller.rb
|
@@ -280,15 +356,19 @@ files:
|
|
280
356
|
- app/controllers/lotus_admin/sessions_controller.rb
|
281
357
|
- app/controllers/lotus_admin/users_controller.rb
|
282
358
|
- app/helpers/lotus_admin/application_helper.rb
|
359
|
+
- app/helpers/lotus_admin/filter_helpers.rb
|
283
360
|
- app/helpers/lotus_admin/form_helpers.rb
|
284
361
|
- app/helpers/lotus_admin/link_helpers.rb
|
285
362
|
- app/helpers/lotus_admin/pagination_helpers.rb
|
286
363
|
- app/helpers/lotus_admin/panel_helpers.rb
|
364
|
+
- app/helpers/lotus_admin/render_helpers.rb
|
287
365
|
- app/helpers/lotus_admin/sidebar_helpers.rb
|
366
|
+
- app/inputs/date_picker_input.rb
|
288
367
|
- app/jobs/lotus_admin/application_job.rb
|
289
368
|
- app/mailers/lotus_admin/application_mailer.rb
|
290
369
|
- app/mailers/lotus_admin/user_mailer.rb
|
291
370
|
- app/models/lotus_admin/application_record.rb
|
371
|
+
- app/models/lotus_admin/filters/configuration.rb
|
292
372
|
- app/models/lotus_admin/user.rb
|
293
373
|
- app/views/administrators/_links.html.haml
|
294
374
|
- app/views/administrators/confirmations/new.html.haml
|
@@ -320,6 +400,9 @@ files:
|
|
320
400
|
- app/views/lotus_admin/dashboard/show.html.haml
|
321
401
|
- app/views/lotus_admin/profiles/edit.html.haml
|
322
402
|
- app/views/lotus_admin/shared/_collection_pagination.html.haml
|
403
|
+
- app/views/lotus_admin/shared/_index.html.haml
|
404
|
+
- app/views/lotus_admin/shared/filters/_modal.html.haml
|
405
|
+
- app/views/lotus_admin/shared/filters/_results_banner.html.haml
|
323
406
|
- app/views/lotus_admin/user_mailer/invited.html.haml
|
324
407
|
- app/views/lotus_admin/user_mailer/invited.text.erb
|
325
408
|
- app/views/lotus_admin/users/_form.html.haml
|
@@ -333,6 +416,7 @@ files:
|
|
333
416
|
- config/initializers/simple_form_material.rb
|
334
417
|
- config/locales/dates.en.yml
|
335
418
|
- config/locales/devise.en.yml
|
419
|
+
- config/locales/filters.en.yml
|
336
420
|
- config/locales/mailers.en.yml
|
337
421
|
- config/locales/page_titles.en.yml
|
338
422
|
- config/locales/simple_form.en.yml
|