From 37c662dcecdd09fb0673ae026702385e9a82672f Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Thu, 29 Nov 2007 22:52:33 +0000 Subject: [PATCH] ActionItem21: checkpoint --- app/controllers/my_profile/cms_controller.rb | 4 +++- app/helpers/application_helper.rb | 35 +++++++++++++++++++++++++++++++++++ app/helpers/cms_helper.rb | 4 ++-- app/views/cms/text_html_new.rhtml | 4 ++-- app/views/cms/view.rhtml | 68 ++++++++++++++++++++++++++++++++++++++++++-------------------------- app/views/layouts/application.rhtml | 10 +++------- app/views/shared/tiny_mce.rhtml | 4 ++-- public/designs/icons/default/README | 11 +++++++++++ public/designs/icons/default/abiword_48.png | Bin 0 -> 1478 bytes public/designs/icons/default/gnome-home.png | Bin 0 -> 1112 bytes public/designs/icons/default/gtk-close.png | Bin 0 -> 1090 bytes public/designs/icons/default/gtk-edit.png | Bin 0 -> 1131 bytes public/designs/icons/default/gtk-new.png | Bin 0 -> 540 bytes public/designs/icons/default/gtk-open.png | Bin 0 -> 905 bytes public/designs/icons/default/style.css | 47 ++++++----------------------------------------- public/stylesheets/button.css | 20 ++++++++++++++++++++ public/stylesheets/common.css | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 17 files changed, 189 insertions(+), 82 deletions(-) create mode 100644 public/designs/icons/default/README create mode 100644 public/designs/icons/default/abiword_48.png create mode 100644 public/designs/icons/default/gnome-home.png create mode 100644 public/designs/icons/default/gtk-close.png create mode 100644 public/designs/icons/default/gtk-edit.png create mode 100644 public/designs/icons/default/gtk-new.png create mode 100644 public/designs/icons/default/gtk-open.png create mode 100644 public/stylesheets/button.css diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index ba84479..e42d050 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -3,6 +3,8 @@ class CmsController < MyProfileController # FIXME add the access control again # protect 'post_content', :profile, :only => [:edit, :new, :reorder, :delete] + design :holder => :profile + include CmsHelper def view @@ -11,7 +13,7 @@ class CmsController < MyProfileController end def index - @article = profile.home_page + @article = nil @subitems = profile.top_level_articles render :action => 'view' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0e1122a..47b9f70 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -314,4 +314,39 @@ module ApplicationHelper content_tag('div', link_to(image_tag(icon, :alt => title, :title => title) + content_tag('div', title), url), :class => 'file-manager-button') end + def hide(id) + "Element.hide(#{id.inspect});" + end + + def show(id) + "Element.show(#{id.inspect});" + end + + def toggle_panel(hide_label, show_label, id) + hide_button_id = id + "-hide" + show_button_id = id + "-show" + + result = "" + 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') + result < " " + 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;' ) + + result + end + + def button(type, label, url, html_options = {}) + design_display_button(type, label, url, { :class => 'with_text' }.merge(html_options)) + end + + def button_to_function(type, label, js_code, html_options = {}) + #design_display_function_button(type, label, js_code, { :class => 'with_text' }.merge(html_options)) + html_options[:class] = "" unless html_options[:class] + html_options[:class] << " button #{type}" + link_to_function(label, js_code, html_options) + end + + def icon(icon_name) + design_display_icon(icon_name, :style => 'width: 24px; height: 24px; display: inline;') + end + end diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index ee88335..2cbb02e 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -1,7 +1,7 @@ module CmsHelper def link_to_edit_article(article) - link_to(_("Edit"), url_for_edit_article(article)) + button('edit', _("Edit"), url_for_edit_article(article)) end def url_for_edit_article(article) @@ -11,7 +11,7 @@ module CmsHelper def link_to_new_article(mime_type) action = mime_type.gsub('/', '_') + '_new' - link_to(_("New %s") % mime_type, :action => action, :parent_id => params[:parent_id]) + button('new', _("New %s") % mime_type, :action => action, :parent_id => params[:parent_id]) end end diff --git a/app/views/cms/text_html_new.rhtml b/app/views/cms/text_html_new.rhtml index 86c2e03..57a56d6 100644 --- a/app/views/cms/text_html_new.rhtml +++ b/app/views/cms/text_html_new.rhtml @@ -6,9 +6,9 @@ <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %> - <%= f.text_field 'name' %> + <%= f.text_field 'name', :size => '64' %> - <%= f.text_area('body') %> + <%= f.text_area('body', :cols => 64) %> <%= submit_tag _('Save') %> diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml index cc10342..10f38cf 100644 --- a/app/views/cms/view.rhtml +++ b/app/views/cms/view.rhtml @@ -1,37 +1,53 @@ <% if @article %> -

+

