From 82012975eb8accbac901a06c04227a67322160f8 Mon Sep 17 00:00:00 2001 From: Caio SBA Date: Sun, 20 Mar 2011 17:41:12 -0300 Subject: [PATCH] Loading logged-in stuff through Ajax --- app/controllers/public/content_viewer_controller.rb | 5 +++++ app/controllers/public/profile_controller.rb | 8 ++++++++ app/helpers/lightbox_helper.rb | 4 ++++ app/views/blocks/profile_image.rhtml | 13 +++++-------- app/views/blocks/profile_info.rhtml | 13 ++++++------- app/views/content_viewer/_article_toolbar.rhtml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/views/content_viewer/view_page.rhtml | 59 ++++------------------------------------------------------- app/views/profile/profile_info.rjs | 6 ++++++ features/activate_enterprise.feature | 56 ++++++++++++++++++++++++-------------------------------- features/admin_categories.feature | 14 ++++++++++---- features/approve_article.feature | 9 +++++---- features/balloon.feature | 48 +++++++++++++++++++----------------------------- features/blog.feature | 3 ++- features/browse.feature | 13 +++++-------- features/categories_block.feature | 8 +++----- features/chat.feature | 4 ++++ features/comment.feature | 6 +++--- features/contact.feature | 6 ++++-- features/edit_article.feature | 61 ++++++++++++++++++++++++++++++++++--------------------------- features/edit_block_of_links.feature | 10 +++++----- features/events.feature | 20 ++++++++++---------- features/forum.feature | 14 ++++++++------ features/gallery_navigation.feature | 28 ++++++++++++++++------------ features/manage_inputs.feature | 9 +++++---- features/manage_products.feature | 16 ++++++++-------- features/my_network_block.feature | 18 ++++++++++-------- features/publish_article.feature | 7 ++++--- features/step_definitions/custom_webrat_steps.rb | 6 +++++- features/step_definitions/noosfero_steps.rb | 6 +++++- features/step_definitions/selenium_steps.rb | 18 ++++++++++++++++++ features/step_definitions/webrat_steps.rb | 49 +++++++++++++++++++++++++++++++++++++++++++++---- features/suggest_article.feature | 18 ++++++++++-------- features/support/selenium.rb | 2 ++ lib/noosfero.rb | 3 +-- test/functional/content_viewer_controller_test.rb | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- test/functional/profile_controller_test.rb | 67 ++++++++++++++++++++++++++++++++++++++++--------------------------- test/functional/themes_controller_test.rb | 6 +++--- test/unit/lightbox_helper_test.rb | 6 ++++++ vendor/plugins/noosfero_caching/init.rb | 4 ++-- 39 files changed, 460 insertions(+), 335 deletions(-) create mode 100644 app/views/content_viewer/_article_toolbar.rhtml create mode 100644 app/views/profile/profile_info.rjs diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index 89041bd..d19897e 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -51,6 +51,11 @@ class ContentViewerController < ApplicationController return end + if request.xhr? && params[:toolbar] + render :partial => 'article_toolbar' + return + end + redirect_to_translation # At this point the page will be showed diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 6f287fa..b9250b2 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -215,6 +215,14 @@ class ProfileController < PublicController end end + def profile_info + begin + @block = profile.blocks.find(params[:block_id]) + rescue + render :text => _('Profile information could not be loaded') + end + end + protected def check_access_to_profile diff --git a/app/helpers/lightbox_helper.rb b/app/helpers/lightbox_helper.rb index c5e213a..4567c3c 100644 --- a/app/helpers/lightbox_helper.rb +++ b/app/helpers/lightbox_helper.rb @@ -32,4 +32,8 @@ module LightboxHelper request.xhr? end + def lightbox_remote_button(type, label, url, options = {}) + button(type, label, url, lightbox_options(options, 'remote-lbOn')) + end + end diff --git a/app/views/blocks/profile_image.rhtml b/app/views/blocks/profile_image.rhtml index fe0fd30..465635a 100644 --- a/app/views/blocks/profile_image.rhtml +++ b/app/views/blocks/profile_image.rhtml @@ -14,14 +14,11 @@

<%= h block.owner.short_name %>

<% end %> -<% if !user.nil? and user.has_permission?('edit_profile', profile) %> -
- <%= link_to _('Control panel'), :controller => 'profile_editor' %> -
-<% end %> +
-
- <%= render :file => 'blocks/profile_info_actions/' + block.owner.class.name.underscore %> -
+
+ diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index 20e2f48..527bd16 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -14,15 +14,13 @@ -