Skip to content

Commit

Permalink
Merge branch 'MDL-43902-master' of git://github.com/FMCorz/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Dec 16, 2014
2 parents 4b0c38d + ba55be9 commit f5360dd
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 31 deletions.
3 changes: 0 additions & 3 deletions admin/tool/profiling/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
.path-admin-tool-profiling .flexible .referencerun {
font-weight: bold;
}
.path-admin-tool-profiling .flexible .r1 .cell {
background-color: whitesmoke;
}
.path-admin-tool-profiling .flexible {
margin-left:auto;
margin-right:auto
Expand Down
4 changes: 2 additions & 2 deletions grade/tests/behat/grade_UI_settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ Feature: Site settings can be used to hide parts of the gradebook UI

@javascript
Scenario: Disable category overriding
And ".r1 .course input[type='text']" "css_element" should exist
And "tr .course input[type='text']" "css_element" should exist
Then I navigate to "Grade category settings" node in "Site administration > Grades"
And I click on "Allow category grades to be manually overridden" "checkbox"
And I press "Save changes"
And I follow "Home"
And I follow "Course 1"
And I follow "Grades"
And ".r0 .course input[type='text']" "css_element" should not exist
And "tr .course input[type='text']" "css_element" should not exist
10 changes: 1 addition & 9 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -1447,9 +1447,6 @@ public static function script($jscode, $url=null) {
* method. In most cases this is not an issue at all so we do not clone by default for performance
* and memory consumption reasons.
*
* Please do not use .r0/.r1 for css, as they will be removed in Moodle 2.9.
* @todo MDL-43902 , remove r0 and r1 from tr classes.
*
* @param html_table $table data to be rendered
* @return string HTML code
*/
Expand Down Expand Up @@ -1579,7 +1576,6 @@ public static function table(html_table $table) {
}

if (!empty($table->data)) {
$oddeven = 1;
$keys = array_keys($table->data);
$lastrowkey = end($keys);
$output .= html_writer::start_tag('tbody', array());
Expand All @@ -1601,12 +1597,10 @@ public static function table(html_table $table) {
$row = $newrow;
}

$oddeven = $oddeven ? 0 : 1;
if (isset($table->rowclasses[$key])) {
$row->attributes['class'] .= ' ' . $table->rowclasses[$key];
}

$row->attributes['class'] .= ' r' . $oddeven;
if ($key == $lastrowkey) {
$row->attributes['class'] .= ' lastrow';
}
Expand Down Expand Up @@ -2077,9 +2071,7 @@ class html_table {

/**
* @var array Array of classes to add to particular rows, space-separated string.
* Classes 'r0' or 'r1' are added automatically for every odd or even row,
* respectively. Class 'lastrow' is added automatically for the last row
* in the table.
* Class 'lastrow' is added automatically for the last row in the table.
*
* Example of usage:
* $t->rowclasses[9] = 'tenth'
Expand Down
6 changes: 1 addition & 5 deletions lib/tablelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,6 @@ function start_output() {

/**
* This function is not part of the public api.
*
* Please do not use .r0/.r1 for css, as they will be removed in Moodle 2.9.
* @todo MDL-43902 , remove r0 and r1 from tr classes.
*/
function print_row($row, $classname = '') {
echo $this->get_row_html($row, $classname);
Expand All @@ -1034,8 +1031,7 @@ function print_row($row, $classname = '') {
*/
public function get_row_html($row, $classname = '') {
static $suppress_lastrow = NULL;
$oddeven = $this->currentrow % 2;
$rowclasses = array('r' . $oddeven);
$rowclasses = array();

if ($classname) {
$rowclasses[] = $classname;
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/html_writer_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function test_table() {

$expected = <<<EOF
<table class="generaltable" id="Jeffrey" data-name="Colin">
<tbody><tr class="r0 lastrow" id="Bob" data-name="Fred">
<tbody><tr class="lastrow" id="Bob" data-name="Fred">
<td class="cell c0 lastcol" id="Jeremy" data-name="John" style=""></td>
</tr>
</tbody>
Expand Down
3 changes: 3 additions & 0 deletions lib/tests/tablelib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ public function test_get_row_html() {
$table->define_columns($columns);
$table->define_headers($headers);
$table->define_baseurl('/invalid.php');

$row = $table->get_row_html($data);
$this->assertRegExp('/row 0 col 0/', $row);
$this->assertRegExp('/<tr class=""/', $row);
$this->assertRegExp('/<td class="cell c0"/', $row);
}
}
6 changes: 3 additions & 3 deletions mod/workshop/allocation/manual/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
margin: 0px auto;
}

.path-mod-workshop .manual-allocator .allocations .r0 {
.path-mod-workshop .manual-allocator .allocations tbody tr:nth-of-type(odd) {
background-color: #eee;
}

.path-mod-workshop .manual-allocator .allocations .r0.highlightreviewerof,
.path-mod-workshop .manual-allocator .allocations .r0.highlightreviewedby {
.path-mod-workshop .manual-allocator .allocations tbody tr:nth-of-type(odd).highlightreviewerof,
.path-mod-workshop .manual-allocator .allocations tbody tr:nth-of-type(odd).highlightreviewedby {
background-color: inherit;
}

Expand Down
12 changes: 6 additions & 6 deletions report/outline/tests/behat/outline.feature
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Feature: View an outline report
And I log in as "teacher1"
And I follow "Course 1"
When I navigate to "Activity report" node in "Course administration > Reports"
Then I should see "2" in the "//tr[contains(concat(' ', normalize-space(@class),' '),' r0 ')]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
And I should see "1" in the "//tr[contains(concat(' ', normalize-space(@class),' '),' r1 ')]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
Then I should see "2" in the "//tbody/tr[(position() mod 2)=1]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
And I should see "1" in the "//tbody/tr[(position() mod 2)=0]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"

@javascript
Scenario: View the outline report when only the standard log reader is enabled
Expand All @@ -71,8 +71,8 @@ Feature: View an outline report
And I log in as "admin"
And I follow "Course 1"
When I navigate to "Activity report" node in "Course administration > Reports"
Then I should see "2" in the "//tr[contains(concat(' ', normalize-space(@class),' '),' r0 ')]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
And I should see "1" in the "//tr[contains(concat(' ', normalize-space(@class),' '),' r1 ')]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
Then I should see "2" in the "//tbody/tr[(position() mod 2)=1]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
And I should see "1" in the "//tbody/tr[(position() mod 2)=0]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"

@javascript
Scenario: View the outline report when both the standard and legacy log readers are enabled
Expand All @@ -95,8 +95,8 @@ Feature: View an outline report
And I log in as "teacher1"
And I follow "Course 1"
When I navigate to "Activity report" node in "Course administration > Reports"
Then I should see "2" in the "//tr[contains(concat(' ', normalize-space(@class),' '),' r0 ')]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
And I should see "1" in the "//tr[contains(concat(' ', normalize-space(@class),' '),' r1 ')]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
Then I should see "2" in the "//tbody/tr[(position() mod 2)=1]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"
And I should see "1" in the "//tbody/tr[(position() mod 2)=0]/child::td[contains(concat(' ', normalize-space(@class),' '),' numviews ')]" "xpath_element"

@javascript
Scenario: View the outline report when no log reader is enabled
Expand Down
4 changes: 2 additions & 2 deletions theme/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ information provided here is intended especially for theme designer.

* CSS related functions in theme class and csslib.php were refactored, addons that are
using this private API need to be updated
* Please update your css to use 'tr:nth-of-type(odd/even)' instead of '.ro/.r1' to apply tr specific css for various tables.
* Please update your css to use 'tr:nth-of-type(odd/even)' instead of '.r0/.r1' to apply tr specific css for various tables.
These classes are deprecated now and will be removed in Moodle 2.9. This has done to better support styling tables that will be altered by JavaScript.
Here is an example to update your css:
Old code:
table.generaltable .r0 {background-color: #F0F0F0;}
table.generaltable .r1 {background-color: #F0F0F0;}
New code:
table.generaltable > tbody > tr:nth-of-type(odd) {background-color: #F0F0F0;}
table.generaltable > tbody > tr:nth-of-type(even) {background-color: #F0F0F0;}
table.generaltable > tbody > tr:nth-of-type(odd) {background-color: #F0F0F0;}

Removed themes:
* afterburner, anomaly, arialist, binarius, boxxie, brick, formal_white, formfactor, fusion, leatherbound,
Expand Down

0 comments on commit f5360dd

Please sign in to comment.