* disable logo-link ?
@ 2015-06-18 14:38 rep.dot.nop
2015-06-18 14:48 ` john
0 siblings, 1 reply; 7+ messages in thread
From: rep.dot.nop @ 2015-06-18 14:38 UTC (permalink / raw)
Hi there,
A colleague asked if it's possible to disable the logo-link, but that
doesn't seem to work right now?
^ permalink raw reply [flat|nested] 7+ messages in thread
* disable logo-link ?
2015-06-18 14:38 disable logo-link ? rep.dot.nop
@ 2015-06-18 14:48 ` john
2015-06-18 15:03 ` rep.dot.nop
0 siblings, 1 reply; 7+ messages in thread
From: john @ 2015-06-18 14:48 UTC (permalink / raw)
On Thu, Jun 18, 2015 at 04:38:32PM +0200, Bernhard Reutner-Fischer wrote:
> A colleague asked if it's possible to disable the logo-link, but that
> doesn't seem to work right now?
No, if there isn't a logo-link specified then the CGit root URL is used;
see ui-shared.c:
if (logo_link && *logo_link)
html_attr(logo_link);
else
html_attr(cgit_rooturl());
^ permalink raw reply [flat|nested] 7+ messages in thread
* disable logo-link ?
2015-06-18 14:48 ` john
@ 2015-06-18 15:03 ` rep.dot.nop
2015-06-18 15:07 ` john
0 siblings, 1 reply; 7+ messages in thread
From: rep.dot.nop @ 2015-06-18 15:03 UTC (permalink / raw)
On 18 June 2015 at 16:48, John Keeping <john at keeping.me.uk> wrote:
> On Thu, Jun 18, 2015 at 04:38:32PM +0200, Bernhard Reutner-Fischer wrote:
>> A colleague asked if it's possible to disable the logo-link, but that
>> doesn't seem to work right now?
>
> No, if there isn't a logo-link specified then the CGit root URL is used;
> see ui-shared.c:
>
> if (logo_link && *logo_link)
> html_attr(logo_link);
> else
> html_attr(cgit_rooturl());
yes, anyone got an idea on a token to disable it?
maybe:
logo-link=
As a second "issue", what about a logo-alt instead of the hardcoded
html("'><img src='");
html_attr(logo);
html("' alt='cgit logo'/></a></td>\n");
in print_header() ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* disable logo-link ?
2015-06-18 15:03 ` rep.dot.nop
@ 2015-06-18 15:07 ` john
2015-06-18 15:13 ` rep.dot.nop
0 siblings, 1 reply; 7+ messages in thread
From: john @ 2015-06-18 15:07 UTC (permalink / raw)
On Thu, Jun 18, 2015 at 05:03:35PM +0200, Bernhard Reutner-Fischer wrote:
> On 18 June 2015 at 16:48, John Keeping <john at keeping.me.uk> wrote:
> > On Thu, Jun 18, 2015 at 04:38:32PM +0200, Bernhard Reutner-Fischer wrote:
> >> A colleague asked if it's possible to disable the logo-link, but that
> >> doesn't seem to work right now?
> >
> > No, if there isn't a logo-link specified then the CGit root URL is used;
> > see ui-shared.c:
> >
> > if (logo_link && *logo_link)
> > html_attr(logo_link);
> > else
> > html_attr(cgit_rooturl());
>
> yes, anyone got an idea on a token to disable it?
>
> maybe:
> logo-link=
It looks like that would have (sort of) worked prior to commit 808c685
(implement repo.logo and repo.logo-link, 2010-12-23), although it would
have had "href=''" in the generated HTML.
> As a second "issue", what about a logo-alt instead of the hardcoded
> html("'><img src='");
> html_attr(logo);
> html("' alt='cgit logo'/></a></td>\n");
>
> in print_header() ?
Good idea.
^ permalink raw reply [flat|nested] 7+ messages in thread
* disable logo-link ?
2015-06-18 15:07 ` john
@ 2015-06-18 15:13 ` rep.dot.nop
2015-06-19 10:37 ` [PATCH] Implement logo-alt rep.dot.nop
0 siblings, 1 reply; 7+ messages in thread
From: rep.dot.nop @ 2015-06-18 15:13 UTC (permalink / raw)
On 18 June 2015 at 17:07, John Keeping <john at keeping.me.uk> wrote:
> On Thu, Jun 18, 2015 at 05:03:35PM +0200, Bernhard Reutner-Fischer wrote:
>> On 18 June 2015 at 16:48, John Keeping <john at keeping.me.uk> wrote:
>> > On Thu, Jun 18, 2015 at 04:38:32PM +0200, Bernhard Reutner-Fischer wrote:
>> >> A colleague asked if it's possible to disable the logo-link, but that
>> >> doesn't seem to work right now?
>> >
>> > No, if there isn't a logo-link specified then the CGit root URL is used;
>> > see ui-shared.c:
>> >
>> > if (logo_link && *logo_link)
>> > html_attr(logo_link);
>> > else
>> > html_attr(cgit_rooturl());
>>
>> yes, anyone got an idea on a token to disable it?
>>
>> maybe:
>> logo-link=
>
> It looks like that would have (sort of) worked prior to commit 808c685
duh. What an idiot wrote that commit ;)
> (implement repo.logo and repo.logo-link, 2010-12-23), although it would
> have had "href=''" in the generated HTML.
>
>> As a second "issue", what about a logo-alt instead of the hardcoded
>> html("'><img src='");
>> html_attr(logo);
>> html("' alt='cgit logo'/></a></td>\n");
>>
>> in print_header() ?
>
> Good idea.
Maybe i find time to tweak this, unless someone beats me to it..
thanks, anyway, and cheers :)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Implement logo-alt
2015-06-18 15:13 ` rep.dot.nop
@ 2015-06-19 10:37 ` rep.dot.nop
2016-06-09 15:27 ` rep.dot.nop
0 siblings, 1 reply; 7+ messages in thread
From: rep.dot.nop @ 2015-06-19 10:37 UTC (permalink / raw)
From: Bernhard Reutner-Fischer <fischeb7 at versionierbaer.cc.univie.ac.at>
Allow to specify an alternative text for the logo image.
Fix empty logo-link while at it.
Signed-off-by: Bernhard Reutner-Fischer <fischeb7 at versionierbaer.cc.univie.ac.at>
---
cgit.c | 15 +++++++++++++--
cgit.h | 2 ++
cgitrc.5.txt | 18 +++++++++++++-----
ui-shared.c | 31 +++++++++++++++++++++++--------
4 files changed, 51 insertions(+), 15 deletions(-)
diff --git a/cgit.c b/cgit.c
index ae413c6..718b531 100644
--- a/cgit.c
+++ b/cgit.c
@@ -80,6 +80,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
string_list_append(&repo->readme, xstrdup(value));
} else if (!strcmp(name, "logo") && value != NULL)
repo->logo = xstrdup(value);
+ else if (!strcmp(name, "logo-alt") && value != NULL)
+ repo->logo_alt = xstrdup(value);
else if (!strcmp(name, "logo-link") && value != NULL)
repo->logo_link = xstrdup(value);
else if (ctx.cfg.enable_filter_overrides) {
@@ -128,12 +130,14 @@ static void config_cb(const char *name, const char *value)
ctx.cfg.head_include = xstrdup(value);
else if (!strcmp(name, "header"))
ctx.cfg.header = xstrdup(value);
- else if (!strcmp(name, "logo"))
- ctx.cfg.logo = xstrdup(value);
else if (!strcmp(name, "index-header"))
ctx.cfg.index_header = xstrdup(value);
else if (!strcmp(name, "index-info"))
ctx.cfg.index_info = xstrdup(value);
+ else if (!strcmp(name, "logo"))
+ ctx.cfg.logo = xstrdup(value);
+ else if (!strcmp(name, "logo-alt"))
+ ctx.cfg.logo_alt = xstrdup(value);
else if (!strcmp(name, "logo-link"))
ctx.cfg.logo_link = xstrdup(value);
else if (!strcmp(name, "module-link"))
@@ -356,6 +360,7 @@ static void prepare_context(void)
ctx.cfg.commit_sort = 0;
ctx.cfg.css = "/cgit.css";
ctx.cfg.logo = "/cgit.png";
+ ctx.cfg.logo_alt = "cgit logo";
ctx.cfg.favicon = "/favicon.ico";
ctx.cfg.local_time = 0;
ctx.cfg.enable_http_clone = 1;
@@ -837,6 +842,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo)
cgit_find_stats_periodname(repo->max_stats));
if (repo->logo)
fprintf(f, "repo.logo=%s\n", repo->logo);
+ if (repo->logo_alt)
+ fprintf(f, "repo.logo-alt=%s\n", repo->logo_alt);
if (repo->logo_link)
fprintf(f, "repo.logo-link=%s\n", repo->logo_link);
fprintf(f, "repo.enable-remote-branches=%d\n", repo->enable_remote_branches);
@@ -1062,6 +1069,10 @@ int main(int argc, const char **argv)
if (!ctx.cfg.virtual_root && ctx.cfg.script_name)
ctx.cfg.virtual_root = ensure_end(ctx.cfg.script_name, '/');
+ /* Now we can set the default global logo-link unless specified */
+ if (!ctx.cfg.logo_link)
+ ctx.cfg.logo_link = (char *)cgit_rooturl();
+
/* If no url parameter is specified on the querystring, lets
* use PATH_INFO as url. This allows cgit to work with virtual
* urls without the need for rewriterules in the webserver (as
diff --git a/cgit.h b/cgit.h
index 16f8092..27167bb 100644
--- a/cgit.h
+++ b/cgit.h
@@ -89,6 +89,7 @@ struct cgit_repo {
char *section;
char *clone_url;
char *logo;
+ char *logo_alt;
char *logo_link;
int snapshots;
int enable_commit_graph;
@@ -195,6 +196,7 @@ struct cgit_config {
char *index_header;
char *index_info;
char *logo;
+ char *logo_alt;
char *logo_link;
char *mimetype_file;
char *module_link;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 0a2a402..4a9c68f 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -242,10 +242,14 @@ logo::
Url which specifies the source of an image which will be used as a logo
on all cgit pages. Default value: "/cgit.png".
+logo-alt::
+ Alternate text of the logo image. Default value: "cgit logo".
+
logo-link::
Url loaded when clicking on the cgit logo image. If unspecified the
- calculated url of the repository index page will be used. Default
- value: none.
+ calculated url of the repository index page will be used.
+ If empty, no URL is emitted.
+ Default value: none.
owner-filter::
Specifies a command which will be invoked to format the Owner
@@ -524,10 +528,14 @@ repo.logo::
Url which specifies the source of an image which will be used as a logo
on this repo's pages. Default value: global logo.
+repo.logo-alt::
+ Alternate text of the logo image. Default value: global logo-alt.
+
repo.logo-link::
Url loaded when clicking on the cgit logo image. If unspecified the
- calculated url of the repository index page will be used. Default
- value: global logo-link.
+ calculated url of the repository index page will be used.
+ If empty, no URL is emitted.
+ Default value: global logo-link.
repo.owner-filter::
Override the default owner-filter. Default value: none. See also:
@@ -804,7 +812,7 @@ favicon=/favicon.ico
# Use a custom logo
logo=/img/mylogo.png
-
+logo-alt=my img alt text
# Enable statistics per week, month and quarter
max-stats=quarter
diff --git a/ui-shared.c b/ui-shared.c
index ac5a287..8334739 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -860,7 +860,8 @@ static void cgit_print_path_crumbs(char *path)
static void print_header(void)
{
- char *logo = NULL, *logo_link = NULL;
+ char *logo = NULL, *logo_alt = NULL, *logo_link = NULL;
+ unsigned int any_logo_link;
html("<table id='header'>\n");
html("<tr>\n");
@@ -869,19 +870,33 @@ static void print_header(void)
logo = ctx.repo->logo;
else
logo = ctx.cfg.logo;
- if (ctx.repo && ctx.repo->logo_link && *ctx.repo->logo_link)
+ if (ctx.repo && ctx.repo->logo_alt && *ctx.repo->logo_alt)
+ logo_alt = ctx.repo->logo_alt;
+ else
+ logo_alt = ctx.cfg.logo_alt;
+ if (ctx.repo && ctx.repo->logo_link)
logo_link = ctx.repo->logo_link;
else
logo_link = ctx.cfg.logo_link;
+ any_logo_link = logo_link && *logo_link;
+
if (logo && *logo) {
- html("<td class='logo' rowspan='2'><a href='");
- if (logo_link && *logo_link)
+ html("<td class='logo' rowspan='2'>");
+ if (any_logo_link) {
+ html("<a href='");
html_attr(logo_link);
- else
- html_attr(cgit_rooturl());
- html("'><img src='");
+ html("'>");
+ }
+ html("<img src='");
html_attr(logo);
- html("' alt='cgit logo'/></a></td>\n");
+ if (logo_alt && *logo_alt) {
+ html("' alt='");
+ html_attr(logo_alt);
+ }
+ html("'/>");
+ if (any_logo_link)
+ html("</a>");
+ html("</td>\n");
}
html("<td class='main'>");
--
1.7.10.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Implement logo-alt
2015-06-19 10:37 ` [PATCH] Implement logo-alt rep.dot.nop
@ 2016-06-09 15:27 ` rep.dot.nop
0 siblings, 0 replies; 7+ messages in thread
From: rep.dot.nop @ 2016-06-09 15:27 UTC (permalink / raw)
ping
On 19 June 2015 at 12:37, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:
> From: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
>
> Allow to specify an alternative text for the logo image.
> Fix empty logo-link while at it.
>
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
> ---
> cgit.c | 15 +++++++++++++--
> cgit.h | 2 ++
> cgitrc.5.txt | 18 +++++++++++++-----
> ui-shared.c | 31 +++++++++++++++++++++++--------
> 4 files changed, 51 insertions(+), 15 deletions(-)
>
> diff --git a/cgit.c b/cgit.c
> index ae413c6..718b531 100644
> --- a/cgit.c
> +++ b/cgit.c
> @@ -80,6 +80,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
> string_list_append(&repo->readme, xstrdup(value));
> } else if (!strcmp(name, "logo") && value != NULL)
> repo->logo = xstrdup(value);
> + else if (!strcmp(name, "logo-alt") && value != NULL)
> + repo->logo_alt = xstrdup(value);
> else if (!strcmp(name, "logo-link") && value != NULL)
> repo->logo_link = xstrdup(value);
> else if (ctx.cfg.enable_filter_overrides) {
> @@ -128,12 +130,14 @@ static void config_cb(const char *name, const char *value)
> ctx.cfg.head_include = xstrdup(value);
> else if (!strcmp(name, "header"))
> ctx.cfg.header = xstrdup(value);
> - else if (!strcmp(name, "logo"))
> - ctx.cfg.logo = xstrdup(value);
> else if (!strcmp(name, "index-header"))
> ctx.cfg.index_header = xstrdup(value);
> else if (!strcmp(name, "index-info"))
> ctx.cfg.index_info = xstrdup(value);
> + else if (!strcmp(name, "logo"))
> + ctx.cfg.logo = xstrdup(value);
> + else if (!strcmp(name, "logo-alt"))
> + ctx.cfg.logo_alt = xstrdup(value);
> else if (!strcmp(name, "logo-link"))
> ctx.cfg.logo_link = xstrdup(value);
> else if (!strcmp(name, "module-link"))
> @@ -356,6 +360,7 @@ static void prepare_context(void)
> ctx.cfg.commit_sort = 0;
> ctx.cfg.css = "/cgit.css";
> ctx.cfg.logo = "/cgit.png";
> + ctx.cfg.logo_alt = "cgit logo";
> ctx.cfg.favicon = "/favicon.ico";
> ctx.cfg.local_time = 0;
> ctx.cfg.enable_http_clone = 1;
> @@ -837,6 +842,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo)
> cgit_find_stats_periodname(repo->max_stats));
> if (repo->logo)
> fprintf(f, "repo.logo=%s\n", repo->logo);
> + if (repo->logo_alt)
> + fprintf(f, "repo.logo-alt=%s\n", repo->logo_alt);
> if (repo->logo_link)
> fprintf(f, "repo.logo-link=%s\n", repo->logo_link);
> fprintf(f, "repo.enable-remote-branches=%d\n", repo->enable_remote_branches);
> @@ -1062,6 +1069,10 @@ int main(int argc, const char **argv)
> if (!ctx.cfg.virtual_root && ctx.cfg.script_name)
> ctx.cfg.virtual_root = ensure_end(ctx.cfg.script_name, '/');
>
> + /* Now we can set the default global logo-link unless specified */
> + if (!ctx.cfg.logo_link)
> + ctx.cfg.logo_link = (char *)cgit_rooturl();
> +
> /* If no url parameter is specified on the querystring, lets
> * use PATH_INFO as url. This allows cgit to work with virtual
> * urls without the need for rewriterules in the webserver (as
> diff --git a/cgit.h b/cgit.h
> index 16f8092..27167bb 100644
> --- a/cgit.h
> +++ b/cgit.h
> @@ -89,6 +89,7 @@ struct cgit_repo {
> char *section;
> char *clone_url;
> char *logo;
> + char *logo_alt;
> char *logo_link;
> int snapshots;
> int enable_commit_graph;
> @@ -195,6 +196,7 @@ struct cgit_config {
> char *index_header;
> char *index_info;
> char *logo;
> + char *logo_alt;
> char *logo_link;
> char *mimetype_file;
> char *module_link;
> diff --git a/cgitrc.5.txt b/cgitrc.5.txt
> index 0a2a402..4a9c68f 100644
> --- a/cgitrc.5.txt
> +++ b/cgitrc.5.txt
> @@ -242,10 +242,14 @@ logo::
> Url which specifies the source of an image which will be used as a logo
> on all cgit pages. Default value: "/cgit.png".
>
> +logo-alt::
> + Alternate text of the logo image. Default value: "cgit logo".
> +
> logo-link::
> Url loaded when clicking on the cgit logo image. If unspecified the
> - calculated url of the repository index page will be used. Default
> - value: none.
> + calculated url of the repository index page will be used.
> + If empty, no URL is emitted.
> + Default value: none.
>
> owner-filter::
> Specifies a command which will be invoked to format the Owner
> @@ -524,10 +528,14 @@ repo.logo::
> Url which specifies the source of an image which will be used as a logo
> on this repo's pages. Default value: global logo.
>
> +repo.logo-alt::
> + Alternate text of the logo image. Default value: global logo-alt.
> +
> repo.logo-link::
> Url loaded when clicking on the cgit logo image. If unspecified the
> - calculated url of the repository index page will be used. Default
> - value: global logo-link.
> + calculated url of the repository index page will be used.
> + If empty, no URL is emitted.
> + Default value: global logo-link.
>
> repo.owner-filter::
> Override the default owner-filter. Default value: none. See also:
> @@ -804,7 +812,7 @@ favicon=/favicon.ico
>
> # Use a custom logo
> logo=/img/mylogo.png
> -
> +logo-alt=my img alt text
>
> # Enable statistics per week, month and quarter
> max-stats=quarter
> diff --git a/ui-shared.c b/ui-shared.c
> index ac5a287..8334739 100644
> --- a/ui-shared.c
> +++ b/ui-shared.c
> @@ -860,7 +860,8 @@ static void cgit_print_path_crumbs(char *path)
>
> static void print_header(void)
> {
> - char *logo = NULL, *logo_link = NULL;
> + char *logo = NULL, *logo_alt = NULL, *logo_link = NULL;
> + unsigned int any_logo_link;
>
> html("<table id='header'>\n");
> html("<tr>\n");
> @@ -869,19 +870,33 @@ static void print_header(void)
> logo = ctx.repo->logo;
> else
> logo = ctx.cfg.logo;
> - if (ctx.repo && ctx.repo->logo_link && *ctx.repo->logo_link)
> + if (ctx.repo && ctx.repo->logo_alt && *ctx.repo->logo_alt)
> + logo_alt = ctx.repo->logo_alt;
> + else
> + logo_alt = ctx.cfg.logo_alt;
> + if (ctx.repo && ctx.repo->logo_link)
> logo_link = ctx.repo->logo_link;
> else
> logo_link = ctx.cfg.logo_link;
> + any_logo_link = logo_link && *logo_link;
> +
> if (logo && *logo) {
> - html("<td class='logo' rowspan='2'><a href='");
> - if (logo_link && *logo_link)
> + html("<td class='logo' rowspan='2'>");
> + if (any_logo_link) {
> + html("<a href='");
> html_attr(logo_link);
> - else
> - html_attr(cgit_rooturl());
> - html("'><img src='");
> + html("'>");
> + }
> + html("<img src='");
> html_attr(logo);
> - html("' alt='cgit logo'/></a></td>\n");
> + if (logo_alt && *logo_alt) {
> + html("' alt='");
> + html_attr(logo_alt);
> + }
> + html("'/>");
> + if (any_logo_link)
> + html("</a>");
> + html("</td>\n");
> }
>
> html("<td class='main'>");
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-06-09 15:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 14:38 disable logo-link ? rep.dot.nop
2015-06-18 14:48 ` john
2015-06-18 15:03 ` rep.dot.nop
2015-06-18 15:07 ` john
2015-06-18 15:13 ` rep.dot.nop
2015-06-19 10:37 ` [PATCH] Implement logo-alt rep.dot.nop
2016-06-09 15:27 ` rep.dot.nop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).