refinerycms-page-menus 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/app/assets/javascripts/refinery/backend.js.coffee +24 -0
  2. data/app/assets/stylesheets/refinery/select_form.css.scss +182 -0
  3. data/app/controllers/refinery/admin/page_menus_controller.rb +57 -1
  4. data/app/controllers/refinery/admin/page_positions_controller.rb +19 -39
  5. data/app/helpers/refinery/page_positions_helper.rb +66 -0
  6. data/app/models/refinery/page_menu.rb +3 -15
  7. data/app/models/refinery/page_position.rb +87 -15
  8. data/app/views/refinery/admin/page_menus/_form.html.erb +27 -35
  9. data/app/views/refinery/admin/page_menus/_form_actions.html.erb +23 -0
  10. data/app/views/refinery/admin/page_menus/_page_menu.html.erb +16 -0
  11. data/app/views/refinery/admin/page_menus/_page_menus.html.erb +2 -0
  12. data/app/views/refinery/admin/page_menus/_records.html.erb +18 -0
  13. data/app/views/refinery/admin/page_menus/_sortable_list.html.erb +5 -0
  14. data/app/views/refinery/admin/page_menus/edit.html.erb +12 -1
  15. data/app/views/refinery/admin/page_menus/index.html.erb +3 -0
  16. data/app/views/refinery/admin/page_positions/_custom_link.html.erb +14 -0
  17. data/app/views/refinery/admin/page_positions/_page_position.html.erb +25 -48
  18. data/app/views/refinery/admin/page_positions/_resource_link.html.erb +14 -0
  19. data/app/views/refinery/admin/page_positions/_resource_link_editor_box.html.erb +21 -0
  20. data/app/views/refinery/admin/page_positions/create.js.erb +5 -0
  21. data/app/views/refinery/admin/page_positions/destroy.js.erb +3 -0
  22. data/config/locales/da.yml +9 -5
  23. data/config/locales/en.yml +25 -82
  24. data/config/locales/fr.yml +37 -0
  25. data/config/routes.rb +15 -4
  26. data/db/migrate/{20120406121839_create_page_menus.rb → 01_create_page_menus.rb} +0 -0
  27. data/db/migrate/{20120411133453_add_permatitle_to_page_menus.rb → 02_add_permatitle_to_page_menus.rb} +0 -0
  28. data/db/migrate/{20120411134419_add_menu_match_to_page_positions.rb → 03_add_menu_match_to_page_positions.rb} +0 -0
  29. data/db/migrate/04_add_flex_fields_to_page_positions.rb +9 -0
  30. data/db/migrate/05_remove_refinery_page_id_from_refinery_page_positions.rb +9 -0
  31. data/db/seeds.rb +18 -0
  32. data/lib/generators/refinery/page_menus/page_menus_generator.rb +12 -2
  33. data/lib/generators/refinery/page_menus/templates/config/initializers/refinery/page_menus.rb.erb +11 -0
  34. data/lib/refinery/page_menus/configuration.rb +24 -3
  35. data/lib/refinery/page_menus/controller_extension.rb +7 -3
  36. data/lib/refinery/page_menus/engine.rb +9 -9
  37. data/lib/refinery/page_menus/instance_methods.rb +1 -1
  38. data/lib/refinery/page_menus/version.rb +18 -0
  39. data/lib/refinery/page_menus.rb +1 -2
  40. data/readme.md +66 -1
  41. metadata +91 -52
  42. data/.gitignore +0 -2
  43. data/app/views/refinery/admin/page_positions/_actions.html.erb +0 -45
  44. data/app/views/refinery/admin/page_positions/_records.html.erb +0 -14
  45. data/app/views/refinery/admin/page_positions/_sortable_list.html.erb +0 -4
  46. data/app/views/refinery/admin/page_positions/index.html.erb +0 -11
  47. data/app/views/refinery/admin/pages/_actions.html.erb +0 -40
  48. data/app/views/refinery/admin/pages/_list_actions.html.erb +0 -28
  49. data/app/views/refinery/admin/pages/_list_page.html.erb +0 -46
  50. data/app/views/refinery/admin/pages/_list_records.html.erb +0 -16
  51. data/app/views/refinery/admin/pages/list.html.erb +0 -8
  52. data/app/views/refinery/admin/pages_shared/_submenu.html.erb +0 -65
  53. data/lib/refinery/page_menus/model_extension.rb +0 -14
  54. data/license.md +0 -21
  55. data/refinerycms-page-menus.gemspec +0 -25
  56. data/spec/factories/pages.rb +0 -5
  57. data/spec/helpers/refinery/pages/content_pages_helper_spec.rb +0 -44
  58. data/spec/lib/generators/refinery/pages/pages_generator_spec.rb +0 -29
  59. data/spec/lib/pages/content_page_presenter_spec.rb +0 -43
  60. data/spec/lib/pages/content_presenter_spec.rb +0 -111
  61. data/spec/lib/pages/page_part_section_presenter_spec.rb +0 -35
  62. data/spec/lib/pages/section_presenter_spec.rb +0 -86
  63. data/spec/lib/pages/title_section_presenter_spec.rb +0 -21
  64. data/spec/lib/pages_spec.rb +0 -26
  65. data/spec/models/refinery/page_spec.rb +0 -415
  66. data/spec/requests/refinery/admin/pages_spec.rb +0 -613
  67. data/spec/requests/refinery/pages_spec.rb +0 -302
