Exemple #1
0
func Index(users []*models.User, total int, limit int, offset int) string {
	var _buffer bytes.Buffer
	_buffer.WriteString("\n\n<h2 class=\"sub-header\">用户总数:")
	_buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(total)))
	_buffer.WriteString("</h2>\n<div class=\"table-responsive\">\n	<table class=\"table table-striped\">\n		<thead>\n			<tr>\n				<th>名字</th>\n				<th>电邮</th>\n				<th>编辑</th>\n			</tr>\n		</thead>\n		<tbody>\n			")
	for _, u := range users {

		_buffer.WriteString("<tr>\n				<td>")
		_buffer.WriteString(gorazor.HTMLEscape(u.Name))
		_buffer.WriteString("</td>\n				<td>")
		_buffer.WriteString(gorazor.HTMLEscape(u.Email))
		_buffer.WriteString("</td>\n				<td><a href=\"/admin/user/edit?id=")
		_buffer.WriteString(gorazor.HTMLEscape(u.ID.Hex()))
		_buffer.WriteString("\">编辑</a></td>\n			</tr>")

	}
	_buffer.WriteString("\n		</tbody>\n	</table>\n</div>")

	js := func() string {
		var _buffer bytes.Buffer
		return _buffer.String()
	}

	title := func() string {
		var _buffer bytes.Buffer

		_buffer.WriteString("用户管理")

		return _buffer.String()
	}

	return layout.Base(_buffer.String(), title(), js())
}
Exemple #2
0
func Add(content string, err string) string {
	var _buffer bytes.Buffer
	_buffer.WriteString("\n\n<link rel=\"stylesheet\" href=\"/css/bootstrap-datetimepicker.css\">\n\n<style>\n.row {\n	margin-top: 10px;\n}\n</style>\n\n<h2>日程登记</h2>\n\n<div class=\"container-fluid\">\n	<form method=\"POST\" action=\"\">\n	<div class=\"row\" >\n		<p class=\"bg-danger\">")
	_buffer.WriteString(gorazor.HTMLEscape(err))
	_buffer.WriteString("</p>\n	</div>\n\n	<div class=\"row\">\n	内容:\n	<input type='text' class=\"form-control\" name=\"content\" value=\"")
	_buffer.WriteString(gorazor.HTMLEscape(content))
	_buffer.WriteString("\"/>\n	</div>\n	\n	<div class=\"row\">\n	开始时间:\n	<input type='text' class=\"datetimepicker form-control\" name=\"startTime\"/>\n	</div>\n	\n	<div class=\"row\">\n	结束时间:\n	<input type='text' class=\"datetimepicker form-control\" name=\"endTime\"/>\n	</div>\n\n	<div class=\"row\">\n	日程指派:\n	<select name=\"appoint\">\n		<option>cheney</option>\n		<option>wuvist</option>\n	</select>\n	</div>\n	\n	<div class=\"row\">\n	<input style=\"float:right\" type=\"submit\" value=\"保存\" class=\"btn btn-primary\"/>\n	</div>\n	</form>\n</div>")

	title := func() string {
		var _buffer bytes.Buffer

		_buffer.WriteString("管理后台 - 添加日程")

		return _buffer.String()
	}

	js := func() string {
		var _buffer bytes.Buffer

		_buffer.WriteString("<script src=\"/js/moment.js\"></script>")

		_buffer.WriteString("<script src=\"/js/bootstrap-datetimepicker.js\"></script>")

		_buffer.WriteString("<script type=\"text/javascript\">\n	$(function () {\n		$(\".datetimepicker\").datetimepicker({\n			format: \"YYYY-MM-DD HH:mm\",\n			defaultDate: \"2014-05-01 00:00\",\n		})\n	});\n</script>")

		return _buffer.String()
	}

	return layout.Base(_buffer.String(), title(), js())
}
Exemple #3
0
func Forward(content string, err string) string {
	var _buffer bytes.Buffer

	//hello word
	/* hello this */

	return layout.Base(_buffer.String(), "", "")
}
Exemple #4
0
func End(totalMessage int, u *User) string {
	var _buffer bytes.Buffer
	_buffer.WriteString((helper.Header()))
	_buffer.WriteString((helper.Msg(u)))
	for i := 0; i < 2; i++ {
		if totalMessage > 0 {
			if totalMessage == 1 {

				_buffer.WriteString("<p>")
				_buffer.WriteString(gorazor.HTMLEscape(u.Name))
				_buffer.WriteString(" has 1 message</p>")

			} else {

				_buffer.WriteString("<p>")
				_buffer.WriteString(gorazor.HTMLEscape(u.Name))
				_buffer.WriteString(" has ")
				_buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(totalMessage)))
				_buffer.WriteString(" messages</p>")

			}
		} else {

			_buffer.WriteString("<p>")
			_buffer.WriteString(gorazor.HTMLEscape(u.Name))
			_buffer.WriteString(" has no messages</p>")

		}
	}
	{
		for i := 0; i < 2; i++ {
			if totalMessage > 0 {
				if totalMessage == 1 {

					_buffer.WriteString("<p>")
					_buffer.WriteString(gorazor.HTMLEscape(u.Name))
					_buffer.WriteString(" has 1 message</p>")

				} else {

					_buffer.WriteString("<p>")
					_buffer.WriteString(gorazor.HTMLEscape(u.Name))
					_buffer.WriteString(" has ")
					_buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(totalMessage)))
					_buffer.WriteString(" messages</p>")

				}
			} else {

				_buffer.WriteString("<p>")
				_buffer.WriteString(gorazor.HTMLEscape(u.Name))
				_buffer.WriteString(" has no messages</p>")

			}
		}
	}
	{
		switch totalMessage {
		case 1:

			_buffer.WriteString("<p>")
			_buffer.WriteString(gorazor.HTMLEscape(u.Name))
			_buffer.WriteString(" has 1  message</p>")

		case 2:

			_buffer.WriteString("<p>")
			_buffer.WriteString(gorazor.HTMLEscape(u.Name))
			_buffer.WriteString(" has 2 messages</p>")

		default:

			_buffer.WriteString("<p>")
			_buffer.WriteString(gorazor.HTMLEscape(u.Name))
			_buffer.WriteString(" has no messages</p>")

		}
	}
	_buffer.WriteString((helper.Footer()))

	title := func() string {
		var _buffer bytes.Buffer

		_buffer.WriteString("<title>")
		_buffer.WriteString(gorazor.HTMLEscape(u.Name))
		_buffer.WriteString("'s homepage</title>")

		return _buffer.String()
	}

	side := func() string {
		var _buffer bytes.Buffer

		return _buffer.String()
	}

	return layout.Base(_buffer.String(), title(), "")
}