lato_core 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +38 -0
  3. data/app/controllers/lato_core/api/v1/api_controller.rb +9 -0
  4. data/app/controllers/lato_core/application_controller.rb +6 -0
  5. data/app/controllers/lato_core/back/authentication_controller.rb +114 -0
  6. data/app/controllers/lato_core/back/back_controller.rb +28 -0
  7. data/app/controllers/lato_core/back/superusers_controller.rb +172 -0
  8. data/app/mailers/lato_core/application_mailer.rb +10 -0
  9. data/app/mailers/lato_core/superusers_mailer.rb +29 -0
  10. data/app/models/lato_core/superuser.rb +43 -0
  11. data/app/views/lato_core/back/authentication/login.html.erb +42 -0
  12. data/app/views/lato_core/back/authentication/password_edit.html.erb +50 -0
  13. data/app/views/lato_core/back/authentication/password_forget.html.erb +37 -0
  14. data/app/views/lato_core/back/back/home.html.erb +20 -0
  15. data/app/views/lato_core/back/superusers/edit.html.erb +12 -0
  16. data/app/views/lato_core/back/superusers/index.html.erb +25 -0
  17. data/app/views/lato_core/back/superusers/new.html.erb +12 -0
  18. data/app/views/lato_core/back/superusers/shared/_form.html.erb +71 -0
  19. data/app/views/lato_core/back/superusers/show.html.erb +1 -0
  20. data/app/views/lato_core/mailers/layouts/mailer.html.erb +9 -0
  21. data/app/views/lato_core/mailers/layouts/mailer.text.erb +1 -0
  22. data/app/views/lato_core/mailers/superusers/notify.html.erb +2 -0
  23. data/app/views/lato_core/mailers/superusers/recover_password.html.erb +4 -0
  24. data/config/config.yml +8 -0
  25. data/config/example.yml +66 -0
  26. data/config/initializers/init.rb +16 -0
  27. data/config/initializers/ram.rb +50 -0
  28. data/config/routes.rb +20 -0
  29. data/db/migrate/20160224181217_create_lato_core_superusers.rb +15 -0
  30. data/lib/lato_core.rb +11 -0
  31. data/lib/lato_core/engine.rb +26 -0
  32. data/lib/lato_core/interface.rb +29 -0
  33. data/lib/lato_core/interface/authentication.rb +34 -0
  34. data/lib/lato_core/interface/cache.rb +29 -0
  35. data/lib/lato_core/interface/communication.rb +104 -0
  36. data/lib/lato_core/interface/languages.rb +60 -0
  37. data/lib/lato_core/interface/navigation.rb +109 -0
  38. data/lib/lato_core/interface/session.rb +71 -0
  39. data/lib/lato_core/interface/superusers.rb +143 -0
  40. data/lib/tasks/lato_core_tasks.rake +11 -0
  41. data/test/controllers/lato_core/api/v1/api_controller_test.rb +9 -0
  42. data/test/controllers/lato_core/application_controller_test.rb +9 -0
  43. data/test/controllers/lato_core/back/authentication_controller_test.rb +13 -0
  44. data/test/controllers/lato_core/back/back_controller_test.rb +9 -0
  45. data/test/controllers/lato_core/back/session_controller_test.rb +13 -0
  46. data/test/controllers/lato_core/back/superusers_controller_test.rb +13 -0
  47. data/test/dummy/README.rdoc +28 -0
  48. data/test/dummy/Rakefile +6 -0
  49. data/test/dummy/app/assets/javascripts/application.js +13 -0
  50. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  51. data/test/dummy/app/controllers/application_controller.rb +5 -0
  52. data/test/dummy/app/helpers/application_helper.rb +2 -0
  53. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  54. data/test/dummy/bin/bundle +3 -0
  55. data/test/dummy/bin/rails +4 -0
  56. data/test/dummy/bin/rake +4 -0
  57. data/test/dummy/bin/setup +29 -0
  58. data/test/dummy/config.ru +4 -0
  59. data/test/dummy/config/application.rb +25 -0
  60. data/test/dummy/config/boot.rb +5 -0
  61. data/test/dummy/config/database.yml +25 -0
  62. data/test/dummy/config/environment.rb +5 -0
  63. data/test/dummy/config/environments/development.rb +41 -0
  64. data/test/dummy/config/environments/production.rb +79 -0
  65. data/test/dummy/config/environments/test.rb +42 -0
  66. data/test/dummy/config/initializers/assets.rb +11 -0
  67. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  68. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  69. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/test/dummy/config/initializers/inflections.rb +16 -0
  71. data/test/dummy/config/initializers/mime_types.rb +4 -0
  72. data/test/dummy/config/initializers/session_store.rb +3 -0
  73. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  74. data/test/dummy/config/locales/en.yml +23 -0
  75. data/test/dummy/config/routes.rb +4 -0
  76. data/test/dummy/config/secrets.yml +22 -0
  77. data/test/dummy/log/test.log +0 -0
  78. data/test/dummy/public/404.html +67 -0
  79. data/test/dummy/public/422.html +67 -0
  80. data/test/dummy/public/500.html +66 -0
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/fixtures/lato_core/superusers.yml +11 -0
  83. data/test/integration/navigation_test.rb +8 -0
  84. data/test/lato_core_test.rb +7 -0
  85. data/test/mailers/lato_core/lato_core_mailer_test.rb +9 -0
  86. data/test/mailers/previews/lato_core/lato_core_mailer_preview.rb +6 -0
  87. data/test/models/lato_core/superuser_test.rb +9 -0
  88. data/test/test_helper.rb +21 -0
  89. metadata +207 -0
