[jenkinscat-docs] master: Added 4th renderer: dialog to add new book/job. (d6194ca)

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


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

On branch  : master

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

commit d6194ca26bbdb9fdb0f35fe7a63235c65e0c5267
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date:   Thu Dec 11 14:13:46 2014 +0100

    Added 4th renderer: dialog to add new book/job.


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

 ChangeLog                                         |    5 +
 src/jenkinscat/renderers/add_book_step_3_page.clj |  141 +++++++++++++++++++++
 2 files changed, 146 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0b56904..05d8b3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-11  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/jenkinscat/renderers/add_book_step_3_page.clj:
+	Added 4th renderer: dialog to add new book/job.
+
 2014-12-09  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/jenkinscat/renderers/page_header.clj:
diff --git a/src/jenkinscat/renderers/add_book_step_3_page.clj b/src/jenkinscat/renderers/add_book_step_3_page.clj
new file mode 100644
index 0000000..2d1f413
--- /dev/null
+++ b/src/jenkinscat/renderers/add_book_step_3_page.clj
@@ -0,0 +1,141 @@
+;;;
+;;; 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-3-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-3
+    "Render page with a question how to build the book."
+    [document-title product-name product-number component-name component-product repository-type repository-name repository-url]
+    (page/xhtml
+        (page-header-renderer/page-header "add book, step 2")
+        [:body
+            [:script "
+                function updateScriptText()
+                {
+                    var scriptTextElement = document.getElementById('script-text');
+                    var selectedScript = document.getElementById('build-script').value;
+                    var buildScript = ''
+                    var submitButton = document.getElementById('submit');
+
+                    submitButton.disabled = 'disabled';
+
+                    if (selectedScript == 'DocBook') {
+                        buildScript = 'publican build --langs en-US --format %';
+                        submitButton.disabled = '';
+                    }
+                    if (selectedScript == 'AsciiDoctor') {
+                        buildScript = 'asciidoctor -d book -b docbook -a nolang -a docinfo -a noxmlns %';
+                        submitButton.disabled = '';
+                    }
+                    if (selectedScript == 'Markdown to HTML') {
+                        buildScript = 'pandoc -f markdown -t html -c kultiad-serif.css -o index.html %';
+                        submitButton.disabled = '';
+                    }
+                    scriptTextElement.innerText = buildScript;
+                }
+            "]
+            (navigation-bar-renderer/navigation-bar "Add book")
+            (form/form-to [:post "/add-book-step-4"]
+                [:div {:class "col-md-10"}
+                    [:h2 "Add book, step 3/3"]
+                    [:table {:class "table table-condensed table-hover table-borderer"}
+                        [:tr {:class "danger"}
+                            [:td "Please select method used to build this book:"]
+                            [:td (form/drop-down {:onChange "updateScriptText()"} "build-script" ["Select..." "DocBook" "AsciiDoctor" "Markdown to HTML"])]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr [:td "&nbsp;"] [:td {:colspan 2} [:div {:id "script-text"} "&nbsp;"]]]
+                        [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                        [:tr
+                            [:td {:width "30%"} "Book name:"]
+                            [:td (form/text-field {:size "40" :class "-form-control" :style "border-width:1px;border-color:red" :readonly "readonly"} "document-title" document-title)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                        [:tr
+                            [:td "Product name:"]
+                            [:td (form/text-field {:size "40" :class "-form-control" :readonly "readonly"} "product-name" product-name)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr
+                            [:td "Product number"]
+                            [:td (form/text-field {:size "20" :class "-form-control" :readonly "readonly"} "product-number" product-number)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                        [:tr
+                            [:td "Bugzilla component name:"]
+                            [:td (form/text-field {:size "40" :class "-form-control" :readonly "readonly"} "component-name" component-name)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr
+                            [:td "Bugzilla product name for given component:"]
+                            [:td (form/text-field {:size "40" :class "-form-control" :readonly "readonly"} "component-product" component-product)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                        [:tr
+                            [:td "Repository: (not editable)"]
+                            [:td "&nbsp;"]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr
+                            [:td "Repository type:"]
+                            [:td (form/text-field {:size "20" :class "-form-control" :readonly "readonly"} "repository-type" repository-type)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr
+                            [:td "Repository name:"]
+                            [:td (form/text-field {:size "70" :class "-form-control" :readonly "readonly"} "repository-name" repository-name)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr
+                            [:td "Repository URL"]
+                            [:td (form/text-field {:size "100" :class "-form-control" :readonly "readonly"} "repository-url" repository-url)]
+                            [:td "&nbsp;"]
+                        ]
+                        [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                        [:tr
+                            [:td "&nbsp;"]
+                            [:td (form/submit-button {:class "btn btn-primary" :id "submit" :disabled "disabled"} "Finish")]
+                            [:td "&nbsp;"]
+                        ]
+                    ]]
+            )
+        ]))
+



More information about the docs-commits mailing list