Commit 37c662dcecdd09fb0673ae026702385e9a82672f

Authored by AntonioTerceiro
1 parent 38968b25

ActionItem21: checkpoint



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@970 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/cms_controller.rb
... ... @@ -3,6 +3,8 @@ class CmsController < MyProfileController
3 3 # FIXME add the access control again
4 4 # protect 'post_content', :profile, :only => [:edit, :new, :reorder, :delete]
5 5  
  6 + design :holder => :profile
  7 +
6 8 include CmsHelper
7 9  
8 10 def view
... ... @@ -11,7 +13,7 @@ class CmsController < MyProfileController
11 13 end
12 14  
13 15 def index
14   - @article = profile.home_page
  16 + @article = nil
15 17 @subitems = profile.top_level_articles
16 18 render :action => 'view'
17 19 end
... ...
app/helpers/application_helper.rb
... ... @@ -314,4 +314,39 @@ module ApplicationHelper
314 314 content_tag('div', link_to(image_tag(icon, :alt => title, :title => title) + content_tag('div', title), url), :class => 'file-manager-button')
315 315 end
316 316  
  317 + def hide(id)
  318 + "Element.hide(#{id.inspect});"
  319 + end
  320 +
  321 + def show(id)
  322 + "Element.show(#{id.inspect});"
  323 + end
  324 +
  325 + def toggle_panel(hide_label, show_label, id)
  326 + hide_button_id = id + "-hide"
  327 + show_button_id = id + "-show"
  328 +
  329 + result = ""
  330 + result << button_to_function('close', hide_label, hide(id) + hide(hide_button_id) + show(show_button_id), :id => hide_button_id, :class => 'hide-button with_text')
  331 + result < " "
  332 + result << button_to_function('open', show_label, show(id) + show(hide_button_id) + hide(show_button_id), :id => show_button_id, :class => 'show-button with_text', :style => 'display: none;' )
  333 +
  334 + result
  335 + end
  336 +
  337 + def button(type, label, url, html_options = {})
  338 + design_display_button(type, label, url, { :class => 'with_text' }.merge(html_options))
  339 + end
  340 +
  341 + def button_to_function(type, label, js_code, html_options = {})
  342 + #design_display_function_button(type, label, js_code, { :class => 'with_text' }.merge(html_options))
  343 + html_options[:class] = "" unless html_options[:class]
  344 + html_options[:class] << " button #{type}"
  345 + link_to_function(label, js_code, html_options)
  346 + end
  347 +
  348 + def icon(icon_name)
  349 + design_display_icon(icon_name, :style => 'width: 24px; height: 24px; display: inline;')
  350 + end
  351 +
317 352 end
... ...
app/helpers/cms_helper.rb
1 1 module CmsHelper
2 2  
3 3 def link_to_edit_article(article)
4   - link_to(_("Edit"), url_for_edit_article(article))
  4 + button('edit', _("Edit"), url_for_edit_article(article))
5 5 end
6 6  
7 7 def url_for_edit_article(article)
... ... @@ -11,7 +11,7 @@ module CmsHelper
11 11  
12 12 def link_to_new_article(mime_type)
13 13 action = mime_type.gsub('/', '_') + '_new'
14   - link_to(_("New %s") % mime_type, :action => action, :parent_id => params[:parent_id])
  14 + button('new', _("New %s") % mime_type, :action => action, :parent_id => params[:parent_id])
15 15 end
16 16  
17 17 end
... ...
app/views/cms/text_html_new.rhtml
... ... @@ -6,9 +6,9 @@
6 6  
7 7 <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %>
8 8  
9   - <%= f.text_field 'name' %>
  9 + <%= f.text_field 'name', :size => '64' %>
10 10  
11   - <%= f.text_area('body') %>
  11 + <%= f.text_area('body', :cols => 64) %>
12 12  
13 13 <%= submit_tag _('Save') %>
14 14  
... ...
app/views/cms/view.rhtml
1 1 <% if @article %>
2   - <h2>
  2 + <h2 id='article-full-path'>
  3 + <%= icon('cms') %>
3 4 <%= link_to profile.identifier, :action => 'index' %>
4 5 <%= @article.hierarchy.map {|item| " / " + ((item == @article) ? item.name : link_to(item.name, :id => item.id)) } %>
5 6 </h2>
  7 +<% else %>
  8 + <h2>
  9 + <%= icon('cms') %>
  10 + <%= _('Content management') %>
  11 + </h2>
  12 + <div style='margin-bottom: 1em;'>
  13 + <%= button('new', _('New article'), :action => 'new') %>
  14 + </div>
6 15 <% end %>
7 16  
8   -<%# list the children %>
  17 +<%# subitem %>
  18 +<%= toggle_panel(_('Hide subitems'), _('Show subitems'), 'article-subitems') unless @subitems.empty? %>
  19 +<div id='article-subitems'>
  20 + <div class='file-manager-title'><%= @article ? _('Subitems') : _('Articles') %></div>
  21 + <div class='file-manager-small'>
  22 + <% unless @subitems.empty? %>
  23 + <ul>
  24 + <% @subitems.each do |item| %>
  25 + <li>
  26 + <%= file_manager_button(item.name, "icons-mime/#{item.icon_name}", :action => 'view', :id => item.id) %>
  27 + </li>
  28 + <% end %>
  29 + </ul>
  30 + <% end %>
