mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-10 23:40:11 +00:00
"Create New Project" button in "My Projects" page.
This commit is contained in:
parent
6b0d566922
commit
ac2a120ee8
8 changed files with 70 additions and 54 deletions
hc
static/css
templates
|
@ -115,7 +115,7 @@ class Profile(models.Model):
|
||||||
|
|
||||||
is_owner = models.Q(owner=self.user)
|
is_owner = models.Q(owner=self.user)
|
||||||
is_member = models.Q(member__user=self.user)
|
is_member = models.Q(member__user=self.user)
|
||||||
return Project.objects.filter(is_owner | is_member)
|
return Project.objects.filter(is_owner | is_member).order_by("name")
|
||||||
|
|
||||||
def checks_from_all_projects(self):
|
def checks_from_all_projects(self):
|
||||||
""" Return a queryset of checks from projects we have access to. """
|
""" Return a queryset of checks from projects we have access to. """
|
||||||
|
|
|
@ -102,6 +102,7 @@ def my_checks(request, code):
|
||||||
request.profile.save()
|
request.profile.save()
|
||||||
|
|
||||||
if request.profile.current_project_id != project.id:
|
if request.profile.current_project_id != project.id:
|
||||||
|
request.project = project
|
||||||
request.profile.current_project = project
|
request.profile.current_project = project
|
||||||
request.profile.save()
|
request.profile.save()
|
||||||
|
|
||||||
|
|
12
static/css/add_project_modal.css
Normal file
12
static/css/add_project_modal.css
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#add-project-modal .modal-header {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#add-project-modal .modal-body {
|
||||||
|
padding: 0 50px 50px 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#add-project-modal h1 {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 0 50px 0;
|
||||||
|
}
|
|
@ -1,15 +1,13 @@
|
||||||
#my-projects a {
|
#project-selector a {
|
||||||
display: block;
|
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
#my-projects a:hover {
|
#project-selector a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#my-projects a:hover .panel {
|
#project-selector a:hover .panel {
|
||||||
border-color: #0091EA;
|
border-color: #0091EA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
34
templates/accounts/add_project_modal.html
Normal file
34
templates/accounts/add_project_modal.html
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<div id="add-project-modal" class="modal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<form method="post" action="{% url 'hc-add-project' %}" class="form-horizontal">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<h1>Create New Project</h1>
|
||||||
|
|
||||||
|
<p>Name your project</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
class="form-control input-lg"
|
||||||
|
autocomplete="off">
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
|
|
||||||
|
{% csrf_token %}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
name="set_project_name"
|
||||||
|
class="btn btn-lg btn-primary btn-block">
|
||||||
|
Create Project
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -117,7 +117,7 @@
|
||||||
href="#"
|
href="#"
|
||||||
class="btn btn-default pull-right"
|
class="btn btn-default pull-right"
|
||||||
data-toggle="modal"
|
data-toggle="modal"
|
||||||
data-target="#create-project-modal">Create Project</a>
|
data-target="#add-project-modal">Create New Project</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if left_project %}
|
{% if left_project %}
|
||||||
|
@ -170,39 +170,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="create-project-modal" class="modal">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<form method="post" action="{% url 'hc-add-project' %}" class="form-horizontal">
|
|
||||||
{% csrf_token %}
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
||||||
<h4>Create Project</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="project-name" class="col-sm-4 control-label">Project Name</label>
|
|
||||||
<div class="col-sm-7">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
id="project-name"
|
|
||||||
name="name">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
name="set_project_name"
|
|
||||||
class="btn btn-primary">Create Project</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="leave-project-modal" class="modal">
|
<div id="leave-project-modal" class="modal">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<form id="leave-project-form" method="post">
|
<form id="leave-project-form" method="post">
|
||||||
|
@ -235,6 +202,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include "accounts/add_project_modal.html" %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<link rel="stylesheet" href="{% static 'css/billing.css' %}" type="text/css">
|
<link rel="stylesheet" href="{% static 'css/billing.css' %}" type="text/css">
|
||||||
<link rel="stylesheet" href="{% static 'css/login.css' %}" type="text/css">
|
<link rel="stylesheet" href="{% static 'css/login.css' %}" type="text/css">
|
||||||
<link rel="stylesheet" href="{% static 'css/projects.css' %}" type="text/css">
|
<link rel="stylesheet" href="{% static 'css/projects.css' %}" type="text/css">
|
||||||
|
<link rel="stylesheet" href="{% static 'css/add_project_modal.css' %}" type="text/css">
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
</head>
|
</head>
|
||||||
<body class="page-{{ page }}">
|
<body class="page-{{ page }}">
|
||||||
|
|
|
@ -7,16 +7,22 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h1 class="settings-title">My Projects</h1>
|
<h1 class="settings-title">
|
||||||
{% for message in messages %}
|
My Projects
|
||||||
<p class="alert alert-{{ message.tags }}">{{ message }}</p>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div id="my-projects" class="row">
|
<div class="pull-right">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#add-project-modal">Create New Project</button>
|
||||||
|
</div>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div id="project-selector" class="row">
|
||||||
{% for project in projects%}
|
{% for project in projects%}
|
||||||
<a href="{% url 'hc-checks' project.code %}">
|
<a href="{% url 'hc-checks' project.code %}">
|
||||||
<div class="col-sm-6 col-md-4">
|
<div class="col-sm-6 col-md-4">
|
||||||
<div class="panel panel-default project-panel">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4>{{ project }}</h4>
|
<h4>{{ project }}</h4>
|
||||||
<div>
|
<div>
|
||||||
|
@ -28,25 +34,20 @@
|
||||||
{{ n }} integration{{ n|pluralize }}
|
{{ n }} integration{{ n|pluralize }}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
{% if show_plans %}
|
|
||||||
<div class="text-muted">
|
<div class="text-muted">
|
||||||
{% if project.owner.subscription %}
|
{{ project.owner.email }}
|
||||||
Plan: {{ project.owner.subscription.plan_name }}
|
|
||||||
{% else %}
|
|
||||||
Plan: Hobbyist
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include "accounts/add_project_modal.html" %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue