thecore_ui_commons 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/trix/LICENSE +20 -0
  3. data/app/assets/config/trix/README.md +395 -0
  4. data/app/assets/config/trix/dist/trix-core.js +12 -0
  5. data/app/assets/config/trix/dist/trix.css +374 -0
  6. data/app/assets/config/trix/dist/trix.js +21 -0
  7. data/app/assets/config/trix/package.json +29 -0
  8. data/app/assets/images/android-chrome-192x192.png +0 -0
  9. data/app/assets/images/android-chrome-512x512.png +0 -0
  10. data/app/assets/images/apple-touch-icon.png +0 -0
  11. data/app/assets/images/favicon-16x16.png +0 -0
  12. data/app/assets/images/favicon-32x32.png +0 -0
  13. data/app/assets/images/favicon.ico +0 -0
  14. data/app/assets/images/logo.png +0 -0
  15. data/app/assets/images/mstile-150x150.png +0 -0
  16. data/app/assets/images/safari-pinned-tab.svg +1042 -0
  17. data/app/assets/images/up-arrow.png +0 -0
  18. data/app/assets/javascripts/browserconfig.xml +9 -0
  19. data/app/assets/javascripts/ie.js +19 -0
  20. data/app/assets/javascripts/manifest.json +20 -0
  21. data/app/assets/javascripts/pages.coffee +3 -0
  22. data/app/assets/javascripts/thecore.js +20 -0
  23. data/app/assets/javascripts/timer.js +135 -0
  24. data/app/assets/stylesheets/{thecore_ui_commons/actiontext.scss → actiontext.scss} +19 -20
  25. data/app/assets/stylesheets/thecore.scss +18 -0
  26. data/app/views/contact_mailer/contact_message.html.erb +5 -0
  27. data/app/views/devise/confirmations/new.html.erb +16 -0
  28. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  29. data/app/views/devise/mailer/password_change.html.erb +5 -0
  30. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  31. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  32. data/app/views/devise/menu/_login_items.html.erb +7 -0
  33. data/app/views/devise/passwords/edit.html.erb +25 -0
  34. data/app/views/devise/passwords/new.html.erb +18 -0
  35. data/app/views/devise/registrations/edit.html.erb +45 -0
  36. data/app/views/devise/registrations/new.html.erb +29 -0
  37. data/app/views/devise/sessions/new.html.erb +28 -0
  38. data/app/views/devise/shared/_links.html.erb +25 -0
  39. data/app/views/devise/unlocks/new.html.erb +16 -0
  40. data/app/views/kaminari/_first_page.html.erb +3 -0
  41. data/app/views/kaminari/_gap.html.erb +3 -0
  42. data/app/views/kaminari/_last_page.html.erb +3 -0
  43. data/app/views/kaminari/_next_page.html.erb +3 -0
  44. data/app/views/kaminari/_page.html.erb +9 -0
  45. data/app/views/kaminari/_paginator.html.erb +15 -0
  46. data/app/views/kaminari/_prev_page.html.erb +3 -0
  47. data/app/views/layouts/_footer.html.erb +3 -0
  48. data/app/views/layouts/_messages.html.erb +9 -0
  49. data/app/views/layouts/_navigation.html.erb +20 -0
  50. data/app/views/layouts/_navigation_links.html.erb +7 -0
  51. data/app/views/layouts/mailer.html.erb +6 -0
  52. data/app/views/layouts/mailer.text.erb +1 -0
  53. data/app/views/layouts/thecore.html.erb +42 -0
  54. data/app/views/shared/_flash.html.erb +10 -0
  55. data/config/initializers/thecore_ui_commons_application_config.rb +4 -3
  56. data/db/migrate/20200515070620_add_username_to_user.rb +11 -0
  57. data/db/migrate/20200515132932_add_rememberable_to_user.rb +5 -0
  58. data/lib/concerns/thecore_ui_commons_user.rb +10 -0
  59. data/lib/thecore_ui_commons/version.rb +1 -1
  60. data/lib/thecore_ui_commons.rb +4 -2
  61. metadata +58 -4
  62. data/app/controllers/pages_controller.rb +0 -43
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to t("devise.sessions.new.sign_in"), new_session_path(resource_name), :class => "btn btn-success" %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to t("devise.registrations.new.sign_up"), new_registration_path(resource_name), :class => "btn btn-success" %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+ <%= link_to t("devise.passwords.new.forgot_your_password"), new_password_path(resource_name), :class => "btn btn-success" %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to t("devise.shared.links.didn_t_receive_confirmation_instructions"), new_confirmation_path(resource_name), :class => "btn btn-success" %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to t("devise.shared.links.didn_t_receive_unlock_instructions"), new_unlock_path(resource_name), :class => "btn btn-success" %><br />
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to t("devise.shared.links.sign_in_with_provider", provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), :class => "btn btn-success" %><br />
24
+ <% end -%>
25
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <h2><%=t("devise.unlocks.new.resend_unlock_instructions")%></h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit <%=t("devise.unlocks.new.resend_unlock_instructions")%> %>
13
+
14
+ <%= render "devise/shared/links" %>
15
+ </div>
16
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li class='disabled'>
2
+ <%= content_tag :a, raw(t 'views.pagination.truncate') %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
3
+ </li>
@@ -0,0 +1,9 @@
1
+ <% if page.current? %>
2
+ <li class='active'>
3
+ <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
4
+ </li>
5
+ <% else %>
6
+ <li>
7
+ <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
8
+ </li>
9
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <%= paginator.render do -%>
2
+ <ul class="pagination">
3
+ <%= first_page_tag unless current_page.first? %>
4
+ <%= prev_page_tag unless current_page.first? %>
5
+ <% each_page do |page| -%>
6
+ <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
7
+ <%= page_tag page %>
8
+ <% elsif !page.was_truncated? -%>
9
+ <%= gap_tag %>
10
+ <% end -%>
11
+ <% end -%>
12
+ <%= next_page_tag unless current_page.last? %>
13
+ <%= last_page_tag unless current_page.last? %>
14
+ </ul>
15
+ <% end -%>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <!-- Arrow to workaround the problem, on android default browser, of input fields being hidden by keyboard /-->
2
+
3
+ <img src="<%= image_url('up-arrow.png') %>" class="img-responsive" id="up-arrow"/>
@@ -0,0 +1,9 @@
1
+ <%# Rails flash messages styled for Bootstrap 3.0 %>
2
+ <% flash.each do |name, msg| %>
3
+ <% if msg.is_a?(String) %>
4
+ <div class="alert alert-<%= name == "notice" ? "success" : "danger" %>">
5
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
6
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
7
+ </div>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <nav class="navbar navbar-inverse">
2
+ <div class="container">
3
+ <div class="navbar-header">
4
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
5
+ <span class="sr-only">Toggle navigation</span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ </button>
10
+ <% if user_signed_in? %>
11
+ <%= link_to t(:dashboard), inside_path, class: 'navbar-brand' %>
12
+ <%end%>
13
+ </div>
14
+ <div class="collapse navbar-collapse">
15
+ <ul class="nav navbar-nav">
16
+ <%= render 'layouts/navigation_links' %>
17
+ </ul>
18
+ </div>
19
+ </div>
20
+ </nav>
@@ -0,0 +1,7 @@
1
+ <% if user_signed_in? %>
2
+ <li><%= link_to t(:contact), contact_path %></li>
3
+
4
+ <li><%= link_to t(:manage), rails_admin_path %></li>
5
+
6
+ <li><%= link_to t(:sign_out), destroy_user_session_path, data:{method: :delete} %></li>
7
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <body style="margin: 0;">
4
+ <%= yield %>
5
+ </body>
6
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%=I18n.locale%>">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="apple-mobile-web-app-capable" content="yes">
6
+
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <title><%= Settings.app_name rescue "Thecore" %></title>
9
+
10
+ <%= tag("link", rel: "manifest", href: asset_path("manifest.json", skip_pipeline: true)) %>
11
+ <meta name="turbolinks-cache-control" content="no-cache">
12
+ <%= stylesheet_link_tag 'thecore', media: 'all', 'data-turbolinks-track' => true %>
13
+ <%= javascript_include_tag 'thecore', 'data-turbolinks-track' => true %>
14
+
15
+ <%= favicon_link_tag 'apple-touch-icon.png', rel: 'apple-touch-icon', sizes: "180x180" %>
16
+ <%= favicon_link_tag 'favicon-32x32.png', rel: 'icon', sizes: "32x32" %>
17
+ <%= favicon_link_tag 'favicon-16x16.png', rel: 'icon', sizes: "16x16" %>
18
+ <%= favicon_link_tag 'safari-pinned-tab.svg', rel: 'mask-icon', color: "#5bbad5" %>
19
+ <meta name="theme-color" content="#3b4e59">
20
+
21
+ <%= csrf_meta_tags %>
22
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
23
+ <!--[if lt IE 9]> <%= javascript_include_tag "ie" %> <![endif]-->
24
+ </head>
25
+ <body>
26
+ <div class="jumbotron vertical-center">
27
+ <div class="container">
28
+ <div class="col-md-4 col-md-offset-4 text-center">
29
+ <img class="main-menu-app-logo" style="width: 25%; max-width: 152px" src="<%= image_url('logo.png') %>"/>
30
+ </div>
31
+ <%- unless flash.empty? %>
32
+ <div class="col-md-4 col-md-offset-4" style="margin-top: 1em;">
33
+ <%= render partial: 'shared/flash' %>
34
+ </div>
35
+ <%-end%>
36
+ <%= yield %>
37
+ </div>
38
+ </div>
39
+
40
+ <%= render 'layouts/footer' %>
41
+ </body>
42
+ </html>
@@ -0,0 +1,10 @@
1
+ <% flash.each do |type, message| %>
2
+ <%-unless [true, "true", :true].include? message%>
3
+ <div class="alert <%= bootstrap_class_for(type) %> fade in" role='alert'>
4
+ <button class="close" data-dismiss="alert">×</button>
5
+ <span class="glyphicon <%= bootstrap_glyphs_icon(type)%>" aria-hidden="true"></span>
6
+ <span class="sr-only"><%= type.capitalize%>:</span>
7
+ <%= message %>
8
+ </div>
9
+ <%-end%>
10
+ <% end %>
@@ -10,11 +10,8 @@ Rails.application.configure do
10
10
  config.assets.precompile += %w( android-chrome-512x512.png )
