jekyll-admin-josercc 0.5.2

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.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +54 -0
  4. data/lib/jekyll/commands/build.rb +14 -0
  5. data/lib/jekyll/commands/serve.rb +26 -0
  6. data/lib/jekyll-admin/apiable.rb +153 -0
  7. data/lib/jekyll-admin/data_file.rb +106 -0
  8. data/lib/jekyll-admin/directory.rb +70 -0
  9. data/lib/jekyll-admin/file_helper.rb +64 -0
  10. data/lib/jekyll-admin/page_without_a_file.rb +7 -0
  11. data/lib/jekyll-admin/path_helper.rb +74 -0
  12. data/lib/jekyll-admin/public/03945ac4fc7fdefc44bc110bf1ba2393.svg +18 -0
  13. data/lib/jekyll-admin/public/059514c92565e4045da1a69525dd9ec0.ttf +0 -0
  14. data/lib/jekyll-admin/public/1dc35d25e61d819a9c357074014867ab.ttf +0 -0
  15. data/lib/jekyll-admin/public/25a32416abee198dd821b0b17a198a8f.eot +0 -0
  16. data/lib/jekyll-admin/public/33a752211d05af6684e26ec63c2ed965.gif +0 -0
  17. data/lib/jekyll-admin/public/55131026930a0cd4539d1e2fdb92722d.ttf +0 -0
  18. data/lib/jekyll-admin/public/847c038a8202754b465604459e16715d.png +0 -0
  19. data/lib/jekyll-admin/public/99adb54b0f30c0758bb4cb9ed5b80aa8.woff +0 -0
  20. data/lib/jekyll-admin/public/a770b6797b68e3f8920e473eb824bac0.gif +0 -0
  21. data/lib/jekyll-admin/public/bfc14ac982326f7d0b1340e20d3e0c37.ttf +0 -0
  22. data/lib/jekyll-admin/public/bundle.js +53 -0
  23. data/lib/jekyll-admin/public/bundle.js.map +1 -0
  24. data/lib/jekyll-admin/public/c4c172d28f17a61e4476715c58640841.png +0 -0
  25. data/lib/jekyll-admin/public/c8ddf1e5e5bf3682bc7bebf30f394148.woff +0 -0
  26. data/lib/jekyll-admin/public/d7c639084f684d66a1bc66855d193ed8.svg +685 -0
  27. data/lib/jekyll-admin/public/e44520ab9079ea7633bfa874bed5d21d.eot +0 -0
  28. data/lib/jekyll-admin/public/e6cf7c6ec7c2d6f670ae9d762604cb0b.woff2 +0 -0
  29. data/lib/jekyll-admin/public/favicon.ico +0 -0
  30. data/lib/jekyll-admin/public/index.html +12 -0
  31. data/lib/jekyll-admin/public/styles.css +5 -0
  32. data/lib/jekyll-admin/public/styles.css.map +1 -0
  33. data/lib/jekyll-admin/server/collection.rb +82 -0
  34. data/lib/jekyll-admin/server/configuration.rb +57 -0
  35. data/lib/jekyll-admin/server/data.rb +82 -0
  36. data/lib/jekyll-admin/server/page.rb +90 -0
  37. data/lib/jekyll-admin/server/static_file.rb +61 -0
  38. data/lib/jekyll-admin/server.rb +100 -0
  39. data/lib/jekyll-admin/static_server.rb +24 -0
  40. data/lib/jekyll-admin/urlable.rb +65 -0
  41. data/lib/jekyll-admin/version.rb +3 -0
  42. data/lib/jekyll-admin.rb +47 -0
  43. metadata +228 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0d4dd148a0b78a087f60188c699c0dd31b909fea