@@ -0,0 +1,24 @@
1
+ jQuery =>
2
+ $('#form-container').css('min-height', $('#left_actions').height() + "px")
3
+
4
+ $('#sortable_list, .sortable_list').addClass("reordering")
5
+ list_reorder.sortable_list.nestedSortable("enable")
6
+
7
+ $('#sortable_list').on 'click', '.header', ->
8
+ $(this).siblings('.body').slideToggle()
9
+
10
+ $('#page_menu_form').submit (e) ->
11
+ save_structure($(this))
12
+
13
+ save_structure = (form) ->
14
+ list_reorder.sortable_list.nestedSortable("disable")
15
+
16
+ $('#sortable_list, .sortable_list').removeClass("reordering")
17
+
18
+ if list_reorder.update_url != null
19
+ serialized_lists = list_reorder.sortable_list.serializelist()
20
+
21
+ for elem in serialized_lists.split('&')
22
+ if elem.length
23
+ input = $("<input>").attr("type", "hidden").attr("name", elem.split('=')[0]).val(elem.split('=')[1])
24
+ form.append(input)
@@ -0,0 +1,182 @@
1
+ .select_from{
2
+ display:block;
3
+ float:left;
4
+ width: 100%;
5
+ }
6
+
7
+ .select_to{
8
+ display:block;
9
+ float:left;
10
+ width: 100%;
11
+ }
12
+
13
+ .select_buttons {
14
+ display:inline-block;
15
+ float:left;
16
+ text-align:right;
17
+ padding-top: 180px;
18
+ width: 36px;
19
+ }
20
+
21
+
22
+ .pp-add-box {
23
+ background: #aaa;
24
+ margin-top: 20px;
25
+ width: 220px;
26
+ padding: 15px;
27
+
28
+ h3 {
29
+ margin-top: 0;
30
+ }
31
+
32
+ input[type='text'] {
33
+ width: 210px;
34
+ }
35
+
36
+ label {
37
+ margin-top: 10px;
38
+ }
39
+
40
+ .pp-selection-box {
41
+ background: white;
42
+ max-height: 140px;
43
+ padding: 10px;
44
+ overflow-y: scroll;
45
+ border: 1px solid #7f9db9;
46
+ }
47
+ }
48
+
49
+ .pp-add-box .button {
50
+ margin-top: 15px;
51
+ }
52
+
53
+ #left_actions {
54
+ position:absolute;
55
+ top: 63px;
56
+
57
+ .controls a {
58
+ background-color: #dbedff;
59
+ background-position: 12px;
60
+ background-repeat: no-repeat;
61
+ border: 1px solid #65C3F7;
62
+ display: block;
63
+ padding: 9px 12px 9px 36px;
64
+
65
+ &:hover {
66
+ background-color: #cae7fb;
67
+ }
68
+ }
69
+
70
+ .resource-pp-add-box{
71
+ label {
72
+ display: inline;
73
+ font-weight: normal;
74
+ }
75
+ }
76
+
77
+
78
+ }
79
+
80
+ #pp-select-container {
81
+ position: relative;
82
+ }
83
+
84
+ #form-container {
85
+ padding-left: 250px;
86
+ padding-right: 10px;
87
+ #sortable_list {
88
+ margin: 20px 0 0 20px;
89
+ padding: 10px 20px 20px 20px;
90
+ background: #eee;
91
+ width: 650px;
92
+ min-height: 400px;
93
+
94
+ list-style: none;
95
+
96
+ ul {
97
+ li {
98
+ list-style: none;
99
+ }
100
+ list-style: none;
101
+ }
102
+
103
+ .pp-placeholder {
104
+ margin-top: 10px;
105
+ cursor: default;
106
+ }
107
+ }
108
+
109
+ }
110
+
111
+
112
+ .pp-link {
113
+ position: relative;
114
+ margin-top: 10px!important;
115
+ list-style: none;
116
+
117
+ .header {
118
+ height: 20px;
119
+ line-height: 20px;
120
+ padding: 8px;
121
+ background: #c3e1ff;
122
+
123
+ &:hover {
124
+ background: #add6ff;
125
+ }
126
+
127
+ .type {
128
+ position: absolute;
129
+ top: 8px;
130
+ right: 36px;
131
+ }
132
+
133
+ .arrow {
134
+ background-repeat: no-repeat;
135
+ background-image: url(/assets/refinery/icons/down.gif);
136
+ background-position:center;
137
+ position: absolute;
138
+ right: 0px;
139
+ top: 0px;
140
+ width: 36px;
141
+ height: 36px;
142
+ cursor: pointer;
143
+ }
144
+ }
145
+
146
+ .body {
147
+ display: none;
148
+ background: #dbedff;
149
+ padding: 15px;
150
+ height: 100px;
151
+ position: relative;
152
+
153
+ label {
154
+ display: inline-block;
155
+ margin-right: 10px;
156
+ margin-top: 0;
157
+ width: 100px;
158
+ text-align: right;
159
+ }
160
+
161
+ input {
162
+ width: 250px;
163
+ }
164
+
165
+ a.remove {
166
+ position: absolute;
167
+ right: 10px;
168
+ bottom: 10px;
169
+ cursor: pointer;
170
+ }
171
+
172
+ .original-resource {
173
+ display: inline-block;
174
+ margin: 5px 0;
175
+ }
176
+ }
177
+
178
+ }
179
+
180
+ .field input[type=text] {
181
+ padding: 3px 5px;
182
+ }
@@ -2,8 +2,64 @@ module Refinery
2
2
  module Admin
