home_page 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/home_page/application.js +8 -1
- data/app/assets/javascripts/home_page/base.js.coffee.erb +44 -0
- data/app/assets/javascripts/home_page/lib/jquery.multisortable.js +254 -0
- data/app/assets/javascripts/home_page/page_module_collections/index.js.coffee +14 -0
- data/app/assets/javascripts/home_page/shared/sortable_list.js.coffee +44 -0
- data/app/assets/stylesheets/home_page/application.css +4 -0
- data/app/assets/stylesheets/home_page/bootswatch.css.less +4 -0
- data/app/assets/stylesheets/vendors/keen/dashboards.css +59 -0
- data/app/controllers/home_page/application_controller.rb +24 -0
- data/app/controllers/page_module_collections_controller.rb +96 -0
- data/app/controllers/page_module_collections_modules_controller.rb +43 -0
- data/app/controllers/page_modules_controller.rb +121 -0
- data/app/controllers/settings_controller.rb +30 -0
- data/app/controllers/users_controller.rb +7 -3
- data/app/helpers/home_page/application_helper.rb +22 -0
- data/app/helpers/home_page/form_helper.rb +23 -0
- data/app/helpers/home_page/show_helper.rb +67 -0
- data/app/models/page_module.rb +78 -0
- data/app/models/page_module_collection.rb +24 -0
- data/app/models/page_module_collection_module.rb +8 -0
- data/app/models/setting.rb +26 -0
- data/app/views/apis/volontariat/_settings.html.erb +5 -0
- data/app/views/layouts/application.html.erb +2 -1
- data/app/views/layouts/fluid/without_rows.html.erb +17 -0
- data/app/views/layouts/shared/_foot.html.erb +9 -1
- data/app/views/layouts/shared/_modal.html.erb +16 -0
- data/app/views/page_module_collections/_collection.html.erb +18 -0
- data/app/views/page_module_collections/_form.html.erb +29 -0
- data/app/views/page_module_collections/_page_module.html.erb +27 -0
- data/app/views/page_module_collections/_page_module_collection.html.erb +41 -0
- data/app/views/page_module_collections/destroy.js.erb +9 -0
- data/app/views/page_module_collections/edit.html.erb +3 -0
- data/app/views/page_module_collections/index.html.erb +67 -0
- data/app/views/page_module_collections/new.html.erb +3 -0
- data/app/views/page_module_collections/show.html.erb +44 -0
- data/app/views/page_module_collections/update.js.erb +11 -0
- data/app/views/page_module_collections_modules/_fields.html.erb +10 -0
- data/app/views/page_module_collections_modules/create.js.erb +8 -0
- data/app/views/page_module_collections_modules/destroy.js.erb +9 -0
- data/app/views/page_module_collections_modules/new.html.erb +27 -0
- data/app/views/page_modules/_actions.html.erb +26 -0
- data/app/views/page_modules/_collection.html.erb +19 -0
- data/app/views/page_modules/_fields.html.erb +52 -0
- data/app/views/page_modules/_form.html.erb +25 -0
- data/app/views/page_modules/_page_module.html.erb +14 -0
- data/app/views/page_modules/_tab.html.erb +39 -0
- data/app/views/page_modules/destroy.js.erb +9 -0
- data/app/views/page_modules/edit.html.erb +3 -0
- data/app/views/page_modules/new.html.erb +3 -0
- data/app/views/page_modules/update.js.erb +11 -0
- data/app/views/settings/_apis.html.erb +20 -0
- data/app/views/settings/index.html.erb +13 -0
- data/app/views/settings/plugins/home_page/_panel.html.erb +42 -0
- data/app/views/settings/plugins/home_page/tabs/_apis.html.erb +24 -0
- data/app/views/shared/_javascript_response.js.erb +50 -0
- data/app/views/shared/layouts/_modal.html.erb +14 -0
- data/app/views/users/index.html.erb +5 -1
- data/app/views/users/show.html.erb +5 -0
- data/config/initializers/default_settings.rb +8 -0
- data/config/locales/general/en.yml +33 -2
- data/config/locales/resources/page_module/en.yml +34 -0
- data/config/locales/resources/page_module_collection/en.yml +21 -0
- data/config/locales/resources/setting/en.yml +26 -0
- data/config/routes.rb +18 -1
- data/db/migrate/20150307193102_create_friendly_id_slugs.rb +3 -3
- data/db/migrate/20150313154924_create_settings.rb +17 -0
- data/db/migrate/20150315082328_create_page_modules_and_page_module_collections.rb +43 -0
- data/lib/home_page.rb +9 -0
- data/lib/home_page/api_provider_host.rb +54 -0
- data/lib/home_page/engine.rb +1 -0
- data/lib/home_page/navigation.rb +62 -21
- data/lib/home_page/pagination_metadata.rb +1 -2
- data/lib/home_page/simple_navigation_renderer/breadcrumbs_without_method_links.rb +6 -2
- data/lib/home_page/version.rb +1 -1
- metadata +242 -50
- data/README.rdoc +0 -3
- data/config/initializers/volontariat.rb +0 -3
@@ -0,0 +1,78 @@
|
|
1
|
+
class PageModule < ActiveRecord::Base
|
2
|
+
has_many :page_module_collection_modules, dependent: :destroy, foreign_key: 'module_id'
|
3
|
+
has_many :collections, class_name: 'PageModuleCollection', through: :page_module_collection_modules
|
4
|
+
|
5
|
+
scope :by_collection_slug, ->(slug) do
|
6
|
+
PageModuleCollection.friendly.find(slug).modules.published_now.
|
7
|
+
order('page_module_collections_modules.position ASC')
|
8
|
+
end
|
9
|
+
|
10
|
+
scope :published_now, -> do
|
11
|
+
now = Time.now
|
12
|
+
where(
|
13
|
+
'(page_modules.published_from IS NULL or page_modules.published_from <= :time) AND (page_modules.published_until IS NULL or page_modules.published_until >= :time)',
|
14
|
+
time: now
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
serialize :data, Hash
|
19
|
+
|
20
|
+
validates :title, presence: true, uniqueness: true
|
21
|
+
|
22
|
+
validate :either_partial_path_or_content_present
|
23
|
+
validate :valid_liquid_syntax, if: 'content.present?'
|
24
|
+
|
25
|
+
attr_accessible :title, :description, :plugin, :partial_path, :content, :data, :moduleable_type, :moduleable_id, :published_from, :published_until
|
26
|
+
|
27
|
+
attr_accessor :collection_id
|
28
|
+
attr_writer :plugin
|
29
|
+
|
30
|
+
extend FriendlyId
|
31
|
+
|
32
|
+
friendly_id :title, use: :slugged
|
33
|
+
|
34
|
+
before_save :set_slug_stub
|
35
|
+
|
36
|
+
def plugin
|
37
|
+
return @plugin if @plugin.present?
|
38
|
+
|
39
|
+
if slug_stub.present? && Setting['home_page.general.plugins'].include?("home_page_#{slug_stub}") || slug_stub == 'home'
|
40
|
+
slug_stub
|
41
|
+
else
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def either_partial_path_or_content_present
|
49
|
+
if partial_path.blank? && content.blank?
|
50
|
+
errors.add(
|
51
|
+
:base,
|
52
|
+
I18n.t(
|
53
|
+
'activerecord.errors.models.page_module.attributes.base.either_partial_path_or_content_must_be_present'
|
54
|
+
)
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def valid_liquid_syntax
|
60
|
+
Liquid::Template.parse(content)
|
61
|
+
rescue Liquid::SyntaxError => e
|
62
|
+
errors.add(
|
63
|
+
:content,
|
64
|
+
I18n.t(
|
65
|
+
'activerecord.errors.models.page_module.attributes.content.liquid_syntax_invalid',
|
66
|
+
message: e.message
|
67
|
+
)
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def set_slug_stub
|
72
|
+
self.slug_stub = slug.split('-').first
|
73
|
+
end
|
74
|
+
|
75
|
+
def should_generate_new_friendly_id?
|
76
|
+
title_changed?
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class PageModuleCollection < ActiveRecord::Base
|
2
|
+
has_many :page_module_collection_modules, dependent: :destroy, foreign_key: 'collection_id'
|
3
|
+
has_many :modules, class_name: 'PageModule', through: :page_module_collection_modules
|
4
|
+
|
5
|
+
validates :title, presence: true, uniqueness: true
|
6
|
+
|
7
|
+
attr_accessible :title
|
8
|
+
|
9
|
+
extend FriendlyId
|
10
|
+
|
11
|
+
friendly_id :title, use: :slugged
|
12
|
+
|
13
|
+
before_save :set_slug_stub
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def set_slug_stub
|
18
|
+
self.slug_stub = slug.split('-').first
|
19
|
+
end
|
20
|
+
|
21
|
+
def should_generate_new_friendly_id?
|
22
|
+
title_changed?
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Setting < RailsSettings::CachedSettings
|
2
|
+
attr_accessible :var, :value
|
3
|
+
|
4
|
+
def expire_cache
|
5
|
+
Rails.cache.delete("settings:#{var}")
|
6
|
+
end
|
7
|
+
|
8
|
+
def cast_value
|
9
|
+
if !value.is_a?(String)
|
10
|
+
value
|
11
|
+
elsif Setting.defaults[var].is_a?(Array) || Setting.defaults[var].is_a?(Hash)
|
12
|
+
JSON.parse(value)
|
13
|
+
elsif Setting.defaults[var].is_a?(TrueClass) || Setting.defaults[var].is_a?(FalseClass)
|
14
|
+
value == 'true'
|
15
|
+
elsif Setting.defaults[var].is_a?(Fixnum)
|
16
|
+
value.to_i
|
17
|
+
elsif Setting.defaults[var].is_a?(Float)
|
18
|
+
value.to_f
|
19
|
+
elsif Setting.defaults[var].is_a?(Symbol)
|
20
|
+
value.to_sym
|
21
|
+
else
|
22
|
+
# e.g. class String
|
23
|
+
value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= setting_input f, 'home_page.apis.providers.volontariat.user_id', label: t('general.apis.user_id'), required: true %>
|
2
|
+
<%= setting_input f, 'home_page.apis.providers.volontariat.hosts.development', label: "#{t('general.environments.development')} #{t('general.apis.host')}" %>
|
3
|
+
<%= setting_input f, 'home_page.apis.providers.volontariat.hosts.test', label: "#{t('general.environments.test')} #{t('general.apis.host')}" %>
|
4
|
+
<%= setting_input f, 'home_page.apis.providers.volontariat.hosts.staging', label: "#{t('general.environments.staging')} #{t('general.apis.host')}" %>
|
5
|
+
<%= setting_input f, 'home_page.apis.providers.volontariat.hosts.production', label: "#{t('general.environments.production')} #{t('general.apis.host')}" %>
|
@@ -4,6 +4,7 @@
|
|
4
4
|
<%= render partial: 'layouts/shared/head' %>
|
5
5
|
</head>
|
6
6
|
<body>
|
7
|
+
<%= render partial: 'layouts/shared/modal' %>
|
7
8
|
<%= render partial: 'layouts/shared/navigation' %>
|
8
9
|
|
9
10
|
<div class="container">
|
@@ -24,7 +25,7 @@
|
|
24
25
|
</div>
|
25
26
|
<% end %>
|
26
27
|
<div class="row">
|
27
|
-
<div class="col-md-12">
|
28
|
+
<div class="col-md-12" id="page">
|
28
29
|
<%= yield %>
|
29
30
|
</div>
|
30
31
|
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<%= render partial: 'layouts/shared/head' %>
|
5
|
+
</head>
|
6
|
+
<body class="<%= @body_class %>">
|
7
|
+
<%= render partial: 'layouts/shared/navigation' %>
|
8
|
+
|
9
|
+
<div class="container-fluid">
|
10
|
+
<%= render partial: 'layouts/shared/flash' %>
|
11
|
+
|
12
|
+
<%= yield %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<%= render partial: 'layouts/shared/foot' %>
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -1 +1,9 @@
|
|
1
|
-
<%= javascript_include_tag *home_page_javascripts %>
|
1
|
+
<%= javascript_include_tag *home_page_javascripts %>
|
2
|
+
<%= yield :javascript_includes %>
|
3
|
+
<%= javascript_tag do %>
|
4
|
+
<%= yield :top_javascript %>
|
5
|
+
|
6
|
+
$(function() {
|
7
|
+
<%= yield(:document_ready) %>
|
8
|
+
});
|
9
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
2
|
+
<div class="modal-dialog">
|
3
|
+
<div class="modal-content">
|
4
|
+
<div class="modal-header">
|
5
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
6
|
+
<h4 class="modal-title" id="myModalLabel"><%= t('general.loading') %></h4>
|
7
|
+
</div>
|
8
|
+
<div class="modal-body">
|
9
|
+
<%= image_tag 'home_page/spinner.gif' %>
|
10
|
+
</div>
|
11
|
+
<div class="modal-footer">
|
12
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t('general.close') %></button>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if @page_module_collections.none? %>
|
2
|
+
<p><%= t('page_module_collections.index.empty_collection') %></p>
|
3
|
+
<% else %>
|
4
|
+
<table class='table table-striped'>
|
5
|
+
<thead>
|
6
|
+
<tr class='<%= cycle('odd', 'even') %>'>
|
7
|
+
<th style='width: 200px'><%= t('general.attributes.title') %></th>
|
8
|
+
<th style='width: 200px'><%= t('general.attributes.slug') %></th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<%= render partial: 'page_module_collections/page_module_collection', collection: @page_module_collections %>
|
14
|
+
</tbody>
|
15
|
+
</table>
|
16
|
+
|
17
|
+
<%= will_paginate @page_module_collections, renderer: BootstrapPagination::Rails %>
|
18
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<% content_for :modal_footer do %>
|
2
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t('general.close') %></button>
|
3
|
+
<button type="submit" class="btn btn-primary"><%= t('general.submit') %></button>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= simple_form_for(
|
7
|
+
resource, url: resource.new_record? ? page_module_collections_path : page_module_collection_path(resource), wrapper: :horizontal_form,
|
8
|
+
method: resource.new_record? ? :post : :put, remote: request.xhr?, html: { class: 'form-horizontal', autocomplete: 'off' }
|
9
|
+
) do |f| %>
|
10
|
+
<% if request.xhr? %>
|
11
|
+
<% content_for :modal_body do %>
|
12
|
+
<%= devise_error_messages! %>
|
13
|
+
|
14
|
+
<%= f.input :title %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render partial: 'shared/layouts/modal' %>
|
18
|
+
<% else %>
|
19
|
+
<%= devise_error_messages! %>
|
20
|
+
|
21
|
+
<%= f.input :title %>
|
22
|
+
|
23
|
+
<div class="form-group">
|
24
|
+
<div class="col-sm-offset-3 col-sm-9">
|
25
|
+
<button type="submit" class="btn btn-primary"><%= t('general.submit') %></button>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<li id="page_module_collection_module_<%= @collection_module_id || page_module.collection_module_id %>"
|
2
|
+
data-id="<%= @collection_module_id || page_module.collection_module_id %>" data-position="<%= @position || page_module.position %>"
|
3
|
+
data-sortable_selector="#page_module_collection_modules"
|
4
|
+
>
|
5
|
+
<table class="table" style="margin-bottom: 0px">
|
6
|
+
<tr class="<%= cycle('odd', 'even') %>">
|
7
|
+
<td class="list-element-striped" style="width:15px"><%= image_tag 'home_page/spinner.gif', class: 'hide sorting_spinner' %></td>
|
8
|
+
<td class="list-element-striped item_position" style="width:75px; text-align:right"><%= @position || page_module.position %></td>
|
9
|
+
<td class="list-element-striped" style="width:300px;"><%= link_to page_module.title, edit_page_module_path(page_module) %></td>
|
10
|
+
<td class="list-element-striped" style="width:300px;"><%= page_module.slug %></td>
|
11
|
+
<td class="list-element-striped" style="width:150px; text-align:center;">
|
12
|
+
<%= page_module.published_from.nil? ? t('general.not_available_short') : page_module.published_from.strftime('%d.%m.%Y %H:%M:%S') %>
|
13
|
+
<br/>
|
14
|
+
-
|
15
|
+
<br/>
|
16
|
+
<%= page_module.published_until.nil? ? t('general.not_available_short') : page_module.published_until.strftime('%d.%m.%Y %H:%M:%S') %>
|
17
|
+
</td>
|
18
|
+
<td class="list-element-striped">
|
19
|
+
<%= link_to(
|
20
|
+
t('general.remove_from_list_but_not_destroy_item'), page_module_collections_module_path(@collection_module_id || page_module.collection_module_id),
|
21
|
+
id: "page_module_collection_module_#{@collection_module_id || page_module.collection_module_id}", method: :delete,
|
22
|
+
data: { confirm: t('general.questions.are_you_sure') }, remote: true
|
23
|
+
) %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
26
|
+
</table>
|
27
|
+
</li>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<tr class="<%= cycle('odd', 'even') %>" id="page_module_collections_row_<%= page_module_collection.id %>">
|
2
|
+
<td>
|
3
|
+
<%= link_to(
|
4
|
+
page_module_collection.title, page_module_collection_path(page_module_collection),
|
5
|
+
class: 'page_module_collection_show_link',
|
6
|
+
:'data-replace' => "#page_module_collections_slug_stub_#{page_module_collection.slug_stub}"
|
7
|
+
) %>
|
8
|
+
</td>
|
9
|
+
<td>
|
10
|
+
<%= page_module_collection.slug %>
|
11
|
+
</td>
|
12
|
+
<td>
|
13
|
+
<div class="dropdown">
|
14
|
+
<button
|
15
|
+
class="btn btn-default dropdown-toggle" type="button" id="page_module_collection_<%= page_module_collection.id %>_actions"
|
16
|
+
data-toggle="dropdown" aria-expanded="true">
|
17
|
+
<%= t('general.actions') %>
|
18
|
+
<span class="caret"></span>
|
19
|
+
</button>
|
20
|
+
<ul class="dropdown-menu" role="menu" aria-labelledby="page_module_collection_<%= page_module_collection.id %>_actions">
|
21
|
+
<li role="presentation">
|
22
|
+
<%= link_to(
|
23
|
+
t('general.destroy'), page_module_collection_path(page_module_collection),
|
24
|
+
id: "page_module_collection_#{page_module_collection.id}", method: :delete,
|
25
|
+
data: { confirm: t('general.questions.are_you_sure') }, remote: true
|
26
|
+
) %>
|
27
|
+
</li>
|
28
|
+
<li role="presentation">
|
29
|
+
|
30
|
+
<button
|
31
|
+
type="button" class="btn btn-default" data-toggle="modal" data-target="#modal"
|
32
|
+
data-url="<%= edit_page_module_collection_path(page_module_collection) %>"
|
33
|
+
data-title="<%= t('page_module_collections.edit.title') %>" data-only-update-body="false"
|
34
|
+
>
|
35
|
+
<span class="glyphicon glyphicon-pencil"></span> <%= t('general.edit') %>
|
36
|
+
</button>
|
37
|
+
</li>
|
38
|
+
</ul>
|
39
|
+
</div>
|
40
|
+
</td>
|
41
|
+
</tr>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% message = flash[:notice] || flash[:alert] %>
|
2
|
+
<% flash.delete(:notice); flash.delete(:alert) %>
|
3
|
+
<% alert = message.present? ? "alert('#{message}');" : '' %>
|
4
|
+
|
5
|
+
<% unless @page_module_collection.persisted? %>
|
6
|
+
$("#page_module_collections_row_<%= @page_module_collection.id %>").remove();
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= raw alert %>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<% content_for :title do %><%= t('page_modules.index.title') %><% end %>
|
2
|
+
|
3
|
+
<div role="tabpanel">
|
4
|
+
<ul class="nav nav-tabs" role="tablist">
|
5
|
+
<li role="presentation" class="active">
|
6
|
+
<a href="#page_module_collections_tab" aria-controls="page_module_collections_tab" role="tab" data-toggle="tab">
|
7
|
+
<%= t('page_module_collections.index.short_title') %>
|
8
|
+
</a>
|
9
|
+
</li>
|
10
|
+
<li role="presentation">
|
11
|
+
<a href="#page_modules_tab" aria-controls="page_modules_tab" role="tab" data-toggle="tab">
|
12
|
+
<%= t('page_modules.index.short_title') %>
|
13
|
+
</a>
|
14
|
+
</li>
|
15
|
+
</ul>
|
16
|
+
<div class="tab-content">
|
17
|
+
<div role="tabpanel" class="tab-pane active" id="page_module_collections_tab">
|
18
|
+
<p>
|
19
|
+
<% if @page_module_collection_slug_stubs.none? %>
|
20
|
+
<div class="alert alert-info" role="alert">
|
21
|
+
<%= t('page_module_collections.index.empty_collection') %>
|
22
|
+
</div>
|
23
|
+
<% else %>
|
24
|
+
<div role="tabpanel">
|
25
|
+
<ul class="nav nav-tabs" role="tablist">
|
26
|
+
<% @page_module_collection_slug_stubs.each_with_index do |slug_stub, index| %>
|
27
|
+
<li role="presentation"<% if index == 0 %> class="active"<% end %>>
|
28
|
+
<a
|
29
|
+
href="<%= page_module_collections_path(slug_stub: slug_stub) %>"
|
30
|
+
data-target="#page_module_collections_slug_stub_<%= slug_stub %>"
|
31
|
+
aria-controls="page_module_collections_slug_stub_<%= slug_stub %>"
|
32
|
+
role="tab" data-toggle="tabajax"
|
33
|
+
>
|
34
|
+
<%= slug_stub.titleize %>
|
35
|
+
</a>
|
36
|
+
</li>
|
37
|
+
<% end %>
|
38
|
+
</ul>
|
39
|
+
<div class="tab-content">
|
40
|
+
<% @page_module_collection_slug_stubs.each_with_index do |slug_stub, index| %>
|
41
|
+
<div role="tabpanel" class="tab-pane<% if index == 0 %> active<% end %>" id="page_module_collections_slug_stub_<%= slug_stub %>">
|
42
|
+
<%= render partial: 'page_module_collections/collection' if index == 0 %>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
48
|
+
</p>
|
49
|
+
|
50
|
+
<p>
|
51
|
+
<button
|
52
|
+
type="button" class="btn btn-default" data-toggle="modal" data-target="#modal" data-url="<%= new_page_module_collection_path %>"
|
53
|
+
data-title="<%= t('page_module_collections.new.title') %>" data-only-update-body="false"
|
54
|
+
>
|
55
|
+
<span class="glyphicon glyphicon-plus"></span> <%= t('page_module_collections.new.short_title') %>
|
56
|
+
</button>
|
57
|
+
</p>
|
58
|
+
</div>
|
59
|
+
<div role="tabpanel" class="tab-pane" id="page_modules_tab">
|
60
|
+
<%= render partial: 'page_modules/tab' %>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<% content_for :javascript_includes do %>
|
66
|
+
<%= javascript_include_tag 'home_page/page_module_collections/index' %>
|
67
|
+
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<% if request.xhr? %>
|
2
|
+
<p>
|
3
|
+
<%= link_to(
|
4
|
+
t('page_module_collections.index.short_title'), page_module_collections_path(slug_stub: @page_module_collection.slug_stub),
|
5
|
+
class: 'page_module_collection_show_link', :'data-replace' => "#page_module_collections_slug_stub_#{@page_module_collection.slug_stub}"
|
6
|
+
) %> > <%= @page_module_collection.title %>
|
7
|
+
</p>
|
8
|
+
<% else %>
|
9
|
+
<% content_for :title do %><%= t('activerecord.models.page_module_collection') %>: <%= @page_module_collection.title %><% end %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<table class="table table-striped" style="margin-bottom:0px;">
|
13
|
+
<thead>
|
14
|
+
<tr class='<%= cycle('odd', 'even') %>'>
|
15
|
+
<th style="width:15px; border-bottom:1px solid #dddddd;"></td>
|
16
|
+
<th style="width: 75px; border-bottom:1px solid #dddddd; vertical-align:top;"><%= t('attributes.position') %></th>
|
17
|
+
<th style='width: 300px; border-bottom:1px solid #dddddd;'><%= t('general.attributes.title') %></th>
|
18
|
+
<th style='width: 300px; border-bottom:1px solid #dddddd;'><%= t('general.attributes.slug') %></th>
|
19
|
+
<th style='width: 150px; border-bottom:1px solid #dddddd;'><%= t('general.attributes.published') %></th>
|
20
|
+
<th style="border-bottom:1px solid #dddddd;"></th>
|
21
|
+
</tr>
|
22
|
+
</thead>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<ul
|
26
|
+
class="nav list-striped multisortable" id="page_module_collection_modules"
|
27
|
+
data-url="<%= move_page_module_collection_modules_path(@page_module_collection) %>"
|
28
|
+
>
|
29
|
+
<%= render partial: 'page_module_collections/page_module', collection: @page_modules %>
|
30
|
+
</ul>
|
31
|
+
|
32
|
+
<p>
|
33
|
+
<button
|
34
|
+
type="button" class="btn btn-default" data-toggle="modal" data-target="#modal"
|
35
|
+
data-url="<%= new_page_module_collection_module_path(@page_module_collection) %>"
|
36
|
+
data-title="<%= t('page_module_collections.show.add_module') %>" data-only-update-body="false"
|
37
|
+
>
|
38
|
+
<span class="glyphicon glyphicon-plus"></span> <%= t('page_module_collections.show.add_module_short') %>
|
39
|
+
</button>
|
40
|
+
</p>
|
41
|
+
|
42
|
+
<% content_for :document_ready do %>
|
43
|
+
new window.HomePage.Shared.SortableList('#page_module_collection_modules');
|
44
|
+
<% end %>
|