@@ -0,0 +1,42 @@
1
+
2
+ <div class="main-content login">
3
+ <% # Stampa i flash ricevuti dai controller %>
4
+ <%= render 'lato_view/layout/flash' %>
5
+
6
+ <ul class="bg-bubbles">
7
+ <li></li>
8
+ <li></li>
9
+ <li></li>
10
+ <li></li>
11
+ <li></li>
12
+ <li></li>
13
+ <li></li>
14
+ <li></li>
15
+ <li></li>
16
+ <li></li>
17
+ </ul>
18
+
19
+ <!-- Blocco Login Utente -->
20
+ <div class="content-login">
21
+ <% if(login_logo = view_getLoginLogo) %>
22
+ <div class="login-logo"><%= image_tag login_logo %></div>
23
+ <% end %>
24
+ <%= form_tag(lato_core.exec_login_path, method: "post", class: 'lato-form') do %>
25
+ <%=raw view(:input).new(type: 'text',
26
+ name: 'username',
27
+ label: CORE_LANG['vocabolary']['username']) %>
28
+
29
+ <%=raw view(:input).new(type: 'password',
30
+ name: 'password',
31
+ label: CORE_LANG['vocabolary']['password']) %>
32
+
33
+ <%= submit_tag("Login", class: 'lato-button') %>
34
+
35
+ <% if core_getRecoveryPasswordPermission %>
36
+ <%= link_to CORE_LANG['vocabolary']['password_forget'], lato_core.password_forget_path, class: 'link-password-forget' %>
37
+ <% end %>
38
+
39
+ <% end %>
40
+ </div>
41
+
42
+ </div>
@@ -0,0 +1,50 @@
1
+ <% block = view(:block).new(width: 'large-4', custom_class: 'flying-block') %>
2
+
3
+ <div class="main-content login">
4
+ <% # Stampa i flash ricevuti dai controller %>
5
+ <%= render 'lato_view/layout/flash' %>
6
+
7
+ <ul class="bg-bubbles">
8
+ <li></li>
9
+ <li></li>
10
+ <li></li>
11
+ <li></li>
12
+ <li></li>
13
+ <li></li>
14
+ <li></li>
15
+ <li></li>
16
+ <li></li>
17
+ <li></li>
18
+ </ul>
19
+
20
+ <!-- Blocco recupero password -->
21
+ <div class="content-login">
22
+ <p class="recover-guide"><%= CORE_LANG['recover_password']['recover_guide_psw'] %></p>
23
+
24
+ <%= form_tag(lato_core.password_update_path, method: "post", class: 'lato-form') do %>
25
+
26
+ <%=raw view(:input).new(type: 'password',
27
+ value: '',
28
+ name: 'password',
29
+ label: CORE_LANG['vocabolary']['password'],
30
+ width: 'large',
31
+ required: true) %>
32
+
33
+ <%=raw view(:input).new(type: 'password',
34
+ value: '',
35
+ name: 'password_confirmation',
36
+ label: CORE_LANG['vocabolary']['password_confirmation'],
37
+ width: 'large',
38
+ custom_class: 'confirm-password',
39
+ required: true) %>
40
+
41
+
42
+ <input type="hidden" value="<%= @user.id %>" name="id">
43
+ <input type="hidden" value="<%= @user.session_code %>" name="token">
44
+
45
+ <%= submit_tag(CORE_LANG['vocabolary']['send'], class: 'lato-button') %>
46
+
47
+ <% end %>
48
+ </div>
49
+
50
+ </div>
@@ -0,0 +1,37 @@
1
+ <% block = view(:block).new(width: 'large-4', custom_class: 'flying-block') %>
2
+
3
+ <div class="main-content login">
4
+ <% # Stampa i flash ricevuti dai controller %>
5
+ <%= render 'lato_view/layout/flash' %>
6
+
7
+ <ul class="bg-bubbles">
8
+ <li></li>
9
+ <li></li>
10
+ <li></li>
11
+ <li></li>
12
+ <li></li>
13
+ <li></li>
14
+ <li></li>
15
+ <li></li>
16
+ <li></li>
17
+ <li></li>
18
+ </ul>
19
+
20
+ <!-- Blocco recupero password -->
21
+ <div class="content-login">
22
+ <p class="recover-guide"><%= CORE_LANG['recover_password']['recover_guide'] %></p>
23
+
24
+ <%= form_tag(lato_core.password_recover_path, method: "post", class: 'lato-form') do %>
25
+
26
+ <%=raw view(:input).new(type: 'email',
27
+ name: 'email',
28
+ label: CORE_LANG['vocabolary']['email']) %>
29
+
30
+ <%= submit_tag(CORE_LANG['vocabolary']['send'], class: 'lato-button') %>
31
+
32
+ <%= link_to CORE_LANG['vocabolary']['login'], lato_core.login_path, class: 'link-back-login' %>
33
+
34
+ <% end %>
35
+ </div>
36
+
37
+ </div>
@@ -0,0 +1,20 @@
1
+ <%
2
+
3
+ # Definisco blocco principale
4
+ block = view(:block).new()
5
+
6
+ # Definisco actionbar
7
+ actionbar = view(:actionbar).new(title: CORE_LANG['vocabolary']['dashboard'])
8
+
9
+ %>
10
+
11
+ <%=raw actionbar %>
12
+
13
+ <div class="content-row">
14
+ <%=raw block.open(width: 'medium-12 large-6') %>
15
+
16
+ <p><b><%= CORE_LANG['welcome'] %></b></p>
17
+ <p><%= CORE_LANG['dashboard'] %></p>
18
+
19
+ <%=raw block.close %>
20
+ </div>
@@ -0,0 +1,12 @@
1
+ <% block = view(:block).new %>
2
+
3
+ <%= raw view(:actionbar).new(title: "#{CORE_LANG['vocabolary']['edit']} #{@superuser.username}",
4
+ links: [[CORE_LANG['vocabolary']['users'], lato_core.superusers_path]]) %>
5
+
6
+ <div class="content-row">
7
+ <%= raw block.open %>
8
+
9
+ <%= render 'lato_core/back/superusers/shared/form', method: 'put' %>
10
+
11
+ <%= raw block.close %>
12
+ </div>
@@ -0,0 +1,25 @@
1
+ <% block = view(:block).new %>
2
+
3
+ <% searchbar = view(:searchbar).new(elements: @search_superusers,
4
+ url: lato_core.superusers_path,
5
+ filter: :username_cont,
6
+ style: :rounded) %>
7
+
8
+ <%=raw view(:actionbar).new(links: [[CORE_LANG['vocabolary']['new'], lato_core.new_superuser_path]],
9
+ title: CORE_LANG['vocabolary']['users'],
10
+ widgets: [[searchbar, :right]]) %>
11
+
12
+ <div class="content-row">
13
+ <%=raw block.open %>
14
+
15
+
16
+ <%=raw view(:index).new(head: [CORE_LANG['vocabolary']['username'], CORE_LANG['vocabolary']['email']],
17
+ elements: @superusers,
18
+ attributes: ['username', 'email'],
19
+ link: lato_core.superusers_path,
20
+ show_link: false) %>
21
+
22
+ <%= will_paginate @superusers %>
23
+
24
+ <%=raw block.close %>
25
+ </div>
@@ -0,0 +1,12 @@
1
+ <% block = view(:block).new %>
2
+
3
+ <%=raw view(:actionbar).new(title: CORE_LANG['vocabolary']['new'],
4
+ links: [[CORE_LANG['vocabolary']['users'], lato_core.superusers_path]]) %>
5
+
6
+ <div class="content-row">
7
+ <%=raw block.open %>
8
+
9
+ <%= render 'lato_core/back/superusers/shared/form', method: 'post' %>
10
+
11
+ <%=raw block.close %>
12
+ </div>
@@ -0,0 +1,71 @@
1
+ <% method = 'post' if !defined? method %>
2
+
3
+ <%= form_for(@superuser, html: {class: "lato-form"}, method: method) do |f| %>
4
+
5
+ <h2 class="form-section-title"><%= CORE_LANG['forms']['base_informations'] %></h2>
6
+
7
+ <div class="form-group">
8
+
9
+ <%=raw view(:input, :text).new(value: @superuser.name, name: 'superuser[name]', label: CORE_LANG['vocabolary']['name'], width: 'half', required: true) %>
10
+
11
+ <%=raw view(:input).new(type: 'text',
12
+ value: @superuser.username,
13
+ name: 'superuser[username]',
14
+ label: CORE_LANG['vocabolary']['username'],
15
+ width: 'half',
16
+ required: true) %>
17
+
18
+ </div>
19
+
20
+ <div class="form-group">
21
+
22
+ <%=raw view(:input).new(type: 'email',
23
+ value: @superuser.email,
24
+ name: 'superuser[email]',
25
+ label: CORE_LANG['vocabolary']['email'],
26
+ width: 'half',
27
+ custom_class: 'email-suggestion',
28
+ required: true) %>
29
+
30
+ <%=raw view(:input).new(type: 'select',
31
+ value: @superuser.permission,
32
+ name: 'superuser[permission]',
33
+ label: CORE_LANG['vocabolary']['permission'],
34
+ width: 'half',
35
+ options: core_getUsersPermissions,
36
+ required: true) %>
37
+
38
+ </div>
39
+
40
+ <h2 class="form-section-title"><%= CORE_LANG['forms']['user_password'] %></h2>
41
+ <% if(method === 'put') %>
42
+ <p class="form-secondary-info"><%= CORE_LANG['forms']['password_edit_settings'] %></p>
43
+ <% end %>
44
+
45
+ <div class="form-group">
46
+
47
+ <%
48
+ password_require = true
49
+ password_require = false if(method === 'put')
50
+ %>
51
+
52
+ <%=raw view(:input).new(type: 'password',
53
+ value: @superuser.password,
54
+ name: 'superuser[password]',
55
+ label: CORE_LANG['vocabolary']['password'],
56
+ width: 'half',
57
+ required: password_require) %>
58
+
59
+ <%=raw view(:input).new(type: 'password',
60
+ value: @superuser.password,
61
+ name: 'superuser[password_confirmation]',
62
+ label: CORE_LANG['vocabolary']['password_confirmation'],
63
+ width: 'half',
64
+ custom_class: 'confirm-password',
65
+ required: password_require) %>
66
+
67
+ </div>
68
+
69
+ <%= f.submit CORE_LANG['vocabolary']['save'], class: 'lato-button' %>
70
+
71
+ <% end %>
@@ -0,0 +1 @@
1
+ <% controller.redirect_to lato_core.superusers_path %>
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
5
+ </head>
6
+ <body>
7
+ <%= yield %>
8
+ </body>
9
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,2 @@
1
+ <h1><%=raw @title %></h1>
2
+ <div><%=raw @message %></div>
@@ -0,0 +1,4 @@
1
+ <h1><%= core_getApplicationName %></h1>
2
+ <h2><%= CORE_LANG['recover_password']['email_intestation'] %></h2>
3
+ <p><%= CORE_LANG['recover_password']['email_guide'] %></p>
4
+ <p><a href="<%= @recover_url %>"><%= @recover_url %></a></p>
data/config/config.yml ADDED
@@ -0,0 +1,8 @@
1
+ # Impostazione voci del menu
2
+ menu:
3
+ core_superusers:
4
+ name: Admin
5
+ url: /lato/core/superusers
6
+ icon: users
7
+ position: 99
8
+ permission: 6
@@ -0,0 +1,66 @@
1
+ # Basic informations
2
+ # -----------------------------------------------------------------------------
3
+ # Please, set a correct value for these informations
4
+
5
+ # Set the application name.
6
+ # Application name is used for lots of settings.
7
+
8
+ app_name: Lato
9
+
10
+ # Set languages used by the applications (if it has more languages).
11
+
12
+ languages: it
13
+
14
+ # Set application root url (default 'localhost').
15
+
16
+ root_url: http://localhost:3000
17
+
18
+ # Set the application service email.
19
+ # Service email is used for email options on Lato like user notifications or
20
+ # password revocery.
21
+
22
+ service_email: service@lato.com
23
+
24
+ # Usage informations
25
+ # -----------------------------------------------------------------------------
26
+
27
+ # Add custom voices to the sidebar.
28
+ # Custom voices are sections on sidebar used for the navigation inside the Lato panel.
29
+
30
+ # menu:
31
+ # example:
32
+ # name: Menu voice
33
+ # url: "/"
34
+ # icon: home
35
+ # position: 1
36
+ # permission: 0
37
+
38
+ # Set custom page after login
39
+ # This is the welcome page that user see after a correct login.
40
+
41
+ # login_home: "/example"
42
+
43
+ # Users settings
44
+ # -----------------------------------------------------------------------------
45
+
46
+ # Hide users with permission value to users with others permission value
47
+ # You can hide users on users section. For example '1 to 2' means that users with
48
+ # permission 2 can not see the names of users with permission 1 on the users list.
49
+
50
+ # hide_users: 1 to 2, 4 to 6
51
+
52
+ # Rename users permission from number to text value on users form.
53
+ # You can set a custom name to users permissions. For example '1 - Client'
54
+ # means that you read 'Client' instead of 1 on the permissions input on the user form.
55
+
56
+ # rename_users_permissions: 1 - Client, 5 - Operator
57
+
58
+ # Hide users permissions on users form.
59
+ # You can set that users can not see these values on the permissions input on
60
+ # the user form.
61
+
62
+ # hide_users_permissions: 2, 3, 4
63
+
64
+ # Permit users to use the recovery password section if they loose their password.
65
+
66
+ # recovery_password: false
@@ -0,0 +1,16 @@
1
+ include LatoCore::Interface
2
+
3
+ # IMPOSTAZIONE VARIABILE PER ACCESSO ALLE LINGUE
4
+
5
+ CORE_LANG = core_loadModuleLanguages('lato_core')
6
+
7
+ # CREAZIONE UTENTE AMMINISTRATORE
8
+
9
+ if ActiveRecord::Base.connection.table_exists? 'lato_core_superusers'
10
+
11
+ LatoCore::Superuser.create(name: 'Admin', username: 'lato',
12
+ email: 'lato@mail.com', permission: 10,
13
+ password: 'password',
14
+ password_confirmation: 'password')
15
+
16
+ end
@@ -0,0 +1,50 @@
1
+ include LatoCore::Interface
2
+
3
+ # Insieme di variabili globali che mantengono dati altrimenti
4
+ # memorizzati in file yaml.
5
+ # Solitamente contengono la lettura del file di configurazione.
6
+ # Cambiare l'ordine in cui sono inserite potrebbe compromettere il corretto
7
+ # funzionamento del modulo.
8
+
9
+ # IMPOSTAZIONE VOCI DI NAVIGAZIONE
10
+ # Contiene la lista di voci di navigazione di lato
11
+ CORE_NAVIGATION = core_getNavbarItems
12
+
13
+ # IMPOSTAZIONE NOME APPLICAZIONE
14
+ # Contiene il nome dell'applicazione
15
+ CORE_APPNAME = core_getApplicationName
16
+
17
+ # IMPOSTAZIONE URL APPLICAZIONE
18
+ # Cotiene l'url base del progetto
19
+ CORE_APPURL = core_getApplicationURL
20
+
21
+ # IMPOSTAZIONE ROOT PANNELLO GESTIONALE
22
+ # Contiene l'url della pagina di benvenuto custom
23
+ CORE_APPLOGINROOT = core_getApplicationLoginRoot
24
+
25
+ # IMPOSTAZIONE LINGUE DELL'APPLICAZIONE
26
+ # Continene la lista delle lingue dell'applicazione gestita con lato
27
+ CORE_APPLANGUAGES = core_getApplicationLanguages
28
+
29
+ # IMPOSTAZIONE INDIRIZZO EMAIL DI SERVIZIO
30
+ # Contiene l'indirizzo email usato cdi default come mittente del mailer
31
+ CORE_APPSERVICEMAIL = core_getApplicationServiceEmail
32
+
33
+ # IMPOSTAZIONE DATI SU UTENTI NASCOSTI
34
+ # Contiene la lista di permessi utente che rappresentano gli utenti da non
35
+ # mostrare nella pagina users.
36
+ CORE_SUPERUSERSHIDESETTINGS = core_getHideUsersSettings
37
+
38
+ # IMPOSTAZIONE PERMESSI UTENTE DA NASCONDERE ALL'UTENTE
39
+ # Contiene la lista di permessi utente da non mostrare nel form di creazione/modifica
40
+ # utenti
41
+ CORE_SUPERUSERSPERMISSIONSHIDESETTINGS = core_getHideUsersPermissionsSettings
42
+
43
+ # IMPOSTAZIONE NOMI DEI PERMESSI UTENTE
44
+ # Contiene la lista di traduzioni da numero permesso utente a valore testuale
45
+ CORE_SUPERUSERSPERMISSIONSNAMESSETTINGS = core_getUsersPermissionsNamesSettings
46
+
47
+ # IMPOSTAZIONI VISUALIZZAZIONE SEZIONE RECUPERO PASSWORD
48
+ # Contiene un valore booleano indicante se e' possibile o meno utilizzare il
49
+ # recupero password per gli utenti
50
+ CORE_RECOVERYPASSWORDPERMISSION = core_getRecoveryPasswordPermission