From 09a7bcbdef237c1443bbbfc29010e7106cffd739 Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Sat, 21 Jan 2017 13:08:29 +0800
Subject: Refactor templates and rearrange its path

---
 public/views/shared/disqus.ejs         |  14 ++++
 public/views/shared/ga.ejs             |  18 ++++
 public/views/shared/help-modal.ejs     | 147 +++++++++++++++++++++++++++++++++
 public/views/shared/polyfill.ejs       |   7 ++
 public/views/shared/refresh-modal.ejs  |  31 +++++++
 public/views/shared/revision-modal.ejs |  27 ++++++
 public/views/shared/signin-modal.ejs   |  95 +++++++++++++++++++++
 7 files changed, 339 insertions(+)
 create mode 100644 public/views/shared/disqus.ejs
 create mode 100644 public/views/shared/ga.ejs
 create mode 100644 public/views/shared/help-modal.ejs
 create mode 100644 public/views/shared/polyfill.ejs
 create mode 100644 public/views/shared/refresh-modal.ejs
 create mode 100644 public/views/shared/revision-modal.ejs
 create mode 100644 public/views/shared/signin-modal.ejs

(limited to 'public/views/shared')

diff --git a/public/views/shared/disqus.ejs b/public/views/shared/disqus.ejs
new file mode 100644
index 00000000..cceaa85c
--- /dev/null
+++ b/public/views/shared/disqus.ejs
@@ -0,0 +1,14 @@
+<div id="disqus_thread"></div>
+<script>
+var disqus_config = function () {
+    this.page.identifier = window.location.pathname.split('/').slice(-1)[0];
+};
+(function() {
+    var d = document, s = d.createElement('script');
+    s.src = '//<%= disqus %>.disqus.com/embed.js';
+    s.setAttribute('data-timestamp', +new Date());
+    (d.head || d.body).appendChild(s);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+                                    
\ No newline at end of file
diff --git a/public/views/shared/ga.ejs b/public/views/shared/ga.ejs
new file mode 100644
index 00000000..66d4acd9
--- /dev/null
+++ b/public/views/shared/ga.ejs
@@ -0,0 +1,18 @@
+<% if(typeof GA !== 'undefined' && GA) { %>
+<script>
+(function (i, s, o, g, r, a, m) {
+    i['GoogleAnalyticsObject'] = r;
+    i[r] = i[r] || function () {
+        (i[r].q = i[r].q || []).push(arguments)
+    }, i[r].l = 1 * new Date();
+    a = s.createElement(o),
+    m = s.getElementsByTagName(o)[0];
+    a.async = 1;
+    a.src = g;
+    m.parentNode.insertBefore(a, m)
+})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
+
+ga('create', '<%= GA %>', 'auto');
+ga('send', 'pageview');
+</script>
+<% } %>
\ No newline at end of file
diff --git a/public/views/shared/help-modal.ejs b/public/views/shared/help-modal.ejs
new file mode 100644
index 00000000..b1ea681d
--- /dev/null
+++ b/public/views/shared/help-modal.ejs
@@ -0,0 +1,147 @@
+<!-- help modal -->
+<div class="modal fade help-modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-question-circle"></i> <%= __('Help') %></h4>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-lg-3">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">
+                                <h3 class="panel-title"><%= __('Contacts') %></h3>
+                            </div>
+                            <div class="panel-body">
+                                <a href="https://github.com/hackmdio/hackmd/issues" target="_blank"><i class="fa fa-tag fa-fw"></i> <%= __('Report an issue') %></a> 
+                                <br>
+                                <a href="mailto:hackmdio@gmail.com"><i class="fa fa-envelope fa-fw"></i> <%= __('Send us email') %></a>
+                            </div>
+                        </div>
+                        <div class="panel panel-default">
+                            <div class="panel-heading">
+                                <h3 class="panel-title"><%= __('Documents') %></h3>
+                            </div>
+                            <div class="panel-body">
+                                <a href="./features" title="Features" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('Features') %></a>
+                                <br>
+                                <a href="./yaml-metadata" title="YAML Metadata" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('YAML Metadata') %></a>
+                                <br>
+                                <a href="./slide-example" title="Slide Example" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('Slide Example') %></a>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-lg-9">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">
+                                <h3 class="panel-title"><%= __('Cheatsheet') %></h3>
+                            </div>
+                            <div class="panel-body" style="height: calc(100vh - 215px); overflow: auto;">
+                                <table class="table table-condensed table-cheatsheet">
+                                    <thead>
+                                        <tr>
+                                            <th><%= __('Example') %></th>
+                                            <th><%= __('Syntax') %></th>
+                                        </tr>
+                                    </thead>
+                                    <tbody class="markdown-body" style="font-family: inherit; font-size: 14px; padding: 0; max-width: inherit;">
+                                        <tr>
+                                            <td><%= __('Header') %></td>
+                                            <td># <%= __('Header') %></td>
+                                        </tr>
+                                        <tr>
+                                            <td><ul><li><%= __('Unordered List') %></li></ul></td>
+                                            <td>- <%= __('Unordered List') %></td>
+                                        </tr>
+                                        <tr>
+                                            <td><ol><li><%= __('Ordered List') %></li></ol></td>
+                                            <td>1. <%= __('Ordered List') %></td>
+                                        </tr>
+                                        <tr>
+                                            <td><ul><li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled><label></label><%= __('Todo List') %></li></ul></td>
+                                            <td>- [ ] <%= __('Todo List') %></td>
+                                        </tr>
+                                        <tr>
+                                            <td><blockquote> <%= __('Blockquote') %></blockquote></td>
+                                            <td>> <%= __('Blockquote') %></td>
+                                        </tr>
+                                        <tr>
+                                            <td><strong><%= __('Bold font') %></strong></td>
+                                            <td>**<%= __('Bold font') %>**</td>
+                                        </tr>
+                                        <tr>
+                                            <td><i><%= __('Italics font') %></i></td>
+                                            <td>*<%= __('Italics font') %>*</td>
+                                        </tr>
+                                        <tr>
+                                            <td><s><%= __('Strikethrough') %></s></td>
+                                            <td>~~<%= __('Strikethrough') %>~~</td>
+                                        </tr>
+                                        <tr>
+                                            <td>19<sup>th</sup></td>
+                                            <td>19^th^</td>
+                                        </tr>
+                                        <tr>
+                                            <td>H<sub>2</sub>O</td>
+                                            <td>H~2~O</td>
+                                        </tr>
+                                        <tr>
+                                            <td><ins><%= __('Inserted text') %></ins></td>
+                                            <td>++<%= __('Inserted text') %>++</td>
+                                        </tr>
+                                        <tr>
+                                            <td><mark><%= __('Marked text') %></mark></td>
+                                            <td>==<%= __('Marked text') %>==</td>
+                                        </tr>
+                                        <tr>
+                                            <td><a><%= __('Link') %></a></td>
+                                            <td>[link text](https:// "title")</td>
+                                        </tr>
+                                        <tr>
+                                            <td><%= __('Image') %></td>
+                                            <td>![image alt](https:// "title")</td>
+                                        </tr>
+                                        <tr>
+                                            <td><code><%= __('Code') %></code></td>
+                                            <td>`<%= __('Code') %>`</td>
+                                        </tr>
+                                        <tr>
+                                            <td><pre style="border:none !important;"><code class="javascript hljs"><div class="wrapper"><div class="gutter linenumber"><span data-linenumber="1"></span></div><div class="code"><span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;
+</div></div></code></pre></td>
+                                            <td>```javascript<br>var i = 0;<br>```</td>
+                                        </tr>
+                                        <tr>
+                                            <td><img align="absmiddle" alt=":smile:" class="emoji" src="./build/emojify.js/dist/images/basic/smile.png" title=":smile:"></img></td>
+                                            <td>:smile:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><%= __('Externals') %></td>
+                                            <td>{%youtube youtube_id %}</td>
+                                        </tr>
+                                        <tr>
+                                            <td>L<sup>a</sup>T<sub>e</sub>X</td>
+                                            <td>$L^aT_eX$</td>
+                                        </tr>
+                                        <tr>
+                                            <td><div class="alert alert-info"><p><%= __('This is a alert area.') %></p></div></td>
+                                            <td>:::info<br><%= __('This is a alert area.') %><br>:::</td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<style>
+    table.table-cheatsheet tr > td:nth-child(2) {
+        font-family: "Source Code Pro", Consolas, monaco, monospace;
+        letter-spacing: 0.025em;
+        line-height: 1.25;
+    }
+</style>
\ No newline at end of file
diff --git a/public/views/shared/polyfill.ejs b/public/views/shared/polyfill.ejs
new file mode 100644
index 00000000..5c885642
--- /dev/null
+++ b/public/views/shared/polyfill.ejs
@@ -0,0 +1,7 @@
+<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+<!--[if lt IE 9]>
+	<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js" integrity="sha256-3Jy/GbSLrg0o9y5Z5n1uw0qxZECH7C6OQpVBgNFYa0g=" crossorigin="anonymous"></script>
+	<script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js" integrity="sha256-g6iAfvZp+nDQ2TdTR/VVKJf3bGro4ub5fvWSWVRi2NE=" crossorigin="anonymous"></script>
+	<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.min.js" integrity="sha256-8E4Is26QH0bD52WoQpcB+R/tcWQtpzlCojrybUd7Mxo=" crossorigin="anonymous"></script>
+<![endif]-->
\ No newline at end of file
diff --git a/public/views/shared/refresh-modal.ejs b/public/views/shared/refresh-modal.ejs
new file mode 100644
index 00000000..5be41b2a
--- /dev/null
+++ b/public/views/shared/refresh-modal.ejs
@@ -0,0 +1,31 @@
+<!-- refresh modal -->
+<div class="modal fade" id="refreshModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+    <div class="modal-dialog modal-sm">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="myModalLabel"><%= __('This page need refresh') %></h4>
+            </div>
+            <div class="modal-body">
+                <div class="incompatible-version">
+                    <h5><%= __('You have an incompatible client version.') %></h5>
+                    <strong><%= __('Refresh to update.') %></strong>
+                </div>
+                <div class="new-version" style="display:none;">
+                    <h5><%= __('New version available!') %></h5>
+                    <a href="<%- url %>/s/release-notes" target="_blank"><%= __('See releases notes here') %></a>
+                    <br>
+                    <strong><%= __('Refresh to enjoy new features.') %></strong>
+                </div>
+                <div class="user-state-changed" style="display:none;">
+                    <h5><%= __('Your user state has changed.') %></h5>
+                    <strong><%= __('Refresh to load new user state.') %></strong>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-primary" id="refreshModalRefresh"><%= __('Refresh') %></button>
+            </div>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/public/views/shared/revision-modal.ejs b/public/views/shared/revision-modal.ejs
new file mode 100644
index 00000000..f824cf06
--- /dev/null
+++ b/public/views/shared/revision-modal.ejs
@@ -0,0 +1,27 @@
+<!-- revision modal -->
+<div class="modal fade" id="revisionModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-history"></i> <%= __('Revision') %></h4>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-lg-4" style="max-height: calc(100vh - 215px); overflow: auto;">
+                        <div class="list-group ui-revision-list"></div>
+                    </div>
+                    <div class="col-lg-8" style="height: calc(100vh - 215px); overflow: hidden;">
+                        <textarea id="revisionViewer" style="display:none;"></textarea>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button>
+                <button type="button" class="btn btn-primary" id="revisionModalDownload"><%= __('Download') %></button>
+                <button type="button" class="btn btn-danger" id="revisionModalRevert"><%= __('Revert') %></button>
+            </div>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/public/views/shared/signin-modal.ejs b/public/views/shared/signin-modal.ejs
new file mode 100644
index 00000000..a8af62e7
--- /dev/null
+++ b/public/views/shared/signin-modal.ejs
@@ -0,0 +1,95 @@
+<!-- signin modal -->
+<div class="modal fade signin-modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
+    <div class="modal-dialog modal-sm">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="mySmallModalLabel"><%= __('Choose method') %></h4>
+            </div>
+            <div class="modal-body" style="text-align: center;">
+                <% if(facebook) { %>
+                <a href="<%- url %>/auth/facebook" class="btn btn-lg btn-block btn-social btn-facebook">
+                    <i class="fa fa-facebook"></i> <%= __('Sign in via %s', 'Facebook') %>
+                </a>
+                <% } %>
+                <% if(twitter) { %>
+                <a href="<%- url %>/auth/twitter" class="btn btn-lg btn-block btn-social btn-twitter">
+                    <i class="fa fa-twitter"></i> <%= __('Sign in via %s', 'Twitter') %>
+                </a>
+                <% } %>
+                <% if(github) { %>
+                <a href="<%- url %>/auth/github" class="btn btn-lg btn-block btn-social btn-github">
+                    <i class="fa fa-github"></i> <%= __('Sign in via %s', 'GitHub') %>
+                </a>
+                <% } %>
+                <% if(gitlab) { %>
+                <a href="<%- url %>/auth/gitlab" class="btn btn-lg btn-block btn-social btn-soundcloud">
+                    <i class="fa fa-gitlab"></i> <%= __('Sign in via %s', 'GitLab') %>
+                </a>
+                <% } %>
+                <% if(dropbox) { %>
+                <a href="<%- url %>/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox">
+                    <i class="fa fa-dropbox"></i> <%= __('Sign in via %s', 'Dropbox') %>
+                </a>
+                <% } %>
+                <% if(google) { %>
+                <a href="<%- url %>/auth/google" class="btn btn-lg btn-block btn-social btn-google">
+                    <i class="fa fa-google"></i> <%= __('Sign in via %s', 'Google') %>
+                </a>
+                <% } %>
+                <% if((facebook || twitter || github || gitlab || dropbox || google) && ldap) { %>
+                <hr>
+                <% }%>
+                <% if(ldap) { %>
+                <h4>Via <% if (ldap.providerName) { %> <%- ldap.providerName %> (LDAP) <% } else { %> LDAP <% } %></h4>
+                <form data-toggle="validator" role="form" class="form-horizontal" method="post" enctype="application/x-www-form-urlencoded">
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <input type="username" class="form-control" name="username" placeholder="Username" required>
+                            <span class="help-block control-label with-errors" style="display: inline;"></span>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <input type="password" class="form-control" name="password" placeholder="Password" required>
+                            <span class="help-block control-label with_errors" style="display: inline;"></span>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <button type="submit" class="btn btn-primary" formaction="<%- url %>/auth/ldap">Sign in</button>
+                        </div>
+                    </div>
+                </form>
+                <% } %>
+                <% if((facebook || twitter || github || gitlab || dropbox || google || ldap) && email) { %>
+                <hr>
+                <% }%>
+                <% if(email) { %>
+                <h4>Via Email</h4>
+                <form data-toggle="validator" role="form" class="form-horizontal" method="post" enctype="application/x-www-form-urlencoded">
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <input type="email" class="form-control" name="email" placeholder="Email" required>
+                            <span class="help-block control-label with-errors" style="display: inline;"></span>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <input type="password" class="form-control" name="password" placeholder="Password" required>
+                            <span class="help-block control-label with-errors" style="display: inline;"></span>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <button type="submit" class="btn btn-primary" formaction="<%- url %>/login">Sign in</button>
+                            <% if(allowemailregister) { %><button type="submit" class="btn btn-default" formaction="<%- url %>/register">Register</button><% }%>
+                        </div>
+                    </div>
+                </form>
+                <% }%>
+            </div>
+        </div>
+    </div>
+</div>
-- 
cgit v1.2.3