diff --git a/app/models/link_list_block.rb b/app/models/link_list_block.rb index e23c07b..7686a73 100644 --- a/app/models/link_list_block.rb +++ b/app/models/link_list_block.rb @@ -1,5 +1,29 @@ class LinkListBlock < Block + ICONS = [ + ['edit', N_('Edit')], + ['new', N_('New')], + ['save', N_('Save')], + ['send', N_('Send')], + ['cancel', N_('Cancel')], + ['add', N_('Add')], + ['up', N_('Up')], + ['down', N_('Down')], + ['left', N_('Left')], + ['right', N_('Right')], + ['up-disabled', N_('Gray Up')], + ['down-disabled', N_('Gray Down')], + ['left-disabled', N_('Gray Left')], + ['right-disabled', N_('Gray Right')], + ['up-red', N_('Red Up')], + ['search', N_('Search')], + ['ok', N_('Ok')], + ['login', N_('Login')], + ['help', N_('Help')], + ['spread', N_('Spread')], + ['eyes', N_('Eyes')] + ] + settings_items :links, Array, :default => [] before_save do |block| @@ -13,14 +37,19 @@ class LinkListBlock < Block def help _('This block can be used to create a menu of links. You can add, remove and update the links as you wish.') end - + def content block_title(title) + content_tag('ul', - links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_to(i[:name], expand_address(i[:address])))} + links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_html(i))} ) end + def link_html(link) + klass = 'icon-' + link[:icon] if link[:icon] + link_to(link[:name], expand_address(link[:address]), :class => klass) + end + def expand_address(address) if owner.respond_to?(:identifier) address.gsub('{profile}', owner.identifier) @@ -33,4 +62,11 @@ class LinkListBlock < Block true end + def icons_options(selected = nil) + ICONS.map do |i| + select = "selected='1'" if i[0] == selected + "" + end + end + end diff --git a/app/models/profile_image_block.rb b/app/models/profile_image_block.rb index 4c1f717..b67a641 100644 --- a/app/models/profile_image_block.rb +++ b/app/models/profile_image_block.rb @@ -1,5 +1,7 @@ class ProfileImageBlock < Block + settings_items :show_name, :type => :boolean, :default => false + def self.description _('A block that displays only image of profiles') end @@ -8,15 +10,20 @@ class ProfileImageBlock < Block _('This block presents the profile image.') end + def default_title + owner.name + end + def content block = self + s = show_name lambda do - render :file => 'blocks/profile_image', :locals => { :block => block } + render :file => 'blocks/profile_image', :locals => { :block => block, :show_name => s} end end def editable? - false + true end def cacheable? diff --git a/app/views/blocks/profile_image.rhtml b/app/views/blocks/profile_image.rhtml index 7597051..f6e2595 100644 --- a/app/views/blocks/profile_image.rhtml +++ b/app/views/blocks/profile_image.rhtml @@ -10,6 +10,10 @@ +<% if show_name %> +

<%= block.title %>

+<% end %> + <% if !user.nil? and user.has_permission?('edit_profile', profile) %>
<%= link_to _('Control panel'), :controller => 'profile_editor' %> diff --git a/app/views/box_organizer/_link_list_block.rhtml b/app/views/box_organizer/_link_list_block.rhtml index 0c1187b..e4aa51e 100644 --- a/app/views/box_organizer/_link_list_block.rhtml +++ b/app/views/box_organizer/_link_list_block.rhtml @@ -1,9 +1,10 @@ <%= _('Links') %>