Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDLSITE-7917: Frontpage editable blocks #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/stats_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ public function frontpage_contribution_stats(): array {

$links = array();
foreach ($recent as $contributor) {
$links[] = '<a href="'.$CFG->wwwroot.'/user/profile.php?id='.$contributor->id.'">'.s(fullname($contributor)).'</a>';
$links[] = '<a style="color: #0077b8; text-decoration: underline;" href="'.$CFG->wwwroot.'/user/profile.php?id='.$contributor->id.'">'.s(fullname($contributor)).'</a>';
}

$links = get_string('contributethankslist', 'local_amos', [
Expand Down
62 changes: 14 additions & 48 deletions templates/frontpage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,20 @@
{}
}}

<h1 class="brandheader" style="margin: 1.5rem 0 0">Translation</h1>

<div class="card-deck my-2">
<div class="card">
<div class="lead card-header">{{#str}} amos, local_amos {{/str}}</div>
<div class="card-body">
<div>{{#str}} about, local_amos {{/str}}</div>
</div>
</div>
<div class="card">
<div class="lead card-header">{{#str}} contribute, local_amos {{/str}}</div>
<div class="card-body">
<p>{{#str}} contributestats, local_amos, {"count": {{#quote}} {{{contributedstrings}}} {{/quote}} } {{/str}}</p>
<p>{{#str}} contributethanks, local_amos, { "listcontributors": {{#quote}} {{{listcontributors}}} {{/quote}} } {{/str}}</p>
<p class="text-center">
<a class="btn btn-large btn-success" href="/local/amos/">{{#str}} contributenow, local_amos {{/str}}</a>
<a class="btn btn-large btn-secondary" href="/local/amos/credits.php">{{#str}} creditstitleshort, local_amos {{/str}}</a>
</p>
</div>
</div>
<div class="card">
<div class="lead card-header">{{#str}} quicklinks, local_amos {{/str}}</div>
<div class="card-body">
<ul class="unstyled">
<li>
<a href="/local/amos/view.php">
{{#str}} quicklinks_amos, local_amos {{/str}}
</a>
</li>
<li>
<a href="/course/view.php?id=2">
{{#str}} quicklinks_forum, local_amos {{/str}}
</a>
</li>
<li>
<a href="/mod/page/view.php?id=9">
{{#str}} quicklinks_newcomers, local_amos {{/str}}
</a>
</li>
<li>
<a href="https://docs.moodle.org/dev/AMOS_manual">
{{#str}} quicklinks_manual, local_amos {{/str}}
</a>
</li>
</ul>
</div>
</div>
</div>
{{#js}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need those scripts at all? Could not this simple replacement be put here into the JS section completely?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it in the module to maintain the standard, replicating what I did in other JavaScript developments like this, related to the HTML content of Moodle.org pages.
I could simplify it and place the content directly outside the AMD module, but that way, we wouldn't keep the code separate.

{{#contributedstrings}}
const contributedstringsElements = document.querySelectorAll('.contributedstrings');
contributedstringsElements.forEach(element => {
element.textContent = '{{{contributedstrings}}}';
});
{{/contributedstrings}}
{{#listcontributors}}
const listcontributorsElements = document.querySelectorAll('.listcontributors');
listcontributorsElements.forEach(element => {
element.innerHTML = '{{#str}} contributethanks, local_amos, { "listcontributors": {{#quote}} {{{listcontributors}}} {{/quote}} } {{/str}}';
});
{{/listcontributors}}
{{/js}}

<div class="card">
<div class="lead card-header">{{#str}} availablelangs, core_install {{/str}}</div>
Expand Down
Loading