mumuki-laboratory 7.0.4 → 7.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_editor.scss +15 -4
- data/app/controllers/concerns/with_authorization.rb +4 -0
- data/app/helpers/breadcrumbs_helper.rb +19 -15
- data/app/helpers/organization_breadcrumbs_helper.rb +24 -0
- data/app/views/book/show.html.erb +4 -0
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/helpers/breadcrumbs_helper_spec.rb +65 -14
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f42f46992e32a1f7dda117eb52cbcfbfcd852c73060eff71aa664f8fb112d533
|
4
|
+
data.tar.gz: 34df1712c6432d8ea9a927a1377ab36075908f5477858de62fecbfcc9de57109
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 699fe650796d10f86a46a1ec905b569acd0b40636f4f4645208ddfa21c3f746e987c2f76fba42027bca4fa0f881263c417b1b55946d976c47f94fde14be4235a
|
7
|
+
data.tar.gz: d5cf2c6626e67b973b3bd65504637aa2baba24d94de8267b0a68b5feedb6859532066c03cc2b03564f4c67ee47b9484447dd6179d8474df870a4fbb2460c5f8d
|
@@ -1,3 +1,8 @@
|
|
1
|
+
$multifile-active-tab-background-color: #FFF;
|
2
|
+
$multifile-inactive-tab-background-color: #F7F7F7;
|
3
|
+
$multifile-active-tab-border-color: #CCCCCC;
|
4
|
+
$multifile-inactive-tab-border-color: #ECF0F1;
|
5
|
+
|
1
6
|
#console {
|
2
7
|
position: relative;
|
3
8
|
}
|
@@ -80,12 +85,15 @@ body.fullscreen {
|
|
80
85
|
justify-content: space-between;
|
81
86
|
align-items: center;
|
82
87
|
margin-bottom: -6px;
|
88
|
+
margin-left: 30px;
|
83
89
|
|
84
90
|
.nav-tabs {
|
85
91
|
display: flex;
|
86
92
|
justify-content: space-between;
|
87
93
|
align-items: center;
|
88
94
|
width: 100%;
|
95
|
+
margin-bottom: 0;
|
96
|
+
z-index: 1;
|
89
97
|
|
90
98
|
li {
|
91
99
|
position: relative;
|
@@ -108,15 +116,18 @@ body.fullscreen {
|
|
108
116
|
}
|
109
117
|
&.active {
|
110
118
|
a {
|
111
|
-
background-color:
|
119
|
+
background-color: $multifile-active-tab-background-color;
|
120
|
+
border: 1px solid $multifile-active-tab-border-color;
|
121
|
+
border-bottom: none;
|
112
122
|
}
|
113
123
|
}
|
114
124
|
&:not(.active) > a {
|
115
|
-
background-color:
|
116
|
-
border: 1px solid
|
125
|
+
background-color: $multifile-inactive-tab-background-color;
|
126
|
+
border: 1px solid $multifile-inactive-tab-border-color;
|
127
|
+
border-bottom: 1px solid $multifile-active-tab-border-color;
|
117
128
|
cursor: pointer;
|
118
129
|
&:hover {
|
119
|
-
background-color:
|
130
|
+
background-color: $multifile-inactive-tab-border-color;
|
120
131
|
}
|
121
132
|
}
|
122
133
|
}
|
@@ -1,27 +1,31 @@
|
|
1
1
|
module BreadcrumbsHelper
|
2
|
-
|
3
2
|
def breadcrumbs(e, extra=nil)
|
4
3
|
breadcrumbs0(e.navigable_name, e, extra, 'last')
|
5
4
|
end
|
6
5
|
|
6
|
+
def header_breadcrumbs(link_for_organization: true)
|
7
|
+
"#{home_breadcrumb} #{organization_breadcrumb(has_link: link_for_organization)}".html_safe
|
8
|
+
end
|
9
|
+
|
7
10
|
def home_breadcrumb
|
8
|
-
"<
|
11
|
+
home = "<i class='da da-mumuki' aria-label=#{t(:home)}></i>".html_safe
|
12
|
+
breadcrumb_item_for_linkable home, mu_home_path, 'brand'
|
9
13
|
end
|
10
14
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def mu_home_path
|
16
|
+
root_path
|
17
|
+
end
|
18
|
+
|
19
|
+
def breadcrumb_item_class(clazz)
|
20
|
+
"class='mu-breadcrumb-list-item #{clazz}'"
|
17
21
|
end
|
18
22
|
|
19
|
-
def
|
20
|
-
"
|
23
|
+
def breadcrumb_list_item(item, clazz='')
|
24
|
+
"<li #{breadcrumb_item_class(clazz)}>#{h item}</li>".html_safe
|
21
25
|
end
|
22
26
|
|
23
|
-
def
|
24
|
-
|
27
|
+
def breadcrumb_item_for_linkable(e, link_path, clazz='')
|
28
|
+
breadcrumb_list_item link_to(e, link_path), clazz
|
25
29
|
end
|
26
30
|
|
27
31
|
private
|
@@ -31,12 +35,12 @@ module BreadcrumbsHelper
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def breadcrumbs0(base, e, extra, last)
|
34
|
-
return "#{breadcrumbs_for_linkable(e)} #{breadcrumb_list_item(
|
38
|
+
return "#{breadcrumbs_for_linkable(e)} #{breadcrumb_list_item(extra, last)}".html_safe if extra
|
35
39
|
|
36
40
|
if e.navigation_end?
|
37
|
-
"#{
|
41
|
+
"#{header_breadcrumbs} #{breadcrumb_list_item(base, last)}".html_safe
|
38
42
|
else
|
39
|
-
"#{breadcrumbs_for_linkable(e.navigable_parent)} #{breadcrumb_list_item(
|
43
|
+
"#{breadcrumbs_for_linkable(e.navigable_parent)} #{breadcrumb_list_item(base, last)}".html_safe
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module OrganizationBreadcrumbsHelper
|
2
|
+
def organization_breadcrumb(has_link: true)
|
3
|
+
clazz = 'last' unless has_link
|
4
|
+
breadcrumb_item_for_linkable(organization_breadcrumb_item_content, root_path, clazz)
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def organization_breadcrumb_item_content(organization=Organization.current)
|
10
|
+
if organization.breadcrumb_image_url.present?
|
11
|
+
breadcrumb_image_for organization
|
12
|
+
else
|
13
|
+
breadcrumb_text_for organization
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def breadcrumb_image_for(organization)
|
18
|
+
image_tag organization.breadcrumb_image_url, class: "da mu-breadcrumb-img"
|
19
|
+
end
|
20
|
+
|
21
|
+
def breadcrumb_text_for(organization)
|
22
|
+
organization.name
|
23
|
+
end
|
24
|
+
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
<%= content_for :breadcrumbs do %>
|
2
|
+
<%= header_breadcrumbs(link_for_organization: false) %>
|
3
|
+
<% end %>
|
4
|
+
|
1
5
|
<div class="col-md-offset-2 col-md-8">
|
2
6
|
<div class="book-header <%= current_user? ? '' : 'logged' %>">
|
3
7
|
<h1>ム mumuki<%= Organization.current.title_suffix %></h1>
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20190724190355) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -237,6 +237,7 @@ ActiveRecord::Schema.define(version: 20190702182407) do
|
|
237
237
|
t.boolean "multifile", default: false
|
238
238
|
t.boolean "layout_shows_loading_content"
|
239
239
|
t.boolean "editor_shows_loading_content"
|
240
|
+
t.boolean "settings", default: false
|
240
241
|
t.index ["name"], name: "index_languages_on_name", unique: true
|
241
242
|
end
|
242
243
|
|
@@ -3,9 +3,14 @@ require 'spec_helper'
|
|
3
3
|
describe BreadcrumbsHelper, organization_workspace: :test do
|
4
4
|
|
5
5
|
helper BreadcrumbsHelper
|
6
|
+
helper OrganizationBreadcrumbsHelper
|
6
7
|
helper LinksHelper
|
7
8
|
helper ERB::Util
|
8
9
|
|
10
|
+
let(:home_breadcrumb_with_link) { "<li class='mu-breadcrumb-list-item brand'><a href=\"#{root_path}\">" }
|
11
|
+
let(:organization_breadcrumb_with_link) { "<li class='mu-breadcrumb-list-item '><a href=\"#{root_path}\">" }
|
12
|
+
let(:organization_breadcrumb_without_link) { "<li class='mu-breadcrumb-list-item last'><a href=\"#{root_path}\">" }
|
13
|
+
|
9
14
|
context 'user' do
|
10
15
|
let(:user) { create(:user, first_name: "Alfonsina", last_name: "Storni") }
|
11
16
|
let(:breadcrumb) { breadcrumbs(user) }
|
@@ -16,7 +21,7 @@ describe BreadcrumbsHelper, organization_workspace: :test do
|
|
16
21
|
context 'exercise' do
|
17
22
|
let(:breadcrumb) { breadcrumbs(exercise) }
|
18
23
|
|
19
|
-
context '
|
24
|
+
context 'in complement' do
|
20
25
|
let!(:complement) { create(:complement, name: 'my guide', exercises: [
|
21
26
|
create(:exercise, name: 'my exercise')
|
22
27
|
]) }
|
@@ -24,29 +29,75 @@ describe BreadcrumbsHelper, organization_workspace: :test do
|
|
24
29
|
|
25
30
|
before { reindex_current_organization! }
|
26
31
|
|
27
|
-
it
|
28
|
-
|
29
|
-
|
32
|
+
it 'breadcrumb goes mumuki / test organization / guide / exercise' do
|
33
|
+
expect(breadcrumb).to include('da da-mumuki')
|
34
|
+
expect(breadcrumb).to include('test')
|
35
|
+
expect(breadcrumb).to include('my guide')
|
36
|
+
expect(breadcrumb).to include('my exercise')
|
37
|
+
expect(breadcrumb).to be_html_safe
|
38
|
+
end
|
30
39
|
|
31
|
-
it
|
32
|
-
|
40
|
+
it 'mumuki, organization and guide have links but exercise does not' do
|
41
|
+
expect(breadcrumb).to include home_breadcrumb_with_link
|
42
|
+
expect(breadcrumb).to include organization_breadcrumb_with_link
|
43
|
+
expect(breadcrumb).to include "<a href=\"/complements/#{complement.id}-my-guide\">my guide</a>"
|
44
|
+
expect(breadcrumb).to include "<li class='mu-breadcrumb-list-item last'>1. my exercise</li>"
|
45
|
+
end
|
33
46
|
end
|
34
47
|
|
35
|
-
context '
|
48
|
+
context 'in chapter' do
|
36
49
|
let!(:chapter) { create(:chapter, name: 'my chapter', lessons: [lesson]) }
|
37
50
|
let(:lesson) { create(:lesson, name: 'my lesson', exercises: [exercise]) }
|
38
51
|
let(:exercise) { create(:exercise, name: 'my exercise') }
|
39
52
|
|
40
53
|
before { reindex_current_organization! }
|
41
54
|
|
42
|
-
it
|
43
|
-
|
44
|
-
|
45
|
-
|
55
|
+
it 'breadcrumb goes mumuki / test organization / chapter / lesson / exercise' do
|
56
|
+
expect(breadcrumb).to include('da da-mumuki')
|
57
|
+
expect(breadcrumb).to include('test')
|
58
|
+
expect(breadcrumb).to include('my chapter')
|
59
|
+
expect(breadcrumb).to include('my lesson')
|
60
|
+
expect(breadcrumb).to include('my exercise')
|
61
|
+
expect(breadcrumb).to be_html_safe
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'mumuki, organization, chapter and lesson have links but exercise does not' do
|
65
|
+
expect(breadcrumb).to include home_breadcrumb_with_link
|
66
|
+
expect(breadcrumb).to include organization_breadcrumb_with_link
|
67
|
+
expect(breadcrumb).to include "<a href=\"/chapters/#{chapter.id}-my-chapter\">my chapter</a>"
|
68
|
+
expect(breadcrumb).to include "<a href=\"/lessons/#{lesson.id}-my-chapter-my-lesson\">1. my lesson</a>"
|
69
|
+
expect(breadcrumb).to include "<li class='mu-breadcrumb-list-item last'>1. my exercise</li>"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'book' do
|
75
|
+
let(:breadcrumb) { header_breadcrumbs(link_for_organization: false) }
|
76
|
+
|
77
|
+
describe 'in organization with text breadcrumb' do
|
78
|
+
it 'breadcrumb goes mumuki / test organization' do
|
79
|
+
expect(breadcrumb).to include('da da-mumuki')
|
80
|
+
expect(breadcrumb).to include('test')
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'mumuki has link but organization does not' do
|
84
|
+
expect(breadcrumb).to include home_breadcrumb_with_link
|
85
|
+
expect(breadcrumb).to include organization_breadcrumb_without_link
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe 'in organization with image breadcrumb' do
|
90
|
+
before { Organization.current.profile = Mumuki::Domain::Organization::Profile.new({breadcrumb_image_url: "organization.jpg"}) }
|
91
|
+
|
92
|
+
it 'breadcrumb goes mumuki / organization logo' do
|
93
|
+
expect(breadcrumb).to include('da da-mumuki')
|
94
|
+
expect(breadcrumb).to_not include('test')
|
95
|
+
end
|
46
96
|
|
47
|
-
it
|
48
|
-
|
49
|
-
|
97
|
+
it 'mumuki has link but organization logo does not' do
|
98
|
+
expect(breadcrumb).to include home_breadcrumb_with_link
|
99
|
+
expect(breadcrumb).to include organization_breadcrumb_without_link
|
100
|
+
end
|
50
101
|
end
|
51
102
|
end
|
52
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-laboratory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -321,6 +321,7 @@ files:
|
|
321
321
|
- app/helpers/messages_helper.rb
|
322
322
|
- app/helpers/multiple_file_editor_helper.rb
|
323
323
|
- app/helpers/open_graph_helper.rb
|
324
|
+
- app/helpers/organization_breadcrumbs_helper.rb
|
324
325
|
- app/helpers/organization_list_helper.rb
|
325
326
|
- app/helpers/page_title_helper.rb
|
326
327
|
- app/helpers/progress_bar_helper.rb
|