3
3
  class PageMenusController < ::Refinery::AdminController
4
4
 
5
- crudify :'refinery/page_menu', :xhr_paging => true, :sortable => false, :redirect_to_url => "refinery.admin_page_menu_page_positions_path(@page_menu)"
5
+ crudify :'refinery/page_menu',
6
+ :xhr_paging => true,
7
+ :sortable => false
8
+
9
+ before_filter :find_page_positions, only: [:edit, :update]
10
+ before_filter :set_page_positions, only: [:create, :update]
11
+
12
+ private
13
+
14
+ # Based upon http://github.com/matenia/jQuery-Awesome-Nested-Set-Drag-and-Drop
15
+ def set_page_positions
16
+ previous = nil
17
+ params[:ul].each do |_, list|
18
+ list.each do |index, hash|
19
+ moved_item_id = hash['id'].split(/page_position\_?/).reject(&:empty?).first
20
+
21
+ if moved_item_id
22
+ current_position = @page_menu.positions.find(moved_item_id) # Scope?
23
+
24
+ if current_position.respond_to?(:move_to_root)
25
+ if previous.present?
26
+ current_position.move_to_right_of(@page_menu.positions.find(previous)) #SCOPE?
27
+ else
28
+ current_position.move_to_root
29
+ end
30
+ else
31
+ current_position.update_attributes :position => index
32
+ end
33
+
34
+ if hash['children'].present?
35
+ update_child_page_positions(hash, current_position)
36
+ end
6
37
 
