From f14c04321fb3763e5ace522ba0b351a286fca37a Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Mon, 9 Jun 2008 02:01:38 +0000 Subject: [PATCH] ActionItem32: added button in control panel to reach favorite enterprises management --- app/views/profile_editor/index.rhtml | 2 ++ public/designs/icons/default/get-icon.sh | 6 +++++- public/images/icons-app/README | 13 +++++++++++++ public/images/icons-app/epiphany-bookmarks.png | Bin 0 -> 2920 bytes public/images/icons-app/favorites.png | 1 + public/images/icons-app/get-icon.sh | 40 ++++++++++++++++++++++++++++++++++++++++ test/functional/profile_editor_controller_test.rb | 12 ++++++++++++ 7 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 public/images/icons-app/epiphany-bookmarks.png create mode 120000 public/images/icons-app/favorites.png create mode 100644 public/images/icons-app/get-icon.sh diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index 39189c7..2270fd7 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -24,6 +24,8 @@ <%= file_manager_button(_('Enterprise Validation'), 'icons-app/validation.png', :controller => 'enterprise_validation') if profile.is_validation_entity? %> + <%= file_manager_button(_('Favorite Enterprises'), 'icons-app/favorites.png', :controller => 'favorite_enterprises') if profile.person? %> + <% end %> <% if @profile.person? %> diff --git a/public/designs/icons/default/get-icon.sh b/public/designs/icons/default/get-icon.sh index 6fe3174..ed62623 100644 --- a/public/designs/icons/default/get-icon.sh +++ b/public/designs/icons/default/get-icon.sh @@ -27,7 +27,11 @@ if [ ! -f $PNG ]; then exit 2 fi -svn add $PNG +if [ -e .svn ]; then + svn add $PNG +else + git add $PNG +fi LINE=$(printf "%-25s %-12s %s" $PNG $THEME $SECTION) sed -i -e "s!### END OF ICONS LISTING ###!$LINE\n&!" README diff --git a/public/images/icons-app/README b/public/images/icons-app/README index e82cbff..1f89bb4 100644 --- a/public/images/icons-app/README +++ b/public/images/icons-app/README @@ -12,6 +12,17 @@ To keep a trace back to the theme theme, when rasterizing the SVG files we keep the original filenames (replacing .svg by .png, obviously) and create symbolic links with names more sensible for Noosfero. +Adding a new icons +================== + +Use the fantastic script get-icon.sh! Suppose you want to add a new icon for +the "favorites". You find that dlg-neu theme has a nice button under apps, +called gtk-open.svg. You call the script as follows: + +$ sh get-icon.sh favorites epiphany-bookmarks.svg + +The script generates the PNG and create symbolic link from PNG using ICON name. + Source for icons ================ @@ -29,6 +40,8 @@ users.png (locally modified) dlg-neu stock_todo.png Nuovo friends.png (modified version of users.png) Nuovo gtk-folder.png Nuovo +epiphany-bookmarks.png dlg-neu +### END OF ICONS LISTING ### Icons rasterization =================== diff --git a/public/images/icons-app/epiphany-bookmarks.png b/public/images/icons-app/epiphany-bookmarks.png new file mode 100644 index 0000000..f5f000b Binary files /dev/null and b/public/images/icons-app/epiphany-bookmarks.png differ diff --git a/public/images/icons-app/favorites.png b/public/images/icons-app/favorites.png new file mode 120000 index 0000000..fd8b67a --- /dev/null +++ b/public/images/icons-app/favorites.png @@ -0,0 +1 @@ +epiphany-bookmarks.png \ No newline at end of file diff --git a/public/images/icons-app/get-icon.sh b/public/images/icons-app/get-icon.sh new file mode 100644 index 0000000..da7071f --- /dev/null +++ b/public/images/icons-app/get-icon.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +ICON=$1 +THEME=$2 +SVG=$3 + +SECTION='apps' + +if [ -z $ICON ] || [ -z $THEME ] || [ -z $SVG ]; then + echo "use: $0 " + echo "example:" + echo " $0 favorites dlg-neu epiphany-bookmarks.svg" + exit 1 +fi + +PNG=$(basename $SVG | sed -e 's/\.svg/\.png/') +SVGFILE=/usr/share/icons/$THEME/scalable/$SECTION/$SVG + +if [ ! -f $SVGFILE ]; then + echo "$SVGFILE not found, stopping." + exit 2 +fi + +rsvg -w 64 -h 64 $SVGFILE $PNG + +if [ ! -f $PNG ]; then + echo "Error creating $PNG, stopping." + exit 2 +fi + +ln -s $PNG ${ICON}.png + +if [ -e .svn ]; then + svn add $PNG ${ICON}.png +else + git add $PNG ${ICON}.png +fi + +LINE=$(printf "%-43s %s" $PNG $THEME) +sed -i -e "s!### END OF ICONS LISTING ###!$LINE\n&!" README diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 2642a16..5fc2998 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -329,4 +329,16 @@ class ProfileEditorControllerTest < Test::Unit::TestCase assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } end + should 'show favorite enterprises button for person' do + person = create_user('testuser').person + get :index, :profile => 'testuser' + assert_tag :tag => 'a', :content => 'Favorite Enterprises' + end + + should 'not show favorite enterprises button for organization' do + org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact') + get :index, :profile => 'testorg' + assert_no_tag :tag => 'a', :content => 'Favorite Enterprises' + end + end -- libgit2 0.21.2