11
11
  config.assets.precompile += %w( logo.png )
12
12
  config.assets.precompile += %w( up-arrow.png )
13
- # mstile-150x150
14
13
  config.assets.precompile += %w( thecore.js )
15
14
  config.assets.precompile += %w( thecore.css )
16
- # config.assets.precompile += %w( app_logo.png )
17
- # config.assets.precompile += %w( main_app_logo.png )
18
15
  config.assets.precompile += %w( ie.js )
19
16
  config.assets.precompile += %w( manifest.json )
20
17
  config.assets.precompile += %w( browserconfig.xml )
@@ -32,4 +29,8 @@ Rails.application.configure do
32
29
  config.serviceworker.routes.draw do
33
30
  match "/manifest.json"
34
31
  end
32
+
33
+ config.after_initialize do
34
+ User.send(:include, ThecoreUiCommonsUser)
35
+ end
35
36
  end
@@ -0,0 +1,11 @@
1
+ class AddUsernameToUser < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :username, :string
4
+ add_index :users, :username
5
+
6
+ User.all.each do |u|
7
+ u.username = u.email.split("@").first
8
+ u.save!
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddRememberableToUser < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :users, :remember_created_at, :datetime
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require 'active_support/concern'
2
+
3
+ module ThecoreUiCommonsUser
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ devise :rememberable
8
+ devise :timeoutable, timeout_in: 30.minutes
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiCommons
2
- VERSION = '2.1.5'
2
+ VERSION = '2.1.6'
3
3
  end