9 31  
10   -<div class='article-children'>
  32 + <% if @article %>
  33 + <div class='file-manager-controls'>
  34 + <%= button('new', _('New subitem'), :action => 'new', :parent_id => @article.id) %>
  35 + </div>
  36 + <% end %>
11 37  
12   - <div class='file-manager-small'>
13   - <ul>
14   - <% @subitems.each do |item| %>
15   - <li>
16   - <%= file_manager_button(item.name, "icons-mime/#{item.icon_name}", :action => 'view', :id => item.id) %>
17   - </li>
18   - <% end %>
19   - </ul>
20   - </div>
21   -
22   - <% if @article %>
23   - <%= link_to _('New subitem'), :action => 'new', :parent_id => @article.id %>
24   - <% else %>
25   - <%= link_to _('New article'), :action => 'new' %>
26   - <% end %>
27   -
28   -</div>
  38 + </div>
  39 +</div> <!-- article-children -->
29 40  
30 41 <%# display the article content %>
  42 +<div id='article-contents'>
  43 + <% if @article %>
  44 + <h2><%= @article.name %></h2>
  45 + <div id='article-controls'>
31 46  
32   -<% if @article %>
33   - <%= link_to_edit_article(@article) %>
34   - <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post } %>
35   - <h2><%= @article.name %></h2>
36   - <%= @article.to_html %>
37   -<% end %>
  47 + <%= link_to_edit_article(@article) %>
  48 +
  49 + <%= button('home', _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post }) %>
  50 + </div>
  51 + <%= @article.to_html %>
  52 + <% end %>
  53 +</div>
... ...
app/views/layouts/application.rhtml
... ... @@ -14,6 +14,7 @@
14 14 <%= stylesheet_link_tag 'common' %>
15 15 <%= stylesheet_link_tag 'help' %>
16 16 <%= stylesheet_link_tag 'menu' %>
  17 + <%= stylesheet_link_tag 'button' %>
17 18 <%= javascript_include_tag 'menu' %>
18 19 <%# cms stuff %>
19 20 <% if params[:controller] == 'cms' %>
... ... @@ -70,13 +71,8 @@
70 71 <div id='header_content'>
71 72 </div>
72 73  
73   - <% if params[:controller] == 'cms' %>
74   - <div id='boxes'><a name="content"> </a>
75   - <%= yield %>
76   - </div>
77   - <% else %>
78   - <%= design_display(yield) %>
79   - <% end %>
  74 + <%= design_display(yield) %>
  75 +
