symphonia 3.4.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -4
- data/CHANGELOG.md +27 -0
- data/README.md +16 -0
- data/app/assets/stylesheets/symphonia/_font_awesome.scss +29 -0
- data/app/assets/stylesheets/symphonia/_layout.scss +40 -0
- data/app/assets/stylesheets/symphonia/basic.scss +2 -35
- data/app/assets/stylesheets/symphonia/symphonia_bootstrap.scss +1 -46
- data/app/controllers/symphonia/accounts_controller.rb +5 -5
- data/app/controllers/symphonia/admin_controller.rb +1 -4
- data/app/helpers/symphonia/application_helper.rb +2 -2
- data/app/views/layouts/symphonia/application.html.erb +2 -2
- data/app/views/symphonia/admin/index.html.erb +1 -11
- data/db/migrate/20130714140501_create_roles.rb +6 -4
- data/db/migrate/20200428180001_add_uuid_to_users.rb +4 -2
- data/db/migrate/20210509141420_roles_change_permissions_to_json.rb +18 -0
- data/db/migrate/20210509180525_roles_change_permissions_to_native_json.rb +7 -0
- data/lib/generators/symphonia/setup/setup_generator.rb +17 -14
- data/lib/generators/symphonia/setup/templates/{settings.rb → app/config/initializers/settings.rb.tt} +0 -0
- data/lib/generators/symphonia/setup/templates/config/initializers/symphonia.rb.tt +48 -0
- data/lib/generators/symphonia/setup/templates/{404.html → public/404.html.tt} +4 -4
- data/lib/generators/symphonia/setup/templates/{500.html → public/500.html.tt} +0 -11
- data/lib/generators/symphonia/setup/templates/{spec_helper.rb → spec/spec_helper.rb.tt} +3 -2
- data/lib/symphonia/action_cable/connection.rb +5 -7
- data/lib/symphonia/admin_constraint.rb +3 -1
- data/lib/symphonia/model_attributes/attribute.rb +30 -14
- data/lib/symphonia/model_filters/base.rb +13 -15
- data/lib/symphonia/model_filters/boolean_filter.rb +10 -11
- data/lib/symphonia/model_filters/date_filter.rb +32 -31
- data/lib/symphonia/model_filters/integer_filter.rb +4 -5
- data/lib/symphonia/model_filters/select_filter.rb +19 -17
- data/lib/symphonia/model_filters/string_filter.rb +4 -5
- data/lib/symphonia/query.rb +10 -34
- data/lib/symphonia/query_columns/attribute_column.rb +59 -5
- data/lib/symphonia/query_columns.rb +1 -2
- data/lib/symphonia/spec_helper.rb +5 -3
- data/lib/symphonia/user_management.rb +0 -1
- data/lib/symphonia/version.rb +3 -1
- data/lib/symphonia.rb +4 -1
- data/spec/controllers/account_controller_spec.rb +66 -69
- data/spec/controllers/admin_controller_spec.rb +24 -25
- data/spec/libs/some_lib_spec.rb +1 -1
- data/spec/rails_helper.rb +4 -3
- data/spec/spec_helper.rb +3 -8
- metadata +69 -167
- data/app/models/symphonia/admin_module.rb +0 -18
- data/app/views/symphonia/filters/table.html.erb +0 -21
- data/db/migrate/20130828175114_create_attachments.rb +0 -20
- data/db/migrate/20141213204351_create_admin_modules.rb +0 -20
- data/lib/symphonia/query_columns/generic_column.rb +0 -165
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37c5df664c5d4a4e23242972efcb37a44a97b0000c943aba8ff68ac7ebd4d2ec
|
4
|
+
data.tar.gz: 1636c08f1a1aa674319a19172cf0291d5fa910a9930056f8598ac96b7bf65937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2716c183798fd2acc14702ac79d44f4f210e4d4b770c6670ff78267c2ada056d3c331229371f02a66ca32d7496618a65972b1405860aace5fd7fc433161b94b
|
7
|
+
data.tar.gz: dbeff2e27c22f063183e6eecd395ba895cf8c6986841281d1914f2e3997ee4a833fd3e78c7a38dca24e49041083f3398a876ea8a4bd476b11ec57cf9830c1734
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rails
|
3
|
+
- rubocop-rspec
|
4
|
+
|
1
5
|
AllCops:
|
2
6
|
TargetRubyVersion: 2.5
|
7
|
+
NewCops: enable
|
3
8
|
|
4
9
|
Layout/EmptyLinesAroundClassBody:
|
5
10
|
EnforcedStyle: empty_lines_special
|
@@ -12,15 +17,13 @@ Metrics/AbcSize:
|
|
12
17
|
Enabled: false
|
13
18
|
Metrics/BlockLength:
|
14
19
|
Enabled: false
|
15
|
-
#Metrics/LineLength:
|
16
|
-
# Enabled: false
|
17
20
|
Metrics/MethodLength:
|
18
21
|
Enabled: false
|
19
22
|
|
20
|
-
#Style/BracesAroundHashParameters:
|
21
|
-
# EnforcedStyle: context_dependent
|
22
23
|
Style/Documentation:
|
23
24
|
Enabled: false
|
25
|
+
Style/FrozenStringLiteralComment:
|
26
|
+
Enabled: false
|
24
27
|
Style/MutableConstant:
|
25
28
|
Enabled: false
|
26
29
|
Style/NegatedIf:
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
|
+
## [4.1.1] - 2021-12-26
|
9
|
+
### Fixed
|
10
|
+
- user activation
|
11
|
+
## [4.1.0] - 2021-10-23
|
12
|
+
### Fixed
|
13
|
+
- missing default settings template in generator:setup
|
14
|
+
### Added
|
15
|
+
- rubocop-rails
|
16
|
+
- rubocop-rspec
|
17
|
+
### Removed
|
18
|
+
- mini_racer
|
19
|
+
### Changed
|
20
|
+
- split SASS files
|
21
|
+
|
22
|
+
## [4.0.0] - 2021-05-18
|
23
|
+
### Removed
|
24
|
+
- development dependency in gemspec replaced by `symphonia_spec` gem
|
25
|
+
- GenericColumn in Query
|
26
|
+
- AdminModule class/table = its not used, its not working
|
27
|
+
### Changed
|
28
|
+
- Rails 6.1 support
|
29
|
+
- Query#to_params boolean argument to named
|
30
|
+
- update generators
|
31
|
+
- use native JSON columns instead of serializations
|
32
|
+
### Added
|
33
|
+
- Gemfile.lock
|
34
|
+
|
8
35
|
## [3.4.0] - 2021-03-22
|
9
36
|
### Changed
|
10
37
|
- upgrade authlogic to 6.4.1 (rails6.1 compatible)
|
data/README.md
CHANGED
@@ -14,3 +14,19 @@ after `bundle install` run post-installation: `rails g symphonia:setup`
|
|
14
14
|
> Setup prepare `config/initializers/settings.rb`, create `spec/spec_helper.rb`, add stylesheets and javascripts references and copy basic layout.
|
15
15
|
|
16
16
|
|
17
|
+
## Upgrade to v4.0
|
18
|
+
1. update Gemfile:
|
19
|
+
```ruby
|
20
|
+
gem 'rails', '~> 6.1'
|
21
|
+
gem 'symphonia', '~> 4.0'
|
22
|
+
source "https://gems.luk4s.cz" do
|
23
|
+
gem 'symphonia_spec', group: %i[development test]
|
24
|
+
end
|
25
|
+
```
|
26
|
+
And `bundle update`
|
27
|
+
2. upgrade rails:
|
28
|
+
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
29
|
+
```bash
|
30
|
+
export THOR_MERGE=vimdiff
|
31
|
+
rails app:update
|
32
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
@import 'font-awesome';
|
2
|
+
/* Font awesome aliases */
|
3
|
+
.fa-add {
|
4
|
+
@extend .fa-plus-circle !optional;
|
5
|
+
}
|
6
|
+
.fa-delete, .fa-del {
|
7
|
+
@extend .fa-trash-o !optional;
|
8
|
+
}
|
9
|
+
.fa-back {
|
10
|
+
@extend .fa-chevron-left !optional;
|
11
|
+
}
|
12
|
+
.fa-true {
|
13
|
+
@extend .fa-check !optional;
|
14
|
+
}
|
15
|
+
.fa-false {
|
16
|
+
@extend .fa-times !optional;
|
17
|
+
}
|
18
|
+
.fa-notice {
|
19
|
+
@extend .fa-check-circle !optional;
|
20
|
+
}
|
21
|
+
.fa-error {
|
22
|
+
@extend .fa-times-circle !optional;
|
23
|
+
}
|
24
|
+
.alert .fa-info {
|
25
|
+
@extend .fa-info-circle !optional;
|
26
|
+
}
|
27
|
+
[class^="fa-"]:before:hover, a[class*=" fa-"]:before:hover {
|
28
|
+
text-decoration: none
|
29
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@import "bootstrap";
|
2
|
+
|
3
|
+
// fixed navbar
|
4
|
+
body > .container {
|
5
|
+
padding-top: 80px;
|
6
|
+
}
|
7
|
+
|
8
|
+
@media print {
|
9
|
+
body > .container {
|
10
|
+
padding-top: 0 !important;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
footer.footer {
|
15
|
+
height: 40px;
|
16
|
+
line-height: 40px;
|
17
|
+
bottom: 0;
|
18
|
+
width: 100%;
|
19
|
+
}
|
20
|
+
|
21
|
+
@keyframes highlight {
|
22
|
+
from {
|
23
|
+
background-color: map-get($theme-colors, warning);
|
24
|
+
}
|
25
|
+
to {
|
26
|
+
background-color: inherit;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
@media print {
|
31
|
+
.contextual {
|
32
|
+
@extend .d-print-none;
|
33
|
+
}
|
34
|
+
a[href]:after {
|
35
|
+
content: none
|
36
|
+
}
|
37
|
+
.btn {
|
38
|
+
@extend .d-print-none;
|
39
|
+
}
|
40
|
+
}
|
@@ -1,37 +1,5 @@
|
|
1
|
-
@import
|
2
|
-
/* Font awesome aliases */
|
3
|
-
.fa-add {
|
4
|
-
//@extend .fa-plus-circle:before;
|
5
|
-
@extend .fa-plus-circle !optional;
|
6
|
-
}
|
7
|
-
.fa-delete, .fa-del {
|
8
|
-
@extend .fa-trash-o !optional;
|
9
|
-
}
|
10
|
-
.fa-back {
|
11
|
-
@extend .fa-chevron-left !optional;
|
12
|
-
}
|
13
|
-
.fa-true {
|
14
|
-
@extend .fa-check !optional;
|
15
|
-
}
|
16
|
-
.fa-false {
|
17
|
-
@extend .fa-times !optional;
|
18
|
-
}
|
1
|
+
@import "_font_awesome";
|
19
2
|
|
20
|
-
.fa-notice {
|
21
|
-
@extend .fa-check-circle !optional;
|
22
|
-
}
|
23
|
-
.fa-error {
|
24
|
-
@extend .fa-times-circle !optional;
|
25
|
-
}
|
26
|
-
.alert .fa-info {
|
27
|
-
@extend .fa-info-circle !optional;
|
28
|
-
}
|
29
|
-
[class^="fa-"]:before, [class*=" fa-"]:before {
|
30
|
-
//padding-right: 5px;
|
31
|
-
}
|
32
|
-
[class^="fa-"]:before:hover, a[class*=" fa-"]:before:hover {
|
33
|
-
text-decoration: none
|
34
|
-
}
|
35
3
|
.page-header.title, .page-header.title h1 {
|
36
4
|
margin-top: 0;
|
37
5
|
}
|
@@ -40,7 +8,6 @@
|
|
40
8
|
}
|
41
9
|
.reorder, .reorder label {
|
42
10
|
cursor: move;
|
43
|
-
cursor: -webkit-grabbing;
|
44
11
|
}
|
45
12
|
|
46
13
|
.flash {
|
@@ -217,4 +184,4 @@ table.table {
|
|
217
184
|
.sortable-ghost {
|
218
185
|
//border: 2px solid black;
|
219
186
|
box-shadow: inset 0 0 5px #000000;
|
220
|
-
}
|
187
|
+
}
|
@@ -1,47 +1,2 @@
|
|
1
|
-
|
2
|
-
// *= require rails_bootstrap_forms
|
3
|
-
// *= require bootstrap-datepicker3
|
4
|
-
//@import "bootstrap-sprockets";
|
5
|
-
|
6
|
-
@import "bootstrap";
|
1
|
+
@import "layout";
|
7
2
|
@import "bootstrap-datepicker3";
|
8
|
-
|
9
|
-
|
10
|
-
// fixed navbar
|
11
|
-
body > .container {
|
12
|
-
padding-top: 80px;
|
13
|
-
}
|
14
|
-
|
15
|
-
@media print {
|
16
|
-
body > .container {
|
17
|
-
padding-top: 0 !important;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
footer.footer {
|
22
|
-
height: 40px;
|
23
|
-
line-height: 40px;
|
24
|
-
bottom: 0;
|
25
|
-
width: 100%;
|
26
|
-
}
|
27
|
-
|
28
|
-
@keyframes highlight {
|
29
|
-
from {
|
30
|
-
background-color: map-get($theme-colors, warning);
|
31
|
-
}
|
32
|
-
to {
|
33
|
-
background-color: inherit;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
@media print {
|
38
|
-
.contextual {
|
39
|
-
@extend .d-print-none;
|
40
|
-
}
|
41
|
-
a[href]:after {
|
42
|
-
content: none
|
43
|
-
}
|
44
|
-
.btn {
|
45
|
-
@extend .d-print-none;
|
46
|
-
}
|
47
|
-
}
|
@@ -32,7 +32,7 @@ module Symphonia
|
|
32
32
|
if @user.valid? && verify_registration && @user.save(validate: false)
|
33
33
|
Notifier.activation_user(@user).deliver_later
|
34
34
|
Notifier.user_registered(@user).deliver_later
|
35
|
-
format.html { redirect_to
|
35
|
+
format.html { redirect_to login_path, notice: t(:text_user_registered) }
|
36
36
|
format.json { render status: :created }
|
37
37
|
else
|
38
38
|
format.html { render action: 'register' }
|
@@ -71,14 +71,14 @@ module Symphonia
|
|
71
71
|
@user = find_account_by_mail(params.require(:email))
|
72
72
|
if @user
|
73
73
|
if @user.active?
|
74
|
-
redirect_to
|
74
|
+
redirect_to login_path, flash: { error: t(:text_user_alerady_active) }
|
75
75
|
else
|
76
76
|
@user.reset_perishable_token!
|
77
77
|
Notifier.activation_user(@user).deliver_later
|
78
|
-
redirect_to
|
78
|
+
redirect_to login_path, notice: t(:text_activation_resend)
|
79
79
|
end
|
80
80
|
else
|
81
|
-
redirect_to
|
81
|
+
redirect_to login_path, flash: { error: t(:text_user_not_found) }
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -88,7 +88,7 @@ module Symphonia
|
|
88
88
|
@user.activate!
|
89
89
|
redirect_to login_path, notice: t(:text_activation_success)
|
90
90
|
else
|
91
|
-
redirect_to
|
91
|
+
redirect_to login_path, flash: { error: t(:text_user_not_found_or_token_invalid) }
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -3,9 +3,6 @@ module Symphonia
|
|
3
3
|
before_action :login_require
|
4
4
|
|
5
5
|
def index
|
6
|
-
@admin_modules = AdminModule.where(user_id: [nil, current_user.id]).order(:position).all
|
7
|
-
@modules_count = @admin_modules.count
|
8
|
-
|
9
6
|
respond_to do |format|
|
10
7
|
format.html
|
11
8
|
end
|
@@ -19,4 +16,4 @@ module Symphonia
|
|
19
16
|
|
20
17
|
end
|
21
18
|
|
22
|
-
end
|
19
|
+
end
|
@@ -28,7 +28,7 @@ module Symphonia
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
s.html_safe
|
32
32
|
end
|
33
33
|
|
34
34
|
def render_menu(menu, options = {})
|
@@ -38,7 +38,7 @@ module Symphonia
|
|
38
38
|
end
|
39
39
|
options[:container_class] ||= 'mr-auto'
|
40
40
|
|
41
|
-
|
41
|
+
content_tag(:ul, s.html_safe, itemscope: '', itemtype: 'http://schema.org/BreadcrumbList', class: "navbar-nav #{options[:container_class]}", id: menu.to_s)
|
42
42
|
end
|
43
43
|
|
44
44
|
def render_menu_node(menu, item, options = {})
|
@@ -5,9 +5,9 @@
|
|
5
5
|
<title><%= html_title %></title>
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
7
|
<%= yield :meta_tags %>
|
8
|
-
<%= stylesheet_link_tag 'application', :
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': true %>
|
9
9
|
<%= yield :stylesheet_tags %>
|
10
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track'
|
10
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': true %>
|
11
11
|
<script type="text/javascript">
|
12
12
|
Symphonia.routes.reorderImagesPath = '<%= symphonia.reorder_attachment_path %>';
|
13
13
|
</script>
|
@@ -1,15 +1,5 @@
|
|
1
1
|
<%= title 'Administrace' %>
|
2
|
-
<% @admin_modules.each_with_index do |admin_module, _index| %>
|
3
|
-
<div class="col-lg-<%= @modules_count == 1 ? '12' : '6' %>" id="<%= dom_id(admin_module) %>">
|
4
|
-
<h3><%= t(admin_module.title, scope: [:admin_module, :titles], default: admin_module.title) %></h3>
|
5
|
-
<% if admin_module.body_path.is_a?(Symbol) %>
|
6
|
-
<%= render(partial: "admin_modules/#{admin_module.body_path}", locals: { admin_module: admin_module }) -%>
|
7
|
-
<% else %>
|
8
|
-
<%= format_text(admin_module.body_path) -%>
|
9
|
-
<% end -%>
|
10
|
-
</div>
|
11
|
-
<% end -%>
|
12
2
|
|
13
3
|
<%= content_for :meta_tags do %>
|
14
4
|
<meta name="turbolinks-root" content="/admin">
|
15
|
-
<% end %>
|
5
|
+
<% end %>
|
@@ -1,10 +1,11 @@
|
|
1
|
-
class CreateRoles < ActiveRecord::Migration[
|
1
|
+
class CreateRoles < ActiveRecord::Migration[6.1]
|
2
|
+
|
2
3
|
def up
|
3
4
|
create_table :roles do |t|
|
4
|
-
t.string
|
5
|
-
t.text
|
5
|
+
t.string :name, null: false
|
6
|
+
t.text :description, null: true
|
6
7
|
|
7
|
-
t.text
|
8
|
+
t.text :permissions
|
8
9
|
|
9
10
|
t.timestamps
|
10
11
|
end
|
@@ -13,4 +14,5 @@ class CreateRoles < ActiveRecord::Migration[5.1]
|
|
13
14
|
def down
|
14
15
|
drop_table :roles
|
15
16
|
end
|
17
|
+
|
16
18
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class AddUuidToUsers < ActiveRecord::Migration[6.0]
|
2
|
+
|
2
3
|
def change
|
3
|
-
uuid_type = connection.adapter_name =~ /PostgreSQL/i ? :uuid : :string
|
4
|
-
add_column :users, :uuid,
|
4
|
+
# uuid_type = connection.adapter_name =~ /PostgreSQL/i ? :uuid : :string
|
5
|
+
add_column :users, :uuid, :uuid
|
5
6
|
end
|
7
|
+
|
6
8
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class RolesChangePermissionsToJson < ActiveRecord::Migration[6.1]
|
2
|
+
|
3
|
+
def up
|
4
|
+
say_with_time "Convert 'roles.permissions' YAML to JSON" do
|
5
|
+
i = 0
|
6
|
+
Symphonia::Role.where.not(permissions: nil).each do |role|
|
7
|
+
yaml = product.read_attribute_before_type_cast :permissions
|
8
|
+
next unless yaml.start_with? "---"
|
9
|
+
|
10
|
+
role.update_columns permissions: YAML.safe_load(yaml)
|
11
|
+
i += 1
|
12
|
+
end
|
13
|
+
|
14
|
+
i
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -2,17 +2,16 @@ require 'rails/generators'
|
|
2
2
|
|
3
3
|
module Symphonia
|
4
4
|
class SetupGenerator < Rails::Generators::Base
|
5
|
-
# include Rails::Generators::Migration
|
6
5
|
|
7
6
|
source_root File.expand_path('templates', __dir__)
|
8
7
|
|
9
8
|
def create_settings
|
10
|
-
|
9
|
+
template 'config/initializers/symphonia.rb'
|
11
10
|
end
|
12
11
|
|
13
12
|
def copy_static
|
14
|
-
|
15
|
-
|
13
|
+
template 'public/404.html'
|
14
|
+
template 'public/500.html'
|
16
15
|
end
|
17
16
|
|
18
17
|
def copy_assets
|
@@ -22,16 +21,14 @@ module Symphonia
|
|
22
21
|
end
|
23
22
|
|
24
23
|
def copy_rspec
|
25
|
-
|
24
|
+
template 'spec/spec_helper.rb'
|
26
25
|
|
27
26
|
create_file '.rspec' do
|
28
|
-
|
29
|
-
'--format documentation'
|
27
|
+
"--require spec_helper"
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
33
31
|
def copy_setup_file
|
34
|
-
|
35
32
|
copy_file 'base_layout.html.erb', 'app/views/layouts/application.html.erb'
|
36
33
|
|
37
34
|
append_to_file 'db/seeds.rb', 'Symphonia::Engine.load_seed'
|
@@ -40,14 +37,20 @@ module Symphonia
|
|
40
37
|
inject_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do
|
41
38
|
" mount Symphonia::Engine => '/'"
|
42
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def rubocop
|
43
|
+
create_file '.rubocop.yml' do
|
44
|
+
"inherit_gem:\n symphonia: .rubocop.yml"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def setup_gemfile
|
49
|
+
append_to_file 'Gemfile' do
|
50
|
+
"gem 'symphonia_spec', source: 'https://gems.luk4s.cz', group: %w[development test]"
|
51
|
+
end
|
43
52
|
|
44
53
|
end
|
45
54
|
|
46
|
-
# def setup_gemfile
|
47
|
-
# append_to_file 'Gemfile' do
|
48
|
-
# File.read(File.join(File.dirname(__FILE__), 'templates/Gemfile'))
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# end
|
52
55
|
end
|
53
56
|
end
|
data/lib/generators/symphonia/setup/templates/{settings.rb → app/config/initializers/settings.rb.tt}
RENAMED
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Symphonia.configure do |config|
|
2
|
+
config.after_login_path = ->(h) { h.symphonia.user_current_path }
|
3
|
+
config.allow_registrations = false
|
4
|
+
config.default_locale = :cs
|
5
|
+
end
|
6
|
+
|
7
|
+
# Symphonia::MenuManager.map :top_menu do |m|
|
8
|
+
# m[:home] = {
|
9
|
+
# label: :label_home,
|
10
|
+
# icon: 'fa fa-home',
|
11
|
+
# url: '/'
|
12
|
+
# }
|
13
|
+
# m[:users] = {
|
14
|
+
# label: :label_users,
|
15
|
+
# icon: 'fa fa-user',
|
16
|
+
# url: ->(h) { h.symphonia.users_path },
|
17
|
+
# if: proc { Symphonia::User.current.admin? }
|
18
|
+
# }
|
19
|
+
# m[:roles] = {
|
20
|
+
# label: :label_roles,
|
21
|
+
# icon: 'fa fa-key',
|
22
|
+
# url: ->(h) { h.symphonia.roles_path },
|
23
|
+
# if: proc { Symphonia::User.current.admin? }
|
24
|
+
# }
|
25
|
+
#
|
26
|
+
# end
|
27
|
+
# Symphonia::MenuManager.map :top_menu_account do |m|
|
28
|
+
# # -----
|
29
|
+
# m[:my_account] = {
|
30
|
+
# label: :label_my_account,
|
31
|
+
# icon: 'fa fa-wrench',
|
32
|
+
# url: ->(h) { h.symphonia.account_path },
|
33
|
+
# if: proc { Symphonia::User.current.logged_in? }
|
34
|
+
# }
|
35
|
+
# m[:logout] = {
|
36
|
+
# label: :button_logout,
|
37
|
+
# icon: 'fa fa-sign-out',
|
38
|
+
# url: ->(h) { h.symphonia.logout_path },
|
39
|
+
# method: 'delete',
|
40
|
+
# if: proc { Symphonia::User.current.logged_in? }
|
41
|
+
# }
|
42
|
+
# m[:login] = {
|
43
|
+
# label: :button_login,
|
44
|
+
# icon: 'fa fa-signin',
|
45
|
+
# url: ->(h) { h.symphonia.login_path },
|
46
|
+
# if: proc { !Symphonia::User.current.logged_in? }
|
47
|
+
# }
|
48
|
+
# end
|
@@ -3,13 +3,13 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8">
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>404
|
7
|
-
<link rel="stylesheet" href="//
|
8
|
-
<link rel="stylesheet" href="
|
6
|
+
<title>404 Stránka nenalezena</title>
|
7
|
+
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
|
8
|
+
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
9
9
|
</head>
|
10
10
|
|
11
11
|
<body>
|
12
|
-
<!-- This file lives in public/
|
12
|
+
<!-- This file lives in public/404.html -->
|
13
13
|
<br />
|
14
14
|
<div class="rows">
|
15
15
|
<p class="col-sm-6 col-md-3">
|
@@ -21,17 +21,6 @@
|
|
21
21
|
<p>
|
22
22
|
Při zpracování požadavku došlo k vnitřní chybě serveru. Kontaktujte prosím administrátora.
|
23
23
|
</p>
|
24
|
-
<ul class="fa-ul">
|
25
|
-
<li>
|
26
|
-
<h3>Lukáš Pokorný</h3>
|
27
|
-
</li>
|
28
|
-
<li>
|
29
|
-
<i class="fa fa-li fa fa-envelope"></i>e-mail: <a href="mailto:admin@lagrace.cz">admin@lagrace.cz</a>
|
30
|
-
</li>
|
31
|
-
<li>
|
32
|
-
<i class="fa fa-li fa fa-mobile-phone"></i>tel: 604484983
|
33
|
-
</li>
|
34
|
-
</ul>
|
35
24
|
</div>
|
36
25
|
</div>
|
37
26
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
ENV['RAILS_ENV'] ||= 'test'
|
2
|
-
|
2
|
+
require_relative '../../config/environment'
|
3
3
|
# Prevent database truncation if the environment is production
|
4
4
|
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
5
5
|
|
6
6
|
# require 'symphonia'
|
7
7
|
RSpec.configure do |config|
|
8
|
-
Dir.glob(File.join(__dir__, 'support', '*.rb')).each { |f| require f }
|
8
|
+
Dir.glob(File.join(__dir__, 'support', '*.rb')).sort.each { |f| require f }
|
9
9
|
|
10
10
|
require 'symphonia/spec_helper'
|
11
11
|
|
@@ -15,4 +15,5 @@ RSpec.configure do |config|
|
|
15
15
|
|
16
16
|
config.infer_spec_type_from_file_location!
|
17
17
|
config.filter_rails_from_backtrace!
|
18
|
+
config.profile_examples = true
|
18
19
|
end
|
@@ -9,17 +9,15 @@ module Symphonia
|
|
9
9
|
|
10
10
|
def connect
|
11
11
|
self.current_user = find_verified_user_or_guest
|
12
|
-
logger.add_tags 'ActionCable',
|
12
|
+
logger.add_tags 'ActionCable', current_user.login unless current_user.nil?
|
13
13
|
end
|
14
14
|
|
15
15
|
protected
|
16
16
|
|
17
17
|
def find_verified_user_or_guest
|
18
|
-
if (credentials = request.session["symphonia/user_credentials"]).
|
19
|
-
|
20
|
-
|
21
|
-
nil
|
22
|
-
end
|
18
|
+
return if (credentials = request.session["symphonia/user_credentials"]).blank?
|
19
|
+
|
20
|
+
::Symphonia::User.find_by(persistence_token: credentials.split(':')[0])
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
@@ -28,4 +26,4 @@ module Symphonia
|
|
28
26
|
|
29
27
|
end
|
30
28
|
end
|
31
|
-
end
|
29
|
+
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Symphonia
|
2
2
|
class AdminConstraint
|
3
|
+
|
3
4
|
def matches?(request)
|
4
5
|
return false if (credentials = request.session["symphonia/user_credentials"]).blank?
|
5
6
|
|
6
7
|
user = User.find_by_persistence_token(credentials.split(':')[0])
|
7
8
|
user&.admin?
|
8
9
|
end
|
10
|
+
|
9
11
|
end
|
10
|
-
end
|
12
|
+
end
|