diff --git a/.gitignore b/.gitignore index 8948c7c..a3f0b7b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,30 @@ pkg/ wiki/ # Other stuff -.idea/ \ No newline at end of file +.idea/ +.bundle/config +bin/autospec +bin/coderay +bin/erubis +bin/guard +bin/htmldiff +bin/launchy +bin/ldiff +bin/nokogiri +bin/pry +bin/rackup +bin/rails +bin/rake +bin/rake2thor +bin/rdoc +bin/refinerycms +bin/ri +bin/rspec +bin/sass +bin/sass-convert +bin/scss +bin/spork +bin/sprockets +bin/thor +bin/tilt +bin/tt \ No newline at end of file diff --git a/app/assets/stylesheets/refinery/select_form.css.scss b/app/assets/stylesheets/refinery/select_form.css.scss index 1a791cf..ad1128b 100644 --- a/app/assets/stylesheets/refinery/select_form.css.scss +++ b/app/assets/stylesheets/refinery/select_form.css.scss @@ -6,7 +6,7 @@ .select_to{ display:block; - float:left; + float:left; width: 100%; } @@ -22,7 +22,6 @@ .pp-add-box { background: #aaa; margin-top: 20px; - width: 220px; padding: 15px; h3 { @@ -51,17 +50,17 @@ } #left_actions { - position:absolute; - top: 63px; + float: left; + width: 250px; - .controls a { + .controls a { background-color: #dbedff; background-position: 12px; background-repeat: no-repeat; border: 1px solid #65C3F7; display: block; padding: 9px 12px 9px 36px; - + &:hover { background-color: #cae7fb; } @@ -74,7 +73,7 @@ } } - + } #pp-select-container { @@ -82,24 +81,21 @@ } #links-container { - padding-left: 250px; - padding-right: 10px; #sortable_list { - margin: 20px 0 0 20px; padding: 10px 20px 20px 20px; background: #eee; width: 650px; min-height: 400px; - + list-style: none; - + ul { li { list-style: none; } list-style: none; } - + .pp-placeholder { margin-top: 10px; cursor: default; @@ -133,7 +129,7 @@ .arrow { background-repeat: no-repeat; background-image: url(/assets/refinery/icons/down.gif); - background-position:center; + background-position:center; position: absolute; right: 0px; top: 0px; @@ -147,7 +143,7 @@ display: none; background: #dbedff; padding: 15px; - height: 100px; + position: relative; label { @@ -161,7 +157,7 @@ input { width: 250px; } - + a.remove { position: absolute; right: 10px; @@ -177,6 +173,11 @@ } +#page_menu_form { + float: right; + width: 700px; +} + .field input[type=text] { padding: 3px 5px; } \ No newline at end of file diff --git a/app/models/refinery/menu_link.rb b/app/models/refinery/menu_link.rb index ccf19f2..8825e89 100644 --- a/app/models/refinery/menu_link.rb +++ b/app/models/refinery/menu_link.rb @@ -1,16 +1,16 @@ module Refinery class MenuLink < Refinery::Core::BaseModel - + attr_accessible :parent_id, :refinery_page_id, :refinery_menu_id, :refinery_resource_id, :refinery_resource_type, - :title_attribute, :custom_url, :label, :menu - + :title_attribute, :custom_url, :label, :menu, :id_attribute, :class_attribute + belongs_to :menu, :class_name => '::Refinery::PageMenu', :foreign_key => :refinery_menu_id belongs_to :resource, :foreign_key => :refinery_resource_id, :polymorphic => true # Docs for acts_as_nested_set https://github.com/collectiveidea/awesome_nested_set # rather than :delete_all we want :destroy acts_as_nested_set :dependent => :destroy - + validates :menu, :presence => true validates :label, :presence => true @@ -38,12 +38,12 @@ def set_label if label.blank? if custom_link? begin - self.label = custom_url.match(/(\w+)\.\w+$/).captures.join.titleize + self.label = custom_url.match(/(\w+)\.\w+$/).captures.join.titleize rescue self.label = custom_url end else - self.label = resource.send(resource_config[:title_attr]) + self.label = resource.send(resource_config[:title_attr]) end end end @@ -59,7 +59,7 @@ def resource_config def resource_type refinery_resource_type || "Custom link" end - + def type_name resource_type.titleize end @@ -88,7 +88,7 @@ def title def resource_url resource.present? ? resource.url : '/' end - + def url if custom_link? custom_url @@ -119,9 +119,11 @@ def to_refinery_menu_item :menu_title => label, :title => title, :type => self.class.name, - :url => url + :url => url, + :id_attribute => id_attribute, + :class_attribute => class_attribute } end - + end end diff --git a/app/views/refinery/admin/menu_links/_menu_link.html.erb b/app/views/refinery/admin/menu_links/_menu_link.html.erb index 137a959..aba387c 100644 --- a/app/views/refinery/admin/menu_links/_menu_link.html.erb +++ b/app/views/refinery/admin/menu_links/_menu_link.html.erb @@ -12,12 +12,23 @@ <% else %> <%= render partial: "refinery/admin/menu_links/resource_link", object: menu_link, locals: {f: f} %> <% end %> - <%= link_to t('remove', :scope => 'refinery.admin.menu_links'), admin_menu_link_path(menu_link), - method: :delete, - remote: true, + +
+ <%= f.label :id_attribute, t('id_attribute', :scope => 'refinery.admin.menu_links') %> + <%= f.text_field :id_attribute %> +
+ +
+ <%= f.label :class_attribute %> + <%= f.text_field :class_attribute %> +
+ + <%= link_to t('remove', :scope => 'refinery.admin.menu_links'), admin_menu_link_path(menu_link), + method: :delete, + remote: true, class: 'remove' %> - +