80 76 </div><!-- id="content" -->
81 77 <div id="footer_content"><!-- Rodape do onteudo -->
82 78 </div><!-- id="footer_content" -->
... ...
app/views/shared/tiny_mce.rhtml
... ... @@ -6,8 +6,8 @@ tinyMCE.init({
6 6 plugins: "paste,searchreplace,print",
7 7 theme_advanced_toolbar_location : "top",
8 8 theme_advanced_layout_manager: 'SimpleLayout',
9   - theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,undo,redo,separator,formatselect,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,table,separator,cleanup,code,separator,help",
10   - theme_advanced_buttons2 : "copy,paste,pastetext,pasteword,search,replace,print",
  9 + theme_advanced_buttons1 : "print,separator,copy,paste,pastetext,pasteword,separator,undo,redo,separator,search,replace,separator,formatselect,separator,help",
  10 + theme_advanced_buttons2 : "bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,table,separator,cleanup,code",
11 11 theme_advanced_buttons3 : "",
12 12 apply_source_formatting : true,
13 13 language: <%= language.inspect %>,
... ...
public/designs/icons/default/README 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +Source and Licensing
  2 +====================
  3 +
  4 +Icon Source theme Source section License
  5 +------------------------- ------------ -------------- -------
  6 +gtk-edit.png dlg-neu stock/ GPLv2+
  7 +gnome-home.png Nuovo apps/ GPLv2+
  8 +gtk-new.png Nuovo stock/ GPLv2+
  9 +gtk-close.png Nuovo stock/ GPLv2+
  10 +gtk-open.png Nuovo stock/ GPLv2+
  11 +abiword_48.png dlg-neu apps/ GPLv2+
... ...
public/designs/icons/default/abiword_48.png 0 → 100644

1.44 KB

public/designs/icons/default/gnome-home.png 0 → 100644

1.09 KB

public/designs/icons/default/gtk-close.png 0 → 100644

1.06 KB

public/designs/icons/default/gtk-edit.png 0 → 100644

1.1 KB

public/designs/icons/default/gtk-new.png 0 → 100644

540 Bytes

public/designs/icons/default/gtk-open.png 0 → 100644

905 Bytes

public/designs/icons/default/style.css
1   -
2   -.none_add { background-image: url('none.png') }
3   -.add { background-image: url('add.png') }
4   -.search { background-image: url('search.png') }
5   -.edit_small { background-image: url('edit_small.png') }
6   -.view_small { background-image: url('view_small.png') }
7   -.del_small { background-image: url('del_small.png') }
8   -.edit { background-image: url('edit.png') }
9   -.save { background-image: url('save.png') }
10   -.back { background-image: url('back.png') }
11   -.reset { background-image: url('reset.png') }
12   -.image { background-image: url('image.png') }
13   -.password { background-image: url('password.png') }
14   -.go-jump { background-image: url('go-jump.png') }
15   -.system-log-out { background-image: url('system-log-out.png') }
16   -.previous_page { background-image: url('go-previous.png') }
17   -.next_page { background-image: url('go-next.png') }
18   -.new_entry { background-image: url('new_entry.png') }
19   -.history { background-image: url('history.png') }
20   -.help { background-image: url('help.png') }
21   -.show_documents_small { background-image: url('del_small.png') }
22   -.add_document_small { background-image: url('del_small.png') }
23   -
24   -/* * * Menu Icons * * */
25   -
26   -.departments { background-image: url('departments.png') }
27   -.ledgers { background-image: url('ledgers.png') }
28   -.point_of_sale { background-image: url('point_of_sale.png') }
29   -.stock { background-image: url('stock.png') }
30   -.documents { background-image: url('documents.png') }
31   -.categories { background-image: url('categories.png') }
32   -.system_actors { background-image: url('system_actors.png') }
33   -.permissions { background-image: url('permissions.png') }
34   -.mass_mails { background-image: url('mass_mails.png') }
35   -.store { background-image: url('store.png') }
36   -.organizations { background-image: url('organizations.png') }
37   -.banks { background-image: url('banks.png') }
38   -.product_icon { background-image: url('banks.png'); border: 2px solid red }
39   -.worker_icon { background-image: url('banks.png'); border: 2px solid red }
40   -.supplier_icon { background-image: url('banks.png'); border: 2px solid red }
41   -.customer_icon { background-image: url('banks.png'); border: 2px solid red }
  1 +.button.edit { background-image: url(gtk-edit.png); }
  2 +.button.home { background-image: url(gnome-home.png); }
  3 +.button.new { background-image: url(gtk-new.png); }
  4 +.button.close { background-image: url(gtk-close.png); }
  5 +.button.open { background-image: url(gtk-open.png); }
  6 +.button.cms { background-image: url(abiword_48.png)}
42 7  
... ...
public/stylesheets/button.css 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +.button {
  2 + border: none;
  3 + margin-left: 5px;
  4 + background-color: transparent;
  5 + background-repeat: no-repeat;
  6 + background-position: 0px;
  7 +
  8 + padding-left: 25px;
  9 +}
  10 +
  11 +a.button , a.button:visited {
  12 + color: black;
  13 + text-decoration: none;
  14 +}
  15 +
  16 +a.button:hover {
  17 + background-color: #ace;
  18 +}
  19 +
  20 +
... ...
public/stylesheets/common.css
... ... @@ -133,8 +133,29 @@ div.file-manager-button a:hover {
133 133 }
134 134  
135 135 /************* file manager (small) style *****************/
136   -div.file-manager-small li {
  136 +.file-manager-small {
  137 + background: white;
  138 + border: 1px solid gray;
  139 +}
  140 +
  141 +.file-manager-title {
  142 + font-weight: bold;
  143 + border: 1px solid gray;
  144 + border-bottom: none;
  145 + border-top: none;
  146 + padding: 2px;
  147 + background: #579;
  148 + color: white;
  149 +}
  150 +
  151 +.file-manager-small ul {
  152 + padding: 5px;
  153 + margin: 0px;
  154 +}
  155 +
  156 +.file-manager-small li {
137 157 list-style: none;
  158 + padding: 2px;
138 159 }
139 160  
140 161 div.file-manager-small
... ... @@ -160,3 +181,44 @@ div.file-manager-button a:hover {
160 181 color: #006;
161 182 }
162 183  
  184 +.file-manager-small {
  185 + position: relative;
  186 +}
  187 +
  188 +.file-manager-small .file-manager-controls {
  189 + border-top: 1px solid gray;
  190 + padding: 4px;
  191 +}
  192 +
  193 +.file-manager-small .file-manager-controls * {
  194 + text-align: right;
  195 +}
  196 +
  197 +/*************************** cms stuff ******************************/
  198 +
  199 +#article-subitems-hide.hide-button {
  200 + float: right;
  201 + margin-top: 2px;
  202 + margin-right: 4px;
  203 + color: white;
  204 +}
  205 +#article-subitems-hide.hide-button:hover {
  206 + background-color: transparent;
  207 + color: black;
  208 +}
  209 +
  210 +#article-full-path {
  211 + border: 1px solid gray;
  212 + margin: 0px;
  213 + font-size: 120%;
  214 + overflow: auto;
  215 + padding: 2px;
  216 + background: #abc;
  217 +}
  218 +
  219 +#article-controls {
  220 + background: white;
  221 + border: 1px solid gray;
  222 + padding-top: 8px;
  223 + padding-bottom: 8px;
  224 +}
... ...