summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-09 18:06:55 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-01-31 22:53:57 +0000
commit5f7257c27dace1dcb9d3eb4732caf68f061a8d68 (patch)
treea00cfa51f1aa44ae3592d49c3232795d21d3fae4 /app/views
parentc4c8ca04052aaf7d37c2335066381b536df68427 (diff)
downloadgitlab-ce-5f7257c27dace1dcb9d3eb4732caf68f061a8d68.tar.gz
Initial work on GitLab Pages update
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/nav/_project_settings.html.haml4
-rw-r--r--app/views/projects/pages/_access.html.haml34
-rw-r--r--app/views/projects/pages/_destroy.haml10
-rw-r--r--app/views/projects/pages/_disabled.html.haml4
-rw-r--r--app/views/projects/pages/_form.html.haml35
-rw-r--r--app/views/projects/pages/_remove_certificate.html.haml16
-rw-r--r--app/views/projects/pages/_upload_certificate.html.haml32
-rw-r--r--app/views/projects/pages/_use.html.haml18
-rw-r--r--app/views/projects/pages/show.html.haml18
9 files changed, 171 insertions, 0 deletions
diff --git a/app/views/layouts/nav/_project_settings.html.haml b/app/views/layouts/nav/_project_settings.html.haml
index c6df66d2c3c..d6c158b6de3 100644
--- a/app/views/layouts/nav/_project_settings.html.haml
+++ b/app/views/layouts/nav/_project_settings.html.haml
@@ -34,3 +34,7 @@
= link_to namespace_project_pipelines_settings_path(@project.namespace, @project), title: 'CI/CD Pipelines' do
%span
CI/CD Pipelines
+ = nav_link(controller: :pages) do
+ = link_to namespace_project_pages_path(@project.namespace, @project), title: 'Pages', data: {placement: 'right'} do
+ %span
+ Pages
diff --git a/app/views/projects/pages/_access.html.haml b/app/views/projects/pages/_access.html.haml
new file mode 100644
index 00000000000..d64f99fd22b
--- /dev/null
+++ b/app/views/projects/pages/_access.html.haml
@@ -0,0 +1,34 @@
+- if @project.pages_url
+ .panel.panel-default
+ .panel-heading
+ Access pages
+ .panel-body
+ %p
+ %strong
+ Congratulations! Your pages are served at:
+ %p= link_to @project.pages_url, @project.pages_url
+
+ - if Settings.pages.custom_domain && @project.pages_custom_url
+ %p= link_to @project.pages_custom_url, @project.pages_custom_url
+
+ - if @project.pages_custom_certificate
+ - unless valid_certificate?
+ #error_explanation
+ .alert.alert-warning
+ Your certificate is invalid.
+
+ - unless valid_certificate_key?
+ #error_explanation
+ .alert.alert-warning
+ Your private key is invalid.
+
+ - unless valid_key_for_certificiate?
+ #error_explanation
+ .alert.alert-warning
+ Your private key can't be used with your certificate.
+
+ - unless valid_certificate_intermediates?
+ #error_explanation
+ .alert.alert-warning
+ Your certificate doesn't have intermediates.
+ Your page may not work properly.
diff --git a/app/views/projects/pages/_destroy.haml b/app/views/projects/pages/_destroy.haml
new file mode 100644
index 00000000000..61b995a5934
--- /dev/null
+++ b/app/views/projects/pages/_destroy.haml
@@ -0,0 +1,10 @@
+- if can?(current_user, :remove_pages, @project) && @project.pages_url
+ .panel.panel-default.panel.panel-danger
+ .panel-heading Remove pages
+ .errors-holder
+ .panel-body
+ = form_tag(namespace_project_pages_path(@project.namespace, @project), method: :delete, class: 'form-horizontal') do
+ %p
+ Removing the pages will prevent from exposing them to outside world.
+ .form-actions
+ = button_to 'Remove pages', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_pages_message(@project) }
diff --git a/app/views/projects/pages/_disabled.html.haml b/app/views/projects/pages/_disabled.html.haml
new file mode 100644
index 00000000000..cf9ef5b4d6f
--- /dev/null
+++ b/app/views/projects/pages/_disabled.html.haml
@@ -0,0 +1,4 @@
+.panel.panel-default
+ .nothing-here-block
+ GitLab Pages is disabled.
+ Ask your system's administrator to enable it.
diff --git a/app/views/projects/pages/_form.html.haml b/app/views/projects/pages/_form.html.haml
new file mode 100644
index 00000000000..a7b03d552db
--- /dev/null
+++ b/app/views/projects/pages/_form.html.haml
@@ -0,0 +1,35 @@
+- if can?(current_user, :update_pages, @project)
+ .panel.panel-default
+ .panel-heading
+ Settings
+ .panel-body
+ = form_for [@project], url: namespace_project_pages_path(@project.namespace, @project), html: { class: 'form-horizontal fieldset-form' } do |f|
+ - if @project.errors.any?
+ #error_explanation
+ .alert.alert-danger
+ - @project.errors.full_messages.each do |msg|
+ %p= msg
+
+ .form-group
+ = f.label :pages_domain, class: 'control-label' do
+ Custom domain
+ .col-sm-10
+ - if Settings.pages.custom_domain
+ = f.text_field :pages_custom_domain, required: false, autocomplete: 'off', class: 'form-control'
+ %span.help-inline Allows you to serve the pages under your domain
+ - else
+ .nothing-here-block
+ Support for custom domains and certificates is disabled.
+ Ask your system's administrator to enable it.
+
+ - if Settings.pages.https
+ .form-group
+ .col-sm-offset-2.col-sm-10
+ .checkbox
+ = f.label :pages_redirect_http do
+ = f.check_box :pages_redirect_http
+ %span.descr Force HTTPS
+ .help-block Redirect the HTTP to HTTPS forcing to always use the secure connection
+
+ .form-actions
+ = f.submit 'Save changes', class: "btn btn-save"
diff --git a/app/views/projects/pages/_remove_certificate.html.haml b/app/views/projects/pages/_remove_certificate.html.haml
new file mode 100644
index 00000000000..e8c0d03adfa
--- /dev/null
+++ b/app/views/projects/pages/_remove_certificate.html.haml
@@ -0,0 +1,16 @@
+- if can?(current_user, :update_pages, @project) && @project.pages_custom_certificate
+ .panel.panel-default.panel.panel-danger
+ .panel-heading
+ Remove certificate
+ .errors-holder
+ .panel-body
+ = form_tag(certificates_namespace_project_pages_path(@project.namespace, @project), method: :delete, class: 'form-horizontal') do
+ %p
+ Removing the certificate will stop serving the page under HTTPS.
+ - if certificate
+ %p
+ %pre
+ = certificate.to_text
+
+ .form-actions
+ = button_to 'Remove certificate', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_pages_certificate_message(@project) }
diff --git a/app/views/projects/pages/_upload_certificate.html.haml b/app/views/projects/pages/_upload_certificate.html.haml
new file mode 100644
index 00000000000..30873fcf395
--- /dev/null
+++ b/app/views/projects/pages/_upload_certificate.html.haml
@@ -0,0 +1,32 @@
+- if can?(current_user, :update_pages, @project) && Settings.pages.https && Settings.pages.custom_domain
+ .panel.panel-default
+ .panel-heading
+ Certificate
+ .panel-body
+ %p
+ Allows you to upload your certificate which will be used to serve pages under your domain.
+ %br
+
+ = form_for [@project], url: namespace_project_pages_path(@project.namespace, @project), html: { class: 'form-horizontal fieldset-form' } do |f|
+ - if @project.errors.any?
+ #error_explanation
+ .alert.alert-danger
+ - @project.errors.full_messages.each do |msg|
+ %p= msg
+
+ .form-group
+ = f.label :pages_custom_certificate, class: 'control-label' do
+ Certificate (PEM)
+ .col-sm-10
+ = f.text_area :pages_custom_certificate, required: true, rows: 5, class: 'form-control', value: ''
+ %span.help-inline Upload a certificate for your domain with all intermediates
+
+ .form-group
+ = f.label :pages_custom_certificate_key, class: 'control-label' do
+ Key (PEM)
+ .col-sm-10
+ = f.text_area :pages_custom_certificate_key, required: true, rows: 5, class: 'form-control', value: ''
+ %span.help-inline Upload a certificate for your domain with all intermediates
+
+ .form-actions
+ = f.submit 'Update certificate', class: "btn btn-save"
diff --git a/app/views/projects/pages/_use.html.haml b/app/views/projects/pages/_use.html.haml
new file mode 100644
index 00000000000..5542bbe670b
--- /dev/null
+++ b/app/views/projects/pages/_use.html.haml
@@ -0,0 +1,18 @@
+- unless @project.pages_url
+ .panel.panel-info
+ .panel-heading
+ Configure pages
+ .panel-body
+ %p
+ Learn how to upload your static site and have it served by
+ GitLab by following the #{link_to "documentation on GitLab Pages", "http://doc.gitlab.com/ee/pages/README.html", target: :blank}.
+ %p
+ In the example below we define a special job named
+ %code pages
+ which is using Jekyll to build a static site. The generated
+ HTML will be stored in the
+ %code public/
+ directory which will then be archived and uploaded to GitLab.
+ The name of the directory should not be different than
+ %code public/
+ in order for the pages to work.
diff --git a/app/views/projects/pages/show.html.haml b/app/views/projects/pages/show.html.haml
new file mode 100644
index 00000000000..5f689800da8
--- /dev/null
+++ b/app/views/projects/pages/show.html.haml
@@ -0,0 +1,18 @@
+- page_title "Pages"
+%h3.page_title Pages
+%p.light
+ With GitLab Pages you can host for free your static websites on GitLab.
+ Combined with the power of GitLab CI and the help of GitLab Runner
+ you can deploy static pages for your individual projects, your user or your group.
+%hr
+
+- if Settings.pages.enabled
+ = render 'access'
+ = render 'use'
+ - if @project.pages_url
+ = render 'form'
+ = render 'upload_certificate'
+ = render 'remove_certificate'
+ = render 'destroy'
+- else
+ = render 'disabled'