[jenkinscat-docs] master: Added 1st renderer: dialog to add new book/job. (ad8e905)

immanetize at fedoraproject.org immanetize at fedoraproject.org
Fri Feb 6 07:40:12 UTC 2015


Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git

On branch  : master

>---------------------------------------------------------------

commit ad8e90559ad54aac7de40c59b2f42d26499d82b4
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date:   Fri Dec 5 13:40:40 2014 +0100

    Added 1st renderer: dialog to add new book/job.


>---------------------------------------------------------------

 ChangeLog                                         |    5 +
 src/jenkinscat/renderers/add_book_step_1_page.clj |  118 +++++++++++++++++++++
 2 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4524041..099034a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-05  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
+	* src/jenkinscat/renderers/add_book_step_1_page.clj:
+	Added 1st renderer: dialog to add new book/job.
+
+2014-12-05  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
 	* src/jenkinscat/renderers/add_book_step_1_error_pages.clj:
 	Added 1st renderer: dialog to add new book/job.
 
diff --git a/src/jenkinscat/renderers/add_book_step_1_page.clj b/src/jenkinscat/renderers/add_book_step_1_page.clj
new file mode 100644
index 0000000..10f2a3a
--- /dev/null
+++ b/src/jenkinscat/renderers/add_book_step_1_page.clj
@@ -0,0 +1,118 @@
+;;;
+;;; Jenkinscat HTTP server that handles all requests send from clients/browsers.
+;;;
+;;; Copyright (c) 2014  Pavel Tisnovsky, Red Hat
+;;; All rights reserved.
+;;;
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions are met:
+;;;     * Redistributions of source code must retain the above copyright
+;;;       notice, this list of conditions and the following disclaimer.
+;;;     * Redistributions in binary form must reproduce the above copyright
+;;;       notice, this list of conditions and the following disclaimer in the
+;;;       documentation and/or other materials provided with the distribution.
+;;;     * Neither the name of the Red Hat nor the
+;;;       names of its contributors may be used to endorse or promote products
+;;;       derived from this software without specific prior written permission.
+;;;
+;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;;; DISCLAIMED. IN NO EVENT SHALL Pavel Tisnovsky BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+;;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+;;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+;;; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;;;
+
+
+
+(ns jenkinscat.renderers.add-book-step-1-page)
+
+(require '[hiccup.core :as hiccup])
+(require '[hiccup.page :as page])
+(require '[hiccup.form :as form])
+
+(require '[jenkinscat.renderers.page-header    :as page-header-renderer])
+(require '[jenkinscat.renderers.navigation-bar :as navigation-bar-renderer])
+
+(defn render-add-book-step-1-page
+    "Render page with the 'add book' dialog."
+    [product-list devel-version]
+    (page/xhtml
+        (page-header-renderer/page-header "add book")
+        [:body
+            [:script "
+                function updateRepositoryPrefix()
+                {
+                    var repoPrefixElement = document.getElementById('repo-prefix');
+                    var repoType = document.getElementById('repository-type').value;
+                    var repoPrefix = ''
+                    if (repoType == 'GitHub')
+                        repoPrefix = 'https://github.com/';
+                    if (repoType == 'SVN (internal)')
+                        repoPrefix = 'https://svn.devel.redhat.com/repos/'
+                    if (repoType == 'Gerrit (internal GIT)')
+                        repoPrefix = 'git://git.app.eng.bos.redhat.com/';
+                    if (repoType == 'Fedora GIT')
+                        repoPrefix = 'git://git.fedorahosted.org/git/docs/';
+                    repoPrefixElement.innerText = repoPrefix;
+                }
+            "]
+            (navigation-bar-renderer/navigation-bar "Add book")
+            (form/form-to [:post "/add-book-step-2"]
+                [:div {:class "col-md-10"}
+                    [:h2 "Add book, step 1/3"]
+                    [:table {:class "table table-condensed table-hover table-borderer"}
+                        [:tr
+                            [:td {:style "width:20%"} "Repository type:"]
+                            [:td {:style "width:20%"} (form/drop-down {:onChange "updateRepositoryPrefix()"} "repository-type" ["Please select repository type" "Gerrit (internal GIT)" "GitHub" "Fedora GIT" "SVN (internal)",])]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr
+                            [:td "Repository name"]
+                            [:td [:div {:id "repo-prefix"} "&nbsp;"]]
+                            [:td (form/text-field {:size "60" :class "-form-control"} "repository-url")]
+                        ]
+                    ;    [:tr
+                    ;        [:td "Book type/build configuration:"]
+                    ;        [:td (form/drop-down "build-configuration"
+                    ;            ["DocBook (Publican)"
+                    ;             "AsciiDoc (asciidoctor and Publican)"
+                    ;             "Markdown (pandoc)"
+                    ;             "Mallard (yelp-build)"
+                    ;             ])]
+                    ;        [:td [:button {:class "btn btn-info" :onclick "window.open('build-configuration-help');" :type "button"} "Help"]]
+                    ;    ]
+                    ;    [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                        [:tr
+                            [:td "&nbsp;"]
+                            [:td (form/submit-button {:class "btn btn-primary"} "Continue")]
+                            [:td "&nbsp;"]
+                        ]
+                    ]]
+            )
+            (if devel-version
+                [:div {:class "col-md-10"}
+                "<a href='/add-book-step-2?repository-type=Gerrit (internal GIT)&repo-prefix=git://git.app.eng.bos.redhat.com/&repository-url=doc-Red_Hat_Developer_Toolset-1-Release_Notes.git'>Gerrit + .edn file</a>"
+                ]
+            )
+            (if devel-version
+                [:div {:class "col-md-10"}
+                "<a href='/add-book-step-2?repository-type=Gerrit (internal GIT)&repo-prefix=git://git.app.eng.bos.redhat.com/&repository-url=doc-Red_Hat_Enterprise_Linux-7-Technical_Notes.git'>Gerrit - .edn file</a>"
+                ]
+            )
+            (if devel-version
+                [:div {:class "col-md-10"}
+                "<a href='/add-book-step-2?repository-type=Gerrit (internal GIT)&repo-prefix=git://git.app.eng.bos.redhat.com/&repository-url=dtc.git'>Gerrit - no DocBook</a>"
+                ]
+            )
+            (if devel-version
+                [:div {:class "col-md-10"}
+                "<a href='/add-book-step-2?repository-type=Gerrit (internal GIT)&repo-prefix=git://git.app.eng.bos.redhat.com/&repository-url=---.git'>Bad repo</a>"
+                ]
+            )
+        ]))
+



More information about the docs-commits mailing list