kuhsaft 0.3.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +127 -77
- data/Rakefile +15 -10
- data/app/assets/javascripts/kuhsaft/application.js +2 -0
- data/app/assets/javascripts/kuhsaft/cms/application.js +16 -4
- data/app/assets/javascripts/kuhsaft/cms/customizations.js +1 -0
- data/app/assets/stylesheets/kuhsaft/application.css.sass +4 -0
- data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +125 -0
- data/app/assets/stylesheets/kuhsaft/cms/customizations.css.sass +1 -0
- data/app/controllers/kuhsaft/application_controller.rb +5 -0
- data/app/controllers/kuhsaft/cms/admin_controller.rb +8 -10
- data/app/controllers/kuhsaft/cms/bricks_controller.rb +35 -0
- data/app/controllers/kuhsaft/cms/pages_controller.rb +16 -19
- data/app/controllers/kuhsaft/pages_controller.rb +4 -10
- data/app/helpers/cms_helper.rb +3 -3
- data/app/helpers/kuhsaft/application_helper.rb +21 -0
- data/app/helpers/kuhsaft/cms/application_helper.rb +10 -0
- data/app/helpers/kuhsaft/cms/pages_helper.rb +14 -0
- data/app/helpers/pages_helper.rb +18 -21
- data/app/models/kuhsaft/accordion_brick.rb +16 -0
- data/app/models/kuhsaft/accordion_item_brick.rb +22 -0
- data/app/models/kuhsaft/brick.rb +85 -0
- data/app/models/kuhsaft/brick_type.rb +7 -0
- data/app/models/kuhsaft/cms.rb +7 -0
- data/app/models/kuhsaft/cms/admin.rb +20 -0
- data/app/models/kuhsaft/column_brick.rb +23 -0
- data/app/models/kuhsaft/image_brick.rb +19 -0
- data/app/models/kuhsaft/image_size.rb +52 -0
- data/app/models/kuhsaft/link_brick.rb +19 -0
- data/app/models/kuhsaft/page.rb +83 -101
- data/app/models/kuhsaft/partition.rb +18 -0
- data/app/models/kuhsaft/placeholder_brick.rb +11 -0
- data/app/models/kuhsaft/slider_brick.rb +16 -0
- data/app/models/kuhsaft/text_brick.rb +9 -0
- data/app/models/kuhsaft/two_column_brick.rb +50 -0
- data/app/models/kuhsaft/video_brick.rb +20 -0
- data/app/uploaders/kuhsaft/asset_uploader.rb +2 -2
- data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +63 -0
- data/app/views/kuhsaft/accordion_bricks/_accordion_brick.html.haml +3 -0
- data/app/{assets/stylesheets/kuhsaft/cms/base/partials/_forms.css.sass → views/kuhsaft/accordion_bricks/accordion_brick/_edit.html.haml} +0 -0
- data/app/views/kuhsaft/accordion_item_bricks/_accordion_item_brick.html.haml +8 -0
- data/app/views/kuhsaft/accordion_item_bricks/accordion_item_brick/_edit.html.haml +1 -0
- data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +10 -0
- data/app/views/kuhsaft/cms/admin/_content_language_switch.html.haml +7 -0
- data/app/views/kuhsaft/cms/admin/_empty_state.html.haml +5 -0
- data/app/views/kuhsaft/cms/admin/_main_navigation.html.haml +6 -0
- data/app/views/kuhsaft/cms/assets/index.html.haml +2 -2
- data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +38 -0
- data/app/views/kuhsaft/cms/bricks/_brick_list.html.haml +4 -0
- data/app/views/kuhsaft/cms/bricks/create.js.haml +1 -0
- data/app/views/kuhsaft/cms/bricks/destroy.js.haml +7 -0
- data/app/views/kuhsaft/cms/bricks/update.js.haml +2 -0
- data/app/views/kuhsaft/cms/pages/_branch.html.haml +17 -9
- data/app/views/kuhsaft/cms/pages/_form.html.haml +25 -60
- data/app/views/kuhsaft/cms/pages/edit.html.haml +14 -8
- data/app/views/kuhsaft/cms/pages/index.html.haml +8 -8
- data/app/views/kuhsaft/cms/pages/new.html.haml +1 -10
- data/app/views/kuhsaft/column_bricks/_column_brick.html.haml +3 -0
- data/app/views/kuhsaft/{cms/page_parts/edit.html.haml → column_bricks/column_brick/_edit.html.haml} +0 -0
- data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -0
- data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +10 -0
- data/app/views/kuhsaft/link_bricks/_link_brick.html.haml +3 -0
- data/app/views/kuhsaft/link_bricks/link_brick/_edit.html.haml +3 -0
- data/app/views/kuhsaft/pages/show.html.haml +5 -3
- data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +2 -0
- data/app/views/kuhsaft/placeholder_bricks/placeholder_brick/_edit.html.haml +1 -0
- data/app/views/kuhsaft/slider_bricks/_slider_brick.html.haml +10 -0
- data/app/views/kuhsaft/{cms/page_parts/index.html.haml → slider_bricks/slider_brick/_edit.html.haml} +0 -0
- data/app/views/kuhsaft/text_bricks/_text_brick.html.haml +12 -0
- data/app/views/kuhsaft/text_bricks/text_brick/_edit.html.haml +2 -0
- data/app/views/kuhsaft/two_column_bricks/_two_column_brick.html.haml +3 -0
- data/app/views/kuhsaft/two_column_bricks/two_column_brick/_childs.html.haml +5 -0
- data/app/views/kuhsaft/two_column_bricks/two_column_brick/_edit.html.haml +1 -0
- data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +9 -0
- data/app/views/kuhsaft/video_bricks/video_brick/_edit.html.haml +8 -0
- data/app/views/layouts/kuhsaft/cms/application.html.haml +20 -0
- data/config/initializers/devise.rb +231 -0
- data/config/initializers/simple_form.rb +142 -0
- data/config/initializers/simple_form_bootstrap.rb +45 -0
- data/config/locales/kuhsaft.en.yml +4 -1
- data/config/locales/models/kuhsaft/accordion_brick/de.yml +4 -0
- data/config/locales/models/kuhsaft/accordion_item_brick/de.yml +7 -0
- data/config/locales/models/kuhsaft/column_brick/de.yml +6 -0
- data/config/locales/models/kuhsaft/image_brick/de.yml +10 -0
- data/config/locales/models/kuhsaft/image_size/de.yml +13 -0
- data/config/locales/models/kuhsaft/link_brick/de.yml +9 -0
- data/config/locales/models/kuhsaft/page/de.yml +17 -0
- data/config/locales/models/kuhsaft/placeholder_brick/de.yml +8 -0
- data/config/locales/models/kuhsaft/slider_brick/de.yml +4 -0
- data/config/locales/models/kuhsaft/text_brick/de.yml +8 -0
- data/config/locales/models/kuhsaft/two_column_brick/de.yml +7 -0
- data/config/locales/models/kuhsaft/video_brick/de.yml +9 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/views/kuhsaft/cms/admin/de.yml +10 -0
- data/config/locales/views/kuhsaft/cms/bricks/de.yml +8 -0
- data/config/locales/views/kuhsaft/cms/pages/de.yml +9 -0
- data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +7 -0
- data/config/locales/views/kuhsaft/text_brick/de.yml +6 -0
- data/config/locales/views/layouts/de.yml +6 -0
- data/config/routes.rb +10 -11
- data/db/migrate/01_create_kuhsaft_pages.rb +31 -0
- data/db/migrate/02_create_kuhsaft_bricks.rb +23 -0
- data/db/migrate/03_create_kuhsaft_brick_types.rb +12 -0
- data/db/migrate/04_create_kuhsaft_assets.rb +10 -0
- data/db/migrate/05_create_kuhsaft_cms_admins.rb +46 -0
- data/db/migrate/06_add_template_name_to_kuhsaft_bricks.rb +7 -0
- data/db/seeds.rb +14 -0
- data/lib/generators/kuhsaft/translations/add_generator.rb +26 -0
- data/lib/kuhsaft.rb +8 -1
- data/lib/kuhsaft/brick_list.rb +71 -0
- data/lib/kuhsaft/engine.rb +17 -12
- data/lib/kuhsaft/partial_extractor.rb +21 -0
- data/lib/kuhsaft/translatable.rb +40 -0
- data/lib/kuhsaft/version.rb +1 -1
- data/lib/tasks/kuhsaft_tasks.rake +10 -0
- data/lib/templates/kuhsaft/translations/add_translation.html.erb +13 -0
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +9 -3
- data/spec/dummy/app/assets/stylesheets/application.css +11 -5
- data/spec/dummy/app/controllers/application_controller.rb +0 -6
- data/spec/dummy/app/views/layouts/application.html.erb +1 -1
- data/spec/dummy/config/application.rb +24 -7
- data/spec/dummy/config/boot.rb +3 -2
- data/spec/dummy/config/database.yml +6 -3
- data/spec/dummy/config/environments/development.rb +8 -1
- data/spec/dummy/config/environments/production.rb +9 -2
- data/spec/dummy/config/environments/test.rb +4 -9
- data/spec/dummy/config/initializers/inflections.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/spec/dummy/config/locales/en.yml +2 -2
- data/spec/dummy/config/routes.rb +2 -57
- data/spec/dummy/db/{migrate/.gitkeep → .gitkeep} +0 -0
- data/spec/dummy/public/500.html +0 -1
- data/spec/dummy/{lib/tasks → public/stylesheets}/.gitkeep +0 -0
- data/spec/factories.rb +11 -17
- data/spec/features/cms_auth_spec.rb +9 -0
- data/spec/features/cms_pages_spec.rb +23 -0
- data/spec/helpers/kuhsaft/cms/application_helper_spec.rb +25 -0
- data/spec/lib/brick_list_spec.rb +39 -0
- data/spec/lib/engine_spec.rb +25 -0
- data/spec/lib/translatable_spec.rb +85 -0
- data/spec/models/accordion_brick_spec.rb +32 -0
- data/spec/models/accordion_item_brick_spec.rb +50 -0
- data/spec/models/asset_spec.rb +25 -23
- data/spec/models/brick_spec.rb +110 -0
- data/spec/models/cms/admin_spec.rb +26 -0
- data/spec/models/column_brick_spec.rb +32 -0
- data/spec/models/image_brick_spec.rb +36 -0
- data/spec/models/image_size_spec.rb +36 -0
- data/spec/models/link_brick_spec.rb +45 -0
- data/spec/models/page_spec.rb +262 -281
- data/spec/models/placeholder_brick_spec.rb +40 -0
- data/spec/models/slider_brick_spec.rb +20 -0
- data/spec/models/text_brick_spec.rb +14 -0
- data/spec/models/two_column_brick_spec.rb +72 -0
- data/spec/models/video_brick_spec.rb +26 -0
- data/spec/spec_helper.rb +60 -51
- data/spec/support/kuhsaft_spec_helper.rb +4 -28
- data/spec/support/request_macros.rb +19 -0
- data/vendor/assets/javascripts/redactor.min.js +12 -0
- data/vendor/assets/stylesheets/redactor.css +692 -0
- metadata +402 -346
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.rvmrc +0 -47
- data/CHANGELOG.md +0 -81
- data/Gemfile +0 -2
- data/Guardfile +0 -25
- data/LICENSE +0 -7
- data/app/assets/images/kuhsaft/add-child-page.png +0 -0
- data/app/assets/images/kuhsaft/closedhand.cur +0 -0
- data/app/assets/images/kuhsaft/delete.png +0 -0
- data/app/assets/images/kuhsaft/header-bg.jpg +0 -0
- data/app/assets/images/kuhsaft/module-nav-tab-bg.png +0 -0
- data/app/assets/images/kuhsaft/openhand.cur +0 -0
- data/app/assets/images/kuhsaft/page-edit-icon.png +0 -0
- data/app/assets/images/kuhsaft/page-new-icon.png +0 -0
- data/app/assets/images/kuhsaft/page-part-draggable-area.png +0 -0
- data/app/assets/images/kuhsaft/page-tree-breadcrumb-arrow.png +0 -0
- data/app/assets/images/kuhsaft/pages-breadcrumb-icon.png +0 -0
- data/app/assets/images/kuhsaft/tab-bg.png +0 -0
- data/app/assets/images/kuhsaft/toggle-arrow-closed.png +0 -0
- data/app/assets/images/kuhsaft/toggle-arrow-open.png +0 -0
- data/app/assets/images/kuhsaft/wrapper-bg.png +0 -0
- data/app/assets/javascripts/kuhsaft/cms/backend.js +0 -34
- data/app/assets/javascripts/kuhsaft/cms/jquery-ui-1.8.12.custom.min.js +0 -192
- data/app/assets/javascripts/kuhsaft/cms/jquery.elastic.source.js +0 -161
- data/app/assets/javascripts/kuhsaft/cms/jquery.min.js +0 -18
- data/app/assets/javascripts/kuhsaft/cms/jquery_ujs.js +0 -336
- data/app/assets/stylesheets/kuhsaft/cms/application.css +0 -6
- data/app/assets/stylesheets/kuhsaft/cms/base/base.css.sass +0 -9
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_assets.css.sass +0 -15
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_buttons.css.sass +0 -34
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_generic.css.sass +0 -342
- data/app/assets/stylesheets/kuhsaft/cms/base/partials/_simple_form.css.sass +0 -76
- data/app/controllers/kuhsaft/cms/page_parts_controller.rb +0 -34
- data/app/models/kuhsaft/localized_page.rb +0 -81
- data/app/models/kuhsaft/page_part.rb +0 -12
- data/app/models/kuhsaft/page_part/content.rb +0 -76
- data/app/models/kuhsaft/page_part/markdown.rb +0 -8
- data/app/views/kuhsaft/cms/page_parts/destroy.js.haml +0 -1
- data/app/views/kuhsaft/cms/page_parts/new.html.haml +0 -0
- data/app/views/kuhsaft/cms/page_parts/show.html.haml +0 -0
- data/app/views/kuhsaft/cms/page_parts/update.js.haml +0 -0
- data/app/views/kuhsaft/page_part/markdowns/_edit_markdown.html.haml +0 -1
- data/app/views/kuhsaft/page_part/markdowns/_show_markdown.html.haml +0 -1
- data/app/views/kuhsaft/pages/index.html.haml +0 -0
- data/app/views/layouts/kuhsaft/admin.html.haml +0 -35
- data/config/initializers/generators.rb +0 -7
- data/config/initializers/page_parts.rb +0 -17
- data/kuhsaft.gemspec +0 -39
- data/lib/generators/kuhsaft/install/assets_generator.rb +0 -12
- data/lib/generators/kuhsaft/install/migrations_generator.rb +0 -43
- data/lib/templates/kuhsaft/install/acts_as_taggable_on_migration.rb +0 -37
- data/lib/templates/kuhsaft/install/add_fulltext_to_localized_page.rb +0 -9
- data/lib/templates/kuhsaft/install/add_page_type_to_localized_pages.rb +0 -9
- data/lib/templates/kuhsaft/install/add_published_at_to_localized_pages.rb +0 -9
- data/lib/templates/kuhsaft/install/add_tags_to_page_part_contents.rb +0 -9
- data/lib/templates/kuhsaft/install/add_type_to_page_part_contents.rb +0 -9
- data/lib/templates/kuhsaft/install/add_url_to_localized_pages.rb +0 -9
- data/lib/templates/kuhsaft/install/create_assets.rb +0 -12
- data/lib/templates/kuhsaft/install/create_kuhsaft_localized_pages.rb +0 -19
- data/lib/templates/kuhsaft/install/create_kuhsaft_pages.rb +0 -14
- data/lib/templates/kuhsaft/install/create_page_part_contents.rb +0 -14
- data/spec/controllers/cms_assets_controller_spec.rb +0 -26
- data/spec/controllers/cms_pages_controller_spec.rb +0 -65
- data/spec/controllers/page_parts_controller_spec.rb +0 -60
- data/spec/controllers/pages_controller_spec.rb +0 -30
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/helpers/cms_helper_spec.rb +0 -22
- data/spec/helpers/pages_helper_spec.rb +0 -119
- data/spec/integration/navigation_spec.rb +0 -9
- data/spec/models/localized_page_spec.rb +0 -266
- data/spec/models/page_part_content_spec.rb +0 -95
- data/spec/models/page_part_spec.rb +0 -17
- data/spec/requests/cms_pages_spec.rb +0 -27
- data/spec/routing/assets_routing_spec.rb +0 -63
- data/spec/routing/page_part_routing_spec.rb +0 -70
- data/spec/routing/pages_routing_spec.rb +0 -74
@@ -1,34 +0,0 @@
|
|
1
|
-
module Kuhsaft
|
2
|
-
module Cms
|
3
|
-
class PagePartsController < AdminController
|
4
|
-
|
5
|
-
def index
|
6
|
-
end
|
7
|
-
|
8
|
-
def show
|
9
|
-
end
|
10
|
-
|
11
|
-
def new
|
12
|
-
end
|
13
|
-
|
14
|
-
def create
|
15
|
-
end
|
16
|
-
|
17
|
-
def edit
|
18
|
-
end
|
19
|
-
|
20
|
-
def update
|
21
|
-
if @page_part = Kuhsaft::PagePart::Content.find(params[:id])
|
22
|
-
@page_part.reposition params[:reposition] if params[:reposition].present? || params.key?(:reposition)
|
23
|
-
end
|
24
|
-
render 'update'
|
25
|
-
end
|
26
|
-
|
27
|
-
def destroy
|
28
|
-
@page_part = Kuhsaft::PagePart::Content.find(params[:id])
|
29
|
-
@page_part.destroy
|
30
|
-
render 'destroy'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
class Kuhsaft::LocalizedPage < ActiveRecord::Base
|
2
|
-
belongs_to :page
|
3
|
-
has_many :page_parts, :class_name => 'Kuhsaft::PagePart::Content', :autosave => true
|
4
|
-
|
5
|
-
scope :current_locale, lambda{ where('locale = ?', Kuhsaft::Page.current_translation_locale) }
|
6
|
-
|
7
|
-
scope :published, lambda{
|
8
|
-
where('published = ? OR published_at < ? AND published = ?',
|
9
|
-
Kuhsaft::PublishState::PUBLISHED,
|
10
|
-
DateTime.now,
|
11
|
-
Kuhsaft::PublishState::PUBLISHED_AT
|
12
|
-
)
|
13
|
-
}
|
14
|
-
|
15
|
-
scope :search, lambda{ |term| current_locale.published.where('`fulltext` LIKE ?', "%#{term}%") }
|
16
|
-
scope :navigation, lambda{ |slug|
|
17
|
-
current_locale.published.where('slug = ?', slug).where('page_type = ?', Kuhsaft::PageType::NAVIGATION)
|
18
|
-
}
|
19
|
-
|
20
|
-
before_validation :create_slug, :create_url, :collect_fulltext
|
21
|
-
delegate :childs, :to => :page
|
22
|
-
|
23
|
-
validates :title, :presence => true
|
24
|
-
validates :locale, :presence => true
|
25
|
-
validates :slug, :presence => true
|
26
|
-
validates :url, :uniqueness => true, :unless => :navigation?
|
27
|
-
|
28
|
-
accepts_nested_attributes_for :page_parts, :allow_destroy => true
|
29
|
-
|
30
|
-
def published?
|
31
|
-
return true if published == Kuhsaft::PublishState::PUBLISHED
|
32
|
-
return false if published == Kuhsaft::PublishState::UNPUBLISHED
|
33
|
-
if published == Kuhsaft::PublishState::PUBLISHED_AT
|
34
|
-
return false if published_at.blank?
|
35
|
-
published_at < DateTime.now
|
36
|
-
else
|
37
|
-
false
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def locale
|
42
|
-
read_attribute(:locale).to_sym unless read_attribute(:locale).nil?
|
43
|
-
end
|
44
|
-
|
45
|
-
def redirect?
|
46
|
-
page_type == Kuhsaft::PageType::REDIRECT
|
47
|
-
end
|
48
|
-
|
49
|
-
def navigation?
|
50
|
-
page_type == Kuhsaft::PageType::NAVIGATION
|
51
|
-
end
|
52
|
-
|
53
|
-
def create_url
|
54
|
-
return if redirect?
|
55
|
-
|
56
|
-
complete_slug = ''
|
57
|
-
if page.present? && page.parent.present?
|
58
|
-
complete_slug << page.parent.url.to_s
|
59
|
-
else
|
60
|
-
complete_slug = "#{self.locale}"
|
61
|
-
end
|
62
|
-
complete_slug << "/#{self.slug}" unless navigation?
|
63
|
-
self.url = complete_slug
|
64
|
-
end
|
65
|
-
|
66
|
-
def create_slug
|
67
|
-
has_slug = title.present? && slug.blank?
|
68
|
-
write_attribute(:slug, read_attribute(:title).downcase.parameterize) if has_slug
|
69
|
-
end
|
70
|
-
|
71
|
-
def collect_fulltext
|
72
|
-
self.fulltext = page_parts.inject('') do |text, page_part|
|
73
|
-
page_part.class.searchable_attributes.each do |attr|
|
74
|
-
text << ' '
|
75
|
-
text << page_part.send(attr).to_s
|
76
|
-
end
|
77
|
-
text
|
78
|
-
end
|
79
|
-
self.fulltext << [title.to_s, keywords.to_s, description.to_s].join(' ')
|
80
|
-
end
|
81
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
module Kuhsaft
|
2
|
-
module PagePart
|
3
|
-
class Content < ActiveRecord::Base
|
4
|
-
include Kuhsaft::Orderable
|
5
|
-
|
6
|
-
belongs_to :localized_page
|
7
|
-
serialize :content
|
8
|
-
acts_as_taggable
|
9
|
-
default_scope order('position ASC')
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def serialize_attr name
|
13
|
-
name = name.to_sym
|
14
|
-
serializeable_attributes << name
|
15
|
-
|
16
|
-
define_method name do
|
17
|
-
self.content ||= {}
|
18
|
-
self.content[name].presence
|
19
|
-
end
|
20
|
-
|
21
|
-
define_method "#{name}=" do |val|
|
22
|
-
self.content_will_change!
|
23
|
-
self.content ||= {}
|
24
|
-
self.content[name] = val
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def searchable_attr name
|
29
|
-
name = name.to_sym
|
30
|
-
searchable_attributes << name
|
31
|
-
end
|
32
|
-
|
33
|
-
def searchable_attributes
|
34
|
-
@searchable_attributes ||= []
|
35
|
-
end
|
36
|
-
|
37
|
-
def serializeable_attributes
|
38
|
-
@serializeable_attributes ||= []
|
39
|
-
end
|
40
|
-
|
41
|
-
def page_part_types
|
42
|
-
descendants
|
43
|
-
end
|
44
|
-
|
45
|
-
def to_name
|
46
|
-
I18n.translate self.to_s.underscore.gsub('/', '.').downcase
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def edit_partial_path
|
51
|
-
path = self.class.model_name.partial_path.split '/'
|
52
|
-
path << "edit_#{path.pop}"
|
53
|
-
path.join '/'
|
54
|
-
#self.class.model_name.partial_path
|
55
|
-
end
|
56
|
-
|
57
|
-
def siblings
|
58
|
-
self.localized_page.page_parts.where('id !=?', self.id) if self.localized_page.present?
|
59
|
-
end
|
60
|
-
|
61
|
-
def show_partial_path
|
62
|
-
path = self.class.model_name.partial_path.split '/'
|
63
|
-
path << "show_#{path.pop}"
|
64
|
-
path.join '/'
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
#
|
69
|
-
# OMFG, OMFG!!! http://stackoverflow.com/questions/5178204/what-is-a-better-way-to-create-sti-model-instance
|
70
|
-
#
|
71
|
-
def atributes_protected_by_default
|
72
|
-
super - [self.class.inheritance_column]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
$(".page-part[data-id='#{@page_part.id}']").css({border: '2px solid red'}).fadeOut(1200, function(){ $(this).remove() })
|
File without changes
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
= input_form.input :text, :as => :text, :input_html => { :class => :small }
|
@@ -1 +0,0 @@
|
|
1
|
-
!= render_markdown(page_part.text)
|
File without changes
|
@@ -1,35 +0,0 @@
|
|
1
|
-
!!!
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
= stylesheet_link_tag 'kuhsaft/cms/application.css', :media => 'screen, projection'
|
5
|
-
= javascript_include_tag 'kuhsaft/cms/application.js'
|
6
|
-
= csrf_meta_tag
|
7
|
-
%body{ :class => "#{controller_name}" }
|
8
|
-
#kuhsaft-wrapper
|
9
|
-
.cms-header
|
10
|
-
.container
|
11
|
-
.meta-actions
|
12
|
-
%a.micro-button{ :href => '/', :target => '_blank' }
|
13
|
-
View Site
|
14
|
-
.logout-box
|
15
|
-
- if respond_to?(:destroy_user_session_path)
|
16
|
-
= current_user.first_name
|
17
|
-
= current_user.last_name
|
18
|
-
= link_to '(logout)', destroy_user_session_path, :class => 'logout micro-logout'
|
19
|
-
.cms-content-container
|
20
|
-
%ul.cms-module-nav
|
21
|
-
= admin_tab(t('.pages_nav'), cms_pages_path)
|
22
|
-
= admin_tab(t('.assets_nav'), cms_assets_path)
|
23
|
-
= render :partial => 'cms/admin_navigation' rescue ''
|
24
|
-
.clear
|
25
|
-
%ul.language-tabs
|
26
|
-
= yield :cms_language_tabs
|
27
|
-
.clear
|
28
|
-
.toolbar
|
29
|
-
= yield :admin_toolbar
|
30
|
-
.clear
|
31
|
-
.cms-content
|
32
|
-
= yield :before_admin_content
|
33
|
-
= yield
|
34
|
-
= yield :after_admin_content
|
35
|
-
= yield :scripts
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Dir.glob("#{Kuhsaft::Engine.root}/app/models/kuhsaft/page_part/*.rb").sort.each { |file| require file }
|
2
|
-
|
3
|
-
# https://rails.lighthouseapp.com/projects/8994/tickets/6306-collection-associations-build-method-not-supported-for-sti
|
4
|
-
# updated: https://github.com/rails/rails/issues/815
|
5
|
-
|
6
|
-
class ActiveRecord::Reflection::AssociationReflection
|
7
|
-
def build_association(*opts)
|
8
|
-
col = klass.inheritance_column.to_sym
|
9
|
-
if (h = opts.first).is_a? Hash and (type = h.symbolize_keys[col]) and type.to_s.constantize.class == Class
|
10
|
-
opts.first[col].to_s.constantize.new(*opts)
|
11
|
-
elsif klass.abstract_class?
|
12
|
-
raise "#{klass.to_s} is an abstract class and can not be directly instantiated"
|
13
|
-
else
|
14
|
-
klass.new(*opts)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/kuhsaft.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "kuhsaft/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "kuhsaft"
|
7
|
-
s.version = Kuhsaft::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Immanuel Häussermann", "Felipe Kaufmann", "Phil Schilter"]
|
10
|
-
s.email = "developers@screenconcept.ch"
|
11
|
-
s.homepage = "http://github.com/screenconcept/kuhsaft"
|
12
|
-
s.summary = %q{A tool that helps you to manage your content within your app.}
|
13
|
-
s.description = %q{Kuhsaft is a Rails engine that offers a simple CMS.}
|
14
|
-
|
15
|
-
s.rubyforge_project = "kuhsaft"
|
16
|
-
|
17
|
-
s.files = `git ls-files`.split("\n")
|
18
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
-
s.require_paths = ["lib"]
|
21
|
-
|
22
|
-
s.add_development_dependency 'rspec-rails', '>= 2.6'
|
23
|
-
s.add_development_dependency 'factory_girl_rails', '1.7.0'
|
24
|
-
s.add_development_dependency 'capybara', '>= 0.4.0'
|
25
|
-
s.add_development_dependency 'sqlite3'
|
26
|
-
s.add_development_dependency 'guard', '>= 0.6'
|
27
|
-
s.add_development_dependency 'guard-spork'
|
28
|
-
s.add_development_dependency 'guard-rspec'
|
29
|
-
s.add_development_dependency 'growl'
|
30
|
-
|
31
|
-
s.add_dependency 'rails', '~>3.1'
|
32
|
-
s.add_dependency 'haml', '~> 3.1'
|
33
|
-
s.add_dependency 'compass', '>= 0.11.1'
|
34
|
-
s.add_dependency 'simple_form', '>= 1.4'
|
35
|
-
s.add_dependency 'carrierwave', '>= 0.5.7'
|
36
|
-
s.add_dependency 'rmagick', '2.12.2'
|
37
|
-
s.add_dependency 'rdiscount', '>= 1.6'
|
38
|
-
s.add_dependency 'acts-as-taggable-on', '>= 2.0.6'
|
39
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
require 'rails/generators/migration'
|
3
|
-
require 'rails/generators/active_record'
|
4
|
-
|
5
|
-
module Kuhsaft
|
6
|
-
module Install
|
7
|
-
class Migrations < Rails::Generators::Base
|
8
|
-
include Rails::Generators::Migration
|
9
|
-
|
10
|
-
source_root(File.join(Kuhsaft::Engine.root, '/lib/templates/kuhsaft/install'))
|
11
|
-
|
12
|
-
def self.next_migration_number(dirname)
|
13
|
-
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
14
|
-
end
|
15
|
-
|
16
|
-
def create_migration_file
|
17
|
-
install_migration_once 'create_kuhsaft_pages.rb'
|
18
|
-
install_migration_once 'create_kuhsaft_localized_pages.rb'
|
19
|
-
install_migration_once 'create_page_part_contents.rb'
|
20
|
-
install_migration_once 'create_assets.rb'
|
21
|
-
install_migration_once 'add_url_to_localized_pages.rb'
|
22
|
-
install_migration_once 'add_type_to_page_part_contents.rb'
|
23
|
-
install_migration_once 'add_fulltext_to_localized_page.rb'
|
24
|
-
install_migration_once 'add_page_type_to_localized_pages.rb'
|
25
|
-
install_migration_once 'add_published_at_to_localized_pages.rb'
|
26
|
-
install_migration_once 'add_tags_to_page_part_contents.rb'
|
27
|
-
install_migration_once 'acts_as_taggable_on_migration.rb'
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
def install_migration_once file
|
32
|
-
end_path = File.join(Rails.root, 'db/migrate/')
|
33
|
-
end_file = File.join(end_path, file)
|
34
|
-
installed = Dir[File.join(end_path, '*.rb')].map(&:to_s).select { |f| f.include?(file) }.length > 0
|
35
|
-
if installed
|
36
|
-
log "The migration '#{file}' is already installed in '#{end_path}'"
|
37
|
-
else
|
38
|
-
migration_template(file, end_file)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
|
4
|
-
rename_column :contents, :tags, :old_tags
|
5
|
-
|
6
|
-
create_table :tags do |t|
|
7
|
-
t.string :name
|
8
|
-
end
|
9
|
-
|
10
|
-
create_table :taggings do |t|
|
11
|
-
t.references :tag
|
12
|
-
|
13
|
-
# You should make sure that the column created is
|
14
|
-
# long enough to store the required class names.
|
15
|
-
t.references :taggable, :polymorphic => true
|
16
|
-
t.references :tagger, :polymorphic => true
|
17
|
-
|
18
|
-
t.string :context
|
19
|
-
|
20
|
-
t.datetime :created_at
|
21
|
-
end
|
22
|
-
|
23
|
-
add_index :taggings, :tag_id
|
24
|
-
add_index :taggings, [:taggable_id, :taggable_type, :context]
|
25
|
-
|
26
|
-
Kuhsaft::PagePart::Content.all.each do |c|
|
27
|
-
c.tag_list = c.old_tags.gsub(' ', ', ') unless c.old_tags.blank?
|
28
|
-
end
|
29
|
-
|
30
|
-
remove_column(:contents, :old_tags)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.down
|
34
|
-
drop_table :taggings
|
35
|
-
drop_table :tags
|
36
|
-
end
|
37
|
-
end
|