blueberry_cms 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +30 -0
- data/app/assets/config/blueberry_cms_manifest.js +2 -0
- data/app/assets/javascripts/blueberry_cms.js +1 -0
- data/app/assets/stylesheets/blueberry_cms/application.css +15 -0
- data/app/controllers/blueberry_cms/admin/pages_controller.rb +62 -0
- data/app/controllers/blueberry_cms/pages_controller.rb +27 -0
- data/app/controllers/blueberry_cms/root_controller.rb +7 -0
- data/app/helpers/blueberry_cms/application_helper.rb +4 -0
- data/app/jobs/blueberry_cms/application_job.rb +4 -0
- data/app/mailers/blueberry_cms/application_mailer.rb +6 -0
- data/app/models/blueberry_cms/application_record.rb +5 -0
- data/app/models/blueberry_cms/page.rb +43 -0
- data/app/models/blueberry_cms/page_block.rb +23 -0
- data/app/models/blueberry_cms/page_blocks/gallery.rb +23 -0
- data/app/models/blueberry_cms/page_blocks/rich_text.rb +24 -0
- data/app/models/blueberry_cms/page_blocks/text.rb +21 -0
- data/app/models/custom_render.rb +11 -0
- data/app/views/blueberry_cms/admin/pages/_block_fields.html.slim +4 -0
- data/app/views/blueberry_cms/admin/pages/_form.html.slim +18 -0
- data/app/views/blueberry_cms/admin/pages/edit.html.slim +14 -0
- data/app/views/blueberry_cms/admin/pages/index.html.slim +46 -0
- data/app/views/blueberry_cms/admin/pages/new.html.slim +14 -0
- data/app/views/blueberry_cms/pages/show.html.slim +9 -0
- data/app/views/layouts/admin.html.erb +14 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/config/initializers/inflections.rb +3 -0
- data/config/locales/cs.yml +30 -0
- data/config/routes.rb +10 -0
- data/lib/blueberry_cms/engine.rb +13 -0
- data/lib/blueberry_cms/liquid_tags/page_link.rb +18 -0
- data/lib/blueberry_cms/version.rb +3 -0
- data/lib/blueberry_cms.rb +8 -0
- data/lib/tasks/blueberry_cms_tasks.rake +4 -0
- metadata +205 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 61c283d61a1921f2eb7b8cd93004a7c37340b3a0
|
4
|
+
data.tar.gz: c1a01ea065df6e7307b24ca2ee94bd7e2acaa8ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51b875bae9db0d15bfc5304088ff730db7a8e99594ff7180f92a5189ab1ed9ee2b84614ae459fa9c5f489aa576d39d7ea1dbe89bc555240b7762804f1eb3f720
|
7
|
+
data.tar.gz: c629268cf0c723f2af56135f04fbb89ed3609895cc040e24b0a521bba716cbde5a46239022cc38f314b05a285cb0eca18d579c87975064df1e3cd5c41f4116dd
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Martin Magnusek
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# BlueberryCMS
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'blueberry_cms'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install blueberry_cms
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'BlueberryCMS'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
load 'rails/tasks/statistics.rake'
|
18
|
+
|
19
|
+
require 'bundler/gem_tasks'
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
|
23
|
+
Rake::TestTask.new(:test) do |t|
|
24
|
+
t.libs << 'lib'
|
25
|
+
t.libs << 'test'
|
26
|
+
t.pattern = 'test/**/*_test.rb'
|
27
|
+
t.verbose = false
|
28
|
+
end
|
29
|
+
|
30
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require 'cocoon'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
module Admin
|
3
|
+
class PagesController < BlueberryCMS.page_admin_controller.constantize
|
4
|
+
def index
|
5
|
+
@pages = Page.all
|
6
|
+
end
|
7
|
+
|
8
|
+
def new
|
9
|
+
@page = Page.new
|
10
|
+
@page.parent = Page.find(params[:parent_id]) if params[:parent_id]
|
11
|
+
end
|
12
|
+
|
13
|
+
def create
|
14
|
+
@page = Page.new(page_params)
|
15
|
+
if @page.save
|
16
|
+
redirect_to [:admin, :pages]
|
17
|
+
else
|
18
|
+
render :new
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def edit
|
23
|
+
@page = Page.find(params[:id])
|
24
|
+
end
|
25
|
+
|
26
|
+
def update
|
27
|
+
@page = Page.find(params[:id])
|
28
|
+
p page_params.to_hash
|
29
|
+
if @page.update_attributes(page_params)
|
30
|
+
redirect_to [:admin, :pages]
|
31
|
+
else
|
32
|
+
render :edit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def destroy
|
37
|
+
@page = Page.find(params[:id])
|
38
|
+
if @page.destroy
|
39
|
+
redirect_to [:admin, :pages]
|
40
|
+
else
|
41
|
+
redirect_to [:admin, :pages]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def page_params
|
48
|
+
params.
|
49
|
+
require(:page).
|
50
|
+
permit(
|
51
|
+
:parent_id, :name,
|
52
|
+
slug_translations: [:cs, :en],
|
53
|
+
blocks_attributes: [
|
54
|
+
:_destroy, :id, :_type, :urls,
|
55
|
+
page_ids: [],
|
56
|
+
content_translations: [:cs, :en],
|
57
|
+
]
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
class PagesController < ApplicationController
|
3
|
+
class LiquidViewContext
|
4
|
+
def initialize(context); @context = context; end
|
5
|
+
def to_liquid; @context; end
|
6
|
+
end
|
7
|
+
|
8
|
+
around_action :set_locale
|
9
|
+
helper_method :liquid_view_context
|
10
|
+
|
11
|
+
def show
|
12
|
+
@page = Page.find_by(path: "/#{params[:path]}")
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def liquid_view_context
|
18
|
+
@liquid_view_context = LiquidViewContext.new(view_context)
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_locale
|
22
|
+
I18n.with_locale(params[:locale]) do
|
23
|
+
yield
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
class Page
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Tree
|
5
|
+
include Mongoid::Tree::Ordering
|
6
|
+
|
7
|
+
field :name
|
8
|
+
field :published_at, type: DateTime
|
9
|
+
field :meta_title, localize: true
|
10
|
+
field :meta_description, localize: true
|
11
|
+
field :meta_keywordds, localize: true, type: Array
|
12
|
+
field :slug, localize: true
|
13
|
+
field :path, localize: true
|
14
|
+
|
15
|
+
embeds_many :blocks, class_name: 'BlueberryCMS::PageBlock'
|
16
|
+
accepts_nested_attributes_for :blocks, allow_destroy: true
|
17
|
+
|
18
|
+
validates :path, uniqueness: true
|
19
|
+
|
20
|
+
after_rearrange :rebuild_path
|
21
|
+
|
22
|
+
before_destroy :move_children_to_parent
|
23
|
+
|
24
|
+
def path
|
25
|
+
root? ? '' : super
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_path
|
29
|
+
"/#{I18n.locale}#{path}"
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def rebuild_path
|
35
|
+
self.path_translations = I18n.available_locales.each_with_object({}) do |locale, translations|
|
36
|
+
I18n.with_locale(locale) do
|
37
|
+
pages = self.ancestors_and_self.collect(&:slug).select(&:present?)
|
38
|
+
translations[locale] = '/' + pages.join('/')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
class PageBlock
|
3
|
+
include Mongoid::Document
|
4
|
+
|
5
|
+
embedded_in :page
|
6
|
+
|
7
|
+
def self.types
|
8
|
+
@types ||= [
|
9
|
+
BlueberryCMS::PageBlocks::Text,
|
10
|
+
BlueberryCMS::PageBlocks::Gallery,
|
11
|
+
BlueberryCMS::PageBlocks::RichText
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
def form_fields(form)
|
16
|
+
raise NotImplementedError
|
17
|
+
end
|
18
|
+
|
19
|
+
def render
|
20
|
+
raise NotImplementedError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
module PageBlocks
|
3
|
+
class Gallery < PageBlock
|
4
|
+
field :urls, type: Array, default: []
|
5
|
+
|
6
|
+
has_many :pages
|
7
|
+
|
8
|
+
def form_fields(form)
|
9
|
+
form.input(:urls, input_html: { value: urls.join(', ') }) +
|
10
|
+
form.association(:pages, collection: Page.all)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render
|
14
|
+
urls
|
15
|
+
end
|
16
|
+
|
17
|
+
def urls=(value)
|
18
|
+
value = value.split(',').map(&:strip)
|
19
|
+
super(value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
module PageBlocks
|
3
|
+
class RichText < PageBlock
|
4
|
+
field :content, localize: true
|
5
|
+
|
6
|
+
def form_fields(form)
|
7
|
+
form.input(:content) do
|
8
|
+
form.fields_for(:content_translations) do |localized_field|
|
9
|
+
I18n.available_locales.map do |locale|
|
10
|
+
localized_field.input locale, input_html: { value: content_translations[locale], rows: 10, cols: 50 }, as: :text
|
11
|
+
end.join.html_safe
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def render(view_context)
|
17
|
+
options = { tables: true, autolink: false, prettify: true }
|
18
|
+
output = Redcarpet::Markdown.new(Redcarpet::Render::HTML, options).render(content)
|
19
|
+
|
20
|
+
Liquid::Template.parse(output).render('h' => view_context)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
module PageBlocks
|
3
|
+
class Text < PageBlock
|
4
|
+
field :content, localize: true
|
5
|
+
|
6
|
+
def form_fields(form)
|
7
|
+
form.input(:content) do
|
8
|
+
form.fields_for(:content_translations) do |localized_field|
|
9
|
+
I18n.available_locales.map do |locale|
|
10
|
+
localized_field.input locale, input_html: { value: content_translations[locale] }
|
11
|
+
end.join.html_safe
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def render
|
17
|
+
content
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
= f.association :parent, collection: (BlueberryCMS::Page.all - [@page])
|
2
|
+
= f.input :name
|
3
|
+
= f.input :slug
|
4
|
+
= f.error :path
|
5
|
+
= f.fields_for :slug_translations do |localized_field|
|
6
|
+
- I18n.available_locales.each do |locale|
|
7
|
+
= localized_field.input locale, input_html: { value: f.object.slug_translations[locale] }
|
8
|
+
|
9
|
+
h3 = t '.blocks'
|
10
|
+
#blocks
|
11
|
+
= f.simple_fields_for :blocks do |block|
|
12
|
+
= render 'block_fields', f: block
|
13
|
+
|
14
|
+
.links
|
15
|
+
- BlueberryCMS::PageBlock.types.each do |type|
|
16
|
+
= link_to_add_association t('.add', type: type.model_name.human), f, :blocks,
|
17
|
+
wrap_object: Proc.new { |block| block.becomes(type) },
|
18
|
+
class: 'btn btn-primary'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
= simple_form_for [:admin, @page] do |f|
|
2
|
+
.content-header
|
3
|
+
h1
|
4
|
+
span.glyphicon.glyphicon-user
|
5
|
+
span.text =< t '.title'
|
6
|
+
|
7
|
+
.content
|
8
|
+
.box
|
9
|
+
.box-content
|
10
|
+
= render 'form', f: f
|
11
|
+
.box-footer
|
12
|
+
.for-horizontal-form
|
13
|
+
= link_to t('blueberry_cms.admin.common.back'), [:admin, :pages], class: 'btn btn-default'
|
14
|
+
= f.button :submit, class: 'btn btn-primary'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
.content-header
|
2
|
+
h1
|
3
|
+
span.glyphicon.glyphicon-user
|
4
|
+
span.text =< t '.title'
|
5
|
+
|
6
|
+
ol.breadcrumb
|
7
|
+
li = link_to t('admin.common.home'), main_app.admin_root_path
|
8
|
+
li.active
|
9
|
+
strong =< t '.title'
|
10
|
+
|
11
|
+
.content
|
12
|
+
.box
|
13
|
+
.box-header
|
14
|
+
.heading
|
15
|
+
h3 = t('.list')
|
16
|
+
.actions
|
17
|
+
= link_to [:new, :admin, :page], class: 'btn btn-primary'
|
18
|
+
.glyphicon.glyphicon-plus
|
19
|
+
= t('.new')
|
20
|
+
|
21
|
+
.box-content
|
22
|
+
table.table.table-striped
|
23
|
+
thead
|
24
|
+
tr
|
25
|
+
th = BlueberryCMS::Page.human_attribute_name :name
|
26
|
+
th = BlueberryCMS::Page.human_attribute_name :slug
|
27
|
+
th = BlueberryCMS::Page.human_attribute_name :path
|
28
|
+
th
|
29
|
+
tbody
|
30
|
+
- @pages.each do |page|
|
31
|
+
tr
|
32
|
+
td = page.name
|
33
|
+
td = page.slug
|
34
|
+
td = page.path
|
35
|
+
td
|
36
|
+
= link_to [:new, :admin, :page, parent_id: page.id], class: 'btn btn-sm btn-primary'
|
37
|
+
i.glyphicon.glyphicon-plus
|
38
|
+
= t('.new_child')
|
39
|
+
'
|
40
|
+
= link_to [:edit, :admin, page], class: 'btn btn-sm btn-primary'
|
41
|
+
i.glyphicon.glyphicon-pencil
|
42
|
+
= t('blueberry_cms.admin.common.edit')
|
43
|
+
'
|
44
|
+
= link_to [:admin, page], method: :delete, class: 'btn btn-sm btn-warning'
|
45
|
+
i.glyphicon.glyphicon-remove
|
46
|
+
= t('blueberry_cms.admin.common.destroy')
|
@@ -0,0 +1,14 @@
|
|
1
|
+
= simple_form_for [:admin, @page] do |f|
|
2
|
+
.content-header
|
3
|
+
h1
|
4
|
+
span.glyphicon.glyphicon-user
|
5
|
+
span.text =< t '.title'
|
6
|
+
|
7
|
+
.content
|
8
|
+
.box
|
9
|
+
.box-content
|
10
|
+
= render 'form', f: f
|
11
|
+
.box-footer
|
12
|
+
.for-horizontal-form
|
13
|
+
= link_to t('blueberry_cms.admin.common.back'), [:admin, :pages], class: 'btn btn-default'
|
14
|
+
= f.button :submit, class: 'btn btn-primary'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>MetrostavCms</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
</head>
|
9
|
+
|
10
|
+
<body>
|
11
|
+
<h1>Admin engine</h1>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Blueberry cms</title>
|
5
|
+
<%= stylesheet_link_tag "blueberry_cms/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "blueberry_cms/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1>Toda</h1>
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
cs:
|
2
|
+
blueberry_cms:
|
3
|
+
admin:
|
4
|
+
pages:
|
5
|
+
block_fields:
|
6
|
+
remove: Odebrat blok
|
7
|
+
edit:
|
8
|
+
title: Upravit stránku
|
9
|
+
form:
|
10
|
+
add: Přidat %{type}
|
11
|
+
submit: Uložit stránku
|
12
|
+
blocks: Bloky
|
13
|
+
index:
|
14
|
+
title: Seznam stránek
|
15
|
+
list: Stránky
|
16
|
+
new: Přidat stránku
|
17
|
+
new_child: Přidat podstránku
|
18
|
+
new:
|
19
|
+
title: Vytvořit stránku
|
20
|
+
common:
|
21
|
+
back: Zpět
|
22
|
+
edit: Upravit
|
23
|
+
destroy: Smazat
|
24
|
+
mongoid:
|
25
|
+
attributes:
|
26
|
+
'blueberry_cms/page':
|
27
|
+
path: Url adresa
|
28
|
+
parent: Rodič
|
29
|
+
slug: Slug
|
30
|
+
name: Název
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'cocoon'
|
2
|
+
require 'liquid'
|
3
|
+
require 'mongoid'
|
4
|
+
require 'mongoid/tree'
|
5
|
+
require 'redcarpet'
|
6
|
+
require 'simple_form'
|
7
|
+
require 'slim-rails'
|
8
|
+
|
9
|
+
module BlueberryCMS
|
10
|
+
class Engine < ::Rails::Engine
|
11
|
+
isolate_namespace BlueberryCMS
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module BlueberryCMS
|
2
|
+
module LiquidTags
|
3
|
+
class PageLink < Liquid::Tag
|
4
|
+
def initialize(tag_name, markup, options)
|
5
|
+
super
|
6
|
+
|
7
|
+
@options = Hash[markup.split(',').map { |kv| kv.split(':').map(&:strip) }].symbolize_keys
|
8
|
+
end
|
9
|
+
|
10
|
+
def render(context)
|
11
|
+
page = Page.find(@options[:id])
|
12
|
+
context['h'].link_to @options[:title].presence || page.name, page.to_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Liquid::Template.register_tag('page_link'.freeze, PageLink)
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blueberry_cms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Magnusek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: liquid
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mongoid
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mongoid-tree
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.0.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: redcarpet
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simple_form
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: slim-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sqlite3
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Description of BlueberryCMS.
|
140
|
+
email:
|
141
|
+
- magnusekm@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- MIT-LICENSE
|
147
|
+
- README.md
|
148
|
+
- Rakefile
|
149
|
+
- app/assets/config/blueberry_cms_manifest.js
|
150
|
+
- app/assets/javascripts/blueberry_cms.js
|
151
|
+
- app/assets/stylesheets/blueberry_cms/application.css
|
152
|
+
- app/controllers/blueberry_cms/admin/pages_controller.rb
|
153
|
+
- app/controllers/blueberry_cms/pages_controller.rb
|
154
|
+
- app/controllers/blueberry_cms/root_controller.rb
|
155
|
+
- app/helpers/blueberry_cms/application_helper.rb
|
156
|
+
- app/jobs/blueberry_cms/application_job.rb
|
157
|
+
- app/mailers/blueberry_cms/application_mailer.rb
|
158
|
+
- app/models/blueberry_cms/application_record.rb
|
159
|
+
- app/models/blueberry_cms/page.rb
|
160
|
+
- app/models/blueberry_cms/page_block.rb
|
161
|
+
- app/models/blueberry_cms/page_blocks/gallery.rb
|
162
|
+
- app/models/blueberry_cms/page_blocks/rich_text.rb
|
163
|
+
- app/models/blueberry_cms/page_blocks/text.rb
|
164
|
+
- app/models/custom_render.rb
|
165
|
+
- app/views/blueberry_cms/admin/pages/_block_fields.html.slim
|
166
|
+
- app/views/blueberry_cms/admin/pages/_form.html.slim
|
167
|
+
- app/views/blueberry_cms/admin/pages/edit.html.slim
|
168
|
+
- app/views/blueberry_cms/admin/pages/index.html.slim
|
169
|
+
- app/views/blueberry_cms/admin/pages/new.html.slim
|
170
|
+
- app/views/blueberry_cms/pages/show.html.slim
|
171
|
+
- app/views/layouts/admin.html.erb
|
172
|
+
- app/views/layouts/application.html.erb
|
173
|
+
- config/initializers/inflections.rb
|
174
|
+
- config/locales/cs.yml
|
175
|
+
- config/routes.rb
|
176
|
+
- lib/blueberry_cms.rb
|
177
|
+
- lib/blueberry_cms/engine.rb
|
178
|
+
- lib/blueberry_cms/liquid_tags/page_link.rb
|
179
|
+
- lib/blueberry_cms/version.rb
|
180
|
+
- lib/tasks/blueberry_cms_tasks.rake
|
181
|
+
homepage: http://github.com/blueberry/blueberry_cms
|
182
|
+
licenses:
|
183
|
+
- MIT
|
184
|
+
metadata: {}
|
185
|
+
post_install_message:
|
186
|
+
rdoc_options: []
|
187
|
+
require_paths:
|
188
|
+
- lib
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
199
|
+
requirements: []
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 2.6.8
|
202
|
+
signing_key:
|
203
|
+
specification_version: 4
|
204
|
+
summary: Summary of BlueberryCMS.
|
205
|
+
test_files: []
|