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
data/bin/hyde_admin.ru
CHANGED
@@ -2,86 +2,306 @@
|
|
2
2
|
# lancer avec rackup
|
3
3
|
require "roda"
|
4
4
|
require 'yaml'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'i18n'
|
7
|
+
require 'date'
|
8
|
+
require 'escape_utils'
|
9
|
+
require_relative '../lib/hyde_admin/version'
|
10
|
+
|
11
|
+
# TODO détecter format nouveau post (pour codemirror)
|
12
|
+
# Serve
|
13
|
+
|
14
|
+
class Mid < Roda
|
15
|
+
plugin :middleware
|
5
16
|
|
6
|
-
class App < Roda
|
7
17
|
YML_FILE_NAME = "hyde_admin.yml"
|
8
18
|
|
9
19
|
plugin :render,
|
10
20
|
#escape: true, # Automatically escape output in erb templates using Erubi's escaping support
|
11
|
-
views: 'admin_views', # Default views directory
|
21
|
+
views: File.join(File.expand_path(File.dirname(__FILE__)),'admin_views'), # Default views directory
|
12
22
|
layout_opts: {template: 'admin_layout', engine: 'html.erb'}, # Default layout options
|
13
23
|
template_opts: {default_encoding: 'UTF-8'} # Default template options
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# TODO load option (default_layout, deploy_dest_address, deploy_dest_path, path_to_jekyll_src, rsync_fullpath)
|
22
|
-
# expliquer dans la doc le hyde.yml (voir une commande pour le prégénérer)
|
24
|
+
plugin :i18n, translations: File.join(File.expand_path(File.dirname(__FILE__)), 'i18n') # gem 'roda-i18n'
|
25
|
+
opts[:root] = Dir.pwd
|
26
|
+
plugin :public, root: File.join(Dir.pwd, '_site') # simulate jekyll site
|
27
|
+
plugin :static, ['/mode', '/lib', '/fslightbox', '/hyde_assets'], :root => File.join(File.expand_path(File.dirname(__FILE__)))
|
28
|
+
plugin :http_auth
|
29
|
+
plugin :common_logger
|
23
30
|
|
24
31
|
def initialize(param)
|
25
|
-
puts "============> #{Dir.pwd}"
|
26
32
|
yml_in_current_dir = File.join(Dir.pwd, YML_FILE_NAME)
|
27
33
|
yml_in_gem = File.expand_path(File.join(File.dirname(__FILE__), YML_FILE_NAME))
|
28
34
|
|
29
|
-
puts yml_in_current_dir
|
30
|
-
puts yml_in_gem
|
31
|
-
|
32
35
|
# Generate default YML for hyde_admin
|
33
36
|
if !File.exist?(yml_in_current_dir)
|
34
|
-
|
37
|
+
FileUtils.cp(yml_in_gem, yml_in_current_dir)
|
35
38
|
end
|
36
39
|
@hyde_parameters ||= YAML.load(File.read(yml_in_current_dir))
|
37
40
|
super(param)
|
38
41
|
end
|
39
42
|
|
43
|
+
def self.transliterate_title_for_url(title)
|
44
|
+
I18n.config.available_locales = :en
|
45
|
+
I18n.transliterate(title).downcase.gsub(/[^a-zA-Z ]/,'').gsub(' ','-')
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.urlize(date_str, title, with_date = true)
|
49
|
+
url_str = ""
|
50
|
+
if with_date
|
51
|
+
url_str += "#{Date.parse(date_str).strftime('%Y-%m-%d')}-"
|
52
|
+
end
|
53
|
+
url_str += "#{self.transliterate_title_for_url(title)}"
|
54
|
+
url_str
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.extract_header_str(str)
|
58
|
+
str.scan(/---(.*?)---/m).flatten.first
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.extract_header(str)
|
62
|
+
headers = Mid.extract_header_str(str).to_s.split("\n")
|
63
|
+
headers = headers.select{ |header| !header.empty? }.map{ |header| header.scan(/([a-zA-Z0-9]*): (.*)/).flatten }.select{ |header| !header.empty? }
|
64
|
+
hsh_headers = {}
|
65
|
+
if !headers.flatten.empty?
|
66
|
+
#$stderr.puts "==============="
|
67
|
+
#$stderr.puts headers.inspect
|
68
|
+
hsh_headers = Hash[headers]
|
69
|
+
end
|
70
|
+
hsh_headers
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.remove_header(str)
|
74
|
+
str.gsub(/---(.*?)---/m, "")
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.gem_source_path
|
78
|
+
File.expand_path(File.dirname(__FILE__))
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.extract_tags(str)
|
82
|
+
str.to_s.scan(/^\[?(.*?)\]?$/).flatten.first.split(',')
|
83
|
+
end
|
84
|
+
|
85
|
+
FORMAT_DATE_FILENAME = '%Y-%m-%d'
|
86
|
+
FORMAT_DATE_INPUT_FILENAME = '%Y-%m-%d %H:%M:%S %z'
|
87
|
+
|
88
|
+
REGEXP_EXTRACT_DATE_FROM_FILENAME = /\d{4}-\d{2}-\d{2}-/
|
89
|
+
REGEXP_EXTRACT_DATE_TITLE_FROM_FILENAME = /(\d{4}-\d{2}-\d{2}-)(.*)(\.[^.]*)$/
|
90
|
+
|
40
91
|
route do |r|
|
41
|
-
|
92
|
+
@page = r.params['page']
|
93
|
+
|
94
|
+
if @hyde_parameters['hyde_admin_auth'].to_s == 'true'
|
95
|
+
http_auth {|u, p| [u, p] == [@hyde_parameters['hyde_admin_user'], @hyde_parameters['hyde_admin_password']] }
|
96
|
+
end
|
97
|
+
|
98
|
+
# GET serve jekyll site
|
42
99
|
r.public
|
43
100
|
|
101
|
+
r.i18n_set_locale(@hyde_parameters['hyde_admin_language']) do
|
102
|
+
|
44
103
|
r.root do
|
45
104
|
r.redirect "/dashboard"
|
46
105
|
end
|
47
106
|
|
107
|
+
# Redirect to jekyll index site
|
48
108
|
r.on "overview" do
|
49
109
|
r.redirect @hyde_parameters['site_index']
|
50
110
|
end
|
51
|
-
|
52
|
-
#
|
111
|
+
|
112
|
+
# Rebuild static files
|
53
113
|
r.on "rebuild" do
|
54
|
-
puts
|
55
|
-
`cd #{
|
114
|
+
puts Dir.pwd
|
115
|
+
`cd #{Dir.pwd} && jekyll b`
|
56
116
|
r.redirect "/dashboard"
|
57
117
|
end
|
58
118
|
|
59
119
|
r.on "deploy" do
|
60
|
-
`#{@hyde_parameters['rsync_fullpath']} #{
|
120
|
+
`#{@hyde_parameters['rsync_fullpath']} -avzr #{Dir.pwd}/_site/ #{@hyde_parameters['deploy_dest_user']}@#{@hyde_parameters['deploy_dest_address']}:#{@hyde_parameters['deploy_dest_path']}`
|
61
121
|
r.redirect "/dashboard"
|
62
122
|
end
|
63
123
|
|
64
|
-
r.
|
65
|
-
|
124
|
+
r.post "configuration" do
|
125
|
+
r.params.each_pair do |k,v|
|
126
|
+
next if k.to_s == "beforeSend"
|
127
|
+
@hyde_parameters[k] = v
|
128
|
+
end
|
129
|
+
File.open(File.join(Dir.pwd, YML_FILE_NAME),"w+") do |f|
|
66
130
|
f.write(@hyde_parameters.to_yaml)
|
67
131
|
end
|
68
|
-
r.redirect "/
|
132
|
+
r.redirect "/configuration"
|
133
|
+
end
|
134
|
+
|
135
|
+
r.get "configuration" do
|
136
|
+
view("configuration")
|
69
137
|
end
|
70
138
|
|
71
139
|
r.on "dashboard" do
|
72
140
|
view("dashboard")
|
73
141
|
end
|
74
142
|
|
143
|
+
r.on "upload_image_form" do
|
144
|
+
render("upload_image_form")
|
145
|
+
end
|
146
|
+
|
147
|
+
r.post "upload_image" do
|
148
|
+
files = [r.params['files']].flatten # 1 or more files
|
149
|
+
@filenames = []
|
150
|
+
files.each do |file|
|
151
|
+
filename = file[:filename]
|
152
|
+
while File.exist?(File.join(@hyde_parameters['images_path'], filename))
|
153
|
+
filename = "#{File.basename(filename, File.extname(filename))}_#{File.extname(filename)}"
|
154
|
+
end
|
155
|
+
@filenames << filename
|
156
|
+
File.open(File.join(@hyde_parameters['images_path'], filename), 'wb') do |f|
|
157
|
+
f.write(file[:tempfile].read)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
render("upload_image_form")
|
161
|
+
end
|
162
|
+
|
163
|
+
r.on "files" do
|
164
|
+
@dir_path = r.params['dir_path'] || Dir.pwd
|
165
|
+
|
166
|
+
# List files
|
167
|
+
r.get "index" do
|
168
|
+
@files = Dir[File.join(@dir_path, '*')].sort(&:casecmp).reverse
|
169
|
+
@parent_dir = (@dir_path != Dir.pwd)
|
170
|
+
view("files/listing")
|
171
|
+
end
|
172
|
+
|
173
|
+
# Upload files
|
174
|
+
r.post "create" do
|
175
|
+
files = [r.params['files']].flatten # 1 or more files
|
176
|
+
files.each do |file|
|
177
|
+
# TODO rename file if exist
|
178
|
+
File.open(File.join(@dir_path, file[:filename]), 'wb') do |f|
|
179
|
+
f.write(file[:tempfile].read)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
r.redirect "/files/index?dir_path=#{@dir_path}"
|
183
|
+
end
|
184
|
+
|
185
|
+
# Create directory
|
186
|
+
r.post "create_dir" do
|
187
|
+
Dir.mkdir(File.join(@dir_path, r.params['directory_name']))
|
188
|
+
r.redirect "/files/index?dir_path=#{@dir_path}"
|
189
|
+
end
|
190
|
+
|
191
|
+
# Create file
|
192
|
+
r.post "create_file" do
|
193
|
+
fullpath = File.join(@dir_path, r.params['file_name'])
|
194
|
+
File.open(fullpath, 'w+') do |f|
|
195
|
+
f.write("")
|
196
|
+
end
|
197
|
+
r.redirect "/files/edit?dir_path=#{@dir_path}&file=#{fullpath}"
|
198
|
+
end
|
199
|
+
|
200
|
+
# Edit text files
|
201
|
+
r.get "edit" do
|
202
|
+
@file = r.params['file']
|
203
|
+
@content = File.read(@file)
|
204
|
+
@header = Mid.extract_header_str(@content)
|
205
|
+
@content = Mid.remove_header(@content)
|
206
|
+
@has_header = (!@header.nil? && !@header.empty?)
|
207
|
+
@has_editor = ['.html','.md'].include?(File.extname(@file))
|
208
|
+
view("files/edit")
|
209
|
+
end
|
210
|
+
|
211
|
+
# Update file
|
212
|
+
r.post "update" do
|
213
|
+
@file = r.params['file']
|
214
|
+
@content = r.params['content']
|
215
|
+
@header = r.params['header']
|
216
|
+
File.open(@file,"w+") do |f|
|
217
|
+
if !@header.nil? and !@header.empty?
|
218
|
+
f.write("---")
|
219
|
+
f.write(@header)
|
220
|
+
f.write("---")
|
221
|
+
f.write("")
|
222
|
+
end
|
223
|
+
f.write(@content)
|
224
|
+
end
|
225
|
+
view("files/edit")
|
226
|
+
end
|
227
|
+
|
228
|
+
# Delete
|
229
|
+
r.post "delete" do
|
230
|
+
file = r.params['file']
|
231
|
+
File.unlink(file)
|
232
|
+
r.redirect "/files/index?dir_path=#{@dir_path}"
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
r.on "ajax" do
|
237
|
+
r.post "update_path_date" do
|
238
|
+
path = r.params['path']
|
239
|
+
date = Date.parse(r.params['date'])
|
240
|
+
new_path = path.gsub(REGEXP_EXTRACT_DATE_FROM_FILENAME, date.strftime("#{FORMAT_DATE_FILENAME}-"))
|
241
|
+
response.write(new_path)
|
242
|
+
end
|
243
|
+
r.post "update_path_title" do
|
244
|
+
path = r.params['path']
|
245
|
+
title = r.params['title']
|
246
|
+
I18n.config.available_locales = :en
|
247
|
+
new_path = path.gsub(REGEXP_EXTRACT_DATE_TITLE_FROM_FILENAME, "\\1#{Mid.transliterate_title_for_url(title)}\\3")
|
248
|
+
response.write(new_path)
|
249
|
+
end
|
250
|
+
r.post "update_date_today" do
|
251
|
+
date = Time.now.strftime(FORMAT_DATE_INPUT_FILENAME)
|
252
|
+
response.write(date)
|
253
|
+
end
|
254
|
+
r.post "images" do
|
255
|
+
nb_elements_per_page = 9
|
256
|
+
|
257
|
+
sort_date = r.params['sort_date']
|
258
|
+
filename = r.params['filename']
|
259
|
+
page = r.params['page'].to_i
|
260
|
+
start_elts = (page || 0) * nb_elements_per_page
|
261
|
+
|
262
|
+
search_filename = "*#{filename.strip}*"
|
263
|
+
|
264
|
+
path_of_images = File.join(Dir.pwd, @hyde_parameters['images_path'], search_filename)
|
265
|
+
|
266
|
+
all_images = Dir.glob(path_of_images).sort_by {|filename| File.mtime(filename) }
|
267
|
+
all_images = all_images.reverse if sort_date == 'asc'
|
268
|
+
@images = all_images[start_elts, nb_elements_per_page]
|
269
|
+
|
270
|
+
path = File.join(Pathname.new(Mid.gem_source_path), 'admin_views', 'partials', 'images_page.html.erb')
|
271
|
+
data = ERB.new(File.read(path)).result(binding)
|
272
|
+
|
273
|
+
response.write(data)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
75
277
|
# Posts/pages/drafts
|
76
278
|
r.on /posts|pages|drafts/ do
|
77
279
|
# Set variable for all routes in /hello branch
|
78
280
|
@type_file = r.matched_path.split('/').compact.select{ |elt| elt != '' }.first
|
79
281
|
|
282
|
+
# Mkdir _pages _drafts _posts if they not exist
|
283
|
+
FileUtils.mkdir_p(File.join(Dir.pwd, "_#{@type_file}"))
|
284
|
+
|
80
285
|
# GET /posts/index request
|
81
286
|
# list all posts...
|
82
287
|
r.get "index" do
|
83
|
-
@files = Dir[File.join(
|
84
|
-
view("listing")
|
288
|
+
@files = Dir[File.join(Dir.pwd, "_#{@type_file}", '*')].sort.reverse
|
289
|
+
view("posts/listing")
|
290
|
+
end
|
291
|
+
|
292
|
+
r.get "new" do
|
293
|
+
@file = ""
|
294
|
+
@headers = {}
|
295
|
+
@new_record = @file.empty?
|
296
|
+
view("posts/edit")
|
297
|
+
end
|
298
|
+
|
299
|
+
# POST /posts/delete?file=truc request
|
300
|
+
# save the truc post
|
301
|
+
r.post "delete" do
|
302
|
+
@file = r.params['file']
|
303
|
+
File.unlink(@file)
|
304
|
+
r.redirect "/#{@type_file}/index?dir_path=#{File.dirname(@file)}"
|
85
305
|
end
|
86
306
|
|
87
307
|
r.is do
|
@@ -91,53 +311,83 @@ class App < Roda
|
|
91
311
|
@file = r.params['file']
|
92
312
|
|
93
313
|
content_file = File.read(@file)
|
94
|
-
@headers =
|
95
|
-
@
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
314
|
+
@headers = Mid.extract_header(content_file)
|
315
|
+
@content = File.read(@file).gsub(/---(.*?)---/m, "")
|
316
|
+
|
317
|
+
# for page
|
318
|
+
if @headers.empty?
|
319
|
+
r.redirect "/files/edit?dir_path=#{r.params['dir_path']}&file=#{@file}"
|
320
|
+
else
|
321
|
+
@new_record = @file.empty?
|
322
|
+
view("posts/edit")
|
323
|
+
end
|
100
324
|
end
|
101
325
|
|
102
326
|
# POST /posts?file=truc request
|
103
327
|
# save the truc post
|
104
328
|
r.post do
|
105
|
-
@file = r.params
|
106
|
-
@content = r.params
|
107
|
-
@filename = r.params
|
108
|
-
@tags = r.params
|
109
|
-
@
|
110
|
-
@
|
111
|
-
@
|
112
|
-
@
|
113
|
-
@
|
114
|
-
@
|
329
|
+
@file = r.params.delete('file') # in a route (new record : empty ELSE old filename)
|
330
|
+
@content = r.params.delete('content')
|
331
|
+
@filename = r.params.delete('filename')
|
332
|
+
@tags = r.params.delete('tags')
|
333
|
+
@date = r.params.delete('date')
|
334
|
+
@meta = r.params.delete('meta')
|
335
|
+
@format = r.params.delete('format')
|
336
|
+
@publish = r.params.delete('publish')
|
337
|
+
@layout = r.params.delete('layout')
|
338
|
+
@title = r.params.delete('title')
|
339
|
+
@new_file = r.params.delete('new_file') # form (new record : empty ELSE new filename)
|
340
|
+
|
341
|
+
#$stderr.puts "---->"
|
342
|
+
|
343
|
+
if @new_file.nil? || @new_file.empty?
|
344
|
+
filename = Mid.urlize(@date, @title, (@type_file != 'pages'))
|
345
|
+
@new_file = File.join(Dir.pwd,"_#{@type_file}", "#{filename}.#{@format}")
|
346
|
+
end
|
115
347
|
|
116
348
|
@headers = ['---']
|
117
|
-
@headers << ['tags', @tags.join(',')].join(': ')
|
349
|
+
@headers << ['tags', @tags.split(',').map(&:strip).join(',')].join(': ')
|
118
350
|
@headers << ['layout', @layout].join(': ')
|
119
351
|
@headers << ['date', @date.to_s].join(': ')
|
120
|
-
|
352
|
+
@headers << ['title', @title.to_s].join(': ')
|
353
|
+
r.params.each do |k,v|
|
354
|
+
if k.start_with?('header')
|
355
|
+
@headers << [v.first, v.last.to_s].join(': ')
|
356
|
+
else
|
357
|
+
@headers << [k, v.to_s].join(': ')
|
358
|
+
end
|
359
|
+
end
|
121
360
|
@headers << ['---']
|
361
|
+
@headers << ['']
|
122
362
|
|
123
|
-
File.open(
|
363
|
+
File.open(@new_file, "w+") do |f|
|
124
364
|
f.write(@headers.join("\n"))
|
125
|
-
f.write(
|
126
|
-
f.write(content)
|
365
|
+
f.write(@content)
|
127
366
|
end
|
128
|
-
end
|
129
367
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
368
|
+
# Change path of file
|
369
|
+
if !@file.to_s.empty? && @new_file.to_s != @file.to_s
|
370
|
+
File.unlink(@file)
|
371
|
+
end
|
372
|
+
|
373
|
+
# publish : move draft to post
|
374
|
+
if @publish == 'publish' && @new_file.to_s.include?('_drafts')
|
375
|
+
FileUtils.mv(@new_file, @new_file.gsub('_drafts','_posts'))
|
376
|
+
end
|
377
|
+
|
378
|
+
r.redirect "/#{@type_file}/index?dir_path=#{File.dirname(@new_file)}"
|
135
379
|
end
|
136
380
|
end
|
137
381
|
end
|
138
|
-
|
139
|
-
# TODO faire un jekyll serve
|
382
|
+
end
|
140
383
|
end
|
141
384
|
end
|
142
385
|
|
386
|
+
# https://roda.jeremyevans.net/rdoc/classes/Roda/RodaPlugins/Middleware.html
|
387
|
+
class App < Roda
|
388
|
+
use Mid
|
389
|
+
use Rack::Static, :urls => [''], root: Dir.pwd # allow to match all files in Dir.pwd
|
390
|
+
end
|
391
|
+
|
143
392
|
run App.freeze.app
|
393
|
+
|
data/bin/hyde_admin.yml
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
---
|
2
|
-
default_layout:
|
3
|
-
deploy_dest_user:
|
4
|
-
deploy_dest_address:
|
5
|
-
deploy_dest_path: "/
|
6
|
-
path_to_jekyll_src: "/Users/scl/blog/rivscblog-zolan"
|
2
|
+
default_layout: default
|
3
|
+
deploy_dest_user: root
|
4
|
+
deploy_dest_address: example.com
|
5
|
+
deploy_dest_path: "/absolute/remote/path/mysite"
|
7
6
|
rsync_fullpath: rsync
|
8
7
|
site_index: index.html
|
8
|
+
hyde_admin_language: en
|
9
|
+
hyde_admin_auth: false
|
10
|
+
hyde_admin_user: admin
|
11
|
+
hyde_admin_password: admin
|
12
|
+
default_format: html
|
13
|
+
display_layout: true
|
14
|
+
display_format: true
|
15
|
+
images_path: assets/images/
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/* modal pictures */
|
2
|
+
.image-selector-content{
|
3
|
+
display: grid;
|
4
|
+
grid-template-columns: 1fr 1fr 1fr;
|
5
|
+
}
|
6
|
+
.image-selector-content .image-element{
|
7
|
+
width: 150px;
|
8
|
+
height: 150px;
|
9
|
+
}
|
10
|
+
.image-selector-content .image-element img{
|
11
|
+
width: 100%;
|
12
|
+
height: 100%;
|
13
|
+
object-fit: contain;
|
14
|
+
overflow: hidden;
|
15
|
+
border:2px solid white;
|
16
|
+
}
|
17
|
+
.image-selector-content .image-element img:hover{
|
18
|
+
border:2px solid gray;
|
19
|
+
}
|
20
|
+
|
21
|
+
.image-element{
|
22
|
+
position: relative;
|
23
|
+
}
|
24
|
+
|
25
|
+
.image-element span{
|
26
|
+
position: absolute;
|
27
|
+
bottom:0px;
|
28
|
+
left:5px;
|
29
|
+
z-index: 10;
|
30
|
+
font-weight: bold;
|
31
|
+
margin-bottom: -20px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.CodeMirror{
|
35
|
+
border: 1px solid #ced4da;
|
36
|
+
border-radius: 4px;
|
37
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$(function(){
|
2
|
+
$(document).on('click','#btn-deploy,#btn-rebuild',function(elt){
|
3
|
+
let path = '';
|
4
|
+
|
5
|
+
if(elt.id === 'btn-deploy'){
|
6
|
+
path = '/deploy';
|
7
|
+
}else if(elt.id === 'btn-rebuild'){
|
8
|
+
path = '/rebuild';
|
9
|
+
}
|
10
|
+
|
11
|
+
$.post( path, {
|
12
|
+
beforeSend: function( xhr ) {
|
13
|
+
$('#waiting').show();
|
14
|
+
}
|
15
|
+
})
|
16
|
+
.done(function( data ) {
|
17
|
+
$('#waiting').hide();
|
18
|
+
return false;
|
19
|
+
});
|
20
|
+
});
|
21
|
+
$(document).on('click','.form-confirm',function(){
|
22
|
+
return window.confirm($(this).attr('data-confirm'));
|
23
|
+
});
|
24
|
+
});
|
data/bin/i18n/en.yml
CHANGED
@@ -5,11 +5,17 @@ pages: pages
|
|
5
5
|
post: post
|
6
6
|
posts: posts
|
7
7
|
save: save
|
8
|
+
new: new
|
8
9
|
edit: edit
|
9
10
|
delete: delete
|
10
|
-
|
11
|
+
create: create
|
12
|
+
upload: upload
|
13
|
+
header: header
|
14
|
+
add_header: add header
|
15
|
+
are_you_sure: are you sure ?
|
11
16
|
tag: tag
|
12
17
|
tags: tags
|
18
|
+
help_tags: set tags separate by comma
|
13
19
|
layout: layout
|
14
20
|
configuration: configuration
|
15
21
|
files: files
|
@@ -25,3 +31,73 @@ date: date
|
|
25
31
|
content: content
|
26
32
|
publish: publish
|
27
33
|
path: path
|
34
|
+
help_path: You can move the file by changing the path. Change the path can affect SEO or causing 404 errors. For a new file, this is automatically filled at submit.
|
35
|
+
overview: overview
|
36
|
+
submit: submit
|
37
|
+
default_layout: default layout
|
38
|
+
help_default_layout: default layout for jekyll posts/pages
|
39
|
+
deploy_dest_user: deploy remote user
|
40
|
+
help_deploy_dest_user: Ssh user for rsync
|
41
|
+
deploy_dest_address: deploy remote domain
|
42
|
+
help_deploy_dest_address: remote domain for ssh deployment (example.com)
|
43
|
+
deploy_dest_path: deploy remote path
|
44
|
+
help_deploy_dest_path: remote path on disk for ssh deployment
|
45
|
+
rsync_fullpath: rsync path
|
46
|
+
help_rsync_fullpath: if rsync is not in PATH, othervise just let 'rsync'
|
47
|
+
site_index: index file name of site
|
48
|
+
help_site_index: link to open when we click on overview
|
49
|
+
hyde_admin_language: hyde admin language
|
50
|
+
help_hyde_admin_language: To change hyde admin language interface (fr = french, en = english)
|
51
|
+
set_date_today: set date at today
|
52
|
+
change_date_path: update date in path
|
53
|
+
change_title_path: update title in path
|
54
|
+
directory_input_placeholder: directory name to create
|
55
|
+
file_input_placeholder: file name to create
|
56
|
+
hyde_admin_auth: enable BasicAuth
|
57
|
+
help_hyde_admin_auth: enable BasicAuth (true/false)
|
58
|
+
hyde_admin_user: BasicAuth user
|
59
|
+
help_hyde_admin_user: BasicAuth user
|
60
|
+
hyde_admin_password: BasicAuth password
|
61
|
+
help_hyde_admin_password: BasicAuth password
|
62
|
+
default_format: default format
|
63
|
+
help_default_format: default format (html = html, md = markdown)
|
64
|
+
display_layout: display the layout input on edit form
|
65
|
+
help_display_layout: display the layout input on edit form (true/false)
|
66
|
+
display_format: display the format input on edit form
|
67
|
+
help_display_format: display the format input on edit form (true/false)
|
68
|
+
images_path: pictures path
|
69
|
+
help_images_path: relative local picture path
|
70
|
+
editor_undo: Undo
|
71
|
+
editor_redo: Redo
|
72
|
+
editor_file: Add picture
|
73
|
+
editor_list: List
|
74
|
+
editor_list_ol: Numbered List
|
75
|
+
editor_link: Add link
|
76
|
+
editor_quote: Quote
|
77
|
+
editor_title_h1: Title H1
|
78
|
+
editor_title_h2: Title H2
|
79
|
+
editor_title_h3: Title H3
|
80
|
+
editor_title_h4: Title H4
|
81
|
+
editor_title_h5: Title H5
|
82
|
+
editor_underline: Underline
|
83
|
+
editor_bold: Bold
|
84
|
+
editor_italic: Italic
|
85
|
+
editor_strikethrough: Strikethrough
|
86
|
+
default_alt_img: Alt text
|
87
|
+
default_title_img: Title text
|
88
|
+
parent_dir: parent directory
|
89
|
+
sort_by_date: sort_by_date
|
90
|
+
older: older first
|
91
|
+
newer: newer first
|
92
|
+
previous_images: previous images
|
93
|
+
next_images: next images
|
94
|
+
search: search
|
95
|
+
filename: filename
|
96
|
+
filename_placeholder: filename...
|
97
|
+
upload_image_form: upload image form
|
98
|
+
pictures_has_been_uploaded: pictures has been uploaded
|
99
|
+
quit: quit
|
100
|
+
header_name: header name
|
101
|
+
header_value: header value
|
102
|
+
images: images
|
103
|
+
load_images: load images
|