+ <%= icon('cms') %> <%= link_to profile.identifier, :action => 'index' %> <%= @article.hierarchy.map {|item| " / " + ((item == @article) ? item.name : link_to(item.name, :id => item.id)) } %>

+<% else %> +

+ <%= icon('cms') %> + <%= _('Content management') %> +

+
+ <%= button('new', _('New article'), :action => 'new') %> +
<% end %> -<%# list the children %> +<%# subitem %> +<%= toggle_panel(_('Hide subitems'), _('Show subitems'), 'article-subitems') unless @subitems.empty? %> +
+
<%= @article ? _('Subitems') : _('Articles') %>
+
+ <% unless @subitems.empty? %> +
    + <% @subitems.each do |item| %> +
  • + <%= file_manager_button(item.name, "icons-mime/#{item.icon_name}", :action => 'view', :id => item.id) %> +
  • + <% end %> +
+ <% end %> -
+ <% if @article %> +
+ <%= button('new', _('New subitem'), :action => 'new', :parent_id => @article.id) %> +
+ <% end %> -
-
    - <% @subitems.each do |item| %> -
  • - <%= file_manager_button(item.name, "icons-mime/#{item.icon_name}", :action => 'view', :id => item.id) %> -
  • - <% end %> -
-
- - <% if @article %> - <%= link_to _('New subitem'), :action => 'new', :parent_id => @article.id %> - <% else %> - <%= link_to _('New article'), :action => 'new' %> - <% end %> - -
+
+
<%# display the article content %> +
+ <% if @article %> +

<%= @article.name %>

+
-<% if @article %> - <%= link_to_edit_article(@article) %> - <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post } %> -

<%= @article.name %>