38
+ previous = moved_item_id
39
+ end
40
+ end
41
+ end if params[:ul].present?
42
+
43
+ PagePosition.rebuild!
44
+ end
45
+
46
+ def update_child_page_positions(_node, position)
47
+ list = _node['children']['0']
48
+ list.each do |index, child|
49
+ child_id = child['id'].split(/page_position\_?/).reject(&:empty?).first
50
+ child_position = @page_menu.positions.find(child_id) # Scoped?
51
+ child_position.move_to_child_of(position)
52
+
53
+ if child['children'].present?
54
+ update_child_page_positions(child, child_position)
55
+ end
56
+ end
57
+ end
58
+
59
+ def find_page_positions
60
+ @page_positions = @page_menu.roots
61
+ end
62
+
7
63
  end
8
64
  end
9
65
  end
@@ -2,49 +2,29 @@ module Refinery
2
2
  module Admin
3
3
  class PagePositionsController < Refinery::AdminController
4
4
 
5
- crudify :'refinery/page_position',
6
- :order => "lft ASC",
7
- :include => [:children],
8
- :paging => false
9
-
10
- before_filter :find_all_menus, :find_menu, :only => [:index, :update_positions]
11
-
12
- # after_filter lambda{::Refinery::Page.expire_page_caching}, :only => [:update_positions]
13
-
14
- # before_filter :restrict_access, :only => [:create, :update, :update_positions, :destroy],
15
- # :if => proc { Refinery.i18n_enabled? }
16
-
17
-
18
- def children
19
- @page_position = find_page_position
20
- render :layout => false
21
- end
22
-
23
- protected
24
-
25
- def find_all_page_positions(conditions = '')
26
- @page_positions = @page_menu.positions.where(conditions).order('lft ASC')
27
- end
28
-
29
- def find_menu
30
- if params[:page_menu_id]
31
- @page_menu = Refinery::PageMenu.find(params[:page_menu_id])
5
+ def create
6
+ respond_to do |format|
7
+ format.js do
8
+ @page_positions = []
9
+ if params[:refinery_resource_ids]
10
+ params[:refinery_resource_ids].each do |id|
11
+ @page_positions << PagePosition.create({refinery_resource_id: id}.merge(params[:page_position]))
12
+ end
13
+ else
14
+ @page_positions << PagePosition.create(params[:page_position])
15
+ end
16
+ end
32
17
  end
33
18
  end
34
19
 
35
- def find_all_menus
36
- @page_menus = Refinery::PageMenu.order('title ASC')
20
+ def destroy
21
+ respond_to do |format|
22
+ format.js do
23
+ @page_position = PagePosition.find(params[:id])
24
+ @page_position.destroy
25
+ end
26
+ end
37
27
  end
38
-
39
- # def restrict_access
40
- # if current_refinery_user.has_role?(:translator) && !current_refinery_user.has_role?(:superuser) &&
41
- # (params[:switch_locale].blank? || params[:switch_locale] == Refinery::I18n.default_frontend_locale.to_s)
42
- # flash[:error] = t('translator_access', :scope => 'refinery.admin.pages')
43
- # redirect_to refinery.admin_pages_path
44
- # end
45
- #
46
- # return true
47
- # end
48
28
 
49
29
  end
50
30
  end
