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,73 @@
|
|
1
|
+
module LatoView
|
2
|
+
class Layout::Index::Cell < Cell
|
3
|
+
|
4
|
+
attr_accessor :elements, :head, :attributes, :link, :show_link, :edit_link,
|
5
|
+
:delete_link, :remote_delete, :custom_class
|
6
|
+
|
7
|
+
def initialize(elements: nil, head: nil, attributes: nil, link: nil,
|
8
|
+
show_link: true, edit_link: true, delete_link: true,
|
9
|
+
remote_delete: false, custom_class: nil)
|
10
|
+
# save params
|
11
|
+
@elements = elements
|
12
|
+
@head = head
|
13
|
+
@attributes = attributes
|
14
|
+
@link = link
|
15
|
+
@show_link = show_link
|
16
|
+
@edit_link = edit_link
|
17
|
+
@delete_link = delete_link
|
18
|
+
@remote_delete = remote_delete
|
19
|
+
@custom_class = custom_class
|
20
|
+
# check params
|
21
|
+
check_params
|
22
|
+
end
|
23
|
+
|
24
|
+
def show
|
25
|
+
open + head + rows + close
|
26
|
+
end
|
27
|
+
|
28
|
+
# open index table
|
29
|
+
def open
|
30
|
+
"<table class='table #{@custom_class}'>"
|
31
|
+
end
|
32
|
+
|
33
|
+
# return ingex head
|
34
|
+
def head
|
35
|
+
render 'head.html'
|
36
|
+
end
|
37
|
+
|
38
|
+
# return index rows
|
39
|
+
def rows
|
40
|
+
render 'rows.html'
|
41
|
+
end
|
42
|
+
|
43
|
+
# return index end
|
44
|
+
def close
|
45
|
+
'</table>'
|
46
|
+
end
|
47
|
+
|
48
|
+
# return show url
|
49
|
+
protected def show_link(id)
|
50
|
+
return "#{@link}#{id}" if @link.end_with? '/'
|
51
|
+
return "#{@link}/#{id}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# return edit url
|
55
|
+
protected def edit_link(id)
|
56
|
+
return "#{@link}#{id}/edit" if @link.end_with? '/'
|
57
|
+
return "#{@link}/#{id}/edit"
|
58
|
+
end
|
59
|
+
|
60
|
+
# return delete url
|
61
|
+
protected def delete_link(id)
|
62
|
+
return show_link(id)
|
63
|
+
end
|
64
|
+
|
65
|
+
# check params
|
66
|
+
private def check_params
|
67
|
+
raise 'Index Cell: head must be an array' unless @head.is_a? Array
|
68
|
+
raise 'Index Cell: attributes must be an array' unless @attributes.is_a? Array
|
69
|
+
raise 'Index Cell: head and attributes have different length' if @head.length != @attributes.length
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% if(@head and !@head.nil?) %>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<% @head.each do |title| %>
|
5
|
+
<th><%=raw title %></th>
|
6
|
+
<% end %>
|
7
|
+
<% if @show_link || @edit_link || @delete_link %>
|
8
|
+
<th class="actions"><%= VIEW_LANG['index']['actions'] %></th>
|
9
|
+
<% end %>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<% end %>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<% if(@elements) %>
|
2
|
+
<tbody>
|
3
|
+
<% @elements.each do |element| %>
|
4
|
+
<tr>
|
5
|
+
<% @attributes.each_with_index do |attribute, index| %>
|
6
|
+
<% value = element.send(attribute) %>
|
7
|
+
|
8
|
+
<% # se e' un booleano %>
|
9
|
+
<% if(!!value == value) %>
|
10
|
+
|
11
|
+
<td data-label="<%= @head[index] %>">
|
12
|
+
<% if value %>
|
13
|
+
<div class="general-status">
|
14
|
+
<div class="status round-status true"></div>
|
15
|
+
</div>
|
16
|
+
<% else %>
|
17
|
+
<div class="general-status">
|
18
|
+
<div class="status round-status false"></div>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
</td>
|
22
|
+
|
23
|
+
<% else %>
|
24
|
+
|
25
|
+
<td data-label="<%= @head[index] %>"><%= value %></td>
|
26
|
+
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% if @show_link || @edit_link || @delete_link %>
|
32
|
+
<td class="actions">
|
33
|
+
<% if(@show_link) %>
|
34
|
+
<%= link_to VIEW_LANG['index']['show'], self.show_link(element.id), class: 'lato-button button-small' %>
|
35
|
+
<% end %>
|
36
|
+
<% if(@edit_link) %>
|
37
|
+
<%= link_to VIEW_LANG['index']['edit'], self.edit_link(element.id), class: 'lato-button button-yellow button-small' %>
|
38
|
+
<% end %>
|
39
|
+
<% if(@delete_link) %>
|
40
|
+
<%= link_to VIEW_LANG['index']['delete'], self.delete_link(element.id), method: :delete, remote: @remote_delete,
|
41
|
+
class: 'lato-button button-red button-small',
|
42
|
+
data: {confirm: VIEW_LANG['input']['confirm_delete']} %>
|
43
|
+
<% end %>
|
44
|
+
</td>
|
45
|
+
<% end %>
|
46
|
+
</tr>
|
47
|
+
<% end %>
|
48
|
+
</tbody>
|
49
|
+
<% end %>
|
@@ -1,14 +1,11 @@
|
|
1
1
|
module LatoView
|
2
|
-
#
|
3
|
-
# lato_view.
|
2
|
+
# This class is used to render elements used as assets for cells.
|
4
3
|
class AssetsController < ActionController::Base
|
5
4
|
|
6
|
-
#
|
7
|
-
# non sono necessari fuori dal pannello di amministrazione)
|
5
|
+
# check user is logged before actions
|
8
6
|
before_action :core_controlUser
|
9
7
|
|
10
|
-
#
|
11
|
-
# tramite libreria trumbowyg
|
8
|
+
# This function render the trumbowyg assets.
|
12
9
|
def trumbowyg_icons
|
13
10
|
send_file "#{LatoView::Engine.root}/app/assets/images/lato_view/vendor/trumbowyg_icons.svg", type: 'image/svg+xml'
|
14
11
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module LatoView
|
2
|
-
#
|
2
|
+
# This class is used to show develop pages on development environment.
|
3
3
|
class DevelopController < ActionController::Base
|
4
|
-
|
5
|
-
#
|
4
|
+
|
5
|
+
# set lato_view layout
|
6
6
|
layout "lato_layout"
|
7
7
|
|
8
|
-
#
|
8
|
+
# check user is logged before actions
|
9
9
|
before_action :core_controlUser
|
10
10
|
|
11
|
-
#
|
11
|
+
# This function render the develop page for lato_view.
|
12
12
|
def home
|
13
13
|
redirect_to lato_core.root_path if Rails.env.production?
|
14
14
|
end
|
@@ -1,20 +1,29 @@
|
|
1
1
|
module LatoView
|
2
|
-
#
|
3
|
-
# delle interfacce
|
2
|
+
# This module contain default lato_view application.
|
4
3
|
module ApplicationHelper
|
5
4
|
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
# This function render a cell set with params.
|
6
|
+
def view(*names)
|
7
|
+
# mantain compatibility with old cells (lato_view 1.0)
|
8
|
+
if names.length === 1
|
9
|
+
puts "YOU ARE USING AND OLD VERSION OF CELLS. PLEASE CONSIDER TO UPDATE YOUR CODE"
|
10
|
+
old_cell = "LatoView::CellsV1::#{names.first.capitalize}::Cell".constantize
|
11
|
+
return old_cell
|
12
|
+
end
|
13
|
+
# return correct cell
|
14
|
+
cell_class = "LatoView::"
|
15
|
+
names.each do |name|
|
16
|
+
cell_class = "#{cell_class}#{name.capitalize}::"
|
17
|
+
end
|
18
|
+
cell_class = "#{cell_class}Cell".constantize
|
19
|
+
return cell_class
|
11
20
|
end
|
12
21
|
|
13
|
-
#
|
22
|
+
# This function render an icon set as params.
|
14
23
|
def put_svg(icon)
|
15
|
-
#
|
24
|
+
# check params
|
16
25
|
raise 'You must send an icon value as parameter' if !icon || icon.nil? || icon.blank?
|
17
|
-
#
|
26
|
+
# render icon
|
18
27
|
render "lato_view/icons/#{icon}.svg"
|
19
28
|
end
|
20
29
|
|
data/config/example.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Assets informations
|
2
|
-
|
2
|
+
################################################################################
|
3
3
|
|
4
4
|
# Add custom assets to the layout
|
5
5
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# type: js
|
13
13
|
|
14
14
|
# Template informations
|
15
|
-
|
15
|
+
################################################################################
|
16
16
|
|
17
17
|
# Set current template
|
18
18
|
|
data/config/initializers/init.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
|
-
#
|
2
|
-
# per controllare i valori corretti delle classi delle celle, dei temi
|
3
|
-
# supprotati ecc.
|
1
|
+
# This file contain lists of values for the application.
|
4
2
|
|
5
|
-
# Valori per celle
|
6
|
-
# ------------------------------------------------------------------------------
|
7
|
-
|
8
|
-
# Lista dimensioni griglia della cella block
|
9
3
|
VIEW_GRIDCLASS = %w(small-1 small-2 small-3 small-4 small-5 small-6
|
10
4
|
small-7 small-8 small-9 small-10 small-11 small-12
|
11
5
|
small-half small-full medium-1 medium-2 medium-3
|
@@ -17,18 +11,8 @@ VIEW_GRIDCLASS = %w(small-1 small-2 small-3 small-4 small-5 small-6
|
|
17
11
|
xlarge-6 xlarge-7 xlarge-8 xlarge-9 xlarge-10 xlarge-11
|
18
12
|
xlarge-12 xlarge-half xlarge-full)
|
19
13
|
|
20
|
-
# Lista possibili tipi di input utilizzabili con la cella input
|
21
|
-
VIEW_INPUTTYPES = %w(text number select password email editor checkbox radio
|
22
|
-
textarea file date multiple-select time)
|
23
|
-
|
24
|
-
# Lista possibili lunghezze elementi della cella input
|
25
14
|
VIEW_INPUTWIDTH = %w(large half third fourth two-third three-fourth)
|
26
15
|
|
27
|
-
|
28
|
-
VIEW_CELLSSTYLES = %w(normal rounded)
|
29
|
-
|
30
|
-
# Valori per i templates
|
31
|
-
# ------------------------------------------------------------------------------
|
16
|
+
VIEW_COMPONENTSTYLES = %w(normal rounded)
|
32
17
|
|
33
|
-
# Nomi dei possibili templates pronti supportati da lavo view
|
34
18
|
VIEW_TEMPLATES = %w(base black)
|
data/config/initializers/ram.rb
CHANGED
@@ -1,23 +1,11 @@
|
|
1
1
|
include LatoCore::Interface
|
2
2
|
include LatoView::Interface
|
3
3
|
|
4
|
-
#
|
5
|
-
# memorizzati in file yaml.
|
6
|
-
# Solitamente contengono la lettura del file di configurazione.
|
7
|
-
# Cambiare l'ordine in cui sono inserite potrebbe compromettere il corretto
|
8
|
-
# funzionamento del modulo.
|
9
|
-
|
10
|
-
# DETERMINO LISTA ASSETS CUSTOM
|
4
|
+
# This function contain important data for the view module.
|
11
5
|
|
12
6
|
VIEW_LATOASSETS = view_getLatoAssetsItems
|
13
7
|
VIEW_APPASSETS = view_getApplicationsAssetsItems
|
14
|
-
|
15
|
-
# DETERMINO URL IMMAGINE LOGO
|
16
|
-
|
17
8
|
VIEW_APPLOGO = view_getApplicationLogo
|
18
9
|
VIEW_SIDEBARLOGO = view_getSidebarLogo
|
19
10
|
VIEW_LOGINLOGO = view_getLoginLogo
|
20
|
-
|
21
|
-
# DETERMINO NOME TEMPLATE UTILIZZATO
|
22
|
-
|
23
11
|
VIEW_CURRENTTEMPLATENAME = view_getCurrentTemplateName
|
data/config/routes.rb
CHANGED
data/lib/lato_view.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
# Lato View e' il modulo del progetto Lato che si occupa di fornire tutti gli
|
2
|
-
# elementi utili a definire l'interfaccia grafica. Questo modulo, anche se
|
3
|
-
# non esplicitamente definito, e' una dipendenza obbligatoria per qualsiasi
|
4
|
-
# altro modulo Lato.
|
5
1
|
module LatoView
|
6
|
-
|
2
|
+
|
3
|
+
# include external gems
|
7
4
|
require 'sass-rails'
|
8
5
|
require 'autoprefixer-rails'
|
9
6
|
require 'jeet'
|
@@ -13,8 +10,9 @@ module LatoView
|
|
13
10
|
require 'ransack'
|
14
11
|
require 'will_paginate'
|
15
12
|
|
16
|
-
#
|
13
|
+
# include engine and interface
|
17
14
|
require 'lato_view/engine'
|
18
15
|
require 'lato_view/interface'
|
19
|
-
require 'lato_view/
|
16
|
+
require 'lato_view/cells'
|
17
|
+
|
20
18
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module LatoView
|
2
|
+
# This class is the main class for cells.
|
3
|
+
class Cell < Cell::Concept
|
4
|
+
|
5
|
+
# Set cells directory
|
6
|
+
view_paths << "#{LatoView::Engine.root}/app/cells"
|
7
|
+
|
8
|
+
# Include cells dependencies
|
9
|
+
include ActionView::Helpers::FormHelper
|
10
|
+
include ActionView::Helpers::UrlHelper
|
11
|
+
include ActionView::Helpers::CaptureHelper
|
12
|
+
include ERB::Util
|
13
|
+
include ::Cell::Erb
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/lato_view/engine.rb
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
module LatoView
|
2
|
-
# Classe che gestisce l'inizializzazione del modulo. Principalemente
|
3
|
-
# aggiunge il supporto ai routes di lato_view e agli helper.
|
4
2
|
class Engine < ::Rails::Engine
|
5
3
|
isolate_namespace LatoView
|
6
4
|
|
7
|
-
#
|
5
|
+
# Add routes support
|
8
6
|
initializer 'Add gem routes to application',
|
9
7
|
before: :load_config_initializers do
|
10
8
|
Rails.application.routes.append do
|
11
|
-
# modificare "/lato/starter" con l'url di base dei routes del modulo
|
12
9
|
mount LatoView::Engine, at: '/lato/view'
|
13
10
|
end
|
14
11
|
end
|
15
12
|
|
16
|
-
#
|
13
|
+
# Set helper to application
|
17
14
|
initializer 'Add helpers to application' do
|
18
15
|
ActiveSupport.on_load :action_controller do
|
19
16
|
helper LatoView::ApplicationHelper
|
20
17
|
end
|
21
18
|
end
|
19
|
+
|
20
|
+
# Add interface to main application
|
21
|
+
config.autoload_paths << LatoView::Engine.root.join('lib/interface')
|
22
|
+
|
22
23
|
end
|
23
24
|
end
|
data/lib/lato_view/interface.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
module LatoView
|
2
|
-
# Classe che contiene tutti i moduli che generano l'interfaccia del modulo
|
3
2
|
module Interface
|
4
3
|
|
5
|
-
#
|
4
|
+
# Require all interface modules
|
6
5
|
require 'lato_view/interface/navigation'
|
7
6
|
include LatoView::Interface::Navigation
|
8
|
-
|
7
|
+
|
9
8
|
require 'lato_view/interface/assets'
|
10
9
|
include LatoView::Interface::Assets
|
11
|
-
|
10
|
+
|
12
11
|
require 'lato_view/interface/images'
|
13
12
|
include LatoView::Interface::Images
|
14
|
-
|
13
|
+
|
15
14
|
require 'lato_view/interface/themes'
|
16
15
|
include LatoView::Interface::Themes
|
17
16
|
|
@@ -1,89 +1,80 @@
|
|
1
|
-
include LatoCore::Interface
|
2
|
-
|
3
1
|
module LatoView
|
4
|
-
module
|
5
|
-
|
6
|
-
# utenti che vogliono accedere al backoffice
|
7
|
-
module Assets
|
2
|
+
# This module contain functions for assest management.
|
3
|
+
module Interface::Assets
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
config
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
assets.push(single_asset)
|
33
|
-
end
|
5
|
+
# This function return an array of url of assets from lato gems.
|
6
|
+
def view_getLatoAssetsItems
|
7
|
+
return VIEW_LATOASSETS if defined? VIEW_LATOASSETS
|
8
|
+
# inizializzo la lista degli assets
|
9
|
+
assets = []
|
10
|
+
# identifico la lista di gemme del progetto Lato usate dalla
|
11
|
+
# applicazione
|
12
|
+
gems = core_getLatoGems
|
13
|
+
# per ogni gemma estraggo i dati necessari a riempire la navbar
|
14
|
+
gems.each do |name|
|
15
|
+
module_name = name.camelize
|
16
|
+
module_root = module_name.constantize::Engine.root
|
17
|
+
next unless File.exist? "#{module_root}/config/config.yml"
|
18
|
+
# accedo al config.yml
|
19
|
+
config = YAML.load(
|
20
|
+
File.read(File.expand_path("#{module_root}/config/config.yml",
|
21
|
+
__FILE__))
|
22
|
+
)
|
23
|
+
# estraggo i dati dallo yaml
|
24
|
+
data = getConfigAssets(config)
|
25
|
+
# aggiungo i dati nella risposta
|
26
|
+
data.each do |single_asset|
|
27
|
+
assets.push(single_asset)
|
34
28
|
end
|
35
|
-
# ritorno il risultato
|
36
|
-
return assets
|
37
29
|
end
|
30
|
+
# ritorno il risultato
|
31
|
+
return assets
|
32
|
+
end
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
assets.push(single_asset)
|
56
|
-
end
|
34
|
+
# This function return an array of url of assets from the main application.
|
35
|
+
def view_getApplicationsAssetsItems
|
36
|
+
return VIEW_APPASSETS if defined? VIEW_APPASSETS
|
37
|
+
# inizializzo la lista delle voci della navbar
|
38
|
+
assets = []
|
39
|
+
directory = core_getCacheDirectory
|
40
|
+
if File.exist? "#{directory}/view.yml"
|
41
|
+
# accedo al view.yml
|
42
|
+
config = YAML.load(
|
43
|
+
File.read(File.expand_path("#{directory}/view.yml", __FILE__))
|
44
|
+
)
|
45
|
+
# estraggo i dati dallo yaml
|
46
|
+
data = getConfigAssets(config)
|
47
|
+
# aggiungo i dati nella risposta
|
48
|
+
data.each do |single_asset|
|
49
|
+
assets.push(single_asset)
|
57
50
|
end
|
58
|
-
# ritorno il risultato
|
59
|
-
return assets
|
60
51
|
end
|
52
|
+
# ritorno il risultato
|
53
|
+
return assets
|
54
|
+
end
|
61
55
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
results.push(output_voice)
|
81
|
-
end
|
56
|
+
# This function return an array of url from the config file of a lamo module.
|
57
|
+
private def getConfigAssets(config)
|
58
|
+
# inizializzo la lista di dati
|
59
|
+
results = []
|
60
|
+
# se il file e' formattato correttamente esamino ogni sua voce
|
61
|
+
if config && config['assets']
|
62
|
+
config['assets'].each do |voice|
|
63
|
+
# estraggo i dati
|
64
|
+
# unique_name = voice[0]
|
65
|
+
name = voice[1]['name'].downcase
|
66
|
+
type = voice[1]['type'].downcase
|
67
|
+
# genero l'oggetto con le informazioni di output
|
68
|
+
output_voice = {
|
69
|
+
name: name,
|
70
|
+
type: type
|
71
|
+
}
|
72
|
+
# aggiungo la voce al risultato
|
73
|
+
results.push(output_voice)
|
82
74
|
end
|
83
|
-
# ritorno il risultato
|
84
|
-
results
|
85
75
|
end
|
86
|
-
|
76
|
+
# ritorno il risultato
|
77
|
+
results
|
87
78
|
end
|
88
79
|
|
89
80
|
end
|