[Git][noosfero/noosfero][master] 2 commits: Add script to standardize icons in link list block

Rodrigo Souto gitlab at mg.gitlab.com
Fri Jun 8 11:22:27 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
7b5d2619 by mendesiasmin at 2018-06-04T14:38:06Z
Add script to standardize icons in link list block

- - - - -
36a97f6f by Rodrigo Souto at 2018-06-08T14:22:22Z
Merge branch 'update-icons-script' into 'master'

Add script to standardize icons in link list block

See merge request noosfero/noosfero!1509
- - - - -


2 changed files:

- app/helpers/organization_helper.rb
- + script/update-icons


Changes:

=====================================
app/helpers/organization_helper.rb
=====================================
--- a/app/helpers/organization_helper.rb
+++ b/app/helpers/organization_helper.rb
@@ -6,7 +6,7 @@ module OrganizationHelper
       { name: _('Invite Friends'),       address: '/profile/{profile}/invite/friends', icon: 'send'      },
       { name: _('Agenda'),               address: '/profile/{profile}/events',         icon: 'event'     },
       { name: _('Image gallery'),        address: '/{profile}/gallery',                icon: 'photos'    },
-      { name: _('Blog'),                 address: '/{profile}/blog',                   icon: 'edit'      }
+      { name: _('Blog'),                 address: '/{profile}/blog',                   icon: 'blog'      }
     ]
   end
 


=====================================
script/update-icons
=====================================
--- /dev/null
+++ b/script/update-icons
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+
+require_relative '../config/environment'
+require_relative '../lib/sample_data'
+include SampleData
+
+profiles = $environment.profiles.find_each
+
+def icon_to type
+  case type
+  when "Profile", "Perfil"
+    return "menu-people"
+  when "Image gallery", "Galeria"
+    return "photos"
+  when "Agenda"
+    return "event"
+  when "Blog"
+    return "blog"
+  else
+    'no-icon'
+  end
+end
+
+print "Update icons in profiles: "
+for person in profiles
+  link_blocks = person.blocks.select do |block|
+                block.kind_of?(LinkListBlock)
+              end
+
+  for block in link_blocks
+    for link in block.links
+      link[:icon] = icon_to link[:name]
+    end
+    block.save
+  end
+  print "."
+end
+done



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/f0c286644fc748d5c0f9227b8e795a922a893b5c...36a97f6f4cf75467fa0ef3fc8b9c2236b1a3be54

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/f0c286644fc748d5c0f9227b8e795a922a893b5c...36a97f6f4cf75467fa0ef3fc8b9c2236b1a3be54
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180608/18de4d97/attachment-0001.html>


More information about the Noosfero-dev mailing list