thecore_ui_commons 2.1.8 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/thecore_ui_commons/thecore.js +1 -3
- data/app/assets/stylesheets/thecore_ui_commons/thecore.scss +4 -0
- data/app/views/devise/sessions/new.html.erb +8 -10
- data/app/views/layouts/thecore.html.erb +2 -2
- data/config/initializers/charts_helper.rb +45 -0
- data/config/initializers/thecore_ui_commons_application_config.rb +3 -0
- data/{lib/helpers → config/initializers}/thecore_ui_commons_helper.rb +3 -1
- data/config/locales/en.yml +43 -27
- data/config/locales/it.yml +5 -0
- data/db/migrate/20200515070620_add_username_to_user.rb +39 -0
- data/lib/concerns/thecore_ui_commons_user.rb +2 -1
- data/lib/thecore_ui_commons.rb +6 -1
- data/lib/thecore_ui_commons/engine.rb +0 -5
- data/lib/thecore_ui_commons/version.rb +1 -1
- metadata +35 -7
- data/db/migrate/20190920115550_create_action_text_tables.action_text.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e4ef3e895b0a8a8245042531114171c1a721e60a7fba2ad98cbebc8531a2938
|
4
|
+
data.tar.gz: 6e742cc4502f25b3de6d78c49ad831066843d70d013f76f15e98e1f9984947a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2807aa12180045e572799d89a286dd9bb51f344855f286ed05a87135367f92228c0193a58c4b68bdfb5c76c887373b6fb174058ac6c0ca095fdab63b26a3154
|
7
|
+
data.tar.gz: ab43258f4bfcde3a1d4f01a8d6da881d13dd0d0c3ac720c3f6f20468c239a3a7f2993660913d9b5075012636ab8a601247d4d1a25c37113e0d31aaf35180f445
|
@@ -1,26 +1,24 @@
|
|
1
1
|
<div class="col-md-4 col-md-offset-4">
|
2
2
|
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
3
3
|
<div class="field">
|
4
|
-
<%= f.
|
5
|
-
<%= f.text_field :login, autofocus: true, :class => "form-control" %>
|
4
|
+
<%= f.text_field :login, autofocus: true, :class => "form-control", placeholder: t("devise.sessions.new.login") %>
|
6
5
|
</div>
|
7
6
|
|
8
7
|
<div class="field">
|
9
|
-
<%= f.
|
10
|
-
<%= f.password_field :password, autocomplete: "off", :class => "form-control" %>
|
8
|
+
<%= f.password_field :password, autocomplete: "off", :class => "form-control", placeholder: t("devise.sessions.new.password") %>
|
11
9
|
</div>
|
12
10
|
|
13
11
|
<% if devise_mapping.rememberable? -%>
|
14
|
-
<div class="
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
<div class="form-check">
|
13
|
+
<%= f.check_box :remember_me, class: "form-check-input" %>
|
14
|
+
<label class="form-check-label" for="defaultCheck1">
|
15
|
+
<%=t "activerecord.attributes.user.remember_me" %>
|
16
|
+
</label>
|
19
17
|
</div>
|
20
18
|
<% end -%>
|
21
19
|
|
22
20
|
<div class="actions">
|
23
|
-
<%= f.submit t("devise.sessions.new.sign_in"), :
|
21
|
+
<%= f.submit t("devise.sessions.new.sign_in"), class: "btn" %>
|
24
22
|
|
25
23
|
<%= render "devise/shared/links" %>
|
26
24
|
</div>
|
@@ -12,8 +12,8 @@
|
|
12
12
|
|
13
13
|
<%# Getting all the assets needed by thecore from all the gems %>
|
14
14
|
<%= get_asset_tags_for("thecore")%>
|
15
|
-
<%= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track' => true) if
|
16
|
-
<%= javascript_include_tag('application', 'data-turbolinks-track' => true) if
|
15
|
+
<%= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track' => true) if (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)).find_asset("application.css")%>
|
16
|
+
<%= javascript_include_tag('application', 'data-turbolinks-track' => true) if (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)).find_asset("application.js") %>
|
17
17
|
|
18
18
|
<%= favicon_link_tag 'apple-touch-icon.png', rel: 'apple-touch-icon', sizes: "180x180" %>
|
19
19
|
<%= favicon_link_tag 'favicon-32x32.png', rel: 'icon', sizes: "32x32" %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'date'
|
2
|
+
module Helpers
|
3
|
+
module ChartsHelper
|
4
|
+
def candlestick_data
|
5
|
+
@acc = rand(6570..6650)
|
6
|
+
60.times.map {|i| [Date.today - 60 + i, ohlc] }.to_h
|
7
|
+
end
|
8
|
+
|
9
|
+
def ohlc
|
10
|
+
open = @acc + rand(-20..20)
|
11
|
+
high = open + rand(0..100)
|
12
|
+
low = open - rand(0..100)
|
13
|
+
@acc = close = open + rand(-((high-low)/3)..((high-low)/2))
|
14
|
+
[open, high, low, close]
|
15
|
+
end
|
16
|
+
|
17
|
+
### HIGH PRIORITY CHARTS
|
18
|
+
def charts_high_pie_demo
|
19
|
+
pie_chart([{name: "Series A", data: 25},{name: "Series B", data: 100},{name: "Series C", data: 200},{name: "Series D", data: 125}], legend: "left")
|
20
|
+
end
|
21
|
+
|
22
|
+
def charts_high_candlestick_demo
|
23
|
+
candlestick_options = {plot_options: {candlestick: {colors: {upward: '#3C90EB',downward: '#DF7D46'}}}}
|
24
|
+
candlestick_chart(candlestick_data, candlestick_options)
|
25
|
+
end
|
26
|
+
|
27
|
+
### MEDIUM PRIORITY CHARTS
|
28
|
+
def charts_medium_radar_demo
|
29
|
+
radar_series = [{name: "What it should be",data: { "Code review"=>10, "Issues"=>5, "Pull request"=>25, "Commits"=>60 }},{name: "What it really is",data: { "Code review"=>1, "Issues"=>3, "Pull request"=>7, "Commits"=>89 }}]
|
30
|
+
radar_chart(radar_series,{title: "GitHub Radar", markers: {size: 4}, theme: 'palette4'})
|
31
|
+
end
|
32
|
+
|
33
|
+
def charts_medium_bubble_demo
|
34
|
+
bubble_series = (1..4).map do |n|{name: "Bubble#{n}",data: 20.times.map{[rand(750),rand(10..60),rand(70)]}}end
|
35
|
+
bubble_chart(bubble_series, data_labels: false, theme: 'palette6')
|
36
|
+
end
|
37
|
+
|
38
|
+
def charts_medium_range_demo
|
39
|
+
range_bar_series = [{name: "Series A",data: {'A' => [1, 5],'B' => [4, 6],'C' => [5, 8],'D' => [3, 11]}}, {name: "Series B",data: {'A' => [2, 6],'B' => [1, 3],'C' => [7, 8],'D' => [5, 9]}}]
|
40
|
+
range_bar_chart(range_bar_series, theme: 'palette3')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
ActiveSupport.on_load(:action_view) { include Helpers::ChartsHelper }
|
@@ -18,6 +18,9 @@ Rails.application.configure do
|
|
18
18
|
config.assets.precompile += %w( thecore_ui_commons/thecore.css )
|
19
19
|
# Very important, needed for trix (i.e.)
|
20
20
|
config.assets.paths << root.join('node_modules')
|
21
|
+
# To store D3 Data
|
22
|
+
# https://medium.com/@hguotblog/use-d3-js-for-data-visualisation-with-rails-69b4f030e366
|
23
|
+
config.assets.paths << root.join('data')
|
21
24
|
# Putting also a reference on the assets foldes in the paths, so to have the
|
22
25
|
# stylesheet and javascript hack work proprly in layout
|
23
26
|
# config.assets.paths <<
|
data/config/locales/en.yml
CHANGED
@@ -1,33 +1,49 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
1
|
en:
|
23
|
-
current_user: Current
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
2
|
+
current_user: Current User
|
3
|
+
devise:
|
4
|
+
sessions:
|
5
|
+
new:
|
6
|
+
login: Login
|
7
|
+
password: Password
|
8
|
+
hello: Hello World
|
9
|
+
dashboard: Dashboard
|
10
|
+
contact: Help us
|
11
|
+
manage: Manage
|
12
|
+
sign_out: Sign Out
|
13
|
+
advanced: Advanced
|
14
|
+
main_records: Registries
|
15
|
+
errors:
|
16
|
+
messages:
|
17
|
+
invalid: Invalid characters
|
18
|
+
tiered_times:
|
19
|
+
dd:
|
20
|
+
zero: "0 Days"
|
21
|
+
one: "%{count} Day"
|
22
|
+
other: "%{count} Days"
|
23
|
+
hh:
|
24
|
+
zero: "0 Hours"
|
25
|
+
one: "%{count} Hour"
|
26
|
+
other: "%{count} Hours"
|
27
|
+
mm:
|
28
|
+
zero: "0 Minutes"
|
29
|
+
one: "%{count} Minute"
|
30
|
+
other: "%{count} Minutes"
|
31
|
+
ss:
|
32
|
+
zero: "0 Seconds"
|
33
|
+
one: "%{count} Second"
|
34
|
+
other: "%{count} Seconds"
|
29
35
|
admin:
|
30
36
|
links:
|
31
37
|
label: Links
|
38
|
+
tools:
|
39
|
+
label: Tools
|
32
40
|
settings:
|
41
|
+
label: Settings
|
33
42
|
advanced: Advanced
|
43
|
+
registries: Registries
|
44
|
+
operations: Operations
|
45
|
+
actions:
|
46
|
+
charts:
|
47
|
+
menu: Analisys
|
48
|
+
title: Charts
|
49
|
+
breadcrumb: Charts
|
data/config/locales/it.yml
CHANGED
@@ -1,4 +1,43 @@
|
|
1
1
|
class AddUsernameToUser < ActiveRecord::Migration[6.0]
|
2
|
+
class User < ApplicationRecord
|
3
|
+
# Include default devise modules. Others available are:
|
4
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
5
|
+
devise :database_authenticatable, :trackable, :validatable
|
6
|
+
# TODO: If it works, these must be added to another gem one which deal
|
7
|
+
# more with sessions
|
8
|
+
# devise :database_authenticatable
|
9
|
+
# devise :rememberable
|
10
|
+
# devise :trackable
|
11
|
+
# devise :validatable
|
12
|
+
# devise :timeoutable, timeout_in: 30.minutes
|
13
|
+
# REFERENCES
|
14
|
+
has_many :role_users, dependent: :destroy, inverse_of: :user
|
15
|
+
has_many :roles, through: :role_users, inverse_of: :users
|
16
|
+
# VALIDATIONS
|
17
|
+
validates :email, uniqueness: { case_sensitive: false }, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i }
|
18
|
+
validates :password, presence: true, on: :create
|
19
|
+
validates :password_confirmation, presence: true, on: :create
|
20
|
+
validate :check_password_and_confirmation_equal
|
21
|
+
validates_each :admin do |record, attr, value|
|
22
|
+
# Don't want admin == false if the current user is the only admin
|
23
|
+
record.errors.add(attr, I18n.t("validation.errors.cannot_unadmin_last_admin")) if record.admin_changed? && record.admin_was == true && User.where(admin: true).count == 1
|
24
|
+
end
|
25
|
+
|
26
|
+
def display_name
|
27
|
+
email
|
28
|
+
end
|
29
|
+
|
30
|
+
def has_role? role
|
31
|
+
roles.include? role
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def check_password_and_confirmation_equal
|
37
|
+
errors.add(:password, I18n.t("validation.errors.password_and_confirm_must_be_the_same")) unless password == password_confirmation
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
2
41
|
def change
|
3
42
|
add_column :users, :username, :string
|
4
43
|
add_index :users, :username
|
@@ -5,6 +5,8 @@ module ThecoreUiCommonsUser
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
devise :database_authenticatable, :trackable, :validatable, :rememberable, :timeoutable, timeout_in: 30.minutes, authentication_keys: [:login]
|
8
|
+
validates :username, uniqueness: { case_sensitive: false }, presence: true, length: { in: 4..15 }
|
9
|
+
validates_format_of :username, with: /\A[a-zA-Z0-9]*\z/, on: :create, message: "can only contain letters and digits"
|
8
10
|
|
9
11
|
attr_writer :login
|
10
12
|
|
@@ -13,7 +15,6 @@ module ThecoreUiCommonsUser
|
|
13
15
|
end
|
14
16
|
# Use login
|
15
17
|
def self.find_first_by_auth_conditions(warden_conditions)
|
16
|
-
puts "################################ VIENE USATO? #####################################################"
|
17
18
|
conditions = warden_conditions.dup
|
18
19
|
if login = conditions.delete(:login)
|
19
20
|
where(conditions.to_h).where(["lower(username) = :value OR lower(email) = :value", { :value => login.downcase }]).first
|
data/lib/thecore_ui_commons.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require 'thecore_background_jobs' # This brings backend commons also.
|
2
2
|
# Rails
|
3
3
|
require 'serviceworker-rails'
|
4
|
+
require "groupdate"
|
5
|
+
require "apexcharts"
|
4
6
|
|
5
7
|
require 'concerns/thecore_ui_commons_user'
|
6
8
|
|
9
|
+
# require 'helpers/thecore_ui_commons_helper'
|
10
|
+
# require 'helpers/charts_helper'
|
11
|
+
|
7
12
|
require "thecore_ui_commons/engine"
|
8
13
|
|
9
14
|
module ThecoreUiCommons
|
@@ -1,10 +1,5 @@
|
|
1
|
-
require 'helpers/thecore_ui_commons_helper'
|
2
1
|
module ThecoreUiCommons
|
3
2
|
class Engine < ::Rails::Engine
|
4
|
-
initializer "thecore_ui_commons.view_helpers" do
|
5
|
-
ActiveSupport.on_load(:action_view) { include Helpers::ThecoreUiCommonsHelper }
|
6
|
-
end
|
7
|
-
|
8
3
|
initializer 'thecore_ui_commons.add_to_migrations' do |app|
|
9
4
|
unless app.root.to_s.match root.to_s
|
10
5
|
# APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_ui_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.13
|
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-
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: thecore_background_jobs
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: serviceworker-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: groupdate
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: apexcharts
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
41
69
|
description: Engine to serve configurations and rails module useful for all the UIs.
|
42
70
|
email:
|
43
71
|
- gabriele.tassoni@gmail.com
|
@@ -97,7 +125,9 @@ files:
|
|
97
125
|
- app/views/layouts/mailer.html.erb
|
98
126
|
- app/views/layouts/mailer.text.erb
|
99
127
|
- app/views/layouts/thecore.html.erb
|
128
|
+
- config/initializers/charts_helper.rb
|
100
129
|
- config/initializers/thecore_ui_commons_application_config.rb
|
130
|
+
- config/initializers/thecore_ui_commons_helper.rb
|
101
131
|
- config/locales/en.ra_settings.yml
|
102
132
|
- config/locales/en.simple_form.yml
|
103
133
|
- config/locales/en.yml
|
@@ -105,11 +135,9 @@ files:
|
|
105
135
|
- config/locales/it.simple_form.yml
|
106
136
|
- config/locales/it.yml
|
107
137
|
- config/routes.rb
|
108
|
-
- db/migrate/20190920115550_create_action_text_tables.action_text.rb
|
109
138
|
- db/migrate/20200515070620_add_username_to_user.rb
|
110
139
|
- db/migrate/20200515132932_add_rememberable_to_user.rb
|
111
140
|
- lib/concerns/thecore_ui_commons_user.rb
|
112
|
-
- lib/helpers/thecore_ui_commons_helper.rb
|
113
141
|
- lib/tasks/thecore_ui_commons_tasks.rake
|
114
142
|
- lib/thecore_ui_commons.rb
|
115
143
|
- lib/thecore_ui_commons/engine.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# This migration comes from action_text (originally 20180528164100)
|
2
|
-
class CreateActionTextTables < ActiveRecord::Migration[6.0]
|
3
|
-
def change
|
4
|
-
create_table :action_text_rich_texts do |t|
|
5
|
-
t.string :name, null: false
|
6
|
-
t.text :body, size: :long
|
7
|
-
t.references :record, null: false, polymorphic: true, index: false
|
8
|
-
|
9
|
-
t.timestamps
|
10
|
-
|
11
|
-
t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|