- <%= @article.to_html %> -<% end %> + <%= link_to_edit_article(@article) %> + + <%= button('home', _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post }) %> +
+ <%= @article.to_html %> + <% end %> +
diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 23d81ed..8d34636 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -14,6 +14,7 @@ <%= stylesheet_link_tag 'common' %> <%= stylesheet_link_tag 'help' %> <%= stylesheet_link_tag 'menu' %> + <%= stylesheet_link_tag 'button' %> <%= javascript_include_tag 'menu' %> <%# cms stuff %> <% if params[:controller] == 'cms' %> @@ -70,13 +71,8 @@
- <% if params[:controller] == 'cms' %> -
- <%= yield %> -
- <% else %> - <%= design_display(yield) %> - <% end %> + <%= design_display(yield) %> + diff --git a/app/views/shared/tiny_mce.rhtml b/app/views/shared/tiny_mce.rhtml index b6dade0..416c994 100644 --- a/app/views/shared/tiny_mce.rhtml +++ b/app/views/shared/tiny_mce.rhtml @@ -6,8 +6,8 @@ tinyMCE.init({ plugins: "paste,searchreplace,print", theme_advanced_toolbar_location : "top", theme_advanced_layout_manager: 'SimpleLayout', - 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", - theme_advanced_buttons2 : "copy,paste,pastetext,pasteword,search,replace,print", + theme_advanced_buttons1 : "print,separator,copy,paste,pastetext,pasteword,separator,undo,redo,separator,search,replace,separator,formatselect,separator,help", + theme_advanced_buttons2 : "bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,table,separator,cleanup,code", theme_advanced_buttons3 : "", apply_source_formatting : true, language: <%= language.inspect %>, diff --git a/public/designs/icons/default/README b/public/designs/icons/default/README new file mode 100644 index 0000000..1514264 --- /dev/null +++ b/public/designs/icons/default/README @@ -0,0 +1,11 @@ +Source and Licensing +==================== + +Icon Source theme Source section License +------------------------- ------------ -------------- ------- +gtk-edit.png dlg-neu stock/ GPLv2+ +gnome-home.png Nuovo apps/ GPLv2+ +gtk-new.png Nuovo stock/ GPLv2+ +gtk-close.png Nuovo stock/ GPLv2+ +gtk-open.png Nuovo stock/ GPLv2+ +abiword_48.png dlg-neu apps/ GPLv2+ diff --git a/public/designs/icons/default/abiword_48.png b/public/designs/icons/default/abiword_48.png new file mode 100644 index 0000000..8b6901a Binary files /dev/null and b/public/designs/icons/default/abiword_48.png differ diff --git a/public/designs/icons/default/gnome-home.png b/public/designs/icons/default/gnome-home.png new file mode 100644 index 0000000..7fc33eb Binary files /dev/null and b/public/designs/icons/default/gnome-home.png differ diff --git a/public/designs/icons/default/gtk-close.png b/public/designs/icons/default/gtk-close.png new file mode 100644 index 0000000..72ae2c8 Binary files /dev/null and b/public/designs/icons/default/gtk-close.png differ diff --git a/public/designs/icons/default/gtk-edit.png b/public/designs/icons/default/gtk-edit.png new file mode 100644 index 0000000..80d145b Binary files /dev/null and b/public/designs/icons/default/gtk-edit.png differ diff --git a/public/designs/icons/default/gtk-new.png b/public/designs/icons/default/gtk-new.png new file mode 100644 index 0000000..c0e1dd8 Binary files /dev/null and b/public/designs/icons/default/gtk-new.png differ diff --git a/public/designs/icons/default/gtk-open.png b/public/designs/icons/default/gtk-open.png new file mode 100644 index 0000000..6c5b71e Binary files /dev/null and b/public/designs/icons/default/gtk-open.png differ diff --git a/public/designs/icons/default/style.css b/public/designs/icons/default/style.css index 0d15ca4..4278611 100644 --- a/public/designs/icons/default/style.css +++ b/public/designs/icons/default/style.css @@ -1,42 +1,7 @@ - -.none_add { background-image: url('none.png') } -.add { background-image: url('add.png') } -.search { background-image: url('search.png') } -.edit_small { background-image: url('edit_small.png') } -.view_small { background-image: url('view_small.png') } -.del_small { background-image: url('del_small.png') } -.edit { background-image: url('edit.png') } -.save { background-image: url('save.png') } -.back { background-image: url('back.png') } -.reset { background-image: url('reset.png') } -.image { background-image: url('image.png') } -.password { background-image: url('password.png') } -.go-jump { background-image: url('go-jump.png') } -.system-log-out { background-image: url('system-log-out.png') } -.previous_page { background-image: url('go-previous.png') } -.next_page { background-image: url('go-next.png') } -.new_entry { background-image: url('new_entry.png') } -.history { background-image: url('history.png') } -.help { background-image: url('help.png') } -.show_documents_small { background-image: url('del_small.png') } -.add_document_small { background-image: url('del_small.png') } - -/* * * Menu Icons * * */ - -.departments { background-image: url('departments.png') } -.ledgers { background-image: url('ledgers.png') } -.point_of_sale { background-image: url('point_of_sale.png') } -.stock { background-image: url('stock.png') } -.documents { background-image: url('documents.png') } -.categories { background-image: url('categories.png') } -.system_actors { background-image: url('system_actors.png') } -.permissions { background-image: url('permissions.png') } -.mass_mails { background-image: url('mass_mails.png') } -.store { background-image: url('store.png') } -.organizations { background-image: url('organizations.png') } -.banks { background-image: url('banks.png') } -.product_icon { background-image: url('banks.png'); border: 2px solid red } -.worker_icon { background-image: url('banks.png'); border: 2px solid red } -.supplier_icon { background-image: url('banks.png'); border: 2px solid red } -.customer_icon { background-image: url('banks.png'); border: 2px solid red } +.button.edit { background-image: url(gtk-edit.png); } +.button.home { background-image: url(gnome-home.png); } +.button.new { background-image: url(gtk-new.png); } +.button.close { background-image: url(gtk-close.png); } +.button.open { background-image: url(gtk-open.png); } +.button.cms { background-image: url(abiword_48.png)} diff --git a/public/stylesheets/button.css b/public/stylesheets/button.css new file mode 100644 index 0000000..093a80c --- /dev/null +++ b/public/stylesheets/button.css @@ -0,0 +1,20 @@ +.button { + border: none; + margin-left: 5px; + background-color: transparent; + background-repeat: no-repeat; + background-position: 0px; + + padding-left: 25px; +} + +a.button , a.button:visited { + color: black; + text-decoration: none; +} + +a.button:hover { + background-color: #ace; +} + + diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index fc7b681..d40ca87 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -133,8 +133,29 @@ div.file-manager-button a:hover { } /************* file manager (small) style *****************/ -div.file-manager-small li { +.file-manager-small { + background: white; + border: 1px solid gray; +} + +.file-manager-title { + font-weight: bold; + border: 1px solid gray; + border-bottom: none; + border-top: none; + padding: 2px; + background: #579; + color: white; +} + +.file-manager-small ul { + padding: 5px; + margin: 0px; +} + +.file-manager-small li { list-style: none; + padding: 2px; } div.file-manager-small @@ -160,3 +181,44 @@ div.file-manager-button a:hover { color: #006; } +.file-manager-small { + position: relative; +} + +.file-manager-small .file-manager-controls { + border-top: 1px solid gray; + padding: 4px; +} + +.file-manager-small .file-manager-controls * { + text-align: right; +} + +/*************************** cms stuff ******************************/ + +#article-subitems-hide.hide-button { + float: right; + margin-top: 2px; + margin-right: 4px; + color: white; +} +#article-subitems-hide.hide-button:hover { + background-color: transparent; + color: black; +} + +#article-full-path { + border: 1px solid gray; + margin: 0px; + font-size: 120%; + overflow: auto; + padding: 2px; + background: #abc; +} + +#article-controls { + background: white; + border: 1px solid gray; + padding-top: 8px; + padding-bottom: 8px; +} -- libgit2 0.21.2