th_simple_content_management 0.2.2 → 0.2.3
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 +15 -0
- data/app/assets/javascripts/simple_content_management/simple_pages/form.js +4 -0
- data/app/assets/javascripts/th-page-editor/column.js +65 -6
- data/app/assets/javascripts/th-page-editor/index.js +244 -12
- data/app/assets/javascripts/th-page-editor/row.js +71 -1
- data/app/assets/stylesheets/simple_content_management/simple_menus.css.scss +1 -1
- data/app/assets/stylesheets/simple_content_management/simple_pages.css.scss +52 -20
- data/app/controllers/redactor_rails/documents_controller.rb +1 -2
- data/app/controllers/redactor_rails/pictures_controller.rb +1 -2
- data/app/controllers/simple_content_management/link_banners_controller.rb +14 -0
- data/app/controllers/simple_content_management/simple_menus_controller.rb +2 -0
- data/app/controllers/simple_content_management/simple_pages_controller.rb +7 -0
- data/app/controllers/simple_content_management/simple_posts_controller.rb +8 -0
- data/app/helpers/simple_content_management/simple_menus_helper.rb +1 -5
- data/app/helpers/simple_content_management/simple_pages_helper.rb +2 -2
- data/app/models/simple_content_management/image_uploader.rb +13 -0
- data/app/models/simple_content_management/link_banner.rb +13 -0
- data/app/models/simple_content_management/simple_menu_item.rb +14 -0
- data/app/models/simple_content_management/simple_page.rb +23 -9
- data/app/models/simple_content_management/simple_route.rb +1 -2
- data/app/views/simple_content_management/link_banners/_form.html.erb +26 -0
- data/app/views/simple_content_management/link_banners/edit.html.erb +2 -0
- data/app/views/simple_content_management/link_banners/new.html.erb +2 -0
- data/app/views/simple_content_management/link_banners/show.html.erb +3 -0
- data/app/views/simple_content_management/simple_menus/show.html.erb +1 -1
- data/app/views/simple_content_management/simple_pages/_form.html.erb +167 -10
- data/app/views/simple_content_management/simple_pages/index.html.erb +4 -2
- data/app/views/simple_content_management/simple_pages/show.html.erb +9 -1
- data/app/views/simple_content_management/simple_posts/preview.html.erb +13 -0
- data/config/locales/simple_content_management/nl/layouts.yml +6 -0
- data/config/locales/simple_content_management/nl/models/link_banner.yml +13 -0
- data/config/locales/simple_content_management/nl/models/simple_page.yml +3 -1
- data/config/routes.rb +7 -1
- data/lib/simple_content_management/breadcrumbs.rb +13 -0
- data/lib/simple_content_management/content_text.rb +2 -1
- data/lib/simple_content_management/version.rb +1 -1
- data/lib/simple_content_management.rb +1 -0
- data/vendor/assets/javascripts/jquery.ajaxform.js +1190 -0
- metadata +82 -83
|
@@ -4,8 +4,7 @@ class RedactorRails::DocumentsController < ApplicationController
|
|
|
4
4
|
before_filter :redactor_authenticate_user! if RedactorRails.document_model.new.respond_to?(RedactorRails.devise_user)
|
|
5
5
|
|
|
6
6
|
def index
|
|
7
|
-
@documents = RedactorRails.document_model.
|
|
8
|
-
RedactorRails.document_model.new.respond_to?(RedactorRails.devise_user) ? { RedactorRails.devise_user_key => redactor_current_user.id } : { })
|
|
7
|
+
@documents = RedactorRails.document_model.all
|
|
9
8
|
render :json => @documents.to_json
|
|
10
9
|
end
|
|
11
10
|
|
|
@@ -4,8 +4,7 @@ class RedactorRails::PicturesController < ApplicationController
|
|
|
4
4
|
before_filter :redactor_authenticate_user! if RedactorRails.picture_model.new.respond_to?(RedactorRails.devise_user)
|
|
5
5
|
|
|
6
6
|
def index
|
|
7
|
-
@pictures = RedactorRails.picture_model.
|
|
8
|
-
RedactorRails.picture_model.new.respond_to?(RedactorRails.devise_user) ? { RedactorRails.devise_user_key => redactor_current_user.id } : { })
|
|
7
|
+
@pictures = RedactorRails.picture_model.all
|
|
9
8
|
render :json => @pictures.to_json
|
|
10
9
|
end
|
|
11
10
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class SimpleContentManagement::LinkBannersController < InheritedResources::Base
|
|
2
|
+
defaults :resource_class => SimpleContentManagement::LinkBanner
|
|
3
|
+
include SimpleAdminPanel::ControllerExtensions
|
|
4
|
+
alias_method_chain :collection, :search_and_pagination
|
|
5
|
+
layout false
|
|
6
|
+
|
|
7
|
+
def create
|
|
8
|
+
create! do |success, failure|
|
|
9
|
+
success.html do
|
|
10
|
+
render "show" and return
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
class SimpleContentManagement::SimpleMenusController< InheritedResources::Base
|
|
2
2
|
defaults :resource_class => SimpleContentManagement::SimpleMenu
|
|
3
3
|
include SimpleAdminPanel::ControllerExtensions
|
|
4
|
+
include SimpleContentManagement::Breadcrumbs
|
|
4
5
|
actions :index, :show, :update
|
|
5
6
|
|
|
6
7
|
def update
|
|
7
8
|
update!
|
|
9
|
+
reconstruct_breadcrumbs
|
|
8
10
|
flash[:success] = "Menu gewijzigd."
|
|
9
11
|
end
|
|
10
12
|
|
|
@@ -2,6 +2,13 @@ class SimpleContentManagement::SimplePagesController < InheritedResources::Base
|
|
|
2
2
|
defaults :resource_class => SimpleContentManagement::SimplePage
|
|
3
3
|
include SimpleAdminPanel::ControllerExtensions
|
|
4
4
|
alias_method_chain :collection, :search_and_pagination
|
|
5
|
+
custom_actions resource: [:refresh]
|
|
6
|
+
|
|
7
|
+
def refresh
|
|
8
|
+
refresh! do
|
|
9
|
+
render "edit" and return
|
|
10
|
+
end
|
|
11
|
+
end
|
|
5
12
|
|
|
6
13
|
protected
|
|
7
14
|
def end_of_association_chain
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class SimpleContentManagement::SimplePostsController < ApplicationController
|
|
2
|
+
include SimpleAdminPanel::ControllerExtensions
|
|
3
|
+
|
|
4
|
+
def preview
|
|
5
|
+
@simple_post = SimpleBlog::SimplePost.find params[:id]
|
|
6
|
+
render "preview", layout: request.xhr? ? false : "iframe"
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -12,16 +12,12 @@ module SimpleContentManagement::SimpleMenusHelper
|
|
|
12
12
|
def simple_menu_item_link_for smi
|
|
13
13
|
if smi.uri[0] == "$"
|
|
14
14
|
smc = SimpleContentManagement::SimpleMenu.find_registered_menu_item smi.uri[1..-1]
|
|
15
|
-
if self.instance_eval
|
|
15
|
+
if smc.condition.nil? || self.instance_eval(&smc.condition)
|
|
16
16
|
link_to smi.name, *self.instance_eval(&smc.link)
|
|
17
17
|
end
|
|
18
18
|
else
|
|
19
19
|
options = {}
|
|
20
20
|
options[:target] = "_blank" if smi.is_target_blank?
|
|
21
|
-
if smi.children.any?
|
|
22
|
-
options[:class] = "dropdown-toggle"
|
|
23
|
-
options[:"data-toggle"] = "dropdown"
|
|
24
|
-
end
|
|
25
21
|
link_to smi.name, smi.uri, options
|
|
26
22
|
end
|
|
27
23
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module SimpleContentManagement::SimplePagesHelper
|
|
2
2
|
def render_page_by_name name
|
|
3
|
-
SimpleContentManagement::SimplePage.where(name: name).first.try(:content_html).try(:html_safe)
|
|
3
|
+
SimpleContentManagement::SimplePage.active.where(name: name).first.try(:content_html).try(:html_safe)
|
|
4
4
|
end
|
|
5
5
|
|
|
6
6
|
def render_page_by_path path
|
|
7
|
-
SimpleContentManagement::SimplePage.search(simple_routes_path_equals: path).first.try(:content_html).try(:html_safe)
|
|
7
|
+
SimpleContentManagement::SimplePage.active.search(simple_routes_path_equals: path).first.try(:content_html).try(:html_safe)
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
class SimpleContentManagement::ImageUploader < CarrierWave::Uploader::Base
|
|
3
|
+
include CarrierWave::MiniMagick
|
|
4
|
+
storage :file
|
|
5
|
+
|
|
6
|
+
def store_dir
|
|
7
|
+
"system/redactor_assets/pictures/#{model.id}"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def extension_white_list
|
|
11
|
+
RedactorRails.image_file_types
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class SimpleContentManagement::LinkBanner < ActiveRecord::Base
|
|
2
|
+
mount_uploader :background_image, SimpleContentManagement::ImageUploader
|
|
3
|
+
|
|
4
|
+
SIZES = {
|
|
5
|
+
"sub" => { w: 295, h: 160 },
|
|
6
|
+
"main" => { w: 895, h: 290 }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
attr_accessible :secondary_title, :primary_title, :uri, :size, :background_image, :background_image_cache
|
|
10
|
+
|
|
11
|
+
validates_presence_of :background_image, :secondary_title, :primary_title, :uri, :size
|
|
12
|
+
validates_inclusion_of :size, in: SIZES.keys
|
|
13
|
+
end
|
|
@@ -9,4 +9,18 @@ class SimpleContentManagement::SimpleMenuItem < ActiveRecord::Base
|
|
|
9
9
|
attr_accessible :name, :uri, :is_target_blank, :position, :simple_menu_id, :parent_id, :method
|
|
10
10
|
|
|
11
11
|
scope :ordered, order("position")
|
|
12
|
+
|
|
13
|
+
def simple_menu
|
|
14
|
+
SimpleContentManagement::SimpleMenu.find simple_menu_id
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def parents
|
|
18
|
+
parents = []
|
|
19
|
+
parent = self
|
|
20
|
+
while parent.parent.present?
|
|
21
|
+
parents << parent.parent
|
|
22
|
+
parent = self.parent
|
|
23
|
+
end
|
|
24
|
+
return parents
|
|
25
|
+
end
|
|
12
26
|
end
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
class SimpleContentManagement::SimplePage < ActiveRecord::Base
|
|
2
2
|
include SimpleContentManagement::ContentText
|
|
3
|
+
include SimpleContentManagement::Breadcrumbs
|
|
3
4
|
|
|
4
5
|
has_many :simple_routes, conditions: { deleted: false }, class_name: "SimpleContentManagement::SimpleRoute"
|
|
6
|
+
belongs_to :preferred_menu_item, class_name: "SimpleContentManagement::SimpleMenuItem"
|
|
5
7
|
|
|
6
|
-
attr_accessible :name, :title, :content_html, :simple_routes_list
|
|
7
|
-
|
|
8
|
+
attr_accessible :name, :title, :content_html, :simple_routes_list, :section, :preferred_menu_item_id, :meta_description, :meta_keywords
|
|
8
9
|
scope :active, where(deleted: false)
|
|
9
10
|
|
|
11
|
+
before_save :reconstruct_breadcrumbs
|
|
12
|
+
|
|
13
|
+
def simple_menu_items
|
|
14
|
+
SimpleContentManagement::SimpleMenuItem.where(uri: path_names.map{ |path| "/#{path}.html" } + (path_names.include?("prive") ? ["/"] : []))
|
|
15
|
+
end
|
|
16
|
+
|
|
10
17
|
def simple_routes_list
|
|
11
18
|
path_names.join ","
|
|
12
19
|
end
|
|
@@ -16,15 +23,18 @@ class SimpleContentManagement::SimplePage < ActiveRecord::Base
|
|
|
16
23
|
|
|
17
24
|
# destroy routes that are no longer required
|
|
18
25
|
self.simple_routes.each do |simple_route|
|
|
19
|
-
|
|
26
|
+
if path_names.include? simple_route.path
|
|
27
|
+
path_names.delete simple_route.path
|
|
28
|
+
else
|
|
29
|
+
simple_route.destroy
|
|
30
|
+
end
|
|
20
31
|
end
|
|
21
32
|
|
|
22
33
|
# ensure any existing routes are set active to the current page.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
path_names.delete simple_route.path
|
|
34
|
+
if id.nil?
|
|
35
|
+
SimpleContentManagement::SimpleRoute.where(path: path_names, deleted: false).update_all deleted: true
|
|
36
|
+
else
|
|
37
|
+
SimpleContentManagement::SimpleRoute.where(path: path_names, deleted: false).where("simple_page_id <> ?", id).update_all deleted: true
|
|
28
38
|
end
|
|
29
39
|
|
|
30
40
|
# create the remaining routes
|
|
@@ -34,7 +44,7 @@ class SimpleContentManagement::SimplePage < ActiveRecord::Base
|
|
|
34
44
|
end
|
|
35
45
|
|
|
36
46
|
def path_names
|
|
37
|
-
simple_routes.pluck("path")
|
|
47
|
+
new_record? ? simple_routes.map(&:path) : simple_routes.active.pluck("path")
|
|
38
48
|
end
|
|
39
49
|
|
|
40
50
|
def destroy
|
|
@@ -45,6 +55,10 @@ class SimpleContentManagement::SimplePage < ActiveRecord::Base
|
|
|
45
55
|
title
|
|
46
56
|
end
|
|
47
57
|
|
|
58
|
+
def reconstruct_breadcrumbs
|
|
59
|
+
self.preferred_menu_item = simple_menu_items.first unless preferred_menu_item.present? || simple_menu_items.first.nil?
|
|
60
|
+
end
|
|
61
|
+
|
|
48
62
|
class << self
|
|
49
63
|
def registered_content_pages
|
|
50
64
|
@registered_content_pages ||= YAML.load_file File.join Rails.root, "config", "content_pages.yml"
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
class SimpleContentManagement::SimpleRoute < ActiveRecord::Base
|
|
2
|
-
validates_uniqueness_of :path
|
|
3
|
-
|
|
4
2
|
belongs_to :simple_page, class_name: "SimpleContentManagement::SimplePage"
|
|
5
3
|
|
|
6
4
|
attr_accessible :path
|
|
@@ -16,5 +14,6 @@ class SimpleContentManagement::SimpleRoute < ActiveRecord::Base
|
|
|
16
14
|
private
|
|
17
15
|
def inform_simple_pages_constraint
|
|
18
16
|
SimpleContentManagement::SimplePagesConstraint.instance.route_created_or_updated self
|
|
17
|
+
true
|
|
19
18
|
end
|
|
20
19
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<%= simple_form_for @link_banner, remote: true do |f| %>
|
|
2
|
+
<div class="errors"><%= f.object.errors.full_messages.to_sentence %></div>
|
|
3
|
+
<%= f.input :secondary_title %>
|
|
4
|
+
<%= f.input :primary_title %>
|
|
5
|
+
<%= f.input :size, as: :radio_buttons, collection: SimpleContentManagement::LinkBanner::SIZES.map{ |name, size| ["#{size[:w]}x#{size[:h]}", name] } %>
|
|
6
|
+
|
|
7
|
+
<%= f.input :quick_search, label: "Bestaande link" do %>
|
|
8
|
+
<select id="link-banner-quick-select" data-placeholder="Kies een bestaande link">
|
|
9
|
+
<option></option>
|
|
10
|
+
<optgroup label="Pagina's">
|
|
11
|
+
<% SimpleContentManagement::SimplePage.includes(:simple_routes).where("name IS NULL").active.each do |simple_page| %>
|
|
12
|
+
<%= content_tag :option, simple_page.title, data: { routes: simple_page.path_names.map{ |path| "/#{path}.html" }.to_json, name: simple_page.title } %>
|
|
13
|
+
<% end %>
|
|
14
|
+
</optgroup>
|
|
15
|
+
</select>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
<%= f.input :uri %>
|
|
19
|
+
|
|
20
|
+
<%= f.input :background_image, hint: "De achtergrond afbeelding van de linkbanner. Je afbeelding's afmetingen moeten gelijk zijn aan de gekozen afmeting van de linkbanner." do %>
|
|
21
|
+
<%= image_tag resource.background_image.url if resource.background_image.present? %>
|
|
22
|
+
<br>
|
|
23
|
+
<%= f.input_field :background_image %>
|
|
24
|
+
<%= f.hidden_field :background_image_cache %>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% end %>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<div data-link-banner-id="<%= @link_banner.id %>">
|
|
2
|
+
<%= render "shared/#{@link_banner.size}_bloc", primary_title: @link_banner.primary_title, secondary_title: @link_banner.secondary_title, target: @link_banner.uri, background_image: @link_banner.background_image.url %>
|
|
3
|
+
</div>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<% end %>
|
|
34
34
|
</optgroup>
|
|
35
35
|
<optgroup label="Pagina's">
|
|
36
|
-
<% SimpleContentManagement::SimplePage.includes(:simple_routes).where("name IS NULL").each do |simple_page| %>
|
|
36
|
+
<% SimpleContentManagement::SimplePage.active.includes(:simple_routes).where("name IS NULL").each do |simple_page| %>
|
|
37
37
|
<%= content_tag :option, simple_page.title, data: { routes: simple_page.path_names.map{ |path| "/#{path}.html" }.to_json, name: simple_page.title } %>
|
|
38
38
|
<% end %>
|
|
39
39
|
</optgroup>
|
|
@@ -2,9 +2,22 @@
|
|
|
2
2
|
<%= simple_form_for [:admin, @simple_page], url: @simple_page.new_record? ? simple_content_management_simple_pages_path : simple_content_management_simple_page_path(@simple_page), html: { class: "simple-page-form" } do |f| %>
|
|
3
3
|
<%= f.input :simple_routes_list, input_html: { data: { simple_routes_list: true } }, wrapper_html: { class: "simple-routes-list" }, hint: "Voeg één of meerdere URL paden toe." %>
|
|
4
4
|
<%= f.input :title, hint: "Wordt gebruikt als HTML titel." %>
|
|
5
|
+
<%= f.input :meta_description, as: :string, input_html: { class: "input-xxlarge" } %>
|
|
6
|
+
<%= f.input :meta_keywords, as: :string, input_html: { class: "input-xxlarge" } %>
|
|
7
|
+
<% if @simple_page.simple_menu_items.any? %>
|
|
8
|
+
<%= f.input :preferred_menu_item_id, include_blank: false, collection: @simple_page.simple_menu_items.map{ |smi| ["#{[smi.simple_menu.name, *smi.parents.map(&:name).reverse, smi.name].join(" / ")}", smi.id] } %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= f.input :preferred_menu_item_id do %>
|
|
11
|
+
<div style="padding-top: 5px;">
|
|
12
|
+
Voeg deze pagina toe aan een menu om breadcrumbs ervoor te maken.
|
|
13
|
+
<br>Indien er meer dan één menuitem linkt naar deze pagina kan hier gekozen worden welke bepalend is voor de breadcrumbs.
|
|
14
|
+
</div>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<%= f.input :section, hint: "Bepalend voor welk menu er getoond wordt.", as: :radio_buttons, collection: { "Prive" => "private", "Zakelijk" => "corporate" } %>
|
|
5
18
|
<%= f.input :content_html, as: :hidden %>
|
|
6
19
|
|
|
7
|
-
<div class="content-html-container">
|
|
20
|
+
<div class="content-html-container content-html-preview">
|
|
8
21
|
<%== @simple_page.content_html %>
|
|
9
22
|
</div>
|
|
10
23
|
|
|
@@ -19,15 +32,22 @@
|
|
|
19
32
|
<h3 id="content-editor-label">Inhoud bewerken</h3>
|
|
20
33
|
<ul class="nav nav-tabs">
|
|
21
34
|
<li class="active"><a href="#editor-html-content" data-toggle="tab">Tekst</a></li>
|
|
22
|
-
<li><a href="#editor-container"
|
|
23
|
-
<li><a href="#editor-
|
|
35
|
+
<li><a href="#editor-container" data-toggle="tab">Container</a></li>
|
|
36
|
+
<li><a href="#editor-link-banner" data-toggle="tab" data-path="<%= new_simple_content_management_link_banner_path %>">Linkbanner</a></li>
|
|
37
|
+
<li><a href="#editor-blog-links" data-toggle="tab">Bloglinks</a></li>
|
|
38
|
+
<li><a href="#editor-link-list" data-toggle="tab">Linklijst</a></li>
|
|
39
|
+
<li><a href="#editor-appointment" data-toggle="tab">Agenda</a></li>
|
|
40
|
+
<li><a href="#editor-blog-post-preview" data-toggle="tab">Blogpost</a></li>
|
|
41
|
+
<li><a href="#editor-offer" data-toggle="tab">Offerte</a></li>
|
|
24
42
|
</ul>
|
|
25
43
|
</div>
|
|
26
44
|
<div class="modal-body">
|
|
27
45
|
<div class="tab-content">
|
|
46
|
+
|
|
28
47
|
<div class="tab-pane active" id="editor-html-content">
|
|
29
48
|
<textarea cols=140 rows=12></textarea>
|
|
30
49
|
</div>
|
|
50
|
+
|
|
31
51
|
<div class="tab-pane" id="editor-container">
|
|
32
52
|
<h2>Converteer dit blok naar een container</h2>
|
|
33
53
|
<p class=lead>
|
|
@@ -37,13 +57,150 @@
|
|
|
37
57
|
Klik op toepassen om dit blok te converteren. Er zal geen informatie verloren gaan, maar deze actie kan niet ongedaan worden.
|
|
38
58
|
</p>
|
|
39
59
|
</div>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
|
|
61
|
+
<div class="tab-pane" id="editor-link-banner"></div>
|
|
62
|
+
|
|
63
|
+
<div class="tab-pane" id="editor-offer">
|
|
64
|
+
<h2>Offerte</h2>
|
|
65
|
+
<p class=lead>
|
|
66
|
+
Plaatst een offerte-berekenaar in dit blok.
|
|
67
|
+
</p>
|
|
68
|
+
<div style="display: none;">
|
|
69
|
+
<% @offer = Offer.new %>
|
|
70
|
+
<%= render "offers/form" %>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="tab-pane" id="editor-link-list">
|
|
75
|
+
<h2>Linklijst</h2>
|
|
76
|
+
<p class="lead">
|
|
77
|
+
Blok met kopje en een lijst aan links.
|
|
78
|
+
</p>
|
|
79
|
+
|
|
80
|
+
<form target="#" id="editor-link-list-form" class="form-horizontal">
|
|
81
|
+
|
|
82
|
+
<div class="control-group">
|
|
83
|
+
<label class="control-label" for="editor-link-list-title">Titel</label>
|
|
84
|
+
<div class="controls">
|
|
85
|
+
<input type="text" id="editor-link-list-title" name="title">
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div class="control-group">
|
|
90
|
+
<label class="control-label" for="editor-link-list-title">Lijsttype</label>
|
|
91
|
+
<div class="controls">
|
|
92
|
+
<label class="radio"><input type="radio" name="listtype" value="linklist" checked="checked"> Linklijst</label>
|
|
93
|
+
<label class="radio"><input type="radio" name="listtype" value="dropdown"> Dropdown</label>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<h3>
|
|
98
|
+
<a href="#" id="add-link-button" class="pull-right btn btn-mini"><i class="icon-plus"></i> toevoegen</a>
|
|
99
|
+
Links
|
|
100
|
+
</h3>
|
|
101
|
+
<table class="table table-condensed" id="links-table">
|
|
102
|
+
<thead>
|
|
103
|
+
<tr>
|
|
104
|
+
<th>Bestaande link</th>
|
|
105
|
+
<th>Naam</th>
|
|
106
|
+
<th>URL</th>
|
|
107
|
+
</tr>
|
|
108
|
+
</thead>
|
|
109
|
+
<tbody>
|
|
110
|
+
<tr class="link-list-quick-select-container">
|
|
111
|
+
<td>
|
|
112
|
+
<select data-placeholder="Kies een bestaande link">
|
|
113
|
+
<option></option>
|
|
114
|
+
<optgroup label="Pagina's">
|
|
115
|
+
<% SimpleContentManagement::SimplePage.includes(:simple_routes).where("name IS NULL").active.each do |simple_page| %>
|
|
116
|
+
<%= content_tag :option, simple_page.title, data: { routes: simple_page.path_names.map{ |path| "/#{path}.html" }.to_json, name: simple_page.title } %>
|
|
117
|
+
<% end %>
|
|
118
|
+
</optgroup>
|
|
119
|
+
</select>
|
|
120
|
+
</td>
|
|
121
|
+
<td>
|
|
122
|
+
<input type="text" name="link-label[]">
|
|
123
|
+
</td>
|
|
124
|
+
<td>
|
|
125
|
+
<input type="text" name="link-uri[]">
|
|
126
|
+
</td>
|
|
127
|
+
</tr>
|
|
128
|
+
</tbody>
|
|
129
|
+
</table>
|
|
130
|
+
|
|
131
|
+
</form>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<div class="tab-pane" id="editor-blog-post-preview" data-path="<%= preview_simple_content_management_simple_post_path("simple_post_id") %>">
|
|
135
|
+
<h2>Blogpost preview blokje</h2>
|
|
136
|
+
<p class="lead">
|
|
137
|
+
Een blogpost preview blokje ter grootte van een kleine linkbanner.
|
|
138
|
+
</p>
|
|
139
|
+
<p>
|
|
140
|
+
<strong>Blogpost:</strong>
|
|
141
|
+
</p>
|
|
142
|
+
<%= select "", "blog_post_id", SimpleBlog::SimplePost.order("published_at desc").collect{ |p| [p.title, p.id] }, include_blank: true %>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<div class="tab-pane" id="editor-appointment">
|
|
146
|
+
<h2>Afspraak agenda</h2>
|
|
147
|
+
<p class="lead">
|
|
148
|
+
Een formulier met een grote agenda voor het maken van een afspraak op een datum en tijd.
|
|
149
|
+
</p>
|
|
150
|
+
<% @appointment_request = AppointmentRequest.new %>
|
|
151
|
+
<div style="display: none;">
|
|
152
|
+
<%= render "appointment_request/form" %>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<div class="tab-pane" id="editor-blog-links">
|
|
157
|
+
<h2>Blogposts linklijst</h2>
|
|
158
|
+
<p class="lead">
|
|
159
|
+
Blok met een kopje, links naar blogposts en een "alle openen" link.
|
|
160
|
+
</p>
|
|
161
|
+
|
|
162
|
+
<form target="#" id="editor-blog-links-form" class="form-horizontal">
|
|
163
|
+
|
|
164
|
+
<div class="control-group">
|
|
165
|
+
<label class="control-label" for="editor-blog-links-title">Titel</label>
|
|
166
|
+
<div class="controls">
|
|
167
|
+
<input type="text" id="editor-blog-links-title">
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div class="control-group">
|
|
172
|
+
<label class="control-label" for="editor-blog-links-title">Tags</label>
|
|
173
|
+
<div class="controls">
|
|
174
|
+
<select id="editor-blog-links-tags" multiple="multiple">
|
|
175
|
+
<% SimpleBlog::SimplePostTag.find_each do |tag| %>
|
|
176
|
+
<%= content_tag :option, tag.name, value: tag.id %>
|
|
177
|
+
<% end %>
|
|
178
|
+
</select>
|
|
179
|
+
<p class="help-block">
|
|
180
|
+
Kies één of meerdere tags waarvan de blogposts weergegeven moeten worden.
|
|
181
|
+
Alle posts met tenminste één van deze tags wordt toegevoegd. Laat leeg om alle posts te laden.
|
|
182
|
+
</p>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<div class="control-group">
|
|
187
|
+
<label class="control-label" for="editor-blog-links-amount">Aantal blogpost links</label>
|
|
188
|
+
<div class="controls">
|
|
189
|
+
<input type="number" id="editor-blog-links-amount" value="6" class="input-small">
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div class="control-group">
|
|
194
|
+
<label class="control-label" for="editor-blog-links-open-all">"Alle openen" link</label>
|
|
195
|
+
<div class="controls">
|
|
196
|
+
<input type="text" id="editor-blog-links-open-all" placeholder="Meer lezen...">
|
|
197
|
+
<p class="help-block">
|
|
198
|
+
Vul hier een naam in voor de link naar alle blogposts met de opgegeven tags. Laat leeg om geen link toe te voegen.
|
|
199
|
+
</p>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
</form>
|
|
47
204
|
</div>
|
|
48
205
|
</div>
|
|
49
206
|
</div>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<%=
|
|
1
|
+
<%= paginate @simple_pages %>
|
|
2
|
+
<%= table_list_for @simple_pages, resource_class: SimpleContentManagement::SimplePage do |t| %>
|
|
2
3
|
<%= t.item :title, as: :link %>
|
|
3
4
|
<%= t.item as: :actions %>
|
|
4
|
-
<% end %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<%= paginate @simple_pages %>
|
|
@@ -2,4 +2,12 @@
|
|
|
2
2
|
<%= link_to "/#{simple_route.path}.html", "/#{simple_route.path}.html", class: "btn btn-small", target: "_blank" %>
|
|
3
3
|
<% end %>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<br>
|
|
6
|
+
<br>
|
|
7
|
+
|
|
8
|
+
<pre><meta name="description" content="<%= CGI.escape_html @simple_page.meta_description %>">
|
|
9
|
+
<meta name="keywords" content="<%= CGI.escape_html @simple_page.meta_keywords %>"></pre>
|
|
10
|
+
|
|
11
|
+
<div class="content-html-preview">
|
|
12
|
+
<%= @simple_page.content_html.html_safe %>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div class="simple-post-preview">
|
|
2
|
+
<h3 class="title"><%= @simple_post.title.truncate(50) %></h3>
|
|
3
|
+
|
|
4
|
+
<div class="info">
|
|
5
|
+
Geschreven door <strong><%= @simple_post.author_name %></strong> op <strong><%= l @simple_post.published_at, format: :short %></strong>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="content">
|
|
9
|
+
<%= @simple_post.content_text.truncate(150) %>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<%= link_to "» lees meer".html_safe, simple_post_path(@simple_post), class: "pull-right read-more" %>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
nl:
|
|
2
|
+
activerecord:
|
|
3
|
+
models:
|
|
4
|
+
simple_content_management/link_banner:
|
|
5
|
+
one: Linkbanner
|
|
6
|
+
other: Linkbanners
|
|
7
|
+
attributes:
|
|
8
|
+
simple_content_management/link_banner:
|
|
9
|
+
primary_title: "Koptitel (regel 2)"
|
|
10
|
+
secondary_title: "Subtitel (regel 1)"
|
|
11
|
+
size: Formaat
|
|
12
|
+
uri: "URL"
|
|
13
|
+
background: Achtergrond afbeelding
|
data/config/routes.rb
CHANGED
|
@@ -5,7 +5,13 @@ Rails.application.routes.draw do
|
|
|
5
5
|
end
|
|
6
6
|
namespace :simple_content_management, path: "admin" do
|
|
7
7
|
resources :simple_content_pages
|
|
8
|
-
resources :simple_pages
|
|
8
|
+
resources :simple_pages do
|
|
9
|
+
get :refresh, on: :member
|
|
10
|
+
end
|
|
9
11
|
resources :simple_menus
|
|
12
|
+
resources :link_banners, only: [:new, :create, :edit, :update, :show]
|
|
13
|
+
resources :simple_posts, only: [] do
|
|
14
|
+
get :preview, on: :member
|
|
15
|
+
end
|
|
10
16
|
end
|
|
11
17
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module SimpleContentManagement::Breadcrumbs
|
|
2
|
+
def reconstruct_breadcrumbs
|
|
3
|
+
pages = SimpleContentManagement::SimplePage.active.all
|
|
4
|
+
menu_items = SimpleContentManagement::SimpleMenuItem.all
|
|
5
|
+
menu_item_ids = menu_items.map(&:id)
|
|
6
|
+
|
|
7
|
+
pages.each do |page|
|
|
8
|
+
next if menu_item_ids.include?(page.preferred_menu_item_id) || page.simple_menu_items.first.nil?
|
|
9
|
+
page.preferred_menu_item_id = page.simple_menu_items.first.id
|
|
10
|
+
page.save
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -15,7 +15,8 @@ module SimpleContentManagement::ContentText
|
|
|
15
15
|
begin
|
|
16
16
|
tmpfile.write self.content_html
|
|
17
17
|
tmpfile.flush
|
|
18
|
-
|
|
18
|
+
# IO.popen for safe execution of commands within JRuby. backticks + utf8 = error
|
|
19
|
+
self.content_text = IO.popen(%{lynx -dump -force_html "#{tmpfile.path}"}, "rb").read
|
|
19
20
|
ensure
|
|
20
21
|
tmpfile.close true # `true` also deletes (unlinks) the file
|
|
21
22
|
end
|
|
@@ -5,6 +5,7 @@ require "redactor_rails_document_uploader"
|
|
|
5
5
|
require "redactor_rails_picture_uploader"
|
|
6
6
|
|
|
7
7
|
module SimpleContentManagement
|
|
8
|
+
require "simple_content_management/breadcrumbs"
|
|
8
9
|
require "simple_content_management/content_text"
|
|
9
10
|
require "simple_content_management/simple_pages_constraint"
|
|
10
11
|
end
|