Skip to content

Commit

Permalink
Replased prameter 'lang' value. from ѩꙁыкъ to ezik
Browse files Browse the repository at this point in the history
  • Loading branch information
kberov committed Nov 10, 2020
1 parent 9f3df01 commit 9b40653
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions lib/Slovo/Controller/Celini.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ my sub _redirect_to_new_celina_url ($c, $page, $celina, $l) {
my $status = $c->req->method =~ /GET|HEAD/i ? 301 : 308;
$c->res->code($status);
return $c->redirect_to('цѣлина_с_ѩꙁыкъ' =>
{'цѣлина' => $celina->{alias}, 'страница' => $page->{alias}, 'ѩꙁыкъ' => $l});
{'цѣлина' => $celina->{alias}, 'страница' => $page->{alias}, 'ezik' => $l});
};

# Prepares collection of parent ids of celiny in which a celina can be put.
Expand All @@ -29,7 +29,7 @@ my sub _celini_options ($c, $id, $page_id, $user, $l) {
return $options;
};

# ANY /<страница:str>/<цѣлина:cel>.<ѩꙁыкъ:lng>.html
# ANY /<страница:str>/<цѣлина:cel>.<ezik:lng>.html
# ANY /<:страница:str>/<цѣлина:cel>.html
# Display a content element in a page in the site.
sub execute ($c, $page, $user, $l, $preview) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Slovo/Controller/Role/Stranica.pm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ sub _go_to_new_page_url ($c, $page, $l) {
my $status = $c->req->method =~ /GET|HEAD/i ? 301 : 308;
$c->res->code($status);
return $c->redirect_to(
'страница_с_ѩꙁыкъ' => {'страница' => $page->{alias}, 'ѩꙁыкъ' => $l});
'страница_с_ѩꙁыкъ' => {'страница' => $page->{alias}, 'ezik' => $l});
}

