scribble_cms 0.71 → 0.82
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/tinymce-small.eot +0 -0
- data/app/assets/fonts/tinymce-small.json +1277 -0
- data/app/assets/fonts/tinymce-small.svg +63 -0
- data/app/assets/fonts/tinymce-small.ttf +0 -0
- data/app/assets/fonts/tinymce-small.woff +0 -0
- data/app/assets/fonts/tinymce.eot +0 -0
- data/app/assets/fonts/tinymce.json +3469 -0
- data/app/assets/fonts/tinymce.svg +131 -0
- data/app/assets/fonts/tinymce.ttf +0 -0
- data/app/assets/fonts/tinymce.woff +0 -0
- data/app/assets/javascripts/ext/tinymce.min.js +15 -0
- data/app/assets/javascripts/scribbler.js +10 -0
- data/app/assets/stylesheets/ext/tinymce.content.min.css +1 -0
- data/app/assets/stylesheets/ext/tinymce.skin.scss +2879 -0
- data/app/models/scribbler_container.rb +18 -18
- data/app/models/scribbler_group.rb +18 -3
- data/app/models/scribbler_image.rb +0 -3
- data/app/views/admin/_scribbler_group_form.html.erb +18 -0
- data/app/views/scribbler_content/forms/_text.html.erb +1 -1
- data/config/locales/scribbler_defaults.de.yml +14 -0
- data/lib/admin/scribbler_groups.rb.template +32 -0
- data/lib/scribble_cms/engine.rb +20 -0
- metadata +17 -2
@@ -1,45 +1,45 @@
|
|
1
1
|
class ScribblerContainer < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
#= Configuration
|
4
4
|
#== Associations
|
5
5
|
has_many :groups, :class_name => "::ScribblerGroup", :foreign_key => "container_id"
|
6
6
|
belongs_to :element, :class_name => "Alchemy::Element", :foreign_key => "element_id"
|
7
7
|
#== Plugins and modules
|
8
8
|
#=== PlugIns
|
9
|
-
# => Stuff in Here
|
10
|
-
|
9
|
+
# => Stuff in Here
|
10
|
+
|
11
11
|
#=== include Modules
|
12
12
|
# => Stuff in Here
|
13
|
-
|
13
|
+
|
14
14
|
#== Konstanten
|
15
15
|
# => Stuff in Here
|
16
|
-
|
16
|
+
|
17
17
|
#== Validation and Callbacks
|
18
18
|
#=== Validation
|
19
19
|
validates_uniqueness_of :name, :on => :create, :message => "must be unique"
|
20
|
-
|
20
|
+
|
21
21
|
#=== Callbacks
|
22
22
|
before_create { self.description = self.name }
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
|
25
25
|
# => END
|
26
|
-
|
26
|
+
|
27
27
|
def ordered_groups
|
28
28
|
self.groups.sort_by {|g| g.human_name.to_s }
|
29
|
-
end
|
30
|
-
|
29
|
+
end
|
30
|
+
|
31
31
|
def scribbler_group(name, &block)
|
32
32
|
yield(self.get_group(name))
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def get_group(name)
|
36
36
|
ScribblerGroup.where(:name => name, :container_id => self.id).first || ScribblerGroup.create(:name => name, :container_id => self.id)
|
37
|
-
end
|
38
|
-
|
37
|
+
end
|
38
|
+
|
39
39
|
def description
|
40
40
|
I18n.t(self.name, :scope => "scribbler.container_names", :default => self.name.humanize)
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
45
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
class ScribblerGroup < ActiveRecord::Base
|
2
2
|
|
3
3
|
#= Configuration
|
4
|
+
attr_accessor :group_data
|
4
5
|
#== Associations
|
5
6
|
belongs_to :container, :class_name => "ScribblerContainer", :foreign_key => "container_id", :touch => true
|
6
7
|
|
7
8
|
has_many :texts, :class_name => "ScribblerText", :foreign_key => "group_id"
|
9
|
+
|
8
10
|
#== Plugins and modules
|
9
11
|
#=== PlugIns
|
10
12
|
# => Stuff in Here
|
@@ -29,6 +31,12 @@ class ScribblerGroup < ActiveRecord::Base
|
|
29
31
|
|
30
32
|
# => END
|
31
33
|
|
34
|
+
def contents
|
35
|
+
contents = ELEMENTS.values.map do |cont_class|
|
36
|
+
cont_class.constantize.where(group_id: self.id).where(:released => true)
|
37
|
+
end.flatten
|
38
|
+
end
|
39
|
+
|
32
40
|
# Display data
|
33
41
|
def row(row_name, options = {})
|
34
42
|
e = get_element(:row, row_name)
|
@@ -98,11 +106,9 @@ class ScribblerGroup < ActiveRecord::Base
|
|
98
106
|
end
|
99
107
|
element = element_class.where(options).first
|
100
108
|
if element.nil?
|
101
|
-
element_class.create(options.merge(:released => !options[:released]))
|
102
109
|
element = element_class.create(options)
|
103
110
|
end
|
104
111
|
|
105
|
-
|
106
112
|
return element
|
107
113
|
end
|
108
114
|
|
@@ -122,6 +128,10 @@ class ScribblerGroup < ActiveRecord::Base
|
|
122
128
|
self.elements.each {|e| e.destroy }
|
123
129
|
end
|
124
130
|
|
131
|
+
def group_data=(data)
|
132
|
+
process_data!(data)
|
133
|
+
end
|
134
|
+
|
125
135
|
# Save data
|
126
136
|
def process_group_data(data = {})
|
127
137
|
# Update realesed data
|
@@ -133,10 +143,11 @@ class ScribblerGroup < ActiveRecord::Base
|
|
133
143
|
|
134
144
|
def process_data!(data)
|
135
145
|
data.each do |key, content|
|
146
|
+
content.symbolize_keys!
|
136
147
|
e_id = content.delete(:id)
|
137
148
|
e_type = content.delete(:type)
|
138
149
|
e_rel = content.delete(:release)
|
139
|
-
element = ELEMENTS[e_type.to_sym].find(e_id)
|
150
|
+
element = ELEMENTS[e_type.to_sym].constantize.find(e_id)
|
140
151
|
element.update_attributes(content)
|
141
152
|
|
142
153
|
if e_rel == "1"
|
@@ -149,6 +160,10 @@ class ScribblerGroup < ActiveRecord::Base
|
|
149
160
|
I18n.t(self.name, :scope => "scribbler.group_names", :default => self.name.humanize) rescue self.name
|
150
161
|
end
|
151
162
|
|
163
|
+
def container_description
|
164
|
+
container.description
|
165
|
+
end
|
166
|
+
|
152
167
|
|
153
168
|
|
154
169
|
|
@@ -5,7 +5,6 @@ class ScribblerImage < ActiveRecord::Base
|
|
5
5
|
after_assign{|i| i.name = sanitize_filename(image.name) }
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
8
|
def sanitize_filename(filename)
|
10
9
|
[filename.split(".").first.parameterize, filename.split(".").last].join(".")
|
11
10
|
end
|
@@ -18,8 +17,6 @@ class ScribblerImage < ActiveRecord::Base
|
|
18
17
|
case_sensitive: false,
|
19
18
|
message: I18n.t("not a valid image")
|
20
19
|
|
21
|
-
|
22
|
-
|
23
20
|
#== Associations
|
24
21
|
|
25
22
|
#== Plugins and modules
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% element_ids = [] %>
|
2
|
+
<%= form_for [:admin, resource] do |f| %>
|
3
|
+
<%= f.fields_for :group_data do |u| %>
|
4
|
+
<% f.object.released_elements.each do |e| %>
|
5
|
+
<div class="scribbler-element scribbler-<%= e.element_type %>" style="<%= 'background-color: #ffffdc;' if params[:active].to_i == e.id %> padding: 5px;">
|
6
|
+
<h3 class="scribbler-header"><%= e.human_name %></h3>
|
7
|
+
<% unless e.hint.blank? %>
|
8
|
+
<p class="scribbler-element-hint"><%= raw(e.hint) %></p>
|
9
|
+
<% end %>
|
10
|
+
<% element_ids << e.id %>
|
11
|
+
<div style="margin-bottom: 5px;"><%= scribbler_form_element(e,u) %></div>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= f.submit %>
|
17
|
+
|
18
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= f.fields_for "#{element.element_type}_#{element.id}" do |e| %>
|
2
|
-
<%= e.text_area :content, :class => ScribbleCms.tiny_mce_css, :
|
2
|
+
<%= e.text_area :content, :class => ScribbleCms.tiny_mce_css, :value => element.content, class: 'html_editor' %>
|
3
3
|
<br />
|
4
4
|
<%= e.hidden_field :type, :value => element.element_type %>
|
5
5
|
<%= e.hidden_field :id, :value => element.id %>
|
@@ -7,3 +7,17 @@ de:
|
|
7
7
|
content-en: 'EN: 2. Text/Inhalt'
|
8
8
|
subject-de: 'DE: 1. Betreff'
|
9
9
|
content-de: 'DE: 2. Text/Inhalt'
|
10
|
+
content: Text/Inhalt
|
11
|
+
title: Name
|
12
|
+
header: Überschrift
|
13
|
+
intro: Einleitung
|
14
|
+
|
15
|
+
activerecord:
|
16
|
+
models:
|
17
|
+
scribbler_group: Textbausteine
|
18
|
+
scribbler_container: Textgruppe
|
19
|
+
attributes:
|
20
|
+
scribbler_group:
|
21
|
+
human_name: Name
|
22
|
+
container_description: Textgruppe
|
23
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
ActiveAdmin.register ScribblerGroup do
|
2
|
+
|
3
|
+
controller do
|
4
|
+
define_method :permitted_params do
|
5
|
+
params.to_hash
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
index do
|
10
|
+
column :human_name
|
11
|
+
column :container_description
|
12
|
+
actions
|
13
|
+
end
|
14
|
+
|
15
|
+
show do
|
16
|
+
h3 scribbler_group.human_name
|
17
|
+
scribbler_group.released_elements.each do |element|
|
18
|
+
panel element.human_name do
|
19
|
+
case element.element_type
|
20
|
+
when :row, :text
|
21
|
+
div do
|
22
|
+
element.content.html_safe
|
23
|
+
end
|
24
|
+
when :image
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
form partial: 'admin/scribbler_group_form'
|
31
|
+
|
32
|
+
end
|
data/lib/scribble_cms/engine.rb
CHANGED
@@ -14,6 +14,26 @@ module Scribbler
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
if defined?(ActiveAdmin)
|
18
|
+
initializer 'activeadmin.tinymce', :group => :all do |app|
|
19
|
+
js = ['ext/tinymce.min.js', 'scribbler.js']
|
20
|
+
css = ['ext/tinymce.skin.css', 'ext/tinymce.content.min.css']
|
21
|
+
|
22
|
+
app.config.assets.precompile += js
|
23
|
+
app.config.assets.precompile += css
|
24
|
+
|
25
|
+
ActiveAdmin.application.tap do |config|
|
26
|
+
js.each do |j|
|
27
|
+
config.register_javascript j
|
28
|
+
end
|
29
|
+
|
30
|
+
css.each do |s|
|
31
|
+
config.register_stylesheet s
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
17
37
|
end
|
18
38
|
end
|
19
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scribble_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.82'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Eck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: friendly_extensions
|
@@ -59,9 +59,22 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- app/assets/fonts/tinymce-small.eot
|
63
|
+
- app/assets/fonts/tinymce-small.json
|
64
|
+
- app/assets/fonts/tinymce-small.svg
|
65
|
+
- app/assets/fonts/tinymce-small.ttf
|
66
|
+
- app/assets/fonts/tinymce-small.woff
|
67
|
+
- app/assets/fonts/tinymce.eot
|
68
|
+
- app/assets/fonts/tinymce.json
|
69
|
+
- app/assets/fonts/tinymce.svg
|
70
|
+
- app/assets/fonts/tinymce.ttf
|
71
|
+
- app/assets/fonts/tinymce.woff
|
62
72
|
- app/assets/javascripts/ext/jquery.Jcrop.min.js
|
73
|
+
- app/assets/javascripts/ext/tinymce.min.js
|
63
74
|
- app/assets/javascripts/scribbler.js
|
64
75
|
- app/assets/stylesheets/ext/jquery.Jcrop.css
|
76
|
+
- app/assets/stylesheets/ext/tinymce.content.min.css
|
77
|
+
- app/assets/stylesheets/ext/tinymce.skin.scss
|
65
78
|
- app/assets/stylesheets/scribbler.css.erb
|
66
79
|
- app/assets/stylesheets/scribbler_layout.css.erb
|
67
80
|
- app/controller/scribbler_pictures_controller.rb
|
@@ -73,6 +86,7 @@ files:
|
|
73
86
|
- app/models/scribbler_link.rb
|
74
87
|
- app/models/scribbler_text.rb
|
75
88
|
- app/models/scribbler_var.rb
|
89
|
+
- app/views/admin/_scribbler_group_form.html.erb
|
76
90
|
- app/views/scribbler_admin/_scribbler_layout.html.erb
|
77
91
|
- app/views/scribbler_admin/_scribbler_sidebar.html.erb
|
78
92
|
- app/views/scribbler_admin/container_edit.html.erb
|
@@ -89,6 +103,7 @@ files:
|
|
89
103
|
- config/scribble_cms.rb
|
90
104
|
- db/migrate/001_create_scribblers.rb
|
91
105
|
- db/migrate/002_add_description_to_scribbler_containers.rb
|
106
|
+
- lib/admin/scribbler_groups.rb.template
|
92
107
|
- lib/scribble_cms.rb
|
93
108
|
- lib/scribble_cms/engine.rb
|
94
109
|
- lib/scribble_cms/scribbler_content_creator.rb
|