Commit f14c04321fb3763e5ace522ba0b351a286fca37a
1 parent
b2170c10
Exists in
master
and in
29 other branches
ActionItem32: added button in control panel to reach favorite enterprises management
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1954 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
7 changed files
with
73 additions
and
1 deletions
Show diff stats
app/views/profile_editor/index.rhtml
... | ... | @@ -24,6 +24,8 @@ |
24 | 24 | |
25 | 25 | <%= file_manager_button(_('Enterprise Validation'), 'icons-app/validation.png', :controller => 'enterprise_validation') if profile.is_validation_entity? %> |
26 | 26 | |
27 | + <%= file_manager_button(_('Favorite Enterprises'), 'icons-app/favorites.png', :controller => 'favorite_enterprises') if profile.person? %> | |
28 | + | |
27 | 29 | <% end %> |
28 | 30 | |
29 | 31 | <% if @profile.person? %> | ... | ... |
public/designs/icons/default/get-icon.sh
... | ... | @@ -27,7 +27,11 @@ if [ ! -f $PNG ]; then |
27 | 27 | exit 2 |
28 | 28 | fi |
29 | 29 | |
30 | -svn add $PNG | |
30 | +if [ -e .svn ]; then | |
31 | + svn add $PNG | |
32 | +else | |
33 | + git add $PNG | |
34 | +fi | |
31 | 35 | |
32 | 36 | LINE=$(printf "%-25s %-12s %s" $PNG $THEME $SECTION) |
33 | 37 | sed -i -e "s!### END OF ICONS LISTING ###!$LINE\n&!" README | ... | ... |
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 |
12 | 12 | the original filenames (replacing .svg by .png, obviously) and create symbolic |
13 | 13 | links with names more sensible for Noosfero. |
14 | 14 | |
15 | +Adding a new icons | |
16 | +================== | |
17 | + | |
18 | +Use the fantastic script get-icon.sh! Suppose you want to add a new icon for | |
19 | +the "favorites". You find that dlg-neu theme has a nice button under apps, | |
20 | +called gtk-open.svg. You call the script as follows: | |
21 | + | |
22 | +$ sh get-icon.sh favorites epiphany-bookmarks.svg | |
23 | + | |
24 | +The script generates the PNG and create symbolic link from PNG using ICON name. | |
25 | + | |
15 | 26 | Source for icons |
16 | 27 | ================ |
17 | 28 | |
... | ... | @@ -29,6 +40,8 @@ users.png (locally modified) dlg-neu |
29 | 40 | stock_todo.png Nuovo |
30 | 41 | friends.png (modified version of users.png) Nuovo |
31 | 42 | gtk-folder.png Nuovo |
43 | +epiphany-bookmarks.png dlg-neu | |
44 | +### END OF ICONS LISTING ### | |
32 | 45 | |
33 | 46 | Icons rasterization |
34 | 47 | =================== | ... | ... |
2.85 KB
... | ... | @@ -0,0 +1,40 @@ |
1 | +#!/bin/sh | |
2 | + | |
3 | +ICON=$1 | |
4 | +THEME=$2 | |
5 | +SVG=$3 | |
6 | + | |
7 | +SECTION='apps' | |
8 | + | |
9 | +if [ -z $ICON ] || [ -z $THEME ] || [ -z $SVG ]; then | |
10 | + echo "use: $0 <ICON> <THEME> <ICON>" | |
11 | + echo "example:" | |
12 | + echo " $0 favorites dlg-neu epiphany-bookmarks.svg" | |
13 | + exit 1 | |
14 | +fi | |
15 | + | |
16 | +PNG=$(basename $SVG | sed -e 's/\.svg/\.png/') | |
17 | +SVGFILE=/usr/share/icons/$THEME/scalable/$SECTION/$SVG | |
18 | + | |
19 | +if [ ! -f $SVGFILE ]; then | |
20 | + echo "$SVGFILE not found, stopping." | |
21 | + exit 2 | |
22 | +fi | |
23 | + | |
24 | +rsvg -w 64 -h 64 $SVGFILE $PNG | |
25 | + | |
26 | +if [ ! -f $PNG ]; then | |
27 | + echo "Error creating $PNG, stopping." | |
28 | + exit 2 | |
29 | +fi | |
30 | + | |
31 | +ln -s $PNG ${ICON}.png | |
32 | + | |
33 | +if [ -e .svn ]; then | |
34 | + svn add $PNG ${ICON}.png | |
35 | +else | |
36 | + git add $PNG ${ICON}.png | |
37 | +fi | |
38 | + | |
39 | +LINE=$(printf "%-43s %s" $PNG $THEME) | |
40 | +sed -i -e "s!### END OF ICONS LISTING ###!$LINE\n&!" README | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -329,4 +329,16 @@ class ProfileEditorControllerTest < Test::Unit::TestCase |
329 | 329 | assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } |
330 | 330 | end |
331 | 331 | |
332 | + should 'show favorite enterprises button for person' do | |
333 | + person = create_user('testuser').person | |
334 | + get :index, :profile => 'testuser' | |
335 | + assert_tag :tag => 'a', :content => 'Favorite Enterprises' | |
336 | + end | |
337 | + | |
338 | + should 'not show favorite enterprises button for organization' do | |
339 | + org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact') | |
340 | + get :index, :profile => 'testorg' | |
341 | + assert_no_tag :tag => 'a', :content => 'Favorite Enterprises' | |
342 | + end | |
343 | + | |
332 | 344 | end | ... | ... |