summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-10 15:06:31 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-01-31 22:53:57 +0000
commit13b6bad17ec46eb78878f6972da1e7e34be86bb5 (patch)
tree745e04a26813be3e65200bc4ab6ece3fe73e6069 /app/views
parent6e99226cca41f36d92c4ccb2cd398d2256091adc (diff)
downloadgitlab-ce-13b6bad17ec46eb78878f6972da1e7e34be86bb5.tar.gz
Implement extra domains and save pages configuration
Diffstat (limited to 'app/views')
-rw-r--r--app/views/projects/pages/_access.html.haml29
-rw-r--r--app/views/projects/pages/_destroy.haml2
-rw-r--r--app/views/projects/pages/_form.html.haml64
-rw-r--r--app/views/projects/pages/_list.html.haml16
-rw-r--r--app/views/projects/pages/_no_domains.html.haml6
-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/index.html.haml25
-rw-r--r--app/views/projects/pages/new.html.haml6
-rw-r--r--app/views/projects/pages/show.html.haml38
10 files changed, 111 insertions, 123 deletions
diff --git a/app/views/projects/pages/_access.html.haml b/app/views/projects/pages/_access.html.haml
index d64f99fd22b..9740877b214 100644
--- a/app/views/projects/pages/_access.html.haml
+++ b/app/views/projects/pages/_access.html.haml
@@ -5,30 +5,9 @@
.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.
+ Congratulations! Your pages are served under:
- - 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.
+ %p= link_to @project.pages_url, @project.pages_url
- - unless valid_certificate_intermediates?
- #error_explanation
- .alert.alert-warning
- Your certificate doesn't have intermediates.
- Your page may not work properly.
+ - @project.pages_domains.each do |domain|
+ %p= link_to domain.url, domain.url
diff --git a/app/views/projects/pages/_destroy.haml b/app/views/projects/pages/_destroy.haml
index 61b995a5934..dd493a6d312 100644
--- a/app/views/projects/pages/_destroy.haml
+++ b/app/views/projects/pages/_destroy.haml
@@ -3,7 +3,7 @@
.panel-heading Remove pages
.errors-holder
.panel-body
- = form_tag(namespace_project_pages_path(@project.namespace, @project), method: :delete, class: 'form-horizontal') do
+ = form_tag(remove_pages_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
diff --git a/app/views/projects/pages/_form.html.haml b/app/views/projects/pages/_form.html.haml
index a7b03d552db..c69b76c6697 100644
--- a/app/views/projects/pages/_form.html.haml
+++ b/app/views/projects/pages/_form.html.haml
@@ -1,35 +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_for [@domain], url: namespace_project_pages_path(@project.namespace, @project), html: { class: 'form-horizontal fieldset-form' } do |f|
+ - if @domain.errors.any?
+ #error_explanation
+ .alert.alert-danger
+ - @domain.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.
+ .form-group
+ = f.label :domain, class: 'control-label' do
+ Domain
+ .col-sm-10
+ = f.text_field :domain, required: true, autocomplete: 'off', class: 'form-control'
+ %span.help-inline * required
- - 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
+ - if Settings.pages.external_https
+ .form-group
+ = f.label :certificate, class: 'control-label' do
+ Certificate (PEM)
+ .col-sm-10
+ = f.text_area :certificate, rows: 5, class: 'form-control', value: ''
+ %span.help-inline Upload a certificate for your domain with all intermediates
- .form-actions
- = f.submit 'Save changes', class: "btn btn-save"
+ .form-group
+ = f.label :key, class: 'control-label' do
+ Key (PEM)
+ .col-sm-10
+ = f.text_area :key, rows: 5, class: 'form-control', value: ''
+ %span.help-inline Upload a certificate for your domain with all intermediates
+ - else
+ .nothing-here-block
+ Support for custom certificates is disabled.
+ Ask your system's administrator to enable it.
+
+ .form-actions
+ = f.submit 'Create New Domain', class: "btn btn-save"
diff --git a/app/views/projects/pages/_list.html.haml b/app/views/projects/pages/_list.html.haml
new file mode 100644
index 00000000000..7dfeb0e6e12
--- /dev/null
+++ b/app/views/projects/pages/_list.html.haml
@@ -0,0 +1,16 @@
+.panel.panel-default
+ .panel-heading
+ Domains (#{@domains.count})
+ %ul.well-list
+ - @domains.each do |domain|
+ %li
+ .pull-right
+ = link_to 'Details', namespace_project_page_path(@project.namespace, @project, domain), class: "btn btn-sm btn-grouped"
+ = link_to 'Remove', namespace_project_page_path(@project.namespace, @project, domain), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-sm btn-grouped"
+ .clearfix
+ %span= link_to domain.domain, domain.url
+ %p
+ - if domain.subject
+ %span.label.label-gray Certificate: #{domain.subject}
+ - if domain.expired?
+ %span.label.label-danger Expired
diff --git a/app/views/projects/pages/_no_domains.html.haml b/app/views/projects/pages/_no_domains.html.haml
new file mode 100644
index 00000000000..5a18740346a
--- /dev/null
+++ b/app/views/projects/pages/_no_domains.html.haml
@@ -0,0 +1,6 @@
+.panel.panel-default
+ .panel-heading
+ Domains
+ .nothing-here-block
+ Support for domains and certificates is disabled.
+ Ask your system's administrator to enable it.
diff --git a/app/views/projects/pages/_remove_certificate.html.haml b/app/views/projects/pages/_remove_certificate.html.haml
deleted file mode 100644
index e8c0d03adfa..00000000000
--- a/app/views/projects/pages/_remove_certificate.html.haml
+++ /dev/null
@@ -1,16 +0,0 @@
-- 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
deleted file mode 100644
index 30873fcf395..00000000000
--- a/app/views/projects/pages/_upload_certificate.html.haml
+++ /dev/null
@@ -1,32 +0,0 @@
-- 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/index.html.haml b/app/views/projects/pages/index.html.haml
new file mode 100644
index 00000000000..fea34c113ba
--- /dev/null
+++ b/app/views/projects/pages/index.html.haml
@@ -0,0 +1,25 @@
+- page_title "Pages"
+%h3.page_title
+ Pages
+
+ = link_to new_namespace_project_page_path(@project.namespace, @project), class: "btn btn-new pull-right", title: "New Domain" do
+ %i.fa.fa-plus
+ New Domain
+
+%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.clearfix
+
+- if Settings.pages.enabled
+ = render 'access'
+ = render 'use'
+ - if Settings.pages.external_http || Settings.pages.external_https
+ = render 'list'
+ - else
+ = render 'no_domains'
+ = render 'destroy'
+- else
+ = render 'disabled'
diff --git a/app/views/projects/pages/new.html.haml b/app/views/projects/pages/new.html.haml
new file mode 100644
index 00000000000..2609df62aac
--- /dev/null
+++ b/app/views/projects/pages/new.html.haml
@@ -0,0 +1,6 @@
+- page_title 'Pages'
+%h3.page_title
+ New Pages Domain
+%hr.clearfix
+%div
+ = render 'form'
diff --git a/app/views/projects/pages/show.html.haml b/app/views/projects/pages/show.html.haml
index 5f689800da8..98c4e890968 100644
--- a/app/views/projects/pages/show.html.haml
+++ b/app/views/projects/pages/show.html.haml
@@ -1,18 +1,22 @@
-- 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
+- page_title "#{@domain.domain}", "Pages Domain"
-- 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'
+%h3.page-title
+ #{@domain.domain}
+
+.table-holder
+ %table.table
+ %tr
+ %td
+ Domain
+ %td
+ = link_to @domain.domain, @domain.url
+ %tr
+ %td
+ Certificate
+ %td
+ - if @domain.certificate
+ %pre
+ = @domain.certificate.to_text
+ - else
+ .light
+ missing