Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
4f1f2a34
Commit
4f1f2a34
authored
Sep 19, 2016
by
Andrew Nicols
Browse files
MDL-53752 mod_book: Clarify book title
parent
6a69cda9
Changes
5
Hide whitespace changes
Inline
Side-by-side
mod/book/locallib.php
View file @
4f1f2a34
...
...
@@ -154,7 +154,7 @@ function book_get_chapter_title($chid, $chapters, $book, $context) {
}
if
(
$numbers
)
{
$title
=
implode
(
'.'
,
$numbers
)
.
' '
.
$title
;
$title
=
implode
(
'.'
,
$numbers
)
.
'. '
.
$title
;
}
return
$title
;
...
...
@@ -241,12 +241,12 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
$nch
++
;
$ns
=
0
;
if
(
$book
->
numbering
==
BOOK_NUM_NUMBERS
)
{
$title
=
"
$nch
$title
"
;
$title
=
"
$nch
.
$title
"
;
$titleout
=
$title
;
}
}
else
{
if
(
$book
->
numbering
==
BOOK_NUM_NUMBERS
)
{
$title
=
"x
$title
"
;
$title
=
"x
.
$title
"
;
}
$titleout
=
html_writer
::
tag
(
'span'
,
$title
,
array
(
'class'
=>
'dimmed_text'
));
}
...
...
@@ -263,15 +263,15 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
if
(
!
$ch
->
hidden
)
{
$ns
++
;
if
(
$book
->
numbering
==
BOOK_NUM_NUMBERS
)
{
$title
=
"
$nch
.
$ns
$title
"
;
$title
=
"
$nch
.
$ns
.
$title
"
;
$titleout
=
$title
;
}
}
else
{
if
(
$book
->
numbering
==
BOOK_NUM_NUMBERS
)
{
if
(
empty
(
$chapters
[
$ch
->
parent
]
->
hidden
))
{
$title
=
"
$nch
.x
$title
"
;
$title
=
"
$nch
.x
.
$title
"
;
}
else
{
$title
=
"x.x
$title
"
;
$title
=
"x.x
.
$title
"
;
}
}
$titleout
=
html_writer
::
tag
(
'span'
,
$title
,
array
(
'class'
=>
'dimmed_text'
));
...
...
@@ -346,7 +346,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
}
if
(
$book
->
numbering
==
BOOK_NUM_NUMBERS
)
{
$title
=
"
$nch
$title
"
;
$title
=
"
$nch
.
$title
"
;
}
}
else
{
$ns
++
;
...
...
@@ -360,7 +360,7 @@ function book_get_toc($chapters, $chapter, $book, $cm, $edit) {
}
if
(
$book
->
numbering
==
BOOK_NUM_NUMBERS
)
{
$title
=
"
$nch
.
$ns
$title
"
;
$title
=
"
$nch
.
$ns
.
$title
"
;
}
}
if
(
$ch
->
id
==
$chapter
->
id
)
{
...
...
mod/book/tests/behat/create_chapters.feature
View file @
4f1f2a34
...
...
@@ -28,37 +28,37 @@ Feature: In a book, create chapters and sub chapters
|
Chapter
title
|
Dummy
first
chapter
|
|
Content
|
Dream
is
the
start
of
a
journey
|
And
I press
"Save changes"
And
I should see
"1 Dummy first chapter"
in the
"Table of contents"
"block"
And
I should see
"1
.
Dummy first chapter"
in the
"Table of contents"
"block"
And
I click on
"Add new chapter"
"link"
in the
"Table of contents"
"block"
And I set the following fields to these values
:
|
Chapter
title
|
Dummy
second
chapter
|
|
Content
|
The
path
is
the
second
part
|
And
I press
"Save changes"
And
I should see
"2 Dummy second chapter"
in the
"Table of contents"
"block"
And
I should see
"2
.
Dummy second chapter"
in the
"Table of contents"
"block"
And
I click on
"Add new chapter"
"link"
in the
"Table of contents"
"block"
And I set the following fields to these values
:
|
Chapter
title
|
Dummy
first
subchapter
|
|
Content
|
The
path
is
the
second
part
|
|
Subchapter
|
true
|
And
I press
"Save changes"
And
I should see
"1.1 Dummy first subchapter"
in the
"Table of contents"
"block"
And
I should see
"1 Dummy first chapter"
in the
".book_content"
"css_element"
And
I should see
"1.1 Dummy first subchapter"
in the
".book_content"
"css_element"
And
I should see
"1.1
.
Dummy first subchapter"
in the
"Table of contents"
"block"
And
I should see
"1
.
Dummy first chapter"
in the
".book_content"
"css_element"
And
I should see
"1.1
.
Dummy first subchapter"
in the
".book_content"
"css_element"
And
I click on
"Next"
"link"
And
I should see
"2 Dummy second chapter"
in the
".book_content"
"css_element"
And
I should see
"2 Dummy second chapter"
in the
"strong"
"css_element"
And
I should see
"2
.
Dummy second chapter"
in the
".book_content"
"css_element"
And
I should see
"2
.
Dummy second chapter"
in the
"strong"
"css_element"
And
I should not see
"Next"
in the
".book_content"
"css_element"
And
I click on
"Exit book"
"link"
And
I should see
"Test book"
in the
"Topic 1"
"section"
And
I follow
"Test book"
And
I should not see
"Previous"
in the
".book_content"
"css_element"
And
I should see
"1 Dummy first chapter"
in the
"strong"
"css_element"
And
I should see
"1
.
Dummy first chapter"
in the
"strong"
"css_element"
When
I click on
"Next"
"link"
Then
I should see
"1.1 Dummy first subchapter"
in the
".book_content"
"css_element"
And
I should see
"1.1 Dummy first subchapter"
in the
"strong"
"css_element"
Then
I should see
"1.1
.
Dummy first subchapter"
in the
".book_content"
"css_element"
And
I should see
"1.1
.
Dummy first subchapter"
in the
"strong"
"css_element"
And
I click on
"Previous"
"link"
And
I should see
"1 Dummy first chapter"
in the
".book_content"
"css_element"
And
I should see
"1 Dummy first chapter"
in the
"strong"
"css_element"
And
I should see
"1
.
Dummy first chapter"
in the
".book_content"
"css_element"
And
I should see
"1
.
Dummy first chapter"
in the
"strong"
"css_element"
Scenario
:
Change editing mode for an individual chapter
Given
I follow
"Test book"
...
...
@@ -67,13 +67,13 @@ Feature: In a book, create chapters and sub chapters
|
Chapter
title
|
Dummy
first
chapter
|
|
Content
|
Dream
is
the
start
of
a
journey
|
And
I press
"Save changes"
And
I should see
"1 Dummy first chapter"
in the
"Table of contents"
"block"
And
"Edit chapter \"
1 Dummy first chapter\""
"link"
should exist in the
"Table of contents"
"block"
And
"Delete chapter \"
1 Dummy first chapter\""
"link"
should exist in the
"Table of contents"
"block"
And
"Hide chapter \"
1 Dummy first chapter\""
"link"
should exist in the
"Table of contents"
"block"
And
I should see
"1
.
Dummy first chapter"
in the
"Table of contents"
"block"
And
"Edit chapter \"
1
.
Dummy first chapter\""
"link"
should exist in the
"Table of contents"
"block"
And
"Delete chapter \"
1
.
Dummy first chapter\""
"link"
should exist in the
"Table of contents"
"block"
And
"Hide chapter \"
1
.
Dummy first chapter\""
"link"
should exist in the
"Table of contents"
"block"
And
"Add new chapter"
"link"
should exist in the
"Table of contents"
"block"
When
I click on
"Turn editing off"
"link"
in the
"Administration"
"block"
Then
"Edit chapter \"
1 Dummy first chapter\""
"link"
should not exist in the
"Table of contents"
"block"
And
"Delete chapter \"
1 Dummy first chapter\""
"link"
should not exist in the
"Table of contents"
"block"
And
"Hide chapter \"
1 Dummy first chapter\""
"link"
should not exist in the
"Table of contents"
"block"
And
"Add new chapter"
"link"
should not exist in the
"Table of contents"
"block"
\ No newline at end of file
Then
"Edit chapter \"
1. Dummy first chapter\""
"link"
should not exist in the
"Table of contents"
"block"
And
"Delete chapter \"
1. Dummy first chapter\""
"link"
should not exist in the
"Table of contents"
"block"
And
"Hide chapter \"
1. Dummy first chapter\""
"link"
should not exist in the
"Table of contents"
"block"
And
"Add new chapter"
"link"
should not exist in the
"Table of contents"
"block"
mod/book/tests/behat/edit_navigation_options.feature
View file @
4f1f2a34
...
...
@@ -30,27 +30,27 @@ Feature: In a book, change the navigation options
|
Content
|
Lorem
ipsum
dolor
sit
amet
|
And
I press
"Save changes"
And
I should see
"Test book"
And
I should see
"1 Test chapter 1"
And
I should see
"1
.
Test chapter 1"
And
I click on
"Add new chapter"
"link"
in the
"Table of contents"
"block"
And I set the following fields to these values
:
|
Chapter
title
|
Test
chapter
2
|
|
Content
|
consectetur
adipiscing
elit
|
And
I press
"Save changes"
And
I should see
"Test book"
And
I should see
"2 Test chapter 2"
And
I click on
"1 Test chapter 1"
"link"
in the
"Table of contents"
"block"
And
I should see
"2
.
Test chapter 2"
And
I click on
"1
.
Test chapter 1"
"link"
in the
"Table of contents"
"block"
And
"Next"
"link"
should not exist
And
I click on
"2 Test chapter 2"
"link"
in the
"Table of contents"
"block"
And
I click on
"2
.
Test chapter 2"
"link"
in the
"Table of contents"
"block"
And
"Previous"
"link"
should not exist
And
I click on
"Edit settings"
"link"
in the
"Administration"
"block"
And
I set the field
"Style of navigation"
to
"Images"
And
I press
"Save and display"
And "//a/child
::
img[contains(
@src,
'nav_next')]"
"xpath_element"
should
exist
And
I click on
"2 Test chapter 2"
"link"
in the
"Table of contents"
"block"
And
I click on
"2
.
Test chapter 2"
"link"
in the
"Table of contents"
"block"
And "//a/child
::
img[contains(
@src,
'nav_prev')]"
"xpath_element"
should
exist
When
I click on
"Edit settings"
"link"
in the
"Administration"
"block"
And
I set the field
"Style of navigation"
to
"Text"
And
I press
"Save and display"
Then
"Next"
"link"
should exist
And
I click on
"2 Test chapter 2"
"link"
in the
"Table of contents"
"block"
And
"Previous"
"link"
should exist
\ No newline at end of file
And
I click on
"2. Test chapter 2"
"link"
in the
"Table of contents"
"block"
And
"Previous"
"link"
should exist
mod/book/tests/behat/log_entries.feature
View file @
4f1f2a34
...
...
@@ -47,21 +47,21 @@ Feature: In a book, verify log entries
And
I should see
"Chapter created"
in the
"#report_log_r9_c5"
"css_element"
And
I click on
"Chapter viewed"
"link"
in the
"#report_log_r2_c5"
"css_element"
And
I switch to
"action"
window
And
I should see
"1 First chapter edited"
in the
".book_content"
"css_element"
And
I should see
"1
.
First chapter edited"
in the
".book_content"
"css_element"
And
I switch to the main window
And
I click on
"Chapter viewed"
"link"
in the
"#report_log_r3_c5"
"css_element"
And
I switch to
"action"
window
And
I should see
"2 Second chapter"
in the
".book_content"
"css_element"
And
I should see
"2
.
Second chapter"
in the
".book_content"
"css_element"
And
I switch to the main window
And
I click on
"Chapter updated"
"link"
in the
"#report_log_r5_c5"
"css_element"
And
I switch to
"action"
window
And
I should see
"1 First chapter edited"
in the
".book_content"
"css_element"
And
I should see
"1
.
First chapter edited"
in the
".book_content"
"css_element"
And
I switch to the main window
And
I click on
"Chapter created"
"link"
in the
"#report_log_r7_c5"
"css_element"
And
I switch to
"action"
window
And
I should see
"2 Second chapter"
in the
".book_content"
"css_element"
And
I should see
"2
.
Second chapter"
in the
".book_content"
"css_element"
And
I switch to the main window
And
I click on
"Chapter created"
"link"
in the
"#report_log_r9_c5"
"css_element"
And
I switch to
"action"
window
And
I should see
"1 First chapter edited"
in the
".book_content"
"css_element"
And
I should see
"1
.
First chapter edited"
in the
".book_content"
"css_element"
And
I switch to the main window
mod/book/tests/behat/show_hide_chapters.feature
View file @
4f1f2a34
...
...
@@ -50,8 +50,8 @@ Feature: Book activity chapter visibility management
@javascript
Scenario
:
Show/hide chapters and subchapters
When
I follow
"Hide chapter \"
2 Second chapter\""
And
I follow
"Hide chapter \"
2 Third chapter\""
When
I follow
"Hide chapter \"
2
.
Second chapter\""
And
I follow
"Hide chapter \"
2
.
Third chapter\""
And
I follow
"Turn editing off"
And
I am on homepage
And
I follow
"Course 1"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment