lato_view 1.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -12
- data/app/assets/javascripts/lato_view/build/FormManager.js +8 -2
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/actionbar/cell.rb +1 -1
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/actionbar/views/show.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/block/cell.rb +1 -1
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/buttongroup/cell.rb +1 -5
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/buttongroup/views/show.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/dropdown/cell.rb +2 -2
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/dropdown/views/show.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/index/cell.rb +2 -2
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/index/views/head.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/index/views/rows.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/cell.rb +5 -4
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/checkbox.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/date.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/editor.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/email.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/file.html.erb +0 -6
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/multiple-select.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/number.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/password.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/radio.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/select.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/text.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/textarea.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/input/views/time.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/searchbar/cell.rb +1 -6
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/searchbar/views/show.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/table/cell.rb +2 -2
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/table/views/head.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/table/views/row.html.erb +0 -0
- data/app/{concepts/lato_view → cells/lato_view/cells_v1}/table/views/rows.html.erb +0 -0
- data/app/cells/lato_view/component/button/cell.rb +30 -0
- data/app/cells/lato_view/component/button/views/show.html.erb +1 -0
- data/app/cells/lato_view/component/buttongroup/cell.rb +31 -0
- data/app/cells/lato_view/component/buttongroup/views/show.html.erb +13 -0
- data/app/cells/lato_view/component/dropdown/cell.rb +26 -0
- data/app/cells/lato_view/component/dropdown/views/show.html.erb +43 -0
- data/app/cells/lato_view/component/form/cell.rb +35 -0
- data/app/cells/lato_view/component/form/views/open.html.erb +3 -0
- data/app/cells/lato_view/component/form/views/show.html.erb +1 -0
- data/app/cells/lato_view/component/searchbar/cell.rb +36 -0
- data/app/cells/lato_view/component/searchbar/views/show.html.erb +9 -0
- data/app/cells/lato_view/input/checkbox/cell.rb +48 -0
- data/app/cells/lato_view/input/checkbox/views/show.html.erb +17 -0
- data/app/cells/lato_view/input/date/cell.rb +45 -0
- data/app/cells/lato_view/input/date/views/show.html.erb +11 -0
- data/app/cells/lato_view/input/editor/cell.rb +45 -0
- data/app/cells/lato_view/input/editor/views/show.html.erb +12 -0
- data/app/cells/lato_view/input/email/cell.rb +45 -0
- data/app/cells/lato_view/input/email/views/show.html.erb +11 -0
- data/app/cells/lato_view/input/file/cell.rb +51 -0
- data/app/cells/lato_view/input/file/views/show.html.erb +18 -0
- data/app/cells/lato_view/input/number/cell.rb +45 -0
- data/app/cells/lato_view/input/number/views/show.html.erb +11 -0
- data/app/cells/lato_view/input/password/cell.rb +46 -0
- data/app/cells/lato_view/input/password/views/show.html.erb +15 -0
- data/app/cells/lato_view/input/radio/cell.rb +63 -0
- data/app/cells/lato_view/input/radio/views/show.html.erb +20 -0
- data/app/cells/lato_view/input/select/cell.rb +87 -0
- data/app/cells/lato_view/input/select/views/show.html.erb +21 -0
- data/app/cells/lato_view/input/text/cell.rb +45 -0
- data/app/cells/lato_view/input/text/views/show.html.erb +11 -0
- data/app/cells/lato_view/input/textarea/cell.rb +45 -0
- data/app/cells/lato_view/input/textarea/views/show.html.erb +12 -0
- data/app/cells/lato_view/input/time/cell.rb +45 -0
- data/app/cells/lato_view/input/time/views/show.html.erb +11 -0
- data/app/cells/lato_view/layout/actionbar/cell.rb +29 -0
- data/app/cells/lato_view/layout/actionbar/views/show.html.erb +13 -0
- data/app/cells/lato_view/layout/block/cell.rb +37 -0
- data/app/cells/lato_view/layout/index/cell.rb +73 -0
- data/app/cells/lato_view/layout/index/views/head.html.erb +12 -0
- data/app/cells/lato_view/layout/index/views/rows.html.erb +49 -0
- data/app/controllers/lato_view/assets_controller.rb +3 -6
- data/app/controllers/lato_view/develop_controller.rb +5 -5
- data/app/helpers/lato_view/application_helper.rb +19 -10
- data/config/example.yml +2 -2
- data/config/initializers/init.rb +1 -1
- data/config/initializers/lists.rb +2 -18
- data/config/initializers/ram.rb +1 -13
- data/config/routes.rb +1 -0
- data/lib/lato_view.rb +5 -7
- data/lib/lato_view/cells.rb +16 -0
- data/lib/lato_view/engine.rb +6 -5
- data/lib/lato_view/interface.rb +4 -5
- data/lib/lato_view/interface/assets.rb +67 -76
- data/lib/lato_view/interface/images.rb +52 -58
- data/lib/lato_view/interface/navigation.rb +6 -11
- data/lib/lato_view/interface/themes.rb +22 -28
- data/lib/tasks/{lato_starter_tasks.rake → lato_view_tasks.rake} +1 -4
- metadata +76 -115
- data/lib/lato_view/concepts.rb +0 -19
- data/test/controllers/lato_view/api/v1/api_controller_test.rb +0 -9
- data/test/controllers/lato_view/application_controller_test.rb +0 -9
- data/test/controllers/lato_view/back/back_controller_test.rb +0 -9
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -29
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -25
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -3
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +0 -8
- data/test/lato_view_test.rb +0 -7
- data/test/test_helper.rb +0 -21
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
|
3
|
+
<label class="form-label"><%= @label %></label>
|
4
|
+
|
5
|
+
<input type="password" class="input input-password <%= @custom_class %>"
|
6
|
+
name="<%= @name %>" placeholder="<%= @placeholder %>" value="<%= @value %>"
|
7
|
+
<%= disabled_data_input %>>
|
8
|
+
|
9
|
+
<% if @visible %>
|
10
|
+
<div class="password-reveal"></div>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<div class="input-error-message"></div>
|
14
|
+
|
15
|
+
</div>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Input::Radio::Cell < Cell
|
3
|
+
|
4
|
+
@@widths = VIEW_INPUTWIDTH
|
5
|
+
|
6
|
+
# NB: options must be an array of hash {name: 'name', value: 'value'}
|
7
|
+
attr_accessor :name, :placeholder, :value, :label, :width, :required,
|
8
|
+
:disabled, :custom_class, :options
|
9
|
+
|
10
|
+
def initialize(name: 'input', placeholder: '', value: '', label: '',
|
11
|
+
width: 'large', required: false, disabled: false,
|
12
|
+
custom_class: '', options: [])
|
13
|
+
# save params
|
14
|
+
@name = name
|
15
|
+
@placeholder = placeholder
|
16
|
+
@value = value
|
17
|
+
@label = label
|
18
|
+
@width = width
|
19
|
+
@required = required
|
20
|
+
@disabled = disabled
|
21
|
+
@custom_class = custom_class
|
22
|
+
@options = options
|
23
|
+
# check params
|
24
|
+
check_params
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
render "show.html"
|
29
|
+
end
|
30
|
+
|
31
|
+
# return required string to input
|
32
|
+
protected def required_data_input
|
33
|
+
return "data-input='required'" if @required
|
34
|
+
end
|
35
|
+
|
36
|
+
# return disabled string to input
|
37
|
+
protected def disabled_data_input
|
38
|
+
return "disabled='disabled'" if @disabled
|
39
|
+
end
|
40
|
+
|
41
|
+
# return true or false to show if option is selected
|
42
|
+
protected def selected_value(option)
|
43
|
+
return "checked" if option[:value] === @value
|
44
|
+
end
|
45
|
+
|
46
|
+
# check params
|
47
|
+
private def check_params
|
48
|
+
raise 'Input Cells: width has not a correct value' unless @@widths.include? width
|
49
|
+
raise 'Input Cells: options must be an array of hash' if options && !options.is_a?(Array)
|
50
|
+
end
|
51
|
+
|
52
|
+
# take in input an activerecords list, a value string and a name string, return
|
53
|
+
# an array that can be used with select
|
54
|
+
def self.generate_options_from_activerecords(activerecords, value, name)
|
55
|
+
rows = []
|
56
|
+
activerecords.each do |row|
|
57
|
+
rows.push([row.send(value), row.send(name)])
|
58
|
+
end
|
59
|
+
rows
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
|
3
|
+
<label class="form-label"><%= @label %></label>
|
4
|
+
|
5
|
+
<% @options.each_with_index do |option, index| %>
|
6
|
+
<div class="form-block">
|
7
|
+
<input type="radio" class="radio <%= @custom_class %>" name="<%= @name %>"
|
8
|
+
value="<%= option[:value] %>" id="<%= @name %>-<%= index %>"
|
9
|
+
<%= selected_value(option) %> <%= disabled_data_input %>>
|
10
|
+
|
11
|
+
<label class="label-control" for="<%= @name %>-<%= index %>">
|
12
|
+
<%= option[:name] %>
|
13
|
+
</label>
|
14
|
+
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<div class="input-error-message"></div>
|
19
|
+
|
20
|
+
</div>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Input::Select::Cell < Cell
|
3
|
+
|
4
|
+
@@widths = VIEW_INPUTWIDTH
|
5
|
+
|
6
|
+
# NB: options must be an array of hash {name: 'name', value: 'value'}
|
7
|
+
attr_accessor :name, :placeholder, :value, :label, :width, :required,
|
8
|
+
:disabled, :custom_class, :options, :option_blank, :multiple
|
9
|
+
|
10
|
+
def initialize(name: 'input', placeholder: '', value: '', label: '',
|
11
|
+
width: 'large', required: false, disabled: false,
|
12
|
+
custom_class: '', options: [], option_blank: true,
|
13
|
+
multiple: false)
|
14
|
+
# save params
|
15
|
+
@name = name
|
16
|
+
@placeholder = placeholder
|
17
|
+
@value = value
|
18
|
+
@label = label
|
19
|
+
@width = width
|
20
|
+
@required = required
|
21
|
+
@disabled = disabled
|
22
|
+
@custom_class = custom_class
|
23
|
+
@options = options
|
24
|
+
@option_blank = option_blank
|
25
|
+
@multiple = multiple
|
26
|
+
# check params
|
27
|
+
check_params
|
28
|
+
end
|
29
|
+
|
30
|
+
def show
|
31
|
+
render "show.html"
|
32
|
+
end
|
33
|
+
|
34
|
+
# return required string to input
|
35
|
+
protected def required_data_input
|
36
|
+
return "data-input='required'" if @required
|
37
|
+
end
|
38
|
+
|
39
|
+
# return disabled string to input
|
40
|
+
protected def disabled_data_input
|
41
|
+
return "disabled='disabled'" if @disabled
|
42
|
+
end
|
43
|
+
|
44
|
+
# return multiple string to input
|
45
|
+
protected def multiple_data_input
|
46
|
+
return "multiple='multiple'" if @multiple
|
47
|
+
end
|
48
|
+
|
49
|
+
# return true or false to show if option is selected
|
50
|
+
protected def selected_value(option)
|
51
|
+
if @multiple
|
52
|
+
@value.each do |value|
|
53
|
+
return "selected='selected'" if option[:value] === value
|
54
|
+
end
|
55
|
+
else
|
56
|
+
return "selected='selected'" if option[:value] === @value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# check params
|
61
|
+
private def check_params
|
62
|
+
raise 'Input Cells: width has not a correct value' unless @@widths.include? width
|
63
|
+
raise 'Input Cells: options must be an array of hash' if options && !options.is_a?(Array)
|
64
|
+
end
|
65
|
+
|
66
|
+
# take in input an activerecords list, a value string and a name string, return
|
67
|
+
# an array that can be used with select
|
68
|
+
def self.generate_options_from_activerecords(activerecords, value, name)
|
69
|
+
rows = []
|
70
|
+
activerecords.each do |row|
|
71
|
+
rows.push({name: row.send(name), value: row.send(value)})
|
72
|
+
end
|
73
|
+
return rows
|
74
|
+
end
|
75
|
+
|
76
|
+
# take in input an array list, return
|
77
|
+
# an array that can be used with select
|
78
|
+
def self.generate_options_from_array(array)
|
79
|
+
rows = []
|
80
|
+
array.each do |row|
|
81
|
+
rows.push({name: row, value: row})
|
82
|
+
end
|
83
|
+
return rows
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
|
3
|
+
<label class="form-label"><%= @label %></label>
|
4
|
+
|
5
|
+
<select class="select <%= @custom_class %>" name="<%= @name %>" placeholder="<%= @placeholder %>"
|
6
|
+
<%= multiple_data_input %>>
|
7
|
+
|
8
|
+
<% if(@option_blank) %>
|
9
|
+
<option></option>
|
10
|
+
<% end %>
|
11
|
+
<% @options.each do |option| %>
|
12
|
+
<option value="<%= option[:value] %>" <%= selected_value(option) %>>
|
13
|
+
<%= option[:name]%>
|
14
|
+
</option>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
</select>
|
18
|
+
|
19
|
+
<div class="input-error-message"></div>
|
20
|
+
|
21
|
+
</div>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Input::Text::Cell < Cell
|
3
|
+
|
4
|
+
@@widths = VIEW_INPUTWIDTH
|
5
|
+
|
6
|
+
attr_accessor :name, :placeholder, :value, :label, :width, :required,
|
7
|
+
:disabled, :custom_class
|
8
|
+
|
9
|
+
def initialize(name: 'input', placeholder: '', value: '', label: '',
|
10
|
+
width: 'large', required: false, disabled: false,
|
11
|
+
custom_class: '')
|
12
|
+
# save params
|
13
|
+
@name = name
|
14
|
+
@placeholder = placeholder
|
15
|
+
@value = value
|
16
|
+
@label = label
|
17
|
+
@width = width
|
18
|
+
@required = required
|
19
|
+
@disabled = disabled
|
20
|
+
@custom_class = custom_class
|
21
|
+
# check params
|
22
|
+
check_params
|
23
|
+
end
|
24
|
+
|
25
|
+
def show
|
26
|
+
render "show.html"
|
27
|
+
end
|
28
|
+
|
29
|
+
# return required string to input
|
30
|
+
protected def required_data_input
|
31
|
+
return "data-input='required'" if @required
|
32
|
+
end
|
33
|
+
|
34
|
+
# return disabled string to input
|
35
|
+
protected def disabled_data_input
|
36
|
+
return "disabled='disabled'" if @disabled
|
37
|
+
end
|
38
|
+
|
39
|
+
# check params
|
40
|
+
private def check_params
|
41
|
+
raise 'Input Cells: width has not a correct value' unless @@widths.include? width
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
|
3
|
+
<label class="form-label"><%= @label %></label>
|
4
|
+
|
5
|
+
<input type="text" class="input <%= @custom_class %>"
|
6
|
+
name="<%= @name %>" placeholder="<%= @placeholder %>"
|
7
|
+
value="<%=h @value %>" <%= disabled_data_input %>>
|
8
|
+
|
9
|
+
<div class="input-error-message"></div>
|
10
|
+
|
11
|
+
</div>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Input::Textarea::Cell < Cell
|
3
|
+
|
4
|
+
@@widths = VIEW_INPUTWIDTH
|
5
|
+
|
6
|
+
attr_accessor :name, :placeholder, :value, :label, :width, :required,
|
7
|
+
:disabled, :custom_class
|
8
|
+
|
9
|
+
def initialize(name: 'input', placeholder: '', value: '', label: '',
|
10
|
+
width: 'large', required: false, disabled: false,
|
11
|
+
custom_class: '')
|
12
|
+
# save params
|
13
|
+
@name = name
|
14
|
+
@placeholder = placeholder
|
15
|
+
@value = value
|
16
|
+
@label = label
|
17
|
+
@width = width
|
18
|
+
@required = required
|
19
|
+
@disabled = disabled
|
20
|
+
@custom_class = custom_class
|
21
|
+
# check params
|
22
|
+
check_params
|
23
|
+
end
|
24
|
+
|
25
|
+
def show
|
26
|
+
render "show.html"
|
27
|
+
end
|
28
|
+
|
29
|
+
# return required string to input
|
30
|
+
protected def required_data_input
|
31
|
+
return "data-input='required'" if @required
|
32
|
+
end
|
33
|
+
|
34
|
+
# return disabled string to input
|
35
|
+
protected def disabled_data_input
|
36
|
+
return "disabled='disabled'" if @disabled
|
37
|
+
end
|
38
|
+
|
39
|
+
# check params
|
40
|
+
private def check_params
|
41
|
+
raise 'Input Cells: width has not a correct value' unless @@widths.include? width
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
|
3
|
+
<label class="form-label"><%= @label %></label>
|
4
|
+
|
5
|
+
<textarea class="textarea <%= @custom_class %>" name="<%= @name %>"
|
6
|
+
placeholder="<%= @placeholder %>" <%= disabled_data_input %>>
|
7
|
+
<%= @value %>
|
8
|
+
</textarea>
|
9
|
+
|
10
|
+
<div class="input-error-message"></div>
|
11
|
+
|
12
|
+
</div>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Input::Time::Cell < Cell
|
3
|
+
|
4
|
+
@@widths = VIEW_INPUTWIDTH
|
5
|
+
|
6
|
+
attr_accessor :name, :placeholder, :value, :label, :width, :required,
|
7
|
+
:disabled, :custom_class
|
8
|
+
|
9
|
+
def initialize(name: 'input', placeholder: '', value: '', label: '',
|
10
|
+
width: 'large', required: false, disabled: false,
|
11
|
+
custom_class: '')
|
12
|
+
# save params
|
13
|
+
@name = name
|
14
|
+
@placeholder = placeholder
|
15
|
+
@value = value
|
16
|
+
@label = label
|
17
|
+
@width = width
|
18
|
+
@required = required
|
19
|
+
@disabled = disabled
|
20
|
+
@custom_class = custom_class
|
21
|
+
# check params
|
22
|
+
check_params
|
23
|
+
end
|
24
|
+
|
25
|
+
def show
|
26
|
+
render "show.html"
|
27
|
+
end
|
28
|
+
|
29
|
+
# return required string to input
|
30
|
+
protected def required_data_input
|
31
|
+
return "data-input='required'" if @required
|
32
|
+
end
|
33
|
+
|
34
|
+
# return disabled string to input
|
35
|
+
protected def disabled_data_input
|
36
|
+
return "disabled='disabled'" if @disabled
|
37
|
+
end
|
38
|
+
|
39
|
+
# check params
|
40
|
+
private def check_params
|
41
|
+
raise 'Input Cells: width has not a correct value' unless @@widths.include? width
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
|
3
|
+
<label class="form-label"><%= @label %></label>
|
4
|
+
|
5
|
+
<input type="text" class="input time-picker <%= @custom_class %>"
|
6
|
+
name="<%= @name %>" placeholder="<%= @placeholder %>"
|
7
|
+
value="<%= @value %>" <%= disabled_data_input %>>
|
8
|
+
|
9
|
+
<div class="input-error-message"></div>
|
10
|
+
|
11
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Layout::Actionbar::Cell < Cell
|
3
|
+
|
4
|
+
@@widget_align = %(left right)
|
5
|
+
|
6
|
+
# NB: widgets must be an array of hash {component: 'component', align: 'align'}
|
7
|
+
attr_accessor :title, :widgets
|
8
|
+
|
9
|
+
def initialize(title: '', widgets: [])
|
10
|
+
# save params
|
11
|
+
@title = title
|
12
|
+
@widgets = widgets
|
13
|
+
# check params
|
14
|
+
check_params
|
15
|
+
end
|
16
|
+
|
17
|
+
def show
|
18
|
+
render 'show.html'
|
19
|
+
end
|
20
|
+
|
21
|
+
private def check_params
|
22
|
+
raise 'Actionbar Cell: widgets must be an array' unless @widgets.is_a? Array
|
23
|
+
widgets.each do |widget|
|
24
|
+
raise 'Actionbar Cell: widget align is not a correct value' unless @@widget_align.include? widget[:align].to_s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="action-bar">
|
2
|
+
<div class="action-group-left">
|
3
|
+
<h1 class="admin-section-title"><%= @title %></h1>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<% if @widgets %>
|
7
|
+
<% @widgets.each do |widget| %>
|
8
|
+
<div class="action-group-<%= widget[:align] %>">
|
9
|
+
<%= raw widget[:component] %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Layout::Block::Cell < Cell
|
3
|
+
|
4
|
+
@@widths = VIEW_GRIDCLASS
|
5
|
+
|
6
|
+
attr_accessor :content, :width, :custom_class
|
7
|
+
|
8
|
+
def initialize(width: 'small-12 medium-12 large-12 xlarge-12', content: '',
|
9
|
+
custom_class: '')
|
10
|
+
# save params
|
11
|
+
@width = width
|
12
|
+
@content = content
|
13
|
+
@class = custom_class
|
14
|
+
# check params
|
15
|
+
end
|
16
|
+
|
17
|
+
def show
|
18
|
+
open + @content + close
|
19
|
+
end
|
20
|
+
|
21
|
+
# open new block
|
22
|
+
def open(width: @width, custom_class: @class)
|
23
|
+
"<div class='content-block column #{width} #{custom_class}'>"
|
24
|
+
end
|
25
|
+
|
26
|
+
# close block
|
27
|
+
def close
|
28
|
+
'</div>'
|
29
|
+
end
|
30
|
+
|
31
|
+
# check params
|
32
|
+
private def check_params
|
33
|
+
raise 'Block Cell: width value in not correct' unless (@width.to_s.split(' ') - @@widths).empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|