@@ -0,0 +1,66 @@
1
+ module Refinery
2
+ module PagePositionsHelper
3
+ require 'nokogiri'
4
+
5
+ def render_menu_list(page_positions)
6
+ results = "".html_safe
7
+ page_positions.each do |page_position|
8
+ if page_position.custom_link?
9
+ results << render_custom_menu_link(page_position)
10
+ else
11
+ results << render_resource_menu_link(page_position)
12
+ end
13
+ end
14
+ results
15
+ end
16
+
17
+ def render_custom_menu_link(page_position)
18
+ list_partial = render(partial: "custom_page_position", locals: {page_position: page_position})
19
+
20
+ dom = Nokogiri::HTML.fragment(list_partial)
21
+ li = dom.css('li').first
22
+
23
+ # append nested ul to end of this li
24
+ li << nested_ul(page_position)
25
+
26
+ dom.to_s.html_safe
27
+ end
28
+
29
+ def render_resource_menu_link(page_position)
30
+ list_partial = render(:partial => page_position.resource_config[:admin_partial], :collection => [page_position.resource])
31
+
32
+ dom = Nokogiri::HTML.fragment(list_partial)
33
+ li = dom.css('li').first
34
+
35
+ # change li's id to that of the page_partial
36
+ li['id'] = dom_id(page_position)
37
+
38
+ # wrap inside of li in div if it's not already
39
+ if dom.css('li > div').empty?
40
+ div = Nokogiri.make("<div class='clearfix'></div>")
41
+ div.children = li.children
42
+ li.children = div
43
+ end
44
+
45
+ # edit title to show actual link label as well
46
+ title_div = dom.css('.title').first
47
+ if title_div.present?
48
+ title_div.content = page_position.label
49
+ end
50
+
51
+ # append nested ul to end of this li
52
+ li << nested_ul(page_position)
53
+
54
+ dom.to_s.html_safe
55
+ end
56
+
57
+ def nested_ul(page_position)
58
+ # recursively create nested list of children
59
+ content_tag :ul, class: 'nested' do
60
+ render_menu_list(page_position.children)
61
+ end
62
+ end
63
+
64
+
65
+ end
66
+ end
@@ -2,26 +2,14 @@ module Refinery
2
2
  class PageMenu < Refinery::Core::BaseModel
3
3
 
4
4
  has_many :positions, :class_name => "::Refinery::PagePosition", :foreign_key => :refinery_menu_id, :dependent => :destroy, :order => "lft ASC"
5
- has_many :pages, :class_name => "::Refinery::Page", :through => :positions, :foreign_key => :refinery_page_id
6
5
 
7
6
  validates :title, :presence => true, :uniqueness => true
8
7
  validates :permatitle, :presence => true, :uniqueness => true
9
8
  validates_associated :positions
10
9
 
11
- def pages=(new_ids)
12
- old_ids = positions.map(&:refinery_page_id)
13
- (new_ids - old_ids).each do |id|
14
- positions.build(:refinery_page_id => id) if !id.empty?
15
- end
16
- (old_ids - new_ids).each do |id|
17
- positions.where(:refinery_page_id => id).destroy_all
18
- end
19
- self.save
20
- end
21
-
22
- # def fast_menu(columns = [])
23
- # live.in_menu.order('lft ASC').includes(:translations)
24
- # end
10
+ attr_accessible :title, :permatitle, :positions, :positions_attributes
11
+
12
+ accepts_nested_attributes_for :positions, :allow_destroy => true
25
13
 
26
14
  def roots
27
15
  @roots ||= positions.select {|pos| pos.parent_id.nil?}
@@ -1,36 +1,108 @@
1
1
  module Refinery
2
2
  class PagePosition < Refinery::Core::BaseModel
3
3
 
4
- attr_accessible :parent_id, :refinery_page_id, :refinery_menu_id
4
+ attr_accessible :parent_id, :refinery_page_id, :refinery_menu_id, :refinery_resource_id, :refinery_resource_type,
5
+ :title_attribute, :custom_url, :label
5
6
 
6
7
  belongs_to :menu, :class_name => '::Refinery::PageMenu', :foreign_key => :refinery_menu_id
7
- belongs_to :page, :class_name => '::Refinery::Page', :foreign_key => :refinery_page_id
8
+ belongs_to :resource, :foreign_key => :refinery_resource_id, :polymorphic => true
8
9
 