@@ -1,9 +1,11 @@
1
- require "thecore_ui_commons/engine"
2
-
3
1
  require 'thecore_backend_commons'
4
2
  # Rails
5
3
  require 'serviceworker-rails'
6
4
 
5
+ require 'concerns/thecore_ui_commons_user'
6
+
7
+ require "thecore_ui_commons/engine"
8
+
7
9
  module ThecoreUiCommons
8
10
  # Your code goes here...
9
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-12 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_backend_commons
@@ -49,15 +49,69 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - app/assets/config/thecore_ui_commons_manifest.js
52
- - app/assets/stylesheets/thecore_ui_commons/actiontext.scss
52
+ - app/assets/config/trix/LICENSE
53
+ - app/assets/config/trix/README.md
54
+ - app/assets/config/trix/dist/trix-core.js
55
+ - app/assets/config/trix/dist/trix.css
56
+ - app/assets/config/trix/dist/trix.js
57
+ - app/assets/config/trix/package.json
58
+ - app/assets/images/android-chrome-192x192.png
59
+ - app/assets/images/android-chrome-512x512.png
60
+ - app/assets/images/apple-touch-icon.png
61
+ - app/assets/images/favicon-16x16.png
62
+ - app/assets/images/favicon-32x32.png
63
+ - app/assets/images/favicon.ico
64
+ - app/assets/images/logo.png
65
+ - app/assets/images/mstile-150x150.png
66
+ - app/assets/images/safari-pinned-tab.svg
67
+ - app/assets/images/up-arrow.png
68
+ - app/assets/javascripts/browserconfig.xml
69
+ - app/assets/javascripts/ie.js
70
+ - app/assets/javascripts/manifest.json
71
+ - app/assets/javascripts/pages.coffee
72
+ - app/assets/javascripts/thecore.js
73
+ - app/assets/javascripts/timer.js
74
+ - app/assets/stylesheets/actiontext.scss
75
+ - app/assets/stylesheets/thecore.scss
53
76
  - app/controllers/application_controller.rb
