aboutsummaryrefslogtreecommitdiffstats
path: root/templates/user
diff options
context:
space:
mode:
authorPatrick G <geek1011@outlook.com>2017-10-18 14:18:31 -0400
committerLauris BH <lauris@nix.lv>2017-10-18 21:18:31 +0300
commit30afce1523ae4e03fcb831a051665c7008c443b3 (patch)
treeeda22e42c34118a36a70cfad6499813485091247 /templates/user
parent2a184f5924ada6e030d9039c9d19aef86901c285 (diff)
downloadgitea-30afce1523ae4e03fcb831a051665c7008c443b3.tar.gz
gitea-30afce1523ae4e03fcb831a051665c7008c443b3.zip
Fix tabs according to semantic-ui docs (#2733)
Diffstat (limited to 'templates/user')
-rw-r--r--templates/user/notification/notification.tmpl18
1 files changed, 7 insertions, 11 deletions
diff --git a/templates/user/notification/notification.tmpl b/templates/user/notification/notification.tmpl
index 6d975a934a..da6bd07d2a 100644
--- a/templates/user/notification/notification.tmpl
+++ b/templates/user/notification/notification.tmpl
@@ -5,18 +5,14 @@
<h1 class="ui dividing header">{{.i18n.Tr "notification.notifications"}}</h1>
<div class="ui top attached tabular menu">
- <a href="{{AppSubUrl}}/notifications?q=unread">
- <div class="{{if eq .Status 1}}active{{end}} item">
- {{.i18n.Tr "notification.unread"}}
- {{if .NotificationUnreadCount}}
- <div class="ui label">{{.NotificationUnreadCount}}</div>
- {{end}}
- </div>
+ <a href="{{AppSubUrl}}/notifications?q=unread" class="{{if eq .Status 1}}active{{end}} item">
+ {{.i18n.Tr "notification.unread"}}
+ {{if .NotificationUnreadCount}}
+ <div class="ui label">{{.NotificationUnreadCount}}</div>
+ {{end}}
</a>
- <a href="{{AppSubUrl}}/notifications?q=read">
- <div class="{{if eq .Status 2}}active{{end}} item">
- {{.i18n.Tr "notification.read"}}
- </div>
+ <a href="{{AppSubUrl}}/notifications?q=read" class="{{if eq .Status 2}}active{{end}} item">
+ {{.i18n.Tr "notification.read"}}
</a>
</div>
<div class="ui bottom attached active tab segment">
' href='#n110'>110 111 112 113 114 115 116 117 118 119 120 121 122
/*-
 * Copyright 2021 Vsevolod Stakhov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#ifndef RSPAMD_CSS_VALUE_HXX
#define RSPAMD_CSS_VALUE_HXX

#include "libserver/html.h"
#include <string>
#include <variant>
#include <optional>
#include "parse_error.hxx"
#include "css_parser.hxx"
#include "contrib/expected/expected.hpp"

namespace rspamd::css {

struct alignas(int) css_color {
	std::uint8_t r;
	std::uint8_t g;
	std::uint8_t b;

	std::uint8_t alpha;

	constexpr css_color(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _alpha = 255) :
	 	r(_r), g(_g), b(_b), alpha(_alpha) {}
};

/*
 * Simple enum class for display stuff
 */
enum class css_display_value {
	DISPLAY_NORMAL,
	DISPLAY_HIDDEN
};

/*
 * CSS flags
 */
enum class css_flag_value {
	FLAG_INHERIT,
	FLAG_IMPORTANT,
	FLAG_NOTIMPORTANT
};

/*
 * Value handler, uses std::variant instead of polymorphic classes for now
 * for simplicity
 */
struct css_value {
	enum class css_value_type {
		CSS_VALUE_COLOR,
		CSS_VALUE_SIZE,
		CSS_VALUE_DISPLAY,
		CSS_VALUE_FLAG,
		CSS_VALUE_NYI,
	} type;

	std::variant<css_color,
			double,
			css_display_value,
			css_flag_value> value;

	constexpr std::optional<css_color> to_color(void) const {
		if (type == css_value_type::CSS_VALUE_COLOR) {
			return std::get<css_color>(value);
		}

		return std::nullopt;
	}

	constexpr std::optional<double> to_size(void) const {
		if (type == css_value_type::CSS_VALUE_SIZE) {
			return std::get<double>(value);
		}

		return std::nullopt;
	}

	constexpr std::optional<css_display_value> to_display(void) const {
		if (type == css_value_type::CSS_VALUE_DISPLAY) {
			return std::get<css_display_value>(value);
		}

		return std::nullopt;
	}

	constexpr std::optional<css_flag_value> to_flag(void) const {
		if (type == css_value_type::CSS_VALUE_FLAG) {
			return std::get<css_flag_value>(value);
		}

		return std::nullopt;
	}

	constexpr bool is_valid(void) const {
		return (type != css_value_type::CSS_VALUE_NYI);
	}

	static auto from_css_block(const css_consumed_block &bl) -> tl::expected<css_value, css_parse_error>;

	static auto maybe_color_from_string(const std::string_view &input)
		-> std::optional<css_value>;
};

}

#endif //RSPAMD_CSS_VALUE_HXX