9
10
  # Docs for acts_as_nested_set https://github.com/collectiveidea/awesome_nested_set
10
11
  # rather than :delete_all we want :destroy
11
12
  acts_as_nested_set :dependent => :destroy
12
13
 
13
- validates :page, :presence => true
14
14
  validates :menu, :presence => true
15
+
16
+ def self.find_all_of_type(type)
17
+ # find all resources of the given type, determined by the configuration
18
+ # TODO - we may want to allow configuration of conditions (DONE), ordering, etc
19
+ if self.resource_config(type)[:admin_page_filter]
20
+ resource_klass(type).where(self.resource_config(type)[:admin_page_filter])
21
+ else
22
+ resource_klass(type).all
23
+ end
24
+ end
25
+
26
+ def self.resource_klass(type)
27
+ resource_config(type)[:klass].constantize
28
+ end
29
+
30
+ def self.resource_config(type)
31
+ Refinery::PageMenus.menu_resources[type.to_sym]
32
+ end
33
+
34
+ def resource_klass
35
+ Refinery::PagePosition.resource_klass(resource_type)
36
+ end
37
+
38
+ def resource_config
39
+ Refinery::PagePosition.resource_config(resource_type)
40
+ end
41
+
42
+ def resource_type
43
+ refinery_resource_type || 'refinery_page'
44
+ end
15
45
 
46
+ def type_name
47
+ custom_link? ? "Custom link" : refinery_resource_type.titleize()
48
+ end
49
+
50
+ def custom_link?
51
+ refinery_resource_id.nil? || refinery_resource_type.nil?
52
+ end
53
+
54
+ def resource_link?
55
+ refinery_resource_id.present? && refinery_resource_type.present?
56
+ end
57
+
58
+ def resource
59
+ return nil if custom_link?
60
+ resource_klass.find(refinery_resource_id)
61
+ end
62
+
63
+ def resource_url
64
+ resource.present? ? resource.url : '/'
65
+ end
66
+
67
+ def resource_title
68
+ resource[resource_config[:title_attr]]
69
+ end
70
+
16
71
  def title
17
- page.title
72
+ title_attribute.present? ? title_attribute : label.present? ? label : resource.title
18
73
  end
19
74
 
20
75
  def url
21
- page.url
22
- end
23
-
24
- def url=(value)
25
- page.url = value
76
+ if custom_link?
77
+ custom_url
78
+ else
79
+ resource_url
80
+ end
26
81
  end
27
-
28
- def original_id
29
- page.id
82
+
83
+ def as_json(options={})
84
+ json = super(options)
85
+ if resource_link?
86
+ json = {
87
+ resource: {
88
+ title: resource_title
89
+ }
90
+ }.merge(json)
91
+ end
92
+ json
30
93
  end
31
-
32
- def original_type
33
- page.type
94
+
95
+ def to_refinery_menu_item
96
+ {
97
+ :id => id,
98
+ :lft => lft,
99
+ :menu_match => menu_match,
100
+ :parent_id => parent_id,
101
+ :rgt => rgt,
102
+ :title => title,
103
+ :type => self.class.name,
104
+ :url => url
105
+ }
34
106
  end
35
107
 
36
108
  end
@@ -1,41 +1,33 @@
1
- <%= form_for [refinery, :admin, @page_menu], :html => {:onsubmit => "selectAll('.select_to')" } do |f| -%>
2
- <%= render '/refinery/admin/error_messages',
3
- :object => @page_menu,
4
- :include_object_name => true %>
5
-
1
+ <%= form_for [refinery, :admin, @page_menu], html: { id: 'page_menu_form' } do |f| %>
6
2
  <div class='field'>
7
3
  <%= f.label :title %>
8
4
  <%= f.text_field :title, class: "larger widest" %>
9
- </div>
5
+ </div>
6
+ <div id='form-container'>
7
+
8
+ <%= render '/refinery/admin/error_messages',
9
+ :object => @page_menu,
10
+ :include_object_name => true %>
11
+
10
12
 