my $cached = 'cached';
Expand All @@ -116,7 +116,7 @@ sub _render_cached_page($c) {
# Cache the page on disk which is being rendered for non authenticated users.
# Cached files are deleted when any page or content is changed.
sub _cache_page ($c, $l) {
my $url_path = $c->url_for({'ѩꙁыкъ' => $l})->path->canonicalize->to_route =~ s|^/||r;
my $url_path = $c->url_for({'ezik' => $l})->path->canonicalize->to_route =~ s|^/||r;
return unless $url_path =~ $cacheable;
my $file = $c->_path_to_file($url_path);
$file->dirname->make_path({mode => oct(700)});
Expand Down
2 changes: 1 addition & 1 deletion lib/Slovo/Controller/Stranici.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ no warnings "experimental::lexical_subs";
use Role::Tiny::With;
with 'Slovo::Controller::Role::Stranica';

# ANY /<страница:str>.<ѩꙁыкъ:lng>.html
# ANY /<страница:str>.<ezik:lng>.html
# ANY /<страница:str>.html
# Display a page in the site
sub execute ($c, $page, $user, $l, $preview) {
Expand Down
10 changes: 5 additions & 5 deletions lib/Slovo/Plugin/DefaultHelpers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ sub register ($self, $app, $config) {
language => sub ($c, $l = '') {
if ($l) {
$l = $c->languages->first(qr/^$l$/) // $c->languages->first;
$c->stash('ѩꙁыкъ', $l);
$c->stash('ezik', $l);
return $c;
}

# language param
$l = $c->stash('ѩꙁыкъ');
$l = $c->stash('ezik');

#existing language
return $l if ($l = $c->languages->first(qr/^$l$/));
Expand Down Expand Up @@ -166,13 +166,13 @@ otherwise.
=head2 language
Wrapper for C<$c-E<gt>stash('ѩꙁыкъ')>, which is set in C<$app-E<gt>defaults> in
Wrapper for C<$c-E<gt>stash('ezik')>, which is set in C<$app-E<gt>defaults> in
C<slovo.conf>. The requested language is also checked if it exists in
C<$c-E<gt>openapi_spec('/parameters/language/enum')>. The first element from
this list is returned if the requested language is not found in it. Using
C<$ѩꙁыкъ>, found in the stash in templates is strongly discouraged.
C<$ezik>, found in the stash in templates is strongly discouraged.
<%= language eq $ѩꙁыкъ %> <!-- renders 1 -->
<%= language eq $ezik %> <!-- renders 1 -->
$c->language
=head2 languages
Expand Down
2 changes: 1 addition & 1 deletion lib/Slovo/resources/api-v1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"minimum" : 1
},
"lang": {
"name": "ѩꙁыкъ",
"name": "ezik",
"description": "In what language the title will be shown or content will be?",
"type": "string",
"in": "query",
Expand Down
6 changes: 3 additions & 3 deletions lib/Slovo/resources/etc/routes.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use Mojo::Base -strict, -signatures;
use feature qw(unicode_strings);
my $default_page = {'страница' => 'коренъ', 'ѩꙁыкъ' => 'bg'};
my $default_page = {'страница' => 'коренъ', 'ezik' => 'bg'};
my %default_to = (to => 'stranici#execute', name => 'коренъ');
{
routes => [
Expand Down Expand Up @@ -77,12 +77,12 @@ my %default_to = (to => 'stranici#execute', name => 'коренъ');
},

{
any => '/<страница:str>/<цѣлина:cel>.<ѩꙁыкъ:lng>.html',
any => '/<страница:str>/<цѣлина:cel>.<ezik:lng>.html',
to => 'celini#execute',
name => 'цѣлина_с_ѩꙁыкъ'
},
{
any => '/<страница:str>.<ѩꙁыкъ:lng>.html',
any => '/<страница:str>.<ezik:lng>.html',
to => 'stranici#execute',
name => 'страница_с_ѩꙁыкъ'
},
Expand Down
4 changes: 2 additions & 2 deletions lib/Slovo/resources/etc/slovo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ my $db_file
$app->defaults(

#layout => 'default'
'ѩꙁыкъ' => 'bg-bg'
'ezik' => 'bg-bg'
);
$app->load_class('Slovo::Controller::Auth');

Expand Down Expand Up @@ -135,7 +135,7 @@ my $mail_cfg = {
domove_root => $home->child('domove')->to_string,

# Cache published pages for non authenticated users
cache_pages => 1,
#cache_pages => 1,

# $mode =~ /^dev/ ? () : (cache_pages => 1),
# Cache-Control header for non authenticated users. For authenticated users
Expand Down
2 changes: 1 addition & 1 deletion lib/Slovo/resources/public/js/sidedrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function get_страници ($url, $parent) {
$item = `<div>${$page_link}${$expander_link}</div>`;
if($row.is_dir === 1) {
$expander_url = $url_no_qs + '?'
+ $.param({pid: $row.id, 'ѩꙁыкъ': $row.language});
+ $.param({pid: $row.id, 'ezik': $row.language});
$expander_link = `<a id="id${$row.id}"
href="${$expander_url}" class="folder-expander mui--pull-right">☰</a>`;
$item = `<strong>${$page_link}${$expander_link}</strong>`;
Expand Down
2 changes: 1 addition & 1 deletion lib/Slovo/resources/templates/partials/_head.html.ep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%
Mojo::Util->import(qw(decode url_unescape));
my $url = url_for({ѩꙁыкъ => language});
my $url = url_for({ezik => language});
my $cn_href
= ($url->scheme // '') . '//'
. ihost_only
Expand Down
4 changes: 2 additions & 2 deletions lib/Slovo/resources/templates/partials/_header.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<%=
$breadcrumb->map(sub {
link_to $_->{title} => страница_с_ѩꙁыкъ =>
{страница => $_->{alias}, ѩꙁыкъ => $_->{language}};
{страница => $_->{alias}, ezik => $_->{language}};
})->join(' ⸙ ') unless $page->{id} == $c->not_found_id
%>
</td>
<td class="mui--text-right">
%= link_to Ѿносно => 'страница_с_ѩꙁыкъ' => {страница => 'ѿносно', ѩꙁыкъ => language}
%= link_to Ѿносно => 'страница_с_ѩꙁыкъ' => {страница => 'ѿносно', ezik => language}
% if ($c->is_user_authenticated) {
% my $name = $c->user->{first_name} . ' ' . $c->user->{last_name};
%= link_to '| Изходъ '.$name => 'sign_out'
Expand Down
2 changes: 1 addition & 1 deletion lib/Slovo/resources/templates/partials/_lang_menu.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ my $current = pop @$langs;
$langs->sort(sub { $a->{language} cmp $b->{language} })->map(sub {
t 'li' => sub {
link_to $_->{language} => 'страница_с_ѩꙁыкъ' =>
{страница => $page->{alias}, ѩꙁыкъ => $_->{language}} => (title => $_->{title});
{страница => $page->{alias}, ezik => $_->{language}} => (title => $_->{title});
}
})->join($/);
%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ my $list = $c->stranici->all_for_list($user, $domain, $preview, language, $opts)
$list->map(sub {
my $expander_link = '';
my $link = link_to $_->{title} => страница_с_ѩꙁыкъ =>
{страница => $_->{alias}, ѩꙁыкъ => $_->{language}};
{страница => $_->{alias}, ezik => $_->{language}};
if ($_->{is_dir}) {
$expander_link = link_to
'☰' =>
url_for('/api/страници')->query(pid => $_->{id}, 'ѩꙁыкъ' => $_->{language}),
url_for('/api/страници')->query(pid => $_->{id}, 'ezik' => $_->{language}),
(class => 'folder-expander mui--pull-right');
return t li => sub {
t strong => sub { $link . ' ' . $expander_link }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
% my $a_title = $celina->{title} =~ s/<[^>]+>?//gr;
<%=
link_to $a_title => 'цѣлина_с_ѩꙁыкъ' =>
{страница => $p->{alias}, цѣлина => $celina->{alias}, ѩꙁыкъ => $celina->{language}} =>
{страница => $p->{alias}, цѣлина => $celina->{alias}, ezik => $celina->{language}} =>
(title => $a_title)
%>
</h2>
<%=
link_to '…' => 'цѣлина_с_ѩꙁыкъ' =>
{страница => $p->{alias}, цѣлина => $celina->{alias},
ѩꙁыкъ => $celina->{language}} => (class => 'писанѥ', title => $a_title)
ezik => $celina->{language}} => (class => 'писанѥ', title => $a_title)
%>
<div class="ѿкѫсъ">
%= html_substr($celina->{teaser}//$celina->{body}, 'p,blockquote', 225);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ my $pages = stranici->all_for_home($user, $domain, $preview, language, $opts);
<% for my $p (@$pages) { %>
<section class="множество" id="страница-<%= $p->{id} %>">
<h1 class="mui--text-dark">
%= link_to $p->{title} => 'страница_с_ѩꙁыкъ' => {страница =>$p->{alias} ,ѩꙁыкъ => language}
%= link_to $p->{title} => 'страница_с_ѩꙁыкъ' => {страница =>$p->{alias} ,ezik => language}
</h1>
% for my $писанѥ (@{$p->{articles}}) {
%= include 'partials/_pisanie_otkysy' => (p=>$p, celina => $писанѥ);
Expand Down

0 comments on commit 9b40653

Please sign in to comment.