alchemy-usermanual 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +10 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +27 -0
- data/README.md +65 -0
- data/Rakefile +39 -0
- data/alchemy-usermanual.gemspec +26 -0
- data/app/assets/images/alchemy/icon_user_manual.png +0 -0
- data/app/assets/javascripts/alchemy/user_manual.js.coffee +8 -0
- data/app/assets/stylesheets/alchemy/user_manual.scss +577 -0
- data/app/controllers/alchemy/admin/user_manual_controller.rb +11 -0
- data/app/views/alchemy/admin/user_manual/show.html.erb +9 -0
- data/config/authorization_rules.rb +5 -0
- data/config/initializers/alchemy_module.rb +15 -0
- data/config/locales/de.yml +25 -0
- data/config/locales/en.yml +25 -0
- data/config/routes.rb +5 -0
- data/lib/alchemy/user_manual/creator.rb +43 -0
- data/lib/alchemy/user_manual/engine.rb +21 -0
- data/lib/alchemy/user_manual/helpers/template_helper.rb +51 -0
- data/lib/alchemy/user_manual/templates/elements.md.erb +13 -0
- data/lib/alchemy/user_manual/templates/introduction.md.erb +3 -0
- data/lib/alchemy/user_manual/templates/page_layouts.md.erb +13 -0
- data/lib/alchemy/user_manual/version.rb +5 -0
- data/lib/alchemy/usermanual.rb +9 -0
- data/spec/controllers/admin/user_manual_controller_spec.rb +14 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/alchemy/elements.yml +6 -0
- data/spec/dummy/config/alchemy/page_layouts.yml +2 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/migrate/20131214164341_alchemy_two_point_six.alchemy.rb +337 -0
- data/spec/dummy/db/schema.rb +338 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/libraries/creator_spec.rb +29 -0
- data/spec/libraries/template_helper_spec.rb +7 -0
- data/spec/spec_helper.rb +21 -0
- metadata +231 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
<% content_for :stylesheets do %>
|
2
|
+
<%= stylesheet_link_tag 'alchemy/user_manual' %>
|
3
|
+
<% end %>
|
4
|
+
<% content_for :javascripts do %>
|
5
|
+
<%= javascript_include_tag 'alchemy/user_manual' %>
|
6
|
+
<% end %>
|
7
|
+
<div class="alchemy_user_manual wrapper">
|
8
|
+
<%= raw @manual.html_content %>
|
9
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Alchemy::Modules.register_module({
|
2
|
+
name: 'user_manual',
|
3
|
+
engine_name: 'alchemy',
|
4
|
+
navigation: {
|
5
|
+
name: 'modules.user_manual',
|
6
|
+
controller: 'alchemy/admin/user_manual',
|
7
|
+
action: 'show',
|
8
|
+
image: 'alchemy/icon_user_manual.png',
|
9
|
+
sub_navigation: [{
|
10
|
+
name: 'modules.user_manual',
|
11
|
+
controller: 'alchemy/admin/user_manual',
|
12
|
+
action: 'show'
|
13
|
+
}]
|
14
|
+
}
|
15
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
---
|
3
|
+
de:
|
4
|
+
alchemy:
|
5
|
+
modules:
|
6
|
+
user_manual: Handbuch
|
7
|
+
user_manual:
|
8
|
+
introduction_text: "In diesem Handbuch finden Sie Informationen über die im Content management system verfügbaren [Seitentypen](#page_layouts) und [Elemente](#elements), ganz individuell für Ihre Website. Außerdem erhalten Sie nähere Informationen darüber, wozu die jeweiligen [Seitentypen](#page_layouts) und [Elemente](#elements) dienen und wie sie einzusetzen sind."
|
9
|
+
element_amount: Mögliche Anzahl pro Seite
|
10
|
+
once_per_page: Einmal pro Seite
|
11
|
+
available_elements: Verfügbare Elemente
|
12
|
+
user_manual: Benutzerhandbuch
|
13
|
+
manual_for: "Benutzerhandbuch für %{project_name}"
|
14
|
+
website_structure: "Liste der verfügbaren Seitentypen und der darauf verfügbaren Elemente"
|
15
|
+
page_layout_descriptions: "Beschreibung der Seitentypen"
|
16
|
+
element_descriptions: "Beschreibung der Elemente"
|
17
|
+
properties: Eigenschaften
|
18
|
+
no_description: Keine Beschreibung vorhanden.
|
19
|
+
"true": Ja
|
20
|
+
"false": Nein
|
21
|
+
none: Keine
|
22
|
+
unlimited: Unendlich
|
23
|
+
element_autogenerating: "Automatisch erstellte Elemente beim Anlegen der Seite"
|
24
|
+
uniqueness: "Einmalig verwendbar"
|
25
|
+
layoutpage: "globale Seite"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
---
|
3
|
+
en:
|
4
|
+
alchemy:
|
5
|
+
modules:
|
6
|
+
user_manual: Manual
|
7
|
+
user_manual:
|
8
|
+
introduction_text: "With this user manual you will get informations about your very individual [page types](#page_layouts) and [elements](#elements) available in the content management system. Furthermore you will get details about what the [page types](#page_layouts) and [elements](#elements) are used to and how you use them."
|
9
|
+
element_amount: Possible count per page
|
10
|
+
once_per_page: Once per page
|
11
|
+
available_elements: Available elements
|
12
|
+
user_manual: "User manual"
|
13
|
+
manual_for: "User manual for %{project_name}"
|
14
|
+
website_structure: "Listing of all available page layouts and their elements"
|
15
|
+
page_layout_descriptions: "Description for page layouts"
|
16
|
+
element_descriptions: "Description for elements"
|
17
|
+
properties: Properties
|
18
|
+
no_description: No description available yet.
|
19
|
+
"true": yes
|
20
|
+
"false": no
|
21
|
+
none: None
|
22
|
+
unlimited: Unlimited
|
23
|
+
element_autogenerating: "Autogenerating of elements"
|
24
|
+
uniqueness: "uniquely usable"
|
25
|
+
layoutpage: "global page"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'github/markdown'
|
3
|
+
|
4
|
+
module Alchemy
|
5
|
+
module UserManual
|
6
|
+
class Creator
|
7
|
+
include TemplateHelper
|
8
|
+
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
def initialize(name = Rails.application.class.parent_name)
|
12
|
+
self.name = name
|
13
|
+
@manual = self
|
14
|
+
end
|
15
|
+
|
16
|
+
def html_content
|
17
|
+
@content ||= GitHub::Markdown.render_gfm(render_content)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def template_path
|
23
|
+
File.expand_path("../templates", __FILE__)
|
24
|
+
end
|
25
|
+
|
26
|
+
def ordered_template_files
|
27
|
+
Dir[
|
28
|
+
"#{template_path}/introduction.md.erb",
|
29
|
+
"#{template_path}/page_layouts.md.erb",
|
30
|
+
"#{template_path}/elements.md.erb"
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def render_content
|
35
|
+
render_result = ""
|
36
|
+
ordered_template_files.each do |template|
|
37
|
+
render_result << ERB.new(File.read(template)).result(binding)
|
38
|
+
end
|
39
|
+
render_result
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module UserManual
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
isolate_namespace Alchemy
|
5
|
+
engine_name 'alchemy_user_manual'
|
6
|
+
|
7
|
+
initializer 'alchemy_user_manual.assets' do |app|
|
8
|
+
app.config.assets.precompile += [
|
9
|
+
"alchemy/user_manual.css",
|
10
|
+
"alchemy/user_manual.js"
|
11
|
+
]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.add_auth_rules
|
15
|
+
Alchemy::Auth::Engine.get_instance.load(File.join(File.dirname(__FILE__), '../../..', 'config/authorization_rules.rb'))
|
16
|
+
end
|
17
|
+
|
18
|
+
config.to_prepare &method(:add_auth_rules).to_proc
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module UserManual
|
3
|
+
module TemplateHelper
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def translated_element_name(name)
|
8
|
+
I18n.t(name, scope: 'element_names', default: name.humanize)
|
9
|
+
end
|
10
|
+
|
11
|
+
def element_anchor_name(element_name)
|
12
|
+
"element_#{translated_element_name(element_name).parameterize}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def layout_properties(layout)
|
16
|
+
properties = []
|
17
|
+
properties << ["layoutpage", layout["layoutpage"] || "false"]
|
18
|
+
properties << ["uniqueness", layout["unique"] || "false"]
|
19
|
+
properties << ["available_elements", linked_element_collection(layout["elements"]) || "none" ]
|
20
|
+
properties << ["element_autogenerating", linked_element_collection(layout["autogenerate"]) || "none"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def element_properties(element)
|
24
|
+
properties = []
|
25
|
+
properties << ['element_amount', possible_amount_of_element(element)]
|
26
|
+
end
|
27
|
+
|
28
|
+
def property_name(property)
|
29
|
+
I18n.t(property.first, :scope => "user_manual")
|
30
|
+
end
|
31
|
+
|
32
|
+
def property_value(property)
|
33
|
+
I18n.t(property.last, :scope => "user_manual")
|
34
|
+
end
|
35
|
+
|
36
|
+
def linked_element_collection(element_names=[])
|
37
|
+
return if element_names.blank?
|
38
|
+
element_names.map {|e| "[#{translated_element_name(e)}](##{element_anchor_name(e)})" }.join(", ")
|
39
|
+
end
|
40
|
+
|
41
|
+
def possible_amount_of_element(element)
|
42
|
+
if element['unique'].to_s == "true"
|
43
|
+
'once_per_page'
|
44
|
+
else
|
45
|
+
element['amount'].present? ? element['amount'] : 'unlimited'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
## 2. <a name="elements"></a> <%= I18n.t("element_descriptions", :scope => "user_manual") %>
|
2
|
+
|
3
|
+
<% Alchemy::Element.descriptions.each do |e| %>
|
4
|
+
|
5
|
+
### <a name="<%= element_anchor_name(e.values.first) %>"></a><%= translated_element_name(e.values.first) %>
|
6
|
+
|
7
|
+
<%= I18n.t(e.values.first, scope: 'element_hints', default: I18n.t("no_description", :scope => "user_manual")) %>
|
8
|
+
|
9
|
+
|<%= element_properties(e).map {|p| "#{property_name(p)}" }.join("|") %>|
|
10
|
+
|<%= element_properties(e).map {|p| "---" }.join("|") %>|
|
11
|
+
|<%= element_properties(e).map {|p| "#{property_value(p)}" }.join("|") %>|
|
12
|
+
|
13
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
## 1. <a name="page_layouts"></a> <%= I18n.t("page_layout_descriptions", :scope => "user_manual") %>
|
2
|
+
|
3
|
+
<% Alchemy::PageLayout.all.each do |l| %>
|
4
|
+
|
5
|
+
### <%= PageLayout.human_layout_name(l["name"]) %>
|
6
|
+
|
7
|
+
<%= I18n.t(l.values.first, scope: 'page_layout_hints', default: I18n.t("no_description", :scope => "user_manual")) %>
|
8
|
+
|
9
|
+
|<%= layout_properties(l).map {|p| "#{property_name(p)}" }.join("|") %>|
|
10
|
+
|<%= layout_properties(l).map {|p| "---" }.join("|") %>|
|
11
|
+
|<%= layout_properties(l).map {|p| "#{property_value(p)}" }.join("|") %>|
|
12
|
+
|
13
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
module Admin
|
5
|
+
describe UserManualController do
|
6
|
+
describe "#show" do
|
7
|
+
it "provides an instance of the UserManual::Creator" do
|
8
|
+
controller.send :show
|
9
|
+
expect(assigns :manual).to be_instance_of(UserManual::Creator)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "sprockets/railtie"
|
8
|
+
# require "rails/test_unit/railtie"
|
9
|
+
|
10
|
+
Bundler.require(*Rails.groups)
|
11
|
+
require "alchemy/usermanual"
|
12
|
+
|
13
|
+
module Dummy
|
14
|
+
class Application < Rails::Application
|
15
|
+
# Settings in config/environments/* take precedence over those specified here.
|
16
|
+
# Application configuration should go into files in config/initializers
|
17
|
+
# -- all .rb files in that directory are automatically loaded.
|
18
|
+
|
19
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
20
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
21
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
22
|
+
|
23
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
24
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
25
|
+
# config.i18n.default_locale = :de
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|