54
- - app/controllers/pages_controller.rb
55
77
  - app/views/active_storage/blobs/_blob.html.erb
78
+ - app/views/contact_mailer/contact_message.html.erb
79
+ - app/views/devise/confirmations/new.html.erb
80
+ - app/views/devise/mailer/confirmation_instructions.html.erb
81
+ - app/views/devise/mailer/password_change.html.erb
82
+ - app/views/devise/mailer/reset_password_instructions.html.erb
83
+ - app/views/devise/mailer/unlock_instructions.html.erb
84
+ - app/views/devise/menu/_login_items.html.erb
85
+ - app/views/devise/passwords/edit.html.erb
86
+ - app/views/devise/passwords/new.html.erb
87
+ - app/views/devise/registrations/edit.html.erb
88
+ - app/views/devise/registrations/new.html.erb
89
+ - app/views/devise/sessions/new.html.erb
90
+ - app/views/devise/shared/_links.html.erb
91
+ - app/views/devise/unlocks/new.html.erb
92
+ - app/views/kaminari/_first_page.html.erb
93
+ - app/views/kaminari/_gap.html.erb
94
+ - app/views/kaminari/_last_page.html.erb
95
+ - app/views/kaminari/_next_page.html.erb
96
+ - app/views/kaminari/_page.html.erb
97
+ - app/views/kaminari/_paginator.html.erb
98
+ - app/views/kaminari/_prev_page.html.erb
99
+ - app/views/layouts/_footer.html.erb
100
+ - app/views/layouts/_messages.html.erb
101
+ - app/views/layouts/_navigation.html.erb
102
+ - app/views/layouts/_navigation_links.html.erb
103
+ - app/views/layouts/mailer.html.erb
104
+ - app/views/layouts/mailer.text.erb
105
+ - app/views/layouts/thecore.html.erb
106
+ - app/views/shared/_flash.html.erb
56
107
  - config/initializers/thecore_ui_commons_application_config.rb
57
108
  - config/locales/en.simple_form.yml
58
109
  - config/locales/it.simple_form.yml
59
110
  - config/routes.rb
60
111
  - db/migrate/20190920115550_create_action_text_tables.action_text.rb
112
+ - db/migrate/20200515070620_add_username_to_user.rb
113
+ - db/migrate/20200515132932_add_rememberable_to_user.rb
114
+ - lib/concerns/thecore_ui_commons_user.rb
61
115
  - lib/tasks/thecore_ui_commons_tasks.rake
62
116
  - lib/thecore_ui_commons.rb
63
117
  - lib/thecore_ui_commons/engine.rb
@@ -1,43 +0,0 @@
1
- class PagesController < ApplicationController
2
- before_action :authenticate_user!, only: [
3
- :inside, :contact
4
- ]
5
-
6
- # So the static link navigation can be set runtime (yes it's an hack
7
- # since I have to set this dynamically at runtime, using a class
8
- # continously re-evaluated)
9
- RailsAdmin.config do |config|
10
- config.navigation_static_label = I18n.t('admin.links.label')
11
- end
12
-
13
- def home
14
- end
15
-
16
- def inside
17
- end
18
-
19
-
20
- def email
21
- @name = params[:name]
22
- @email = params[:email]
23
- @message = params[:message]
24
-
25
- if @name.blank?
26
- flash[:alert] = "Please enter your name before sending your message. Thank you."
27
- render :contact
28
- elsif @email.blank? || @email.scan(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i).size < 1
29
- flash[:alert] = "You must provide a valid email address before sending your message. Thank you."
30
- render :contact
31
- elsif @message.blank? || @message.length < 10
32
- flash[:alert] = "Your message is empty. Requires at least 10 characters. Nothing to send."
33
- render :contact
34
- elsif @message.scan(/<a href=/).size > 0 || @message.scan(/\[url=/).size > 0 || @message.scan(/\[link=/).size > 0 || @message.scan(/http:\/\//).size > 0
35
- flash[:alert] = "You can't send links. Thank you for your understanding."
36
- render :contact
37
- else
38
- ContactMailer.contact_message(@name,@email,@message).deliver_now
39
- redirect_to root_path, notice: "Your message was sent. Thank you."
40
- end
41
- end
42
-
43
- end