11
-
12
- <div class='select'>
13
-
14
- <div class="hemisquare">
15
- <span class='label_with_help'>
16
- <%= label_tag :all_pages, t('.all_pages') %>
17
- <%= refinery_help_tag t('.all_pages_help') %>
18
- </span>
19
- <%= collection_select :all, :pages, Refinery::Page.all - @page_menu.pages, :id, :title, {}, { :allow_blank => true, :size => 20, :multiple => true, :class => "select_from" } %>
20
- </div>
21
-
22
- <div class='select_buttons'>
23
- <%= button_tag ">", :type => 'button', :onclick => "moveSelectedPage('.select_from','.select_to')", :class => 'select_add' %>
24
- <%= button_tag "<", :type => 'button', :onclick => "moveSelectedPage('.select_to','.select_from')", :class => 'select_remove' %>
25
- </div>
26
-
27
- <div class="hemisquare right_side">
28
- <span class='label_with_help'>
29
- <%= f.label :pages, t('.menu_pages') %>
30
- <%= refinery_help_tag t('.pages_help') %>
31
- </span>
32
- <%= f.collection_select :pages, @page_menu.pages, :id, :title, {}, { :allow_blank => true, :size => 20, :multiple => true, :class => "select_to" } %>
33
- </div>
34
-
13
+
14
+ <ul id="sortable_list">
15
+ <% if @page_positions.present? %>
16
+ <% @page_positions.each do |page_position| %>
17
+ <%= render partial: 'refinery/admin/page_positions/page_position', object: page_position %>
18
+ <% end %>
19
+ <% else %>
20
+ <li class='pp-placeholder' id="">
21
+ <%# We need a div here so we don't get a js error for a empty list %>
22
+ <div>Use the left side to add links to your menu.</div>
23
+ </li>
24
+ <% end %>
25
+ </ul>
35
26
  </div>
36
-
27
+
28
+
37
29
  <%= render '/refinery/admin/form_actions', :f => f,
38
- :continue_editing => false,
39
- :delete_title => t('delete', :scope => 'refinery.travels.admin.travels.category'),
40
- :delete_confirmation => t('message', :scope => 'refinery.admin.delete') %>
41
- <% end %>
30
+ :continue_editing => false,
31
+ :delete_title => t('delete', :scope => 'refinery.travels.admin.travels.category'),
32
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete') %>
33
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <div id='left_actions'>
2
+
3
+ <div id="custom_url_box" class="pp-add-box">
4
+ <%= form_for [refinery, :admin, @page_menu.positions.build], remote: true do |f| %>
5
+ <%= f.hidden_field :refinery_menu_id %>
6
+ <h3>Custom Link</h3>
7
+ <div class='field'>
8
+ <%= f.label :custom_url, "Url" %>
9
+ <%= f.text_field :custom_url %>
10
+ </div>
11
+ <div class='field'>
12
+ <%= f.label :label %>
13
+ <%= f.text_field :label %>
14
+ </div>
15
+ <%= f.submit "Add" %>
16
+ <% end %>
17
+ </div>
18
+
19
+ <% Refinery::PageMenus.menu_resources.each do |resource_type, config| %>
20
+ <%= render partial: "refinery/admin/page_positions/resource_link_editor_box", locals: { resource_type: resource_type, config: config } %>
21
+ <% end %>
22
+
23
+ </div>
@@ -0,0 +1,16 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%#= dom_id(test) %>">
2
+ <span class='title'>
3
+ <%= page_menu.title %>
4
+
5
+ </span>
6
+ <span class='actions'>
7
+
8
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_admin_page_menu_path(page_menu),
9
+ :title => t('.edit') %>
10
+ <%= link_to refinery_icon_tag("delete.png"), refinery.admin_page_menu_path(page_menu),
11
+ :class => "cancel confirm-delete",
12
+ :title => t('.delete'),
13
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => page_menu.title),
14
+ :method => :delete %>
15
+ </span>
16
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @page_mennus if Refinery::Admin::PageMenusController.pageable? %>
2
+ <%= render 'sortable_list' %>