lato_view 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +35 -0
- data/app/assets/fonts/lato-bold-webfont.eot +0 -0
- data/app/assets/fonts/lato-bold-webfont.svg +4551 -0
- data/app/assets/fonts/lato-bold-webfont.ttf +0 -0
- data/app/assets/fonts/lato-bold-webfont.woff +0 -0
- data/app/assets/fonts/lato-bold-webfont.woff2 +0 -0
- data/app/assets/fonts/lato-regular-webfont.eot +0 -0
- data/app/assets/fonts/lato-regular-webfont.svg +4241 -0
- data/app/assets/fonts/lato-regular-webfont.ttf +0 -0
- data/app/assets/fonts/lato-regular-webfont.woff +0 -0
- data/app/assets/fonts/lato-regular-webfont.woff2 +0 -0
- data/app/assets/images/lato_view/icons/_arrow-down.svg +1 -0
- data/app/assets/images/lato_view/icons/_arrow-left.svg +1 -0
- data/app/assets/images/lato_view/icons/_arrow-right.svg +1 -0
- data/app/assets/images/lato_view/icons/_arrow-up.svg +1 -0
- data/app/assets/images/lato_view/icons/_artist.svg +1 -0
- data/app/assets/images/lato_view/icons/_artwork.svg +1 -0
- data/app/assets/images/lato_view/icons/_attachment.svg +1 -0
- data/app/assets/images/lato_view/icons/_calendar.svg +1 -0
- data/app/assets/images/lato_view/icons/_clients.svg +1 -0
- data/app/assets/images/lato_view/icons/_close.svg +1 -0
- data/app/assets/images/lato_view/icons/_download.svg +1 -0
- data/app/assets/images/lato_view/icons/_file.svg +1 -0
- data/app/assets/images/lato_view/icons/_google-plus.svg +1 -0
- data/app/assets/images/lato_view/icons/_home.svg +1 -0
- data/app/assets/images/lato_view/icons/_info.svg +1 -0
- data/app/assets/images/lato_view/icons/_instagram.svg +1 -0
- data/app/assets/images/lato_view/icons/_lato-logo.svg +1 -0
- data/app/assets/images/lato_view/icons/_linkedin.svg +1 -0
- data/app/assets/images/lato_view/icons/_list.svg +1 -0
- data/app/assets/images/lato_view/icons/_magni-glass.svg +1 -0
- data/app/assets/images/lato_view/icons/_mail.svg +1 -0
- data/app/assets/images/lato_view/icons/_minus.svg +1 -0
- data/app/assets/images/lato_view/icons/_modify.svg +1 -0
- data/app/assets/images/lato_view/icons/_percentage.svg +1 -0
- data/app/assets/images/lato_view/icons/_plus.svg +1 -0
- data/app/assets/images/lato_view/icons/_power.svg +1 -0
- data/app/assets/images/lato_view/icons/_settings.svg +1 -0
- data/app/assets/images/lato_view/icons/_sweet.svg +1 -0
- data/app/assets/images/lato_view/icons/_trash.svg +1 -0
- data/app/assets/images/lato_view/icons/_twitter.svg +1 -0
- data/app/assets/images/lato_view/icons/_upload.svg +1 -0
- data/app/assets/images/lato_view/icons/_user.svg +1 -0
- data/app/assets/images/lato_view/icons/_users.svg +1 -0
- data/app/assets/images/lato_view/icons/_warning.svg +1 -0
- data/app/assets/images/lato_view/icons/_web.svg +1 -0
- data/app/assets/images/lato_view/vendor/trumbowyg_icons.svg +1 -0
- data/app/assets/images/lato_view/work-in-progress/da-scegliere.svg +225 -0
- data/app/assets/images/lato_view/work-in-progress/social.svg +76 -0
- data/app/assets/javascripts/lato_view/application.js +68 -0
- data/app/assets/javascripts/lato_view/build/ActionBar.js +65 -0
- data/app/assets/javascripts/lato_view/build/Dropdown.js +33 -0
- data/app/assets/javascripts/lato_view/build/Flash.js +23 -0
- data/app/assets/javascripts/lato_view/build/FormManager.js +159 -0
- data/app/assets/javascripts/lato_view/build/Navigation.js +79 -0
- data/app/assets/javascripts/lato_view/build/Util.js +91 -0
- data/app/assets/javascripts/lato_view/build/Validator.js +235 -0
- data/app/assets/javascripts/lato_view/vendor/dropzone.min.js +2 -0
- data/app/assets/javascripts/lato_view/vendor/jquery.email-autocomplete.min.js +9 -0
- data/app/assets/javascripts/lato_view/vendor/modernizr.js +3 -0
- data/app/assets/javascripts/lato_view/vendor/moment.min.js +7 -0
- data/app/assets/javascripts/lato_view/vendor/picker-it_IT.js +1 -0
- data/app/assets/javascripts/lato_view/vendor/picker.date.js +5 -0
- data/app/assets/javascripts/lato_view/vendor/picker.js +7 -0
- data/app/assets/javascripts/lato_view/vendor/picker.time.js +5 -0
- data/app/assets/javascripts/lato_view/vendor/trumbowyg.js +1522 -0
- data/app/assets/stylesheets/lato_view/application.scss.erb +32 -0
- data/app/assets/stylesheets/lato_view/base/_base.scss +53 -0
- data/app/assets/stylesheets/lato_view/base/_helpers.scss +491 -0
- data/app/assets/stylesheets/lato_view/base/_media.scss +32 -0
- data/app/assets/stylesheets/lato_view/base/_reset.scss +424 -0
- data/app/assets/stylesheets/lato_view/base/_typography.scss +138 -0
- data/app/assets/stylesheets/lato_view/config/_config.scss +143 -0
- data/app/assets/stylesheets/lato_view/config/templates/_base-template.scss +158 -0
- data/app/assets/stylesheets/lato_view/config/templates/_black-template.scss +158 -0
- data/app/assets/stylesheets/lato_view/modules/_action-bar.scss +62 -0
- data/app/assets/stylesheets/lato_view/modules/_arranger.scss +10 -0
- data/app/assets/stylesheets/lato_view/modules/_button-group.scss +70 -0
- data/app/assets/stylesheets/lato_view/modules/_buttons.scss +177 -0
- data/app/assets/stylesheets/lato_view/modules/_content-block.scss +33 -0
- data/app/assets/stylesheets/lato_view/modules/_datepicker.scss +580 -0
- data/app/assets/stylesheets/lato_view/modules/_dropdown.scss +166 -0
- data/app/assets/stylesheets/lato_view/modules/_flash.scss +55 -0
- data/app/assets/stylesheets/lato_view/modules/_form-controls.scss +83 -0
- data/app/assets/stylesheets/lato_view/modules/_form.scss +297 -0
- data/app/assets/stylesheets/lato_view/modules/_modules.scss +19 -0
- data/app/assets/stylesheets/lato_view/modules/_navbar.scss +262 -0
- data/app/assets/stylesheets/lato_view/modules/_pagination.scss +30 -0
- data/app/assets/stylesheets/lato_view/modules/_search-bar.scss +44 -0
- data/app/assets/stylesheets/lato_view/modules/_select.scss +313 -0
- data/app/assets/stylesheets/lato_view/modules/_sidebar.scss +211 -0
- data/app/assets/stylesheets/lato_view/modules/_status.scss +39 -0
- data/app/assets/stylesheets/lato_view/modules/_table.scss +94 -0
- data/app/assets/stylesheets/lato_view/modules/_upload.scss +371 -0
- data/app/assets/stylesheets/lato_view/modules/_wyswyg.scss +755 -0
- data/app/assets/stylesheets/lato_view/views/_admin.scss +30 -0
- data/app/assets/stylesheets/lato_view/views/_grid.scss +448 -0
- data/app/assets/stylesheets/lato_view/views/_login.scss +152 -0
- data/app/assets/stylesheets/lato_view/views/_print.scss +41 -0
- data/app/assets/stylesheets/lato_view/views/_views.scss +48 -0
- data/app/concepts/lato_view/actionbar/cell.rb +65 -0
- data/app/concepts/lato_view/actionbar/views/show.html.erb +21 -0
- data/app/concepts/lato_view/block/cell.rb +52 -0
- data/app/concepts/lato_view/buttongroup/cell.rb +50 -0
- data/app/concepts/lato_view/buttongroup/views/show.html.erb +7 -0
- data/app/concepts/lato_view/dropdown/cell.rb +46 -0
- data/app/concepts/lato_view/dropdown/views/show.html.erb +19 -0
- data/app/concepts/lato_view/index/cell.rb +112 -0
- data/app/concepts/lato_view/index/views/head.html.erb +12 -0
- data/app/concepts/lato_view/index/views/rows.html.erb +49 -0
- data/app/concepts/lato_view/input/cell.rb +148 -0
- data/app/concepts/lato_view/input/views/checkbox.html.erb +8 -0
- data/app/concepts/lato_view/input/views/date.html.erb +5 -0
- data/app/concepts/lato_view/input/views/editor.html.erb +7 -0
- data/app/concepts/lato_view/input/views/email.html.erb +5 -0
- data/app/concepts/lato_view/input/views/file.html.erb +17 -0
- data/app/concepts/lato_view/input/views/multiple-select.html.erb +12 -0
- data/app/concepts/lato_view/input/views/number.html.erb +5 -0
- data/app/concepts/lato_view/input/views/password.html.erb +8 -0
- data/app/concepts/lato_view/input/views/radio.html.erb +10 -0
- data/app/concepts/lato_view/input/views/select.html.erb +12 -0
- data/app/concepts/lato_view/input/views/text.html.erb +5 -0
- data/app/concepts/lato_view/input/views/textarea.html.erb +5 -0
- data/app/concepts/lato_view/input/views/time.html.erb +5 -0
- data/app/concepts/lato_view/searchbar/cell.rb +63 -0
- data/app/concepts/lato_view/searchbar/views/show.html.erb +6 -0
- data/app/concepts/lato_view/table/cell.rb +88 -0
- data/app/concepts/lato_view/table/views/head.html.erb +9 -0
- data/app/concepts/lato_view/table/views/row.html.erb +7 -0
- data/app/concepts/lato_view/table/views/rows.html.erb +5 -0
- data/app/controllers/lato_view/assets_controller.rb +18 -0
- data/app/controllers/lato_view/develop_controller.rb +18 -0
- data/app/helpers/lato_view/application_helper.rb +22 -0
- data/app/views/lato_view/develop/home.html.erb +281 -0
- data/app/views/lato_view/icons/_arrowdown.svg +1 -0
- data/app/views/lato_view/icons/_arrowleft.svg +1 -0
- data/app/views/lato_view/icons/_arrowright.svg +1 -0
- data/app/views/lato_view/icons/_arrowup.svg +1 -0
- data/app/views/lato_view/icons/_artist.svg +1 -0
- data/app/views/lato_view/icons/_artwork.svg +1 -0
- data/app/views/lato_view/icons/_attachment.svg +1 -0
- data/app/views/lato_view/icons/_calendar.svg +1 -0
- data/app/views/lato_view/icons/_clients.svg +1 -0
- data/app/views/lato_view/icons/_close.svg +1 -0
- data/app/views/lato_view/icons/_download.svg +1 -0
- data/app/views/lato_view/icons/_file.svg +1 -0
- data/app/views/lato_view/icons/_googleplus.svg +1 -0
- data/app/views/lato_view/icons/_home.svg +1 -0
- data/app/views/lato_view/icons/_info.svg +1 -0
- data/app/views/lato_view/icons/_instagram.svg +1 -0
- data/app/views/lato_view/icons/_latologo.svg +1 -0
- data/app/views/lato_view/icons/_linkedin.svg +1 -0
- data/app/views/lato_view/icons/_list.svg +1 -0
- data/app/views/lato_view/icons/_magni-glass.svg +1 -0
- data/app/views/lato_view/icons/_mail.svg +1 -0
- data/app/views/lato_view/icons/_minus.svg +1 -0
- data/app/views/lato_view/icons/_modify.svg +1 -0
- data/app/views/lato_view/icons/_percentage.svg +1 -0
- data/app/views/lato_view/icons/_plus.svg +1 -0
- data/app/views/lato_view/icons/_power.svg +1 -0
- data/app/views/lato_view/icons/_settings.svg +1 -0
- data/app/views/lato_view/icons/_sweet.svg +1 -0
- data/app/views/lato_view/icons/_trash.svg +1 -0
- data/app/views/lato_view/icons/_twitter.svg +1 -0
- data/app/views/lato_view/icons/_upload.svg +1 -0
- data/app/views/lato_view/icons/_user.svg +1 -0
- data/app/views/lato_view/icons/_users.svg +1 -0
- data/app/views/lato_view/icons/_warning.svg +1 -0
- data/app/views/lato_view/icons/_web.svg +1 -0
- data/app/views/lato_view/layout/_flash.html.erb +5 -0
- data/app/views/lato_view/layout/_header.html.erb +31 -0
- data/app/views/lato_view/layout/_sidebar.html.erb +28 -0
- data/app/views/lato_view/layout/_strings.html.erb +8 -0
- data/app/views/layouts/lato_layout.html.erb +81 -0
- data/config/example.yml +19 -0
- data/config/initializers/assets.rb +5 -0
- data/config/initializers/init.rb +5 -0
- data/config/initializers/lists.rb +34 -0
- data/config/initializers/ram.rb +23 -0
- data/config/routes.rb +9 -0
- data/lib/lato_view/concepts.rb +19 -0
- data/lib/lato_view/engine.rb +23 -0
- data/lib/lato_view/interface/assets.rb +90 -0
- data/lib/lato_view/interface/images.rb +69 -0
- data/lib/lato_view/interface/navigation.rb +17 -0
- data/lib/lato_view/interface/themes.rb +37 -0
- data/lib/lato_view/interface.rb +19 -0
- data/lib/lato_view.rb +20 -0
- data/lib/tasks/lato_starter_tasks.rake +11 -0
- data/test/controllers/lato_view/api/v1/api_controller_test.rb +9 -0
- data/test/controllers/lato_view/application_controller_test.rb +9 -0
- data/test/controllers/lato_view/back/back_controller_test.rb +9 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +25 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/lato_view_test.rb +7 -0
- data/test/test_helper.rb +21 -0
- metadata +453 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
module LatoView
|
2
|
+
# Cella che si occupa di generare una actionbar in grado di contenere
|
3
|
+
# il titolo della pagina e i link alle principali azioni. Puo' inoltre
|
4
|
+
# contenere anche dei widget per altri tipi di interazioni.
|
5
|
+
module Actionbar
|
6
|
+
# Cella Actionbar
|
7
|
+
class Cell < Cell
|
8
|
+
|
9
|
+
# Lista allineamenti accettati dalla cella per i widget
|
10
|
+
@@align = %(left right)
|
11
|
+
# Lista di links da mostrare nella Actionbar secondo la
|
12
|
+
# struttura [['Nome link', 'url'], ['Nome link', 'url']]
|
13
|
+
# * *default*: nil
|
14
|
+
attr_accessor :links
|
15
|
+
|
16
|
+
# Titolo principale da mostrare nella Actionbar
|
17
|
+
# * *default*: nil
|
18
|
+
attr_accessor :title
|
19
|
+
|
20
|
+
# Celle da inserire all'interno della Actionbar. Le celle per ora
|
21
|
+
# supportate sono: (searchbar, dropdown, buttongroup).
|
22
|
+
# I widget devono essere inseriti sotto forma di array che segue
|
23
|
+
# la struttura [[cella_widget, 'allineamento'], [...]]
|
24
|
+
# * *default*: nil
|
25
|
+
attr_accessor :widgets
|
26
|
+
|
27
|
+
def initialize(links: nil, title: '', widgets: nil)
|
28
|
+
# assegno i valori alle variabili di istanza
|
29
|
+
@links = links if links && check_links(links)
|
30
|
+
@title = title
|
31
|
+
@widgets = widgets if widgets && check_widgets(widgets)
|
32
|
+
end
|
33
|
+
|
34
|
+
def show
|
35
|
+
render 'show.html'
|
36
|
+
end
|
37
|
+
|
38
|
+
# Funzione che controlla che la lista links sia inviata nel formato
|
39
|
+
# corretto
|
40
|
+
private def check_links(links)
|
41
|
+
# evito il controllo se sono in production
|
42
|
+
return true if Rails.env.production?
|
43
|
+
raise 'Actionbar Concept: links must be an array' unless links.is_a? Array
|
44
|
+
links.each do |link|
|
45
|
+
raise 'Actionbar Concept: links content must be an array' unless link.is_a? Array
|
46
|
+
raise 'Actionbar Concept: links content must have two value' if link.length != 2
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Funzione che controlla che i widgets passati alla actionbar siano corretti
|
51
|
+
private def check_widgets(widgets)
|
52
|
+
# evito il controllo se sono in production
|
53
|
+
return true if Rails.env.production?
|
54
|
+
raise 'Actionbar Concept: links must be an array' unless widgets.is_a? Array
|
55
|
+
widgets.each do |widget|
|
56
|
+
raise 'Actionbar Concept: widgets content must be an array' unless widget.is_a? Array
|
57
|
+
raise 'Actionbar Concept: widgets content must have two value' if widget.length != 2
|
58
|
+
raise 'Actionbar Concept: widget align is not a correct value' unless @@align.include? widget.last.to_s
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
# Fine cella
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,21 @@
|
|
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.last %>">
|
9
|
+
<%= raw widget.first %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="action-group-right">
|
15
|
+
<% if @links %>
|
16
|
+
<% @links.each do |link| %>
|
17
|
+
<%= link_to link[0], link[1], class: 'lato-button action-button' %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
</div>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module LatoView
|
2
|
+
# Cella che si occupa di generare un blocco contenitore generale
|
3
|
+
# utilizzabile per inserire altri elementi
|
4
|
+
module Block
|
5
|
+
# Cella Block
|
6
|
+
class Cell < Cell
|
7
|
+
# Lista dei parametri accettati per l'attributo width
|
8
|
+
@@widths = VIEW_GRIDCLASS
|
9
|
+
|
10
|
+
# Dimensione del blocco (half, third, fourth, two-third)
|
11
|
+
# * *default*: nil (large)
|
12
|
+
attr_accessor :width
|
13
|
+
|
14
|
+
# Contenuto del blocco
|
15
|
+
# * *default*: nil
|
16
|
+
attr_accessor :content
|
17
|
+
|
18
|
+
# Classi custom aggiunte all'html del blocco
|
19
|
+
# * *default*: nil
|
20
|
+
attr_accessor :custom_class
|
21
|
+
|
22
|
+
def initialize(width: 'small-12 medium-12 large-12 xlarge-12', content: '', custom_class: '')
|
23
|
+
# eseguo brevi controlli sull'input
|
24
|
+
raise 'Block Concept: width value in not correct' unless (width.to_s.split(' ') - @@widths).empty?
|
25
|
+
# assegno i valori alle variabili di istanza
|
26
|
+
@width = width
|
27
|
+
@content = content
|
28
|
+
@class = custom_class
|
29
|
+
end
|
30
|
+
|
31
|
+
def show
|
32
|
+
open + @content + close
|
33
|
+
end
|
34
|
+
|
35
|
+
# Funzione per stampare l'apertura di un blocco
|
36
|
+
# * *Parametri* :
|
37
|
+
# - width: dimensione del blocco da aprire (se non viene impostata la
|
38
|
+
# funzione
|
39
|
+
# utilizza la dimensione prefissata in fase di inizializzazione)
|
40
|
+
def open(width: @width, custom_class: @class)
|
41
|
+
"<div class='content-block column #{width} #{custom_class}'>"
|
42
|
+
end
|
43
|
+
|
44
|
+
# Funzione per stampare la chiusura di un blocco
|
45
|
+
def close
|
46
|
+
'</div>'
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
# Fine cella
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module LatoView
|
2
|
+
# Elemento grafico composto da un insieme di link uniti in orizzontale
|
3
|
+
module Buttongroup
|
4
|
+
# Cella Buttongroup
|
5
|
+
class Cell < Cell
|
6
|
+
# Lista stili possibili per il bottongroup
|
7
|
+
@@styles = VIEW_CELLSSTYLES
|
8
|
+
|
9
|
+
# Lista di links da mostrare nella Actionbar secondo la
|
10
|
+
# struttura [['Nome link', 'url'], ['Nome link', 'url']]
|
11
|
+
# * *default*: nil
|
12
|
+
attr_accessor :links
|
13
|
+
|
14
|
+
# Dimensione dei pulsanti della button
|
15
|
+
# * *default*: nil
|
16
|
+
attr_accessor :size
|
17
|
+
|
18
|
+
# Stile da utilizzare per la buttongroup
|
19
|
+
# * *default*: nil (normal)
|
20
|
+
attr_accessor :style
|
21
|
+
|
22
|
+
def initialize(links: nil, size: nil, style: 'normal')
|
23
|
+
# eseguo brevi controlli sull'input
|
24
|
+
raise 'Bottongroup Concept: style value in not correct' unless @@styles.include? style.to_s
|
25
|
+
# assegno i valori alle variabili di istanza
|
26
|
+
@links = links if links && check_links(links)
|
27
|
+
@size = size
|
28
|
+
@style = style
|
29
|
+
end
|
30
|
+
|
31
|
+
def show
|
32
|
+
render 'show.html'
|
33
|
+
end
|
34
|
+
|
35
|
+
# Funzione che controlla che la lista links sia inviata nel formato
|
36
|
+
# corretto
|
37
|
+
private def check_links(links)
|
38
|
+
# evito il controllo se sono in production
|
39
|
+
return true if Rails.env.production?
|
40
|
+
raise 'Bottongroup Concept: links must be an array' unless links.is_a? Array
|
41
|
+
links.each do |link|
|
42
|
+
raise 'Bottongroup Concept: links content must be an array' unless link.is_a? Array
|
43
|
+
raise 'Bottongroup Concept: links content must have two value' if link.length != 2
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
# Fine cella
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module LatoView
|
2
|
+
# Cella che si occupa di generare un pannello di dropdown in grado di
|
3
|
+
# contenere una lista di link
|
4
|
+
module Dropdown
|
5
|
+
# Cella Actionbar
|
6
|
+
class Cell < Cell
|
7
|
+
# Lista di links da mostrare nel Dropdown secondo la
|
8
|
+
# struttura [['Nome link', 'url'], ['Nome link', 'url']]
|
9
|
+
# * *default*: nil
|
10
|
+
attr_accessor :links
|
11
|
+
|
12
|
+
# Titolo principale da mostrare nel dropdown
|
13
|
+
# * *default*: nil
|
14
|
+
attr_accessor :title
|
15
|
+
|
16
|
+
# Testo da inserire come nome nel pulsante che apre il Dropdown
|
17
|
+
# * *default*: nil
|
18
|
+
attr_accessor :button
|
19
|
+
|
20
|
+
def initialize(links: nil, title: '', button: nil)
|
21
|
+
# assegno i valori alle variabili di istanza
|
22
|
+
@links = links if links && check_links(links)
|
23
|
+
@title = title
|
24
|
+
@button = button
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
render 'show.html'
|
29
|
+
end
|
30
|
+
|
31
|
+
# Funzione che controlla che la lista links sia inviata nel formato
|
32
|
+
# corretto
|
33
|
+
private def check_links(links)
|
34
|
+
# evito il controllo se sono in production
|
35
|
+
return true if Rails.env.production?
|
36
|
+
raise 'Dropdown Concept: links must be an array' unless links.is_a? Array
|
37
|
+
links.each do |link|
|
38
|
+
raise 'Dropdown Concept: links content must be an array' unless link.is_a? Array
|
39
|
+
raise 'Dropdown Concept: links content must have two value' if link.length != 2
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
# Fine cella
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="arranger">
|
2
|
+
<% if @title %>
|
3
|
+
<div class="arrange-voice"><%= @title %></div>
|
4
|
+
<% end %>
|
5
|
+
<div class="dropdown">
|
6
|
+
<% if @button %>
|
7
|
+
<div class="active-voice"><span class="voice-text"><%= @button %></span> <span class="drop-icon"></span></div>
|
8
|
+
<% else %>
|
9
|
+
<div class="active-voice"><span class="voice-text"><%= @links.first.first %></span> <span class="drop-icon"></span></div>
|
10
|
+
<% end %>
|
11
|
+
<div class="the-drop">
|
12
|
+
<ul>
|
13
|
+
<% @links.each do |link| %>
|
14
|
+
<li><a href="<%= link.last %>"><%= link.first %></a></li>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module LatoView
|
2
|
+
# Cella che si occupa di mostrare una lista di elementi di un model
|
3
|
+
# insieme ai link alle azioni di visualizzazione, modifica e eliminazione.
|
4
|
+
# Il corretto funzionamento dei link alle azioni necessita che i routes del
|
5
|
+
# modello siano settati attraverso la funzione 'resources'
|
6
|
+
module Index
|
7
|
+
# Cella Index
|
8
|
+
class Cell < Cell
|
9
|
+
# Istanze del database da stampare
|
10
|
+
attr_accessor :elements
|
11
|
+
|
12
|
+
# Intestazione della tabella
|
13
|
+
# * *struttura*: ['Voce 1', 'Voce 2', ... ]
|
14
|
+
attr_accessor :head
|
15
|
+
|
16
|
+
# Attributi dellle entita' da mostrare nella tabella
|
17
|
+
# * *struttura*: ['voce1', 'voce2', ... ]
|
18
|
+
attr_accessor :attributes
|
19
|
+
|
20
|
+
# Link principale alla pagina index delle entita'
|
21
|
+
# (da gestire tramite resources)
|
22
|
+
attr_accessor :link
|
23
|
+
|
24
|
+
# Valore booleano che indica se mostrare il link allo show dell'entita'
|
25
|
+
# * *default*: true
|
26
|
+
attr_accessor :show_link
|
27
|
+
|
28
|
+
# Valore booleano che indica se mostrare il link all'edit dell'entita'
|
29
|
+
# * *default*: true
|
30
|
+
attr_accessor :edit_link
|
31
|
+
|
32
|
+
# Valore booleano che indica se mostrare il link al delete dell'entita'
|
33
|
+
# * *default*: true
|
34
|
+
attr_accessor :delete_link
|
35
|
+
|
36
|
+
# Valore booleano che indica se il link di eliminazione deve essere
|
37
|
+
# eseguito con il remote: true
|
38
|
+
# * *default*: false
|
39
|
+
attr_accessor :remote_delete
|
40
|
+
|
41
|
+
# Valore usato per aggiungere delle classi custom alla tabella dell'index
|
42
|
+
# * *default*: nil
|
43
|
+
attr_accessor :custom_class
|
44
|
+
|
45
|
+
def initialize(elements: nil, head: nil, attributes: nil, link: nil,
|
46
|
+
show_link: true, edit_link: true, delete_link: true,
|
47
|
+
remote_delete: false, custom_class: nil)
|
48
|
+
# eseguo brevi controlli sull'input
|
49
|
+
raise 'Index Concept: head must be an array' unless head.is_a? Array
|
50
|
+
raise 'Index Concept: attributes must be an array' unless attributes.is_a? Array
|
51
|
+
raise 'Index Concept: head and attributes have different length' if head.length != attributes.length
|
52
|
+
# assegno i valori alle variabili di istanza
|
53
|
+
@elements = elements
|
54
|
+
@head = head
|
55
|
+
@attributes = attributes
|
56
|
+
@link = link
|
57
|
+
@show_link = show_link
|
58
|
+
@edit_link = edit_link
|
59
|
+
@delete_link = delete_link
|
60
|
+
@remote_delete = remote_delete
|
61
|
+
@custom_class = custom_class
|
62
|
+
end
|
63
|
+
|
64
|
+
def show
|
65
|
+
open + head + rows + close
|
66
|
+
end
|
67
|
+
|
68
|
+
# Funzione che stampa l'apertura dell'index
|
69
|
+
def open
|
70
|
+
"<table class='table #{@custom_class}'>"
|
71
|
+
end
|
72
|
+
|
73
|
+
# Funzione che genera l'intestazione dell'index
|
74
|
+
def head
|
75
|
+
render 'head.html'
|
76
|
+
end
|
77
|
+
|
78
|
+
# Funzione che stampa le righe dell'index
|
79
|
+
def rows
|
80
|
+
render 'rows.html'
|
81
|
+
end
|
82
|
+
|
83
|
+
# Funzione che stampa la chiusura di una tabella
|
84
|
+
def close
|
85
|
+
'</table>'
|
86
|
+
end
|
87
|
+
|
88
|
+
# Funzione che ritorna il link allo show dell'entita' con l'id
|
89
|
+
# passato come parametro
|
90
|
+
protected def show_link(id)
|
91
|
+
return "#{@link}#{id}" if @link.end_with? '/'
|
92
|
+
"#{@link}/#{id}"
|
93
|
+
end
|
94
|
+
|
95
|
+
# Funzione che ritorna il link all'edit dell'entita'
|
96
|
+
# con l'id passato come parametro
|
97
|
+
protected def edit_link(id)
|
98
|
+
return "#{@link}#{id}/edit" if @link.end_with? '/'
|
99
|
+
"#{@link}/#{id}/edit"
|
100
|
+
end
|
101
|
+
|
102
|
+
# Funzione che ritorna il link all'edit dell'entita'
|
103
|
+
# con l'id passato come parametro
|
104
|
+
protected def delete_link(id)
|
105
|
+
show_link(id)
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
end
|
110
|
+
# Fine cella
|
111
|
+
end
|
112
|
+
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' %>
|
35
|
+
<% end %>
|
36
|
+
<% if(@edit_link) %>
|
37
|
+
<%= link_to VIEW_LANG['index']['edit'], self.edit_link(element.id), class: 'lato-button button-yellow' %>
|
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',
|
42
|
+
data: {confirm: VIEW_LANG['input']['confirm_delete']} %>
|
43
|
+
<% end %>
|
44
|
+
</td>
|
45
|
+
<% end %>
|
46
|
+
</tr>
|
47
|
+
<% end %>
|
48
|
+
</tbody>
|
49
|
+
<% end %>
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module LatoView
|
2
|
+
# Cella che gestisce tutti i possibili input utilizzabili nei form
|
3
|
+
module Input
|
4
|
+
# Cella Input
|
5
|
+
class Cell < Cell
|
6
|
+
# Lista di tipologie di input accettate
|
7
|
+
@@types = VIEW_INPUTTYPES
|
8
|
+
# Lista dei parametri accettati per l'attributo width
|
9
|
+
@@widths = VIEW_INPUTWIDTH
|
10
|
+
|
11
|
+
# Tipologia di input da inizializzare
|
12
|
+
# (text, number, select, password, email, multiple-select, date,
|
13
|
+
# checkbox, radio, textarea, file)
|
14
|
+
# * *default*: 'text'
|
15
|
+
attr_accessor :type
|
16
|
+
|
17
|
+
# Nome da assegnare all'input
|
18
|
+
# * *default*: 'input'
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# Valore da inserire come placeholder all'input
|
22
|
+
# * *default*: nil
|
23
|
+
attr_accessor :placeholder
|
24
|
+
|
25
|
+
# Valore gia' impostato nell'input
|
26
|
+
# * *default*: nil
|
27
|
+
attr_accessor :value
|
28
|
+
|
29
|
+
# Testo da inserire nella label dell'input
|
30
|
+
# * *default*: nil
|
31
|
+
attr_accessor :label
|
32
|
+
|
33
|
+
# Dimensione dell'input (half, third, fourth, two-third)
|
34
|
+
# * *default*: nil ('large')
|
35
|
+
attr_accessor :width
|
36
|
+
|
37
|
+
# Valore booleano usato per indicare se l'input e' obbligatorio
|
38
|
+
# nel form in cui si trova
|
39
|
+
# * *default*: false
|
40
|
+
attr_accessor :required
|
41
|
+
|
42
|
+
# Valore booleano che indica (nel caso di input password) se mostrare
|
43
|
+
# il pulsante per vedere la password
|
44
|
+
# * *default*: true
|
45
|
+
attr_accessor :password_visible
|
46
|
+
|
47
|
+
# Classi custom da inserire nel codice dell'input
|
48
|
+
# * *default*: nil
|
49
|
+
attr_accessor :custom_class
|
50
|
+
|
51
|
+
# Lista di opzioni da mostrare (nel caso di input select o radio buttons
|
52
|
+
# e checkbox).
|
53
|
+
# La struttura deve essere [['value1', 'Name 1'], ['value2', 'Name 2']]
|
54
|
+
# * *default*: []
|
55
|
+
attr_accessor :options
|
56
|
+
|
57
|
+
# Valore booleano che indica (nel caso di input select) se mostrare
|
58
|
+
# o meno la prima opzione del select vuota
|
59
|
+
# * *default*: false
|
60
|
+
attr_accessor :option_blank
|
61
|
+
|
62
|
+
# Valore che indica se disattivare o meno l'input
|
63
|
+
# * *default*: false
|
64
|
+
attr_accessor :disabled
|
65
|
+
|
66
|
+
# Valore che indica (nel caso di input file) se accettare piu' file o
|
67
|
+
# uno singolarmente
|
68
|
+
# * *default*: false
|
69
|
+
attr_accessor :multiple_files
|
70
|
+
|
71
|
+
def initialize(type: 'text', name: 'input', placeholder: '',
|
72
|
+
value: '', label: '', width: 'large', required: false,
|
73
|
+
password_visible: true, custom_class: '', options: [],
|
74
|
+
option_blank: false, disabled: false,
|
75
|
+
multiple_files: false)
|
76
|
+
# eseguo brevi controlli sull'input
|
77
|
+
raise 'Input Concept: type has not a correct value' unless @@types.include? type
|
78
|
+
raise 'Input Concept: width has not a correct value' unless @@widths.include? width
|
79
|
+
raise 'Input Concept: options must be an array' if options && !options.is_a?(Array)
|
80
|
+
# assegno i valori alle variabili di istanza
|
81
|
+
@type = type
|
82
|
+
@name = name
|
83
|
+
@placeholder = placeholder
|
84
|
+
@value = value
|
85
|
+
@label = label
|
86
|
+
@width = width
|
87
|
+
@required = required
|
88
|
+
@password_visible = password_visible
|
89
|
+
@options = options
|
90
|
+
@custom_class = custom_class
|
91
|
+
@option_blank = option_blank
|
92
|
+
@disabled = disabled
|
93
|
+
@multiple_files = multiple_files
|
94
|
+
end
|
95
|
+
|
96
|
+
def show
|
97
|
+
render "#{@type.downcase}.html" if @type
|
98
|
+
end
|
99
|
+
|
100
|
+
# Ritorna il value di un opzione di un select ricevuta come parametro.
|
101
|
+
# Funzione usata solo per i select e i radio button
|
102
|
+
protected def option_value(option)
|
103
|
+
return option.first if option.is_a? Array
|
104
|
+
return option
|
105
|
+
end
|
106
|
+
|
107
|
+
# Ritorna il name di un opzione di un select di un select ricevuta
|
108
|
+
# come parametro. Funzione usata solo per i select e i radio button
|
109
|
+
protected def option_name(option)
|
110
|
+
return option.last if option.is_a? Array
|
111
|
+
return option
|
112
|
+
end
|
113
|
+
|
114
|
+
# Ritorna una stringa 'selected' se il valore dell'option ricevuto
|
115
|
+
# come parametro e' uguale al value inizializzato all'input
|
116
|
+
protected def selected_value(option)
|
117
|
+
value = option_value(option)
|
118
|
+
return "checked" if value === @value && @type === 'radio'
|
119
|
+
return "selected='selected'" if value === @value || (@type === 'multiple-select' && @value.is_a?(Array) && @value.include?(value))
|
120
|
+
end
|
121
|
+
|
122
|
+
# Funzione che ritorna la stringa con attributo data-input settato a
|
123
|
+
# required se l'input risulta essere stato inizializzato come obbligatorio
|
124
|
+
protected def required_data_input
|
125
|
+
return "data-input='check'" if @type === 'checkbox' && @required
|
126
|
+
return "data-input='required'" if @required
|
127
|
+
end
|
128
|
+
|
129
|
+
# Funzione che disabilita un input
|
130
|
+
protected def disabled_data_input
|
131
|
+
return "disabled='disabled'" if @disabled
|
132
|
+
end
|
133
|
+
|
134
|
+
# Funzione che prende in input un activerecords, il nome dell'attributo
|
135
|
+
# da usare come valore e il nome dell'attributo da usare come nome e
|
136
|
+
# ritorna un array da usare come options per un input select o un radio buttons
|
137
|
+
def self.generate_options_from_activerecords(activerecords, value, name)
|
138
|
+
rows = []
|
139
|
+
activerecords.each do |row|
|
140
|
+
rows.push([row.send(value), row.send(name)])
|
141
|
+
end
|
142
|
+
rows
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
# Fine cella
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
<div class="form-block">
|
3
|
+
<input type="hidden" name="<%= @name %>" value="0">
|
4
|
+
<input type="checkbox" class="check <%= @custom_class %>" <%= disabled_data_input %> name="<%= @name %>" id="<%= @name %>" value="1" <% if @value %>checked<% end %>>
|
5
|
+
<label class="label-control" for="<%= @name %>"><%= @label%></label>
|
6
|
+
</div>
|
7
|
+
<div class="input-error-message"></div>
|
8
|
+
</div>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<input type="text" class="input date-picker <%= @custom_class %>" name="<%= @name %>" placeholder="<%= @placeholder %>" <%= disabled_data_input %> value="<%= @value %>">
|
4
|
+
<div class="input-error-message"></div>
|
5
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<textarea class="editor <%= @custom_class %>" name="<%= @name %>" placeholder="<%= @placeholder %>" >
|
4
|
+
<%= @value %>
|
5
|
+
</textarea>
|
6
|
+
<div class="input-error-message"></div>
|
7
|
+
</div>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class="form-control <%= @width %>" data-control="email" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<input type="email" autocomplete="off" class="input input-email <%= @custom_class %>" <%= disabled_data_input %> name="<%= @name %>" placeholder="<%= @placeholder %>" value="<%= @value %>">
|
4
|
+
<div class="input-error-message"></div>
|
5
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<input type="file" class="input-file <%= @custom_class %>" id="<%= @name %>" name="<%= @name %>" <%= disabled_data_input %> placeholder="<%= @placeholder %>" value="<%= @value %>" data-multiple-caption="{count} <%= VIEW_LANG['input']['selected_files'] %>" <% if @multiple_files %>multiple<% end %>>
|
4
|
+
<label for="<%= @name %>">
|
5
|
+
<div class="upload-icon">
|
6
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><path d="M189.9 126.9v57.6c0 6-4.5 10.5-10.5 10.5H19.2c-6 0-10.5-4.5-10.5-10.5v-57.6c0-6 4.5-10.5 10.5-10.5s10.5 4.5 10.5 10.5v46.5h139.1v-46.5c0-6 4.5-10.5 10.5-10.5s10.6 4.5 10.6 10.5zm-125.2-61l24-24.5v91.1c0 6 4.5 10.5 10.5 10.5s10.5-4.5 10.5-10.5V41.3l24 24.5c2 2 5 3 7.5 3s5.5-1 7.5-3c4-4 4-10.5 0-15l-42-43c-2-2-5-3-7.5-3s-5.5 1-7.5 3l-42 43c-4 4-4 10.5 0 15 4.5 4.6 11 4.1 15 .1z"/></svg>
|
7
|
+
</div>
|
8
|
+
<span><%= VIEW_LANG['input']['choose_file'] %></span>
|
9
|
+
</label>
|
10
|
+
<div class="input-error-message"></div>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<%
|
14
|
+
|
15
|
+
# DA FIXARE CARICAMENTO ICONA CON RENDER O FUNZIONE PUT_SVG
|
16
|
+
|
17
|
+
%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<select class="select <%= @custom_class %>" name="<%= @name %>" placeholder="<%= @placeholder %>" <%= disabled_data_input %> multiple="multiple">
|
4
|
+
<% if(@option_blank) %>
|
5
|
+
<option></option>
|
6
|
+
<% end %>
|
7
|
+
<% @options.each do |option| %>
|
8
|
+
<option value="<%= option_value(option) %>" <%= selected_value(option) %>><%= option_name(option) %></option>
|
9
|
+
<% end %>
|
10
|
+
</select>
|
11
|
+
<div class="input-error-message"></div>
|
12
|
+
</div>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class="form-control <%= @width %>" data-control="number" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<input type="text" class="input input-number <%= @custom_class %>" <%= disabled_data_input %> name="<%= @name %>" placeholder="<%= @placeholder %>" value="<%= @value %>">
|
4
|
+
<div class="input-error-message"></div>
|
5
|
+
</div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="form-control <%= @width %>" <%= required_data_input %>>
|
2
|
+
<label class="form-label"><%= @label %></label>
|
3
|
+
<input type="password" class="input input-password <%= @custom_class %>" <%= disabled_data_input %> name="<%= @name %>" placeholder="<%= @placeholder %>" value="<%= @value %>">
|
4
|
+
<% if @password_visible %>
|
5
|
+
<div class="password-reveal"></div>
|
6
|
+
<% end %>
|
7
|
+
<div class="input-error-message"></div>
|
8
|
+
</div>
|