4
+ data.tar.gz: 627708ca25128a6c7f6f2f6faaf0066bd6131b43
5
+ SHA512:
6
+ metadata.gz: 334d87089477b0d97d85641a076637e9fbbc42bce1264ff736b4edeb4c6454b78a51c541d6a3850f8bd252704434e29f3818641460be8b03511b79b27c5b27c7
7
+ data.tar.gz: 68fa43bfccb85cdc8b6a7c3695418ee87a399d653e39dbac6ffd92a5e4dd0217ec585fc983b5ceae93a31399394221abae37971470aa2c511888cd12553f8a49
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2017 Mert Kahyaoğlu and the Jekyll Admin contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ [![Gem Version](https://img.shields.io/gem/v/jekyll-admin.svg)](https://rubygems.org/gems/jekyll-admin)
2
+ [![Build Status](https://travis-ci.org/jekyll/jekyll-admin.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-admin)
3
+ [![Build status](https://ci.appveyor.com/api/projects/status/biop1r6ae524xlm2/branch/master?svg=true)](https://ci.appveyor.com/project/benbalter/jekyll-admin/branch/master)
4
+ [![Coverage Status](https://coveralls.io/repos/github/jekyll/jekyll-admin/badge.svg?branch=master)](https://coveralls.io/github/jekyll/jekyll-admin?branch=master)
5
+ [![NPM Dependencies](https://david-dm.org/jekyll/jekyll-admin.svg)](https://david-dm.org/jekyll/jekyll-admin)
6
+
7
+ A Jekyll plugin that provides users with a traditional CMS-style graphical interface to author content and administer Jekyll sites. The project is divided into two parts. A Ruby-based HTTP API that handles Jekyll and filesystem operations, and a Javascript-based front end, built on that API.
8
+
9
+ ![screenshot of Jekyll Admin](/screenshot.png)
10
+
11
+ ## Installation
12
+
13
+ Refer to the [installing plugins](https://jekyllrb.com/docs/plugins/#installing-a-plugin) section of Jekyll's documentation and install the `jekyll-admin` plugin as you would any other plugin. Here's the short version:
14
+
15
+ 1. Add the following to your site's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'jekyll-admin', group: :jekyll_plugins
19
+ ```
20
+
21
+ 2. Run `bundle install`
22
+
23
+ ## Usage
24
+
25
+ 1. Start Jekyll as you would normally (`bundle exec jekyll serve`)
26
+ 2. Navigate to `http://localhost:4000/admin` to access the administrative interface
27
+
28
+ ## Options
29
+
30
+ Jekyll Admin related options can be specified in `_config.yml`
31
+ under a key called `jekyll_admin`. Currently it has only one option `hidden_links`
32
+ which is for hiding unwanted links on the sidebar. The following keys under `hidden_links` can be used in order to hide default links;
33
+
34
+ ```yaml
35
+ jekyll_admin:
36
+ hidden_links:
37
+ - posts
38
+ - pages
39
+ - staticfiles
40
+ - datafiles
41
+ - configuration
42
+ ```
43
+
44
+ ## Contributing
45
+
46
+ Interested in contributing to Jekyll Admin? We’d love your help. Jekyll Admin is an open source project, built one contribution at a time by users like you. See [the contributing instructions](.github/CONTRIBUTING.md), and [the development docs](http://jekyll.github.io/jekyll-admin/development/) for more information.
47
+
48
+ ## Looking for a hosted version?
49
+
50
+ Jekyll Admin is intended to be run on your computer alongside your local Jekyll installation. If you're looking for a hosted version, we'd recommend checking out [Siteleaf](https://www.siteleaf.com/) a hosted Jekyll editor with deep GitHub integration (whom we'd also like to thank for inspiring parts of Jekyll Admin itself!).
51
+
52
+ ## License
53
+
54
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,14 @@
1
+ module Jekyll
2
+ module Commands
3
+ class Build < Command
4
+ class << self
5
+ alias_method :original_build, :build
6
+
7
+ def build(site, options)
8
+ options["watch"] = false
9
+ original_build(site, options)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ module Jekyll
2
+ module Commands
3
+ class Serve < Command
4
+ class << self
5
+ def start_up_webrick(opts, destination)
6
+ server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
7
+ server.mount(opts["baseurl"], Servlet, destination, file_handler_opts)
8
+
9
+ jekyll_admin_monkey_patch(server)
10
+
11
+ Jekyll.logger.info "Server address:", server_address(server, opts)
12
+ launch_browser server, opts if opts["open_url"]
13
+ boot_or_detach server, opts
14
+ end
15
+
16
+ def jekyll_admin_monkey_patch(server)
17
+ server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
18
+ server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
19
+ Jekyll.logger.warn "Auto-regeneration:", "disabled by JekyllAdmin."
20
+ Jekyll.logger.warn "", "The site will regenerate only via the Admin interface."
21
+ Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,153 @@
1
+ module JekyllAdmin
2
+ # Abstract module to be included in Convertible and Document to provide
3
+ # additional, API-specific functionality without duplicating logic
4
+ module APIable
5
+
6
+ CONTENT_FIELDS = %w(next previous content excerpt).freeze
7
+
8
+ # Returns a hash suitable for use as an API response.
9
+ #
10
+ # For Documents and Pages:
11
+ #
12
+ # 1. Adds the file's raw content to the `raw_content` field
13
+ # 2. Adds the file's raw YAML front matter to the `front_matter` field
14
+ #
15
+ # For Static Files it addes the Base64 `encoded_content` field
16
+ #
17
+ # Options:
18
+ #
19
+ # include_content - if true, includes the content in the respond, false by default
20
+ # to support mapping on indexes where we only want metadata
21
+ #
22
+ #
23
+ # Returns a hash (which can then be to_json'd)
24
+ def to_api(include_content: false)
25
+ output = hash_for_api
26
+ output = output.merge(url_fields)
27
+
28
+ # Include content, if requested, otherwise remove it
29
+ if include_content
30
+ output = output.merge(content_fields)
31
+ else
32
+ CONTENT_FIELDS.each { |field| output.delete(field) }
33
+ end
34
+
35
+ # Documents have duplicate output and content fields, Pages do not
36
+ # Since it's an API, use `content` in both for consistency
37
+ output.delete("output")
38
+
39
+ # By default, calling to_liquid on a collection will return a docs
40
+ # array with each rendered document, which we don't want.
41
+ if is_a?(Jekyll::Collection)
42
+ output.delete("docs")
43
+ output["entries_url"] = entries_url
44
+ end
45
+
46
+ if is_a?(Jekyll::Document)
47
+ output["name"] = basename
48
+ end
49
+
50
+ output
51
+ end
52
+
53
+ private
54
+
55
+ # Pages don't have a hash method, but Documents do
56
+ def file_path
57
+ if is_a?(Jekyll::Document)
58
+ path
59
+ else
60
+ File.join(@base, @dir, name)
61
+ end
62
+ end
63
+
64
+ # StaticFiles don't have `attr_accesor` set for @site or @name
65
+ def site
66
+ @site
67
+ end
68
+
69
+ def name
70
+ @name
71
+ end
72
+
73
+ def file_contents
74
+ @file_contents ||= File.read(file_path, file_read_options) if file_exists?
75
+ end
76
+
77
+ def file_read_options
78
+ Jekyll::Utils.merged_file_read_opts(site, {})
79
+ end
80
+
81
+ def front_matter
82
+ return unless file_exists?
83
+ @front_matter ||= if file_contents =~ Jekyll::Document::YAML_FRONT_MATTER_REGEXP
84
+ SafeYAML.load(Regexp.last_match(1))
85
+ else
86
+ {}
87
+ end
88
+ end
89
+
90
+ def raw_content
91
+ return unless file_exists?
92
+ @raw_content ||= if file_contents =~ Jekyll::Document::YAML_FRONT_MATTER_REGEXP
93
+ $POSTMATCH
94
+ else
95
+ file_contents
96
+ end
97
+ end
98
+
99
+ def encoded_content
100
+ @encoded_content ||= Base64.encode64(file_contents) if file_exists?
101
+ end
102
+
103
+ def file_exists?
104
+ return @file_exists if defined? @file_exists
105
+ @file_exists = File.exist?(file_path)
106
+ end
107
+
108
+ # Base hash from which to generate the API output
109
+ def hash_for_api
110
+ output = to_liquid
111
+ if output.respond_to?(:hash_for_json)
112
+ output.hash_for_json
113
+ else
114
+ output.to_h
115
+ end
116
+ end
117
+
118
+ # Returns a hash of content fields for inclusion in the API output
119
+ def content_fields
120
+ output = {}
121
+
122
+ # Include file content-related fields
123
+ if is_a?(Jekyll::StaticFile)
124
+ output["encoded_content"] = encoded_content
125
+ elsif is_a?(JekyllAdmin::DataFile)
126
+ output["content"] = content
127
+ output["raw_content"] = raw_content
128
+ else
129
+ output["raw_content"] = raw_content
130
+ output["front_matter"] = front_matter
131
+ end
132
+
133
+ # Include next and previous documents non-recursively
134
+ if is_a?(Jekyll::Document)
135
+ %w(next previous).each do |direction|
136
+ method = "#{direction}_doc".to_sym
137
+ doc = public_send(method)
138
+ output[direction] = doc.to_api if doc
139
+ end
140
+ end
141
+
142
+ output
143
+ end
144
+
145
+ def url_fields
146
+ return {} unless respond_to?(:http_url) && respond_to?(:api_url)
147
+ {
148
+ "http_url" => http_url,
149
+ "api_url" => api_url,
150
+ }
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,106 @@
1
+ module JekyllAdmin
2
+ class DataFile
3
+ METHODS_FOR_LIQUID = %w(path relative_path slug ext title).freeze
4
+ EXTENSIONS = %w(yaml yml json csv).freeze
5
+
6
+ include APIable
7
+ include URLable
8
+ include PathHelper
9
+ extend PathHelper
10
+
11
+ attr_reader :id
12
+
13
+ # Initialize a new DataFile object
14
+ #
15
+ # id - the file ID as passed from the API. This may or may not have an extension
16
+ def initialize(id)
17
+ @id ||= File.extname(id).empty? ? "#{id}.yml" : id
18
+ end
19
+ alias_method :path, :id
20
+
21
+ def exists?
22
+ @exists ||= File.exist?(absolute_path)
23
+ end
24
+
25
+ # Returns unparsed content as it exists on disk
26
+ def raw_content
27
+ @raw_content ||= File.open(absolute_path, "r:UTF-8", &:read)
28
+ end
29
+
30
+ # Returnes (re)parsed content using Jekyll's native parsing mechanism
31
+ def content
32
+ @content ||= data_reader.read_data_file(absolute_path)
33
+ end
34
+
35
+ # Returns the file's extension with preceeding `.`
36
+ def ext
37
+ @ext ||= if File.extname(id).to_s.empty?
38
+ ".yml"
39
+ else
40
+ File.extname(id)
41
+ end
42
+ end
43
+ alias_method :extension, :ext
44
+
45
+ # Returns the file's sanitized slug (as used in `site.data[slug]`)
46
+ def slug
47
+ @slug ||= data_reader.sanitize_filename(basename)
48
+ end
49
+
50
+ # Returns the human-readable title of the data file
51
+ def title
52
+ @title ||= Jekyll::Utils.titleize_slug(slug.tr("_", "-"))
53
+ end
54
+
55
+ # Return path relative to configured `data_dir`
56
+ def relative_path
57
+ id.sub("/#{DataFile.data_dir}/", "")
58
+ end
59
+
60
+ # Return the absolute path to given data file
61
+ def absolute_path
62
+ sanitized_path id
63
+ end
64
+
65
+ # Mimics Jekyll's native to_liquid functionality by returning a hash
66
+ # of data file metadata
67
+ def to_liquid
68
+ @to_liquid ||= METHODS_FOR_LIQUID.map { |key| [key, public_send(key)] }.to_h
69
+ end
70
+
71
+ def self.all
72
+ data_dir = sanitized_path DataFile.data_dir
73
+ files = Dir["#{data_dir}/**/*.{#{EXTENSIONS.join(",")}}"].reject do |d|
74
+ File.directory?(d)
75
+ end
76
+
77
+ files.map do |path|
78
+ new path_without_site_source(path)
79
+ end
80
+ end
81
+
82
+ # Relative path to data directory within site source
83
+ def self.data_dir
84
+ JekyllAdmin.site.config["data_dir"]
85
+ end
86
+
87
+ private
88
+
89
+ def data_reader
90
+ @data_reader = Jekyll::DataReader.new(JekyllAdmin.site)
91
+ end
92
+
93
+ def basename
94
+ @basename ||= File.basename(id, ".*")
95
+ end
96
+
97
+ def basename_with_extension
98
+ [basename, extension].join
99
+ end
100
+ alias_method :filename, :basename_with_extension
101
+
102
+ def namespace
103
+ "data"
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,70 @@
1
+ module JekyllAdmin
2
+ class Directory
3
+ extend Forwardable
4
+ def_delegator :@path, :basename, :name
5
+ def_delegator :@path, :mtime, :modified_time
6
+ attr_reader :path, :splat, :content_type, :base
7
+
8
+ include Enumerable
9
+ include JekyllAdmin::URLable
10
+ include JekyllAdmin::APIable
11
+
12
+ TYPE = :directory
13
+
14
+ # Arguments:
15
+ #
16
+ # path - full path of the directory which its entries will be listed
17
+ #
18
+ # base - passes site.source to generate `relative_path` needed for `to_api`
19
+ #
20
+ # content_type - type of the requested directory entries, this is used to generate
21
+ # API endpoint of the directory along with `splat`
22
+ #
23
+ # splat - the requested directory path relative to content namespace
24
+ def initialize(path, base: nil, content_type: nil, splat: nil)
25
+ @base = Pathname.new base
26
+ @content_type = content_type
27
+ @splat = Pathname.new splat
28
+ @path = Pathname.new path
29
+ end
30
+
31
+ def to_liquid
32
+ {
33
+ :name => name,
34
+ :modified_time => modified_time,
35
+ :path => relative_path,
36
+ :type => TYPE,
37
+ }
38
+ end
39
+
40
+ def relative_path
41
+ path.relative_path_from(base).to_s
42
+ end
43
+
44
+ def resource_path
45
+ if content_type == "pages"
46
+ "/pages/#{splat}/#{name}"
47
+ elsif content_type == "data"
48
+ "/data/#{splat}/#{name}/"
49
+ else
50
+ "/collections/#{content_type}/entries/#{splat}/#{name}"
51
+ end
52
+ end
53
+ alias_method :url, :resource_path
54
+
55
+ def http_url
56
+ nil
57
+ end
58
+
59
+ def directories
60
+ path.entries.map do |entry|
61
+ next if [".", ".."].include? entry.to_s
62
+ next unless path.join(entry).directory?
63
+ self.class.new(
64
+ path.join(entry),
65
+ :base => base, :content_type => content_type, :splat => splat
66
+ )
67
+ end.compact!
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,64 @@
1
+ module JekyllAdmin
2
+ module FileHelper
3
+
4
+ # The file the user requested in the URL
5
+ def requested_file
6
+ find_by_path(path)
7
+ end
8
+
9
+ # The file ultimately written to disk
10
+ # This may be the requested file, or in the case of a rename will be read
11
+ # from the new path that was actually written to disk
12
+ def written_file
13
+ find_by_path(write_path)
14
+ end
15
+
16
+ # Write a file to disk with the given content
17
+ def write_file(path, content)
18
+ Jekyll.logger.debug "WRITING:", path
19
+ path = sanitized_path(path)
20
+ FileUtils.mkdir_p File.dirname(path)
21
+ File.write(path, content)
22
+ site.process
23
+ end
24
+
25
+ # Delete the file at the given path
26
+ def delete_file(path)
27
+ Jekyll.logger.debug "DELETING:", path
28
+ FileUtils.rm_f sanitized_path(path)
29
+ site.process
30
+ end
31
+
32
+ private
33
+
34
+ def ensure_requested_file
35
+ ensure_file(requested_file)
36
+ end
37
+
38
+ def ensure_written_file
39
+ ensure_file(written_file)
40
+ end
41
+
42
+ def find_by_path(path)
43
+ files = case namespace
44
+ when "collections"
45
+ collection.docs
46
+ when "data"
47
+ DataFile.all
48
+ when "pages", "static_files"
49
+ site.public_send(namespace.to_sym)
50
+ else
51
+ []
52
+ end
53
+ files.find { |f| sanitized_path(f.path) == path }
54
+ end
55
+
56
+ def ensure_file(file)
57
+ render_404 if file.nil?
58
+ end
59
+
60
+ def ensure_directory
61
+ render_404 unless Dir.exist?(directory_path)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,7 @@
1
+ module JekyllAdmin
2
+ class PageWithoutAFile < Jekyll::Page
3
+ def read_yaml(*)
4
+ @data ||= {}
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,74 @@
1
+ module JekyllAdmin
2
+ module PathHelper
3
+ def sanitized_path(path)
4
+ path = path_without_site_source(path)
5
+ Jekyll.sanitized_path JekyllAdmin.site.source, path
6
+ end
7
+
8
+ # Returns the basename + extension for the requested file
9
+ def filename
10
+ params["ext"] ||= "yml" if namespace == "data"
11
+ "#{params["path"]}.#{params["ext"]}"
12
+ end
13
+
14
+ # Returns the sanitized path relative to the site source
15
+ def sanitized_relative_path(path)
16
+ path_without_site_source sanitized_path(path)
17
+ end
18
+
19
+ # Returns the sanitized absolute path to the requested object
20
+ def absolute_path
21
+ sanitized_path File.join(directory_path, filename)
22
+ end
23
+ alias_method :path, :absolute_path
24
+
25
+ # Returns the sanitized relative path to the requested object
26
+ def relative_path
27
+ sanitized_relative_path absolute_path
28
+ end
29
+
30
+ # Returns the sanitized absolute path to write the requested object
31
+ def write_path
32
+ if renamed?
33
+ sanitized_path request_payload["path"]
34
+ else
35
+ path
36
+ end
37
+ end
38
+ alias_method :request_path, :write_path
39
+
40
+ # Returns the sanitized relative path to write the requested object
41
+ def relative_write_path
42
+ sanitized_relative_path write_path
43
+ end
44
+
45
+ # Is this request renaming a file?
46
+ def renamed?
47
+ return false unless request_payload["path"]
48
+ ensure_leading_slash(request_payload["path"]) != relative_path
49
+ end
50
+
51
+ private
52
+
53
+ # Returns the path to the requested file's containing directory
54
+ def directory_path
55
+ case namespace
56
+ when "collections"
57
+ sanitized_path File.join(collection.relative_directory, params["splat"].first)
58
+ when "data"
59
+ sanitized_path File.join(DataFile.data_dir, params["splat"].first)
60
+ else
61
+ sanitized_path params["splat"].first
62
+ end
63
+ end
64
+
65
+ def ensure_leading_slash(input)
66
+ return input if input.nil? || input.empty? || input.start_with?("/")
67
+ "/#{input}"
68
+ end
69
+
70
+ def path_without_site_source(path)
71
+ path.to_s.gsub(%r!\A#{Regexp.escape(JekyllAdmin.site.source)}!, "")
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2015 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="rw-widgets" horiz-adv-x="1000" >
7
+ <font-face font-family="rw-widgets" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="up-dir" unicode="&#xe800;" d="m571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
10
+ <glyph glyph-name="left-dir" unicode="&#xe801;" d="m357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
11
+ <glyph glyph-name="right-dir" unicode="&#xe802;" d="m321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
12
+ <glyph glyph-name="down-dir" unicode="&#xe803;" d="m571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
13
+ <glyph glyph-name="calendar" unicode="&#xe804;" d="m71-79h161v161h-161v-161z m197 0h178v161h-178v-161z m-197 197h161v178h-161v-178z m197 0h178v178h-178v-178z m-197 214h161v161h-161v-161z m411-411h179v161h-179v-161z m-214 411h178v161h-178v-161z m428-411h161v161h-161v-161z m-214 197h179v178h-179v-178z m-196 482v161q0 7-6 12t-12 6h-36q-7 0-12-6t-6-12v-161q0-7 6-13t12-5h36q7 0 12 5t6 13z m410-482h161v178h-161v-178z m-214 214h179v161h-179v-161z m214 0h161v161h-161v-161z m18 268v161q0 7-5 12t-13 6h-35q-8 0-13-6t-5-12v-161q0-7 5-13t13-5h35q8 0 13 5t5 13z m215 36v-715q0-29-22-50t-50-21h-786q-29 0-50 21t-21 50v715q0 29 21 50t50 21h72v54q0 36 26 63t63 26h36q37 0 63-26t26-63v-54h214v54q0 36 27 63t63 26h35q37 0 63-26t27-63v-54h71q29 0 50-21t22-50z" horiz-adv-x="928.6" />
14
+ <glyph glyph-name="clock" unicode="&#xe805;" d="m500 546v-250q0-7-5-12t-13-5h-178q-8 0-13 5t-5 12v36q0 8 5 13t13 5h125v196q0 8 5 13t12 5h36q8 0 13-5t5-13z m232-196q0 83-41 152t-110 111-152 41-153-41-110-111-41-152 41-152 110-111 153-41 152 41 110 111 41 152z m125 0q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
15
+ <glyph glyph-name="search" unicode="&#xe806;" d="m643 386q0 103-74 176t-176 74-177-74-73-176 73-177 177-73 176 73 74 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 152-31 126-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
16
+ </font>
17
+ </defs>
18
+ </svg>