hyde_admin 0.0.1 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitattributes +3 -0
- data/.idea/hyde_admin.iml +2 -0
- data/.idea/vcs.xml +6 -0
- data/CHANGELOG.md +35 -0
- data/README.md +23 -0
- data/TODO.md +3 -0
- data/bin/admin_views/admin_layout.html.erb +204 -108
- data/bin/admin_views/configuration.erb +13 -0
- data/bin/admin_views/dashboard.erb +1 -1
- data/bin/admin_views/editor_html.erb +24 -0
- data/bin/admin_views/editor_js.erb +120 -0
- data/bin/admin_views/files/edit.erb +30 -0
- data/bin/admin_views/files/listing.erb +111 -0
- data/bin/admin_views/partials/image_element.html.erb +4 -0
- data/bin/admin_views/partials/images_page.html.erb +8 -0
- data/bin/admin_views/posts/edit.erb +158 -0
- data/bin/admin_views/posts/listing.erb +37 -0
- data/bin/admin_views/upload_image_form.erb +45 -0
- data/bin/fslightbox/fslightbox.js +1 -0
- data/bin/hyde_admin +3 -0
- data/bin/hyde_admin.ru +306 -56
- data/bin/hyde_admin.yml +12 -5
- data/bin/hyde_assets/hyde_admin.css +37 -0
- data/bin/hyde_assets/hyde_admin.js +24 -0
- data/bin/i18n/en.yml +77 -1
- data/bin/i18n/fr.yml +77 -1
- data/bin/lib/codemirror.css +349 -0
- data/bin/lib/codemirror.js +9833 -0
- data/bin/mode/css/css.js +864 -0
- data/bin/mode/css/gss.html +104 -0
- data/bin/mode/css/gss_test.js +17 -0
- data/bin/mode/css/index.html +81 -0
- data/bin/mode/css/less.html +152 -0
- data/bin/mode/css/less_test.js +54 -0
- data/bin/mode/css/scss.html +158 -0
- data/bin/mode/css/scss_test.js +110 -0
- data/bin/mode/css/test.js +217 -0
- data/bin/mode/htmlembedded/htmlembedded.js +37 -0
- data/bin/mode/htmlembedded/index.html +60 -0
- data/bin/mode/htmlmixed/htmlmixed.js +153 -0
- data/bin/mode/htmlmixed/index.html +100 -0
- data/bin/mode/javascript/index.html +118 -0
- data/bin/mode/javascript/javascript.js +959 -0
- data/bin/mode/javascript/json-ld.html +72 -0
- data/bin/mode/javascript/test.js +521 -0
- data/bin/mode/javascript/typescript.html +62 -0
- data/bin/mode/markdown/index.html +418 -0
- data/bin/mode/markdown/markdown.js +886 -0
- data/bin/mode/markdown/test.js +1319 -0
- data/bin/mode/ruby/index.html +183 -0
- data/bin/mode/ruby/ruby.js +303 -0
- data/bin/mode/ruby/test.js +23 -0
- data/bin/mode/sass/index.html +68 -0
- data/bin/mode/sass/sass.js +459 -0
- data/bin/mode/sass/test.js +122 -0
- data/bin/mode/spreadsheet/index.html +42 -0
- data/bin/mode/spreadsheet/spreadsheet.js +112 -0
- data/bin/mode/xml/index.html +61 -0
- data/bin/mode/xml/test.js +51 -0
- data/bin/mode/xml/xml.js +417 -0
- data/bin/mode/yaml/index.html +80 -0
- data/bin/mode/yaml/yaml.js +120 -0
- data/bin/mode/yaml-frontmatter/index.html +121 -0
- data/bin/mode/yaml-frontmatter/yaml-frontmatter.js +72 -0
- data/hyde_admin.gemspec +7 -1
- data/lib/hyde_admin/version.rb +1 -1
- metadata +131 -7
- data/bin/admin_views/edit.erb +0 -57
- data/bin/admin_views/listing.erb +0 -32
- data/bin/hyde_admin.sh +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ef51602655e92300fd16efb61fc625738e962b8708146c702666fefe759d582
|
4
|
+
data.tar.gz: 695738c9eb64ff85aaa643fb2b06ac8219d9ed1abec97cd9fc2ca7a4b99014f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1076b6a7a5cd25e24715a5bfc27f5cc7ddb2f2a88c3406d6ca2affeb45e391cab4e74f734ef0036a6c33ae1f2fa61e977b63e8446cd26139aacafabcacbbde7e
|
7
|
+
data.tar.gz: 29719bfc0e10609a22b45590031c5e4fea57d9e190ba158a186d2fa523953d0c37df8e204ff8d846296b915fb108d9a0a7d61b0bb2ae8b9991dccc2175d0c519
|
data/.gitattributes
ADDED
data/.idea/hyde_admin.iml
CHANGED
@@ -11,6 +11,8 @@
|
|
11
11
|
</content>
|
12
12
|
<orderEntry type="inheritedJdk" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.0) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.10, RVM: ruby-2.7.0) [gem]" level="application" />
|
14
16
|
</component>
|
15
17
|
<component name="RModuleSettingsStorage">
|
16
18
|
<LOAD_PATH number="0" />
|
data/.idea/vcs.xml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# 0.0.7
|
2
|
+
|
3
|
+
Post edit : bugfix, keep layout & format when we don't show input.
|
4
|
+
CodeMirror editor : form-control style
|
5
|
+
Locales shows possible value for config.
|
6
|
+
|
7
|
+
# 0.0.6
|
8
|
+
|
9
|
+
Form upload image + style images selector
|
10
|
+
Menu follows workflow
|
11
|
+
Configuration remove beforeSend
|
12
|
+
Rsync params
|
13
|
+
Publish only for drafts
|
14
|
+
|
15
|
+
# 0.0.5
|
16
|
+
|
17
|
+
Sometimes no tags
|
18
|
+
|
19
|
+
# 0.0.4
|
20
|
+
|
21
|
+
Correct images selector
|
22
|
+
Some refactoring
|
23
|
+
Escape translations
|
24
|
+
|
25
|
+
# 0.0.3
|
26
|
+
|
27
|
+
Bugfix (see commits)
|
28
|
+
|
29
|
+
# 0.0.2
|
30
|
+
|
31
|
+
First usable version
|
32
|
+
|
33
|
+
# 0.0.1
|
34
|
+
|
35
|
+
PoC
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
## Getting Started with Hyde Admin
|
2
|
+
|
3
|
+
Add
|
4
|
+
|
5
|
+
`gem 'hyde_admin'`
|
6
|
+
|
7
|
+
In the Gemfile of your jekyll site.
|
8
|
+
|
9
|
+
Run
|
10
|
+
|
11
|
+
`bundle update`
|
12
|
+
|
13
|
+
When run
|
14
|
+
|
15
|
+
`hyde_admin`
|
16
|
+
|
17
|
+
in your jekyll directory.
|
18
|
+
You can visit localhost:9292 !
|
19
|
+
|
20
|
+
hyde_admin.yml is automatically generated in your jekyll directory.
|
21
|
+
(you can change settings with hyde_admin ou directly)
|
22
|
+
|
23
|
+
Hyde_admin allow ssh deployment.
|
data/TODO.md
ADDED
@@ -1,5 +1,5 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html lang="
|
2
|
+
<html lang="<%= @hyde_parameters['hyde_admin_language'] %>">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<title>Hyde for Jekyll</title>
|
@@ -11,121 +11,217 @@
|
|
11
11
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
|
12
12
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
|
13
13
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
14
|
-
|
14
|
+
|
15
|
+
<script src="/lib/codemirror.js"></script>
|
16
|
+
<link rel="stylesheet" href="/lib/codemirror.css">
|
17
|
+
<script src="/mode/javascript/javascript.js"></script>
|
18
|
+
<script src="/mode/css/css.js"></script>
|
19
|
+
<script src="/mode/sass/sass.js"></script>
|
20
|
+
<script src="/mode/ruby/ruby.js"></script>
|
21
|
+
<script src="/mode/yaml/yaml.js"></script>
|
22
|
+
<script src="/mode/xml/xml.js"></script>
|
23
|
+
<script src="/mode/markdown/markdown.js"></script>
|
24
|
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
25
|
+
|
26
|
+
<link rel="stylesheet" href="/hyde_assets/hyde_admin.css">
|
27
|
+
<script src="/hyde_assets/hyde_admin.js"></script>
|
15
28
|
</head>
|
16
29
|
<body>
|
17
|
-
|
18
|
-
<div class="
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
<
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
<
|
89
|
-
<
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
</
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
Year-end sale
|
103
|
-
</a>
|
104
|
-
</li>
|
105
|
-
</ul>
|
106
|
-
-->
|
30
|
+
<div class="container-fluid">
|
31
|
+
<div class="row">
|
32
|
+
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
|
33
|
+
<div class="position-sticky pt-3">
|
34
|
+
<ul class="nav flex-column">
|
35
|
+
<li class="nav-item">
|
36
|
+
</li>
|
37
|
+
<li class="nav-item">
|
38
|
+
<a class="nav-link active" aria-current="page" href="/dashboard">
|
39
|
+
<span data-feather="home" class="fas fa-tachometer-alt"></span>
|
40
|
+
<%= EscapeUtils.escape_html t.dashboard.capitalize %>
|
41
|
+
</a>
|
42
|
+
</li>
|
43
|
+
<li class="nav-item">
|
44
|
+
<a class="nav-link" href="/pages/index">
|
45
|
+
<span data-feather="file" class="fas fa-file"></span>
|
46
|
+
<%= EscapeUtils.escape_html t.pages.capitalize %>
|
47
|
+
</a>
|
48
|
+
</li>
|
49
|
+
<li class="nav-item">
|
50
|
+
<a class="nav-link" href="/drafts/index">
|
51
|
+
<span data-feather="shopping-cart" class="fas fa-file"></span>
|
52
|
+
<%= EscapeUtils.escape_html t.drafts.capitalize %>
|
53
|
+
</a>
|
54
|
+
</li>
|
55
|
+
<li class="nav-item">
|
56
|
+
<a class="nav-link" href="/posts/index">
|
57
|
+
<span data-feather="users" class="fas fa-file"></span>
|
58
|
+
<%= EscapeUtils.escape_html t.posts.capitalize %>
|
59
|
+
</a>
|
60
|
+
</li>
|
61
|
+
<li class="nav-item">
|
62
|
+
<a class="nav-link" href="/files/index">
|
63
|
+
<span data-feather="users" class="fas fa-copy"></span>
|
64
|
+
<%= EscapeUtils.escape_html t.files.capitalize %>
|
65
|
+
</a>
|
66
|
+
</li>
|
67
|
+
<li></li>
|
68
|
+
<li class="nav-item mb-4 mt-4">
|
69
|
+
<a class="nav-link" href="/configuration">
|
70
|
+
<span data-feather="layers" class="fas fa-tools"></span>
|
71
|
+
<%= EscapeUtils.escape_html t.configuration.capitalize %>
|
72
|
+
</a>
|
73
|
+
</li>
|
74
|
+
<li></li>
|
75
|
+
<li class="nav-item">
|
76
|
+
<a class="nav-link active" aria-current="page" href="/rebuild" id="btn-rebuild">
|
77
|
+
<span data-feather="home" class="fas fa-hammer"></span>
|
78
|
+
<%= EscapeUtils.escape_html t.rebuild.capitalize %>
|
79
|
+
</a>
|
80
|
+
</li>
|
81
|
+
<li class="nav-item">
|
82
|
+
<a class="nav-link active" aria-current="page" target="_blank" href="/<%= @hyde_parameters['site_index'] %>">
|
83
|
+
<span data-feather="home" class="fas fa-eye"></span>
|
84
|
+
<%= EscapeUtils.escape_html t.overview.capitalize %>
|
85
|
+
</a>
|
86
|
+
</li>
|
87
|
+
<li class="nav-item">
|
88
|
+
<a class="nav-link active" aria-current="page" href="/deploy" id="btn-deploy">
|
89
|
+
<span data-feather="home" class="fas fa-cloud-upload-alt"></span>
|
90
|
+
<%= EscapeUtils.escape_html t.deploy.capitalize %>
|
91
|
+
</a>
|
92
|
+
</li>
|
93
|
+
</ul>
|
94
|
+
<p class="text-center text-muted"><br><br><em>Hyde Admin V.<%= HydeAdmin::VERSION %></em> <a href="https://github.com/rivsc/hyde_admin" class="link-secondary"><i class="fab fa-github"></i></a></p>
|
95
|
+
</div>
|
96
|
+
</nav>
|
97
|
+
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
|
98
|
+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
99
|
+
<h1 class="h2">Hyde Admin for Jekyll</h1>
|
100
|
+
<!--
|
101
|
+
<div class="btn-toolbar mb-2 mb-md-0">
|
102
|
+
<div class="btn-group me-2">
|
103
|
+
<button type="button" class="btn btn-sm btn-outline-secondary"><%= t.backup_zip %></button>
|
104
|
+
<button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
|
105
|
+
</div>
|
106
|
+
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle">
|
107
|
+
<span data-feather="calendar"></span>
|
108
|
+
This week
|
109
|
+
</button>
|
110
|
+
</div>
|
111
|
+
-->
|
112
|
+
</div>
|
113
|
+
<%= yield %>
|
114
|
+
</main>
|
107
115
|
</div>
|
108
|
-
</
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div id="waiting" style="width:100vw;height:100vh;display:none;text-align:center;background-color:rgba(0,0,0,0.5);position: fixed;top:0px;left:0px">
|
119
|
+
<i class="fas fa-circle-notch fa-10x fa-spin" style="margin-top:40vh;"></i>
|
120
|
+
</div>
|
109
121
|
|
110
|
-
<
|
111
|
-
<div class="
|
112
|
-
<
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<button type="button" class="btn btn-
|
122
|
+
<div class="modal modal-image" tabindex="-1" role="dialog">
|
123
|
+
<div class="modal-dialog" role="document">
|
124
|
+
<div class="modal-content">
|
125
|
+
<div class="modal-header">
|
126
|
+
<h5 class="modal-title"><%= t.images.capitalize %></h5>
|
127
|
+
<!--
|
128
|
+
<button type="button" class="btn btn-default close" data-dismiss="modal" aria-label="Close">
|
129
|
+
<span aria-hidden="true">×</span>
|
130
|
+
</button>
|
131
|
+
-->
|
132
|
+
<button type="button" class="btn btn-outline-secondary btn-sm load-image">
|
133
|
+
<%= t.load_images.capitalize %>
|
134
|
+
</button>
|
135
|
+
</div>
|
136
|
+
<div class="modal-body">
|
137
|
+
<div>
|
138
|
+
<div class="image-selector-search d-block" data-page="0">
|
139
|
+
<form action="" class="form-inline">
|
140
|
+
<div class="form-group mb-2">
|
141
|
+
<label>
|
142
|
+
<input class="form-check-input" type="radio" name="sort_date" value="asc"> <%= EscapeUtils.escape_html t.newer.capitalize %>
|
143
|
+
</label>
|
144
|
+
|
145
|
+
<label>
|
146
|
+
<input class="form-check-input" type="radio" name="sort_date" value="desc" checked> <%= EscapeUtils.escape_html t.older.capitalize %>
|
147
|
+
</label>
|
148
|
+
</div>
|
149
|
+
<div class="form-group mb-2">
|
150
|
+
<label for="inputFilename" class="sr-only"><%= EscapeUtils.escape_html t.filename.capitalize %></label>
|
151
|
+
<input type="text" class="form-control" name="filename" id="inputFilename" placeholder="<%= EscapeUtils.escape_html t.filename_placeholder.capitalize %>">
|
152
|
+
</div>
|
153
|
+
<button type="submit" class="btn btn-primary image-selector-search-submit d-block mb-2"><%= EscapeUtils.escape_html t.search.capitalize %></button>
|
154
|
+
</form>
|
155
|
+
</div>
|
156
|
+
<div class="image-selector-content">
|
157
|
+
<% path = File.join(Pathname.new(Mid.gem_source_path), 'admin_views', 'partials', 'images_page.html.erb') %>
|
158
|
+
<%= ERB.new(File.read(path)).result(binding) %>
|
159
|
+
</div>
|
160
|
+
<div class="image-selector-page text-center">
|
161
|
+
<a href="#" title="<%= EscapeUtils.escape_html t.previous_images %>" class="btn btn-secondary image-selector-page-prev px-4">
|
162
|
+
<i class="fas fa-chevron-left"></i>
|
163
|
+
</a>
|
164
|
+
<a href="#" title="<%= EscapeUtils.escape_html t.next_images %>" class="btn btn-secondary image-selector-page-next px-4">
|
165
|
+
<i class="fas fa-chevron-right"></i>
|
166
|
+
</a>
|
167
|
+
</div>
|
168
|
+
</div>
|
117
169
|
</div>
|
118
|
-
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle">
|
119
|
-
<span data-feather="calendar"></span>
|
120
|
-
This week
|
121
|
-
</button>
|
122
170
|
</div>
|
123
171
|
</div>
|
124
|
-
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<script type="text/javascript" charset="utf-8">
|
175
|
+
<% if @file %>
|
176
|
+
if(window.document.getElementById('i-content')){
|
177
|
+
window.myCodeMirror = CodeMirror.fromTextArea(window.document.getElementById('i-content'), {
|
178
|
+
lineNumbers: true,
|
179
|
+
tabSize: 2,
|
180
|
+
indentWithTabs: false,
|
181
|
+
mode: "<%= {'.js' => 'javascript', '.json' => 'javascript', '.xml' => 'xml', '.svg' => 'xml', '.css' => 'css', '.yml' => 'yaml', '.sass' => 'sass', '.rb' => 'ruby', '.md' => 'markdown'}[File.extname(@file)] || 'markdown' %>"
|
182
|
+
});
|
183
|
+
}
|
184
|
+
<% end %>
|
185
|
+
|
186
|
+
function search(offset_page){
|
187
|
+
let sort_date = $('.image-selector-search input[name=sort_date]:checked').val();
|
188
|
+
let filename = $('.image-selector-search input[name=filename]').val();
|
189
|
+
let page = $('.image-selector-search').attr('data-page');
|
190
|
+
let new_page = parseInt(page) + offset_page;
|
191
|
+
|
192
|
+
if(new_page < 0){
|
193
|
+
new_page = 0;
|
194
|
+
}
|
195
|
+
|
196
|
+
$.post( "/ajax/images", { sort_date: sort_date, filename: filename, page: new_page })
|
197
|
+
.done(function( data ) {
|
198
|
+
$('.image-selector-content').html(data);
|
199
|
+
});
|
125
200
|
|
126
|
-
|
127
|
-
|
128
|
-
|
201
|
+
$('.image-selector-search').attr('data-page', new_page);
|
202
|
+
return false;
|
203
|
+
}
|
129
204
|
|
205
|
+
$(document).on('click', '.image-selector-search-submit', function(){
|
206
|
+
search(0);
|
207
|
+
return false;
|
208
|
+
});
|
209
|
+
$(document).on('click', '.image-selector-page-prev', function(){
|
210
|
+
search(-1);
|
211
|
+
return false;
|
212
|
+
});
|
213
|
+
$(document).on('click', '.image-selector-page-next', function(){
|
214
|
+
search(1);
|
215
|
+
return false;
|
216
|
+
});
|
217
|
+
$(document).on('click', '.load-image', function(){
|
218
|
+
var windowObjectReference = window.open("/upload_image_form", "update_image", "dialog=yes,menubar=no,location=no,resizable=no,scrollbars=yes,status=yes,outerWidth=800,innerHeight=300,width=800,height=300");
|
219
|
+
return false;
|
220
|
+
});
|
221
|
+
function reload_image(){
|
222
|
+
$('.load-image').click();
|
223
|
+
}
|
224
|
+
</script>
|
225
|
+
<script src="/fslightbox/fslightbox.js"></script>
|
130
226
|
</body>
|
131
227
|
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h2><%= EscapeUtils.escape_html t.configuration.capitalize %></h2>
|
2
|
+
|
3
|
+
<form action="/configuration" method="post">
|
4
|
+
<% @hyde_parameters.each_pair do |setting, value| %>
|
5
|
+
<div class="mb-3">
|
6
|
+
<label for="i-<%= setting %>" class="form-label"><%= EscapeUtils.escape_html t.send(setting).capitalize %></label>
|
7
|
+
<input type="text" class="form-control" value="<%= value %>" name="<%= setting %>" id="i-<%= setting %>">
|
8
|
+
<div id="i-<%= setting %>-help" class="form-text"><%= EscapeUtils.escape_html t.send("help_#{setting}").capitalize %></div>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
<button type="submit" class="btn btn-primary"><%= EscapeUtils.escape_html t.submit.capitalize %></button>
|
12
|
+
</form>
|
13
|
+
|
@@ -1 +1 @@
|
|
1
|
-
dashboard
|
1
|
+
<h2><%= EscapeUtils.escape_html t.dashboard.capitalize %></h2>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="codemirror-toolbar btn-toolbar" role="toolbar">
|
2
|
+
<div class="btn-group mr-2" role="group" aria-label="Undo/redo">
|
3
|
+
<button type="button" class="btn btn-light"><i class="fas fa-undo-alt" title="<%= EscapeUtils.escape_html t.editor_undo %>"></i></button>
|
4
|
+
<button type="button" class="btn btn-light"><i class="fas fa-redo-alt" title="<%= EscapeUtils.escape_html t.editor_redo %>"></i></button>
|
5
|
+
</div>
|
6
|
+
<div class="btn-group mr-2" role="group" aria-label="Structural tags">
|
7
|
+
<button type="button" class="btn btn-light"><i class="fas fa-file-image" title="<%= EscapeUtils.escape_html t.editor_file %>"></i></button>
|
8
|
+
<button type="button" class="btn btn-light"><i class="fas fa-list cmt-replace" title="<%= EscapeUtils.escape_html t.editor_list %>"></i></button>
|
9
|
+
<button type="button" class="btn btn-light"><i class="fas fa-list-ol cmt-replace" title="<%= EscapeUtils.escape_html t.editor_list_ol %>"></i></button>
|
10
|
+
<button type="button" class="btn btn-light"><i class="fas fa-link cmt-replace" title="<%= EscapeUtils.escape_html t.editor_link %>"></i></button>
|
11
|
+
<button type="button" class="btn btn-light"><i class="fas fa-quote-left cmt-replace" title="<%= EscapeUtils.escape_html t.editor_quote %>"></i></button>
|
12
|
+
</div>
|
13
|
+
<div class="btn-group mr-2" role="group" aria-label="Style tags">
|
14
|
+
<button type="button" class="btn btn-light"><i class="fas fa-heading cmt-heading-1" title="<%= EscapeUtils.escape_html t.editor_title_h1 %>">1</i></button>
|
15
|
+
<button type="button" class="btn btn-light"><i class="fas fa-heading cmt-heading-2" title="<%= EscapeUtils.escape_html t.editor_title_h2 %>">2</i></button>
|
16
|
+
<button type="button" class="btn btn-light"><i class="fas fa-heading cmt-heading-3" title="<%= EscapeUtils.escape_html t.editor_title_h3 %>">3</i></button>
|
17
|
+
<button type="button" class="btn btn-light"><i class="fas fa-heading cmt-heading-4" title="<%= EscapeUtils.escape_html t.editor_title_h4 %>">4</i></button>
|
18
|
+
<button type="button" class="btn btn-light"><i class="fas fa-heading cmt-heading-5" title="<%= EscapeUtils.escape_html t.editor_title_h5 %>">5</i></button>
|
19
|
+
<button type="button" class="btn btn-light"><i class="fas fa-underline cmt-replace" title="<%= EscapeUtils.escape_html t.editor_underline %>"></i></button>
|
20
|
+
<button type="button" class="btn btn-light"><i class="fas fa-bold cmt-replace" title="<%= EscapeUtils.escape_html t.editor_bold %>"></i></button>
|
21
|
+
<button type="button" class="btn btn-light"><i class="fas fa-italic cmt-replace" title="<%= EscapeUtils.escape_html t.editor_italic %>"></i></button>
|
22
|
+
<button type="button" class="btn btn-light"><i class="fas fa-strikethrough cmt-replace" title="<%= EscapeUtils.escape_html t.editor_strikethrough %>"></i></button>
|
23
|
+
</div>
|
24
|
+
</div>
|
@@ -0,0 +1,120 @@
|
|
1
|
+
$(document).on('click', '.codemirror-toolbar .fa-undo-alt', function(){
|
2
|
+
window.myCodeMirror.undo();
|
3
|
+
});
|
4
|
+
$(document).on('click', '.codemirror-toolbar .fa-redo-alt', function(){
|
5
|
+
window.myCodeMirror.redo();
|
6
|
+
});
|
7
|
+
$(document).on('click', '.codemirror-toolbar .fa-file-image', function(){
|
8
|
+
$('.modal-image').modal('show');
|
9
|
+
});
|
10
|
+
$(document).on('click', '.modal-image img', function(){
|
11
|
+
let img_src = '<img src="' + $(this).attr('src') + '" alt="<%= EscapeUtils.escape_html t.default_alt_img %>" title="<%= EscapeUtils.escape_html t.default_title_img %>" />';
|
12
|
+
if(window.mode_markdown){
|
13
|
+
img_src = '.attr('src') + ')';
|
14
|
+
}
|
15
|
+
window.myCodeMirror.replaceSelection(img_src);
|
16
|
+
$('.modal-image').modal('hide');
|
17
|
+
});
|
18
|
+
$(document).on('click', '.codemirror-toolbar .fa-heading', function(){
|
19
|
+
let obj_cursor = window.myCodeMirror.getCursor();
|
20
|
+
|
21
|
+
let heading_number = 0;
|
22
|
+
if($(this).hasClass('cmt-heading-1')){
|
23
|
+
heading_number = 1;
|
24
|
+
}else if($(this).hasClass('cmt-heading-2')){
|
25
|
+
heading_number = 2;
|
26
|
+
}else if($(this).hasClass('cmt-heading-3')){
|
27
|
+
heading_number = 3;
|
28
|
+
}else if($(this).hasClass('cmt-heading-4')){
|
29
|
+
heading_number = 4;
|
30
|
+
}else if($(this).hasClass('cmt-heading-5')){
|
31
|
+
heading_number = 5;
|
32
|
+
}
|
33
|
+
|
34
|
+
let begin_str = '<h' + heading_number + '>';
|
35
|
+
let end_str = '</h' + heading_number + '>';
|
36
|
+
if(window.mode_markdown){
|
37
|
+
begin_str = '#';
|
38
|
+
for (let i = 1; i < heading_number; i++) {
|
39
|
+
begin_str = begin_str + '#';
|
40
|
+
}
|
41
|
+
begin_str = begin_str + ' ';
|
42
|
+
end_str = '';
|
43
|
+
}
|
44
|
+
window.myCodeMirror.replaceSelection(begin_str + window.myCodeMirror.getSelection() + end_str);
|
45
|
+
if(!window.myCodeMirror.somethingSelected()){
|
46
|
+
window.myCodeMirror.setCursor({ line: obj_cursor.line, ch: obj_cursor.ch + begin_str.length });
|
47
|
+
}
|
48
|
+
window.myCodeMirror.focus();
|
49
|
+
});
|
50
|
+
$(document).on('click', '.codemirror-toolbar .cmt-replace', function(){
|
51
|
+
let begin_str = '';
|
52
|
+
let end_str = '';
|
53
|
+
|
54
|
+
if($(this).hasClass('fa-underline')){
|
55
|
+
begin_str = '<u>';
|
56
|
+
end_str = '</u>';
|
57
|
+
/*if(window.mode_markdown){
|
58
|
+
begin_str = '';
|
59
|
+
end_str = '';
|
60
|
+
}*/
|
61
|
+
}else if($(this).hasClass('fa-bold')){
|
62
|
+
begin_str = '<b>';
|
63
|
+
end_str = '</b>';
|
64
|
+
if(window.mode_markdown){
|
65
|
+
begin_str = '**';
|
66
|
+
end_str = '**';
|
67
|
+
}
|
68
|
+
}else if($(this).hasClass('fa-italic')){
|
69
|
+
begin_str = '<i>';
|
70
|
+
end_str = '</i>';
|
71
|
+
if(window.mode_markdown){
|
72
|
+
begin_str = '*';
|
73
|
+
end_str = '*';
|
74
|
+
}
|
75
|
+
}else if($(this).hasClass('fa-strikethrough')){
|
76
|
+
begin_str = '<s>';
|
77
|
+
end_str = '</s>';
|
78
|
+
if(window.mode_markdown){
|
79
|
+
begin_str = '~~';
|
80
|
+
end_str = '~~';
|
81
|
+
}
|
82
|
+
}else if($(this).hasClass('fa-link')){
|
83
|
+
begin_str = '<a href="https://www.example.com/">';
|
84
|
+
end_str = '</a>';
|
85
|
+
if(window.mode_markdown){
|
86
|
+
begin_str = '[';
|
87
|
+
end_str = '](https://www.example.com/)';
|
88
|
+
}
|
89
|
+
}else if($(this).hasClass('fa-quote-left')){
|
90
|
+
begin_str = '<blockquote>\n <p>';
|
91
|
+
end_str = '</p>\n</blockquote>';
|
92
|
+
if(window.mode_markdown){
|
93
|
+
begin_str = '>';
|
94
|
+
end_str = '';
|
95
|
+
}
|
96
|
+
}else if($(this).hasClass('fa-list')){
|
97
|
+
begin_str = '<ul>\n <li>';
|
98
|
+
end_str = '</li>\n</ul>';
|
99
|
+
if(window.mode_markdown){
|
100
|
+
begin_str = '- ';
|
101
|
+
end_str = '';
|
102
|
+
}
|
103
|
+
}else if($(this).hasClass('fa-list-ol')){
|
104
|
+
begin_str = '<ol>\n <li>';
|
105
|
+
end_str = '</li>\n</ol>';
|
106
|
+
if(window.mode_markdown){
|
107
|
+
begin_str = '1. ';
|
108
|
+
end_str = '';
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
let obj_cursor = window.myCodeMirror.getCursor();
|
113
|
+
window.myCodeMirror.replaceSelection(begin_str + window.myCodeMirror.getSelection() + end_str);
|
114
|
+
if(!window.myCodeMirror.somethingSelected()){
|
115
|
+
let moreline = (begin_str.split('\n').length > 1 ? begin_str.split('\n').length / 2 : 0);
|
116
|
+
let morech = (moreline > 0 ? begin_str.split('\n')[begin_str.split('\n').length - 1].length : begin_str.length);
|
117
|
+
window.myCodeMirror.setCursor({ line: obj_cursor.line + moreline, ch: obj_cursor.ch + morech });
|
118
|
+
}
|
119
|
+
window.myCodeMirror.focus();
|
120
|
+
});
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h2><%= EscapeUtils.escape_html t.edit.capitalize %></h2>
|
2
|
+
|
3
|
+
<form action="/files/update?file=<%= @file %>" method="post">
|
4
|
+
<% if @has_header %>
|
5
|
+
<div class="mb-3">
|
6
|
+
<label for="i-header" class="form-label"><%= EscapeUtils.escape_html t.header.capitalize %></label>
|
7
|
+
<textarea class="form-control text-editor" id="i-header" rows="3" name="header" style="font-family: <%= (['.html', '.xml', '.yml', '.js', '.md'].include?(File.extname(@file)) ? 'monospace' : 'inherit') %>"><%= @header %></textarea>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
<div class="mb-3">
|
11
|
+
<label for="i-content" class="form-label"><%= EscapeUtils.escape_html t.content.capitalize %>
|
12
|
+
<% if ['.html','.md'].include?(File.extname(@file)) %>
|
13
|
+
<a href="https://jekyllrb.com/docs/liquid/" class="text-secondary" target="_blank"><i class="fas fa-question-circle"></i></a>
|
14
|
+
<% end %>
|
15
|
+
</label>
|
16
|
+
|
17
|
+
<% if @has_editor %>
|
18
|
+
<% path = File.join(Pathname.new(Mid.gem_source_path), 'admin_views', 'editor_html.erb') %>
|
19
|
+
<%= ERB.new(File.read(path)).result(binding) %>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<textarea class="form-control text-editor" id="i-content" rows="3" name="content" style="font-family: <%= (['.html', '.xml', '.yml', '.js', '.md'].include?(File.extname(@file)) ? 'monospace' : 'inherit') %>"><%= @content %></textarea>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8">
|
25
|
+
<% path = File.join(Pathname.new(Mid.gem_source_path), 'admin_views', 'editor_js.erb') %>
|
26
|
+
<%= ERB.new(File.read(path)).result(binding) %>
|
27
|
+
</script>
|
28
|
+
</div>
|
29
|
+
<button type="submit" class="btn btn-primary"><%= EscapeUtils.escape_html t.submit.capitalize %></button>
|
30
|
+
</form>
|