radiant-templates-extension 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HELP_designer.textile +79 -0
- data/README.textile +123 -0
- data/Rakefile +136 -0
- data/VERSION +1 -0
- data/app/controllers/admin/part_types_controller.rb +8 -0
- data/app/controllers/admin/templates_controller.rb +38 -0
- data/app/helpers/admin/part_types_helper.rb +26 -0
- data/app/helpers/admin/templates_helper.rb +108 -0
- data/app/models/part_type.rb +14 -0
- data/app/models/template.rb +80 -0
- data/app/models/template_part.rb +21 -0
- data/app/views/admin/pages/_edit_template.html.haml +32 -0
- data/app/views/admin/pages/_edit_template_part.html.haml +20 -0
- data/app/views/admin/pages/_switch_templates.html.haml +23 -0
- data/app/views/admin/pages/_template_column.html.haml +3 -0
- data/app/views/admin/pages/_template_column_header.html.haml +1 -0
- data/app/views/admin/part_types/_form.html.haml +36 -0
- data/app/views/admin/part_types/_list.html.haml +23 -0
- data/app/views/admin/part_types/edit.html.haml +5 -0
- data/app/views/admin/part_types/index.html.haml +7 -0
- data/app/views/admin/part_types/new.html.haml +2 -0
- data/app/views/admin/part_types/remove.html.haml +15 -0
- data/app/views/admin/templates/_form.html.haml +65 -0
- data/app/views/admin/templates/_template_part.html.haml +21 -0
- data/app/views/admin/templates/_templates_css.html.haml +12 -0
- data/app/views/admin/templates/edit.html.haml +10 -0
- data/app/views/admin/templates/index.html.haml +47 -0
- data/app/views/admin/templates/new.html.haml +9 -0
- data/app/views/admin/templates/remove.html.haml +15 -0
- data/config/initializers/radiant_config.rb +3 -0
- data/config/locales/en.yml +32 -0
- data/config/routes.rb +7 -0
- data/db/migrate/001_create_templates.rb +17 -0
- data/db/migrate/002_create_template_parts.rb +15 -0
- data/db/migrate/003_rename_sublayout_column.rb +9 -0
- data/db/migrate/004_add_position_to_templates.rb +13 -0
- data/db/migrate/005_create_part_types.rb +17 -0
- data/db/migrate/006_add_description_to_template_parts.rb +9 -0
- data/db/migrate/007_add_page_class_name_to_templates.rb +9 -0
- data/db/migrate/008_add_index_to_templates.rb +9 -0
- data/db/migrate/009_create_default_part_types.rb +23 -0
- data/db/migrate/010_update_boolean_part_type.rb +9 -0
- data/db/migrate/011_add_timestamps.rb +19 -0
- data/lib/file_system/model/part_type_extensions.rb +19 -0
- data/lib/file_system/model/template_extensions.rb +52 -0
- data/lib/tasks/templates_extension_tasks.rake +28 -0
- data/lib/templates/associations.rb +7 -0
- data/lib/templates/controller_extensions.rb +20 -0
- data/lib/templates/helper.rb +75 -0
- data/lib/templates/page_extensions.rb +43 -0
- data/lib/templates/tags.rb +43 -0
- data/public/images/admin/menu_arrow.png +0 -0
- data/public/images/admin/move_higher.png +0 -0
- data/public/images/admin/move_lower.png +0 -0
- data/public/images/admin/move_to_bottom.png +0 -0
- data/public/images/admin/move_to_top.png +0 -0
- data/public/images/admin/part_type.png +0 -0
- data/public/images/admin/template.png +0 -0
- data/spec/controllers/admin_page_controller_extensions_spec.rb +61 -0
- data/spec/controllers/part_types_controller_spec.rb +89 -0
- data/spec/controllers/templates_controller_spec.rb +322 -0
- data/spec/datasets/part_types_dataset.rb +15 -0
- data/spec/datasets/templates_dataset.rb +34 -0
- data/spec/helpers/templates_helper_spec.rb +56 -0
- data/spec/models/page_extensions_spec.rb +9 -0
- data/spec/models/part_type_spec.rb +28 -0
- data/spec/models/tags_spec.rb +44 -0
- data/spec/models/template_part_spec.rb +37 -0
- data/spec/models/template_spec.rb +88 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +39 -0
- data/templates_extension.rb +83 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/vendor/plugins/make_resourceful/DEFAULTS +148 -0
- data/vendor/plugins/make_resourceful/LICENSE +7 -0
- data/vendor/plugins/make_resourceful/README +239 -0
- data/vendor/plugins/make_resourceful/Rakefile +42 -0
- data/vendor/plugins/make_resourceful/VERSION +1 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb +87 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb +5 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml +10 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb +57 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb +2 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb +13 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb +2 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb +7 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml +5 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml +11 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml +5 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml +9 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml +12 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml +14 -0
- data/vendor/plugins/make_resourceful/init.rb +3 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/base.rb +52 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/builder.rb +354 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb +346 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb +92 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb +51 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb +118 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb +137 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/maker.rb +83 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/response.rb +33 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/serialize.rb +181 -0
- data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +473 -0
- data/vendor/plugins/make_resourceful/spec/actions_spec.rb +283 -0
- data/vendor/plugins/make_resourceful/spec/base_spec.rb +12 -0
- data/vendor/plugins/make_resourceful/spec/builder_spec.rb +332 -0
- data/vendor/plugins/make_resourceful/spec/callbacks_spec.rb +71 -0
- data/vendor/plugins/make_resourceful/spec/integration_spec.rb +396 -0
- data/vendor/plugins/make_resourceful/spec/maker_spec.rb +91 -0
- data/vendor/plugins/make_resourceful/spec/response_spec.rb +37 -0
- data/vendor/plugins/make_resourceful/spec/responses_spec.rb +314 -0
- data/vendor/plugins/make_resourceful/spec/rspec_on_rails/LICENSE +35 -0
- data/vendor/plugins/make_resourceful/spec/rspec_on_rails/redirect_to.rb +81 -0
- data/vendor/plugins/make_resourceful/spec/rspec_on_rails/render_template.rb +28 -0
- data/vendor/plugins/make_resourceful/spec/serialize_spec.rb +133 -0
- data/vendor/plugins/make_resourceful/spec/spec_helper.rb +279 -0
- data/vendor/plugins/make_resourceful/spec/urls_spec.rb +276 -0
- metadata +214 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
class PartType < ActiveRecord::Base
|
2
|
+
|
3
|
+
# Default Order
|
4
|
+
default_scope :order => 'name'
|
5
|
+
|
6
|
+
# Associations
|
7
|
+
has_many :template_parts
|
8
|
+
|
9
|
+
# Validations
|
10
|
+
validates_presence_of :name
|
11
|
+
validates_uniqueness_of :name
|
12
|
+
validates_inclusion_of :field_type, :identifier => :field_types,
|
13
|
+
:in => %w{text_area text_field check_box radio_button hidden predefined}
|
14
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
class Template < ActiveRecord::Base
|
2
|
+
acts_as_list
|
3
|
+
class << self
|
4
|
+
def reordering
|
5
|
+
@reordering = true
|
6
|
+
yield
|
7
|
+
@reordering = false
|
8
|
+
end
|
9
|
+
|
10
|
+
def reordering?
|
11
|
+
@reordering
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Default Order
|
16
|
+
default_scope :order => "position ASC"
|
17
|
+
|
18
|
+
# Associations
|
19
|
+
has_many :pages, :dependent => :nullify
|
20
|
+
has_many :template_parts, :dependent => :destroy, :order => "id ASC"
|
21
|
+
belongs_to :layout
|
22
|
+
|
23
|
+
# Validations
|
24
|
+
validates_presence_of :name, :layout_id
|
25
|
+
validate :valid_page_class_name
|
26
|
+
|
27
|
+
# Callbacks
|
28
|
+
before_validation :create_template_parts
|
29
|
+
after_update :update_pages
|
30
|
+
|
31
|
+
def template_parts_with_hash=(value)
|
32
|
+
if value.is_a? Hash
|
33
|
+
@add_template_parts = order_and_extract(value)
|
34
|
+
else
|
35
|
+
template_parts_without_hash=(value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
alias_method_chain :template_parts=, :hash
|
40
|
+
|
41
|
+
private
|
42
|
+
def create_template_parts
|
43
|
+
if @add_template_parts
|
44
|
+
self.template_parts.clear
|
45
|
+
@add_template_parts.each do |part|
|
46
|
+
self.template_parts << TemplatePart.new(part)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
@add_template_parts = nil
|
50
|
+
end
|
51
|
+
|
52
|
+
def order_and_extract(hash)
|
53
|
+
hash.to_a.sort_by(&:first).map(&:last)
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_pages
|
57
|
+
unless self.class.reordering?
|
58
|
+
self.pages.each do |page|
|
59
|
+
page.parts.each do |part|
|
60
|
+
if part.name == 'body'
|
61
|
+
attrs = {:content => self.content}
|
62
|
+
attrs[:draft_content] = self.content if defined?(ConcurrentDraftExtension)
|
63
|
+
part.update_attributes(attrs)
|
64
|
+
else
|
65
|
+
unless self.template_parts.map(&:name).include?(part.name)
|
66
|
+
part.destroy
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
page.update_attributes(:layout_id => self.layout_id, :class_name => (self.page_class_name.blank? ? page.class_name : self.page_class_name))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def valid_page_class_name
|
76
|
+
unless Page.is_descendant_class_name?(page_class_name)
|
77
|
+
errors.add :page_class_name, "must be set to a valid descendant of Page"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class TemplatePart < ActiveRecord::Base
|
2
|
+
|
3
|
+
# Default Order
|
4
|
+
default_scope :order => 'name'
|
5
|
+
|
6
|
+
# Associations
|
7
|
+
belongs_to :template
|
8
|
+
belongs_to :part_type
|
9
|
+
|
10
|
+
# Validations
|
11
|
+
validates_presence_of :name, :part_type_id
|
12
|
+
validates_exclusion_of :name, :in => %w{body}, :message => "cannot be named 'body'"
|
13
|
+
|
14
|
+
def index
|
15
|
+
@index ||= new_record? ? "0#{rand(1000)}" : id
|
16
|
+
end
|
17
|
+
|
18
|
+
def part_type_name=(name)
|
19
|
+
self.part_type = PartType.find_by_name(name)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
- if !(@content_template ||= @page.template).blank?
|
2
|
+
= hidden_field_tag "#{page_part_name(0)}[name]", "body", :id => "page_parts_0_name"
|
3
|
+
= hidden_field_tag "#{page_part_name(0)}[filter_id]", nil, :id => "page_parts_0_filter_id"
|
4
|
+
= hidden_field_tag "#{page_part_name(0)}[content]", @content_template.content, :id => "page_parts_0_content"
|
5
|
+
= hidden_field_tag "page[parts_attributes][0][id]", @page.part(:body).try(:[], 'id')
|
6
|
+
- if defined?(ConcurrentDraftExtension)
|
7
|
+
= hidden_field_tag "#{page_part_name(0)}[draft_content]", @content_template.content, :id => 'page_parts_0_draft_content'
|
8
|
+
= hidden_field 'page', 'template_id', :value => @content_template.id
|
9
|
+
= hidden_field 'page', 'layout_id', :value => @content_template.layout_id
|
10
|
+
- unless @content_template.page_class_name.blank?
|
11
|
+
= hidden_field 'page', 'class_name', :value => @content_template.page_class_name
|
12
|
+
- @content_template.template_parts.each_with_index do |part, index|
|
13
|
+
= render :partial => "edit_template_part", :object => part, :locals => {:index => index + 1}
|
14
|
+
|
15
|
+
- else
|
16
|
+
= defaults['edit_page_parts']
|
17
|
+
= hidden_field 'page', 'template_id', :value => nil
|
18
|
+
|
19
|
+
- content_for :page_css do
|
20
|
+
:sass
|
21
|
+
.template_part
|
22
|
+
padding: 6px 0
|
23
|
+
border-bottom: 1px solid #DFDCD1
|
24
|
+
width: 100%
|
25
|
+
label
|
26
|
+
textarea.textarea
|
27
|
+
display: block
|
28
|
+
input.text
|
29
|
+
display: block
|
30
|
+
padding: 2px 0
|
31
|
+
font-size: 16px
|
32
|
+
width: 500px
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.clear
|
2
|
+
.template_part{ :id => "part_" + edit_template_part.name.gsub(/\W/, "_"), :style => (edit_template_part.part_type.field_type == 'predefined' ? "display:none" : nil) }
|
3
|
+
= hidden_field_tag "#{page_part_name(index)}[name]", edit_template_part.name, :id => "page_parts_#{index}_name"
|
4
|
+
= hidden_field_tag "#{page_part_name(index)}[filter_id]", edit_template_part.filter_id, :id => "page_parts_#{index}_filter_id"
|
5
|
+
= hidden_field_tag "page[parts_attributes][#{index}][id]", @page.part(edit_template_part.name).try(:[], :id)
|
6
|
+
%p
|
7
|
+
%label{:for => "page_parts_#{index}_content"}
|
8
|
+
= edit_template_part.name.humanize
|
9
|
+
- unless edit_template_part.description.blank?
|
10
|
+
%span.description= " - " + escape_once(edit_template_part.description)
|
11
|
+
- if edit_template_part.part_type.field_class && edit_template_part.part_type.field_class.include?('text')
|
12
|
+
%span.reference_links{:style => "float:right"}
|
13
|
+
= t('reference')
|
14
|
+
- unless edit_template_part.filter_id.blank?
|
15
|
+
= hidden_field_tag "part_#{edit_template_part.name.to_slug}_filter_id", edit_template_part.filter_id, :id => "part_#{edit_template_part.name.to_slug}_filter_id"
|
16
|
+
%span{:id => "filter_reference_link_#{edit_template_part.name}"}
|
17
|
+
= link_to_function t('filter'), "loadFilterReference('#{edit_template_part.name}');", :title => edit_template_part.filter_id
|
18
|
+
%span{:id => "tag_reference_link_#{edit_template_part.name.to_slug}"}
|
19
|
+
= link_to_function t('available_tags'), "loadTagReference('#{edit_template_part.name.to_slug}');"
|
20
|
+
= find_and_preserve(template_part_field(edit_template_part, index, defined?(ConcurrentDraftExtension)))
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%tr
|
2
|
+
%th.label Template
|
3
|
+
%td{:class => "field", :style => "text-align: left;"}
|
4
|
+
- @content_template ||= @page.template
|
5
|
+
%ul#template-chooser
|
6
|
+
- ::Template.find(:all).each do |template|
|
7
|
+
%li{:class => template == @content_template ? 'selected' : nil}= link_to_unless(template == @content_template, template.name.humanize.titleize, "?template=#{template.id}")
|
8
|
+
%li{:class => @content_template.blank? ? 'selected' : nil}
|
9
|
+
= link_to_unless(@content_template.blank?, "Blank Page", @page.id.nil? ? "?template=" : "?template=0")
|
10
|
+
|
11
|
+
- content_for :page_css do
|
12
|
+
:sass
|
13
|
+
ul#template-chooser
|
14
|
+
list-style: none
|
15
|
+
li, li a
|
16
|
+
display: inline
|
17
|
+
padding: 0.3em
|
18
|
+
line-height: 2.0em
|
19
|
+
color: white
|
20
|
+
white-space: nowrap
|
21
|
+
&.selected
|
22
|
+
font-weight: bold
|
23
|
+
font-size: 110%
|
@@ -0,0 +1 @@
|
|
1
|
+
%th.template= t('template')
|
@@ -0,0 +1,36 @@
|
|
1
|
+
- form_for [:admin, @part_type], :html => {'data-onsubmit_status' => onsubmit_status(@part_type)} do |f|
|
2
|
+
-# = f.hidden_field :lock_version # for optimistic locking. Not yet implemented for template part types
|
3
|
+
.form_area
|
4
|
+
%p#content
|
5
|
+
%table.index#part_type
|
6
|
+
%thead
|
7
|
+
%tr
|
8
|
+
%th.part_type_name= f.label t('name')
|
9
|
+
%th.type= f.label t('field_type')
|
10
|
+
%th.class= f.label t('field_class')
|
11
|
+
%th.styles= f.label t('field_styles')
|
12
|
+
%tbody
|
13
|
+
%tr
|
14
|
+
%td.part_type_name
|
15
|
+
%p= f.text_field :name, :class => 'textbox'
|
16
|
+
%td.type
|
17
|
+
- types = PartType.validate_callback_chain.select {|callback| callback.identifier == :field_types }[0].options[:in]
|
18
|
+
= f.select :field_type, types
|
19
|
+
%td.class
|
20
|
+
%p= f.text_field :field_class, :class => 'textbox'
|
21
|
+
%td.styles
|
22
|
+
%p= f.text_field :field_styles, :class => 'textbox'
|
23
|
+
|
24
|
+
%p.buttons{:style=>"clear: left"}
|
25
|
+
= save_model_button(@part_type)
|
26
|
+
= save_model_and_continue_editing_button(@part_type)
|
27
|
+
= t('or')
|
28
|
+
= link_to t('cancel'), admin_part_types_url
|
29
|
+
= updated_stamp @part_type
|
30
|
+
|
31
|
+
- @part_types = PartType.all
|
32
|
+
|
33
|
+
%br
|
34
|
+
.box
|
35
|
+
%h3= t('existing_part_types')
|
36
|
+
= render :partial => 'list'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%table.index#part_types
|
2
|
+
%thead
|
3
|
+
%tr
|
4
|
+
%th.part_type_name= t('name')
|
5
|
+
%th.type= t('field_type')
|
6
|
+
%th.class= t('field_class')
|
7
|
+
%th.styles= t('field_styles')
|
8
|
+
%th.actions{:style=>"width:9em"}= t('modify')
|
9
|
+
%tbody
|
10
|
+
- if @part_types.any?
|
11
|
+
- @part_types.each do |part_type|
|
12
|
+
%tr[part_type]
|
13
|
+
%td.name
|
14
|
+
= image('part_type', :alt => '')
|
15
|
+
= link_to part_type.name, edit_admin_part_type_url(part_type)
|
16
|
+
%td.type= part_type.field_type
|
17
|
+
%td.class= part_type.field_class
|
18
|
+
%td.styles= part_type.field_styles
|
19
|
+
%td.actions
|
20
|
+
= link_to image('minus') + ' ' + t('remove'), remove_admin_part_type_url(part_type), :class => "action"
|
21
|
+
- else
|
22
|
+
%tr
|
23
|
+
%td.empty{:colspan => admin.part_type.index.tbody.length}= t('no_part_types')
|
@@ -0,0 +1,15 @@
|
|
1
|
+
%h1= t('remove_part_type')
|
2
|
+
%p= t('text.part_types.remove_warning')
|
3
|
+
|
4
|
+
%table.index#templates
|
5
|
+
%tbody
|
6
|
+
%tr.node.level_1
|
7
|
+
%td.part_type
|
8
|
+
= image('part_type', :alt => "")
|
9
|
+
%span.title= @part_type.name
|
10
|
+
|
11
|
+
- form_for [:admin, @part_type], :html => {:method => :delete, 'data-onsubmit_status'=>"Removing #{t('part_type')}…"} do
|
12
|
+
%p.buttons
|
13
|
+
%input.button{:type=>"submit", :value => t('delete_part_type')}/
|
14
|
+
= t('or')
|
15
|
+
= link_to t('cancel'), admin_part_types_url
|
@@ -0,0 +1,65 @@
|
|
1
|
+
-#= f.hidden_field :lock_version # for optimistic locking. Not yet implemented for templates
|
2
|
+
= render_region :form_top, :locals => {:f => f}
|
3
|
+
.form_area
|
4
|
+
- render_region :form, :locals => {:f => f} do |form|
|
5
|
+
- form.edit_title do
|
6
|
+
%p.title
|
7
|
+
= f.label :name, t('name')
|
8
|
+
= f.text_field :name, :class => 'textbox activate', :maxlength => 100
|
9
|
+
- form.edit_content do
|
10
|
+
%p.content
|
11
|
+
%label
|
12
|
+
%span= t('parts')
|
13
|
+
= link_to_function image_tag("admin/plus.png") + ' ' + t('add_part'), "new_template_part()", :class => 'action', :style => "float: right"
|
14
|
+
%table.index#templates
|
15
|
+
%thead
|
16
|
+
%tr
|
17
|
+
%th.template_name= t('name')
|
18
|
+
%th.description= t('description')
|
19
|
+
%th.part_type= t('type')
|
20
|
+
%th.filter= t('filter')
|
21
|
+
%th.modify= t('modify')
|
22
|
+
%th.reorder= t('order')
|
23
|
+
%tbody#parts
|
24
|
+
= render :partial => "template_part", :collection => current_object.template_parts
|
25
|
+
%p.structure
|
26
|
+
= f.label :structure, t('structure')
|
27
|
+
= find_and_preserve(f.text_area(:content, :class => "textarea", :style => "width:100%"))
|
28
|
+
|
29
|
+
.set
|
30
|
+
- render_region :layout, :locals => {:f => f} do |layout|
|
31
|
+
- layout.edit_layout do
|
32
|
+
%p
|
33
|
+
= f.label :layout_id, t('layout')
|
34
|
+
= f.collection_select :layout_id, Layout.find(:all), :id, :name, :include_blank => false
|
35
|
+
- layout.edit_type do
|
36
|
+
%p
|
37
|
+
= f.label :class_name, t('page_type')
|
38
|
+
= f.collection_select :page_class_name, Page.descendants, :name, :display_name, :include_blank => "<normal>"
|
39
|
+
|
40
|
+
- render_region :form_bottom, :locals => {:f => f} do |form_bottom|
|
41
|
+
- form_bottom.edit_buttons do
|
42
|
+
%p.buttons{:style=>"clear: left"}
|
43
|
+
= save_model_button(current_object)
|
44
|
+
= save_model_and_continue_editing_button(current_object)
|
45
|
+
= t('or')
|
46
|
+
= link_to t('cancel'), admin_templates_url
|
47
|
+
- form_bottom.edit_timestamp do
|
48
|
+
= updated_stamp current_object
|
49
|
+
%br
|
50
|
+
|
51
|
+
- if admin?
|
52
|
+
- render_region :bottom do |bottom|
|
53
|
+
- bottom.parts_button do
|
54
|
+
#actions
|
55
|
+
%ul
|
56
|
+
%li= link_to image('plus') + " " + t('edit_part_types'), admin_part_types_url
|
57
|
+
|
58
|
+
- content_for :page_css do
|
59
|
+
:sass
|
60
|
+
.template_part
|
61
|
+
background: white
|
62
|
+
label
|
63
|
+
display: none
|
64
|
+
.inline
|
65
|
+
display: inline-block
|
@@ -0,0 +1,21 @@
|
|
1
|
+
%tr{:class => "template_part", :id => "template_part_#{template_part.index}"}
|
2
|
+
- fields_for "template[template_parts][#{template_part.index}]", template_part do |t|
|
3
|
+
%td.name
|
4
|
+
%label{:for => "template_template_parts_#{template_part.index}_name"} t('name')
|
5
|
+
= t.text_field :name, :id => "template_template_parts_#{template_part.index}_name"
|
6
|
+
%td.desc
|
7
|
+
%label{:for => "template_template_parts_#{template_part.index}_description"} t('description')
|
8
|
+
= t.text_field :description, :id => "template_template_parts_#{template_part.index}_description"
|
9
|
+
%td.part_type
|
10
|
+
%label{:for => "template_template_parts_#{template_part.index}_part_type_id"} t('type')
|
11
|
+
= t.select :part_type_id, part_type_options, {}, :id => "template_template_parts_#{template_part.index}_part_type_id"
|
12
|
+
%td.filter
|
13
|
+
%label{:for => "template_template_parts_#{template_part.index}_filter_id"} t('filter')
|
14
|
+
= t.select :filter_id, [['<none>', '']] + TextFilter.descendants.map { |s| s.filter_name }.sort, :id => "template template_parts_#{template_part.index}_filter_id"
|
15
|
+
%td.modify
|
16
|
+
= link_to_function image('minus') + ' ' + t('remove'), "$('template_part_#{template_part.index}').remove();", :class => "action"
|
17
|
+
%td.reorder
|
18
|
+
= link_to_function image('move_to_top', :alt => "Move to top"), "reorder_template_part(this, 'top');"
|
19
|
+
= link_to_function image('move_higher', :alt => "Move up"), "reorder_template_part(this, 'up');"
|
20
|
+
= link_to_function image('move_lower', :alt => "Move down"), "reorder_template_part(this, 'down');"
|
21
|
+
= link_to_function image('move_to_bottom', :alt => "Move to bottom"), "reorder_template_part(this, 'bottom');"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- @page_title = current_object.name + ' ' + t('template') + ' - ' + default_page_title
|
2
|
+
|
3
|
+
- render_region :main do |main|
|
4
|
+
- main.edit_header do
|
5
|
+
%h1= t('edit_template')
|
6
|
+
- main.edit_form do
|
7
|
+
- form_for :template, current_object, :url => admin_template_path(current_object), :html => {:method => :put , 'data-onsubmit_status' => onsubmit_status(current_object)} do |f|
|
8
|
+
= render :partial => 'form', :locals => {:f => f}
|
9
|
+
|
10
|
+
- content_for 'page_scripts', template_edit_javascripts
|
@@ -0,0 +1,47 @@
|
|
1
|
+
- include_javascript 'admin/ruledtable'
|
2
|
+
|
3
|
+
- @page_title = t('templates') + ' - ' + default_page_title
|
4
|
+
|
5
|
+
.outset
|
6
|
+
= render_region :top
|
7
|
+
%table.index#templates
|
8
|
+
%thead
|
9
|
+
%tr
|
10
|
+
- render_region :thead do |thead|
|
11
|
+
- thead.title_header do
|
12
|
+
%th.template_name= t('template')
|
13
|
+
- thead.parts_header do
|
14
|
+
%th.parts= t('parts')
|
15
|
+
- thead.actions_header do
|
16
|
+
%th.actions{:style=>"width:9em"}= t('modify')
|
17
|
+
- thead.order_header do
|
18
|
+
%th.order{:style=>"width:9em"}= t('order')
|
19
|
+
%tbody
|
20
|
+
- if @content_templates.any?
|
21
|
+
- @content_templates.each do |template|
|
22
|
+
%tr[template]
|
23
|
+
- render_region :tbody, :locals => {:template => template} do |tbody|
|
24
|
+
- tbody.title_cell do
|
25
|
+
%td.name{:style => "white-space: nowrap"}
|
26
|
+
= image('template', :alt => '')
|
27
|
+
= link_to template.name, edit_admin_template_url(template)
|
28
|
+
- tbody.parts_cell do
|
29
|
+
%td.parts
|
30
|
+
- template.template_parts.each do |part|
|
31
|
+
= part.name + ' '
|
32
|
+
- tbody.actions_cell do
|
33
|
+
%td.actions
|
34
|
+
= link_to image('minus') + ' ' + t('remove'), remove_admin_template_url(template), :class => "action"
|
35
|
+
- tbody.order_cell do
|
36
|
+
%td.order
|
37
|
+
= order_links(template)
|
38
|
+
- else
|
39
|
+
%tr
|
40
|
+
%td.empty{:colspan => admin.template.index.tbody.length}= t('no_templates')
|
41
|
+
|
42
|
+
- render_region :bottom do |bottom|
|
43
|
+
- bottom.new_button do
|
44
|
+
#actions
|
45
|
+
= pagination_for(@templates)
|
46
|
+
%ul
|
47
|
+
%li= link_to image('plus') + " " + t('new_template'), new_admin_template_url
|