From e30eb192c7b8d5d61475e287224d09530dec03e6 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Tue, 31 Mar 2015 22:59:25 -0300 Subject: [PATCH] removing notification plugin --- plugins/notification/controllers/notification_plugin_admin_controller.rb | 20 -------------------- plugins/notification/controllers/notification_plugin_profile_controller.rb | 53 ----------------------------------------------------- plugins/notification/lib/ext/profile.rb | 13 ------------- plugins/notification/lib/notification_plugin.rb | 15 --------------- plugins/notification/lib/notification_plugin/category_notification.rb | 4 ---- plugins/notification/lib/notification_plugin/helpers/viewer_helper.rb | 8 -------- plugins/notification/lib/notification_plugin/lobby_note_content.rb | 31 ------------------------------- plugins/notification/lib/notification_plugin/notification_content.rb | 24 ------------------------ plugins/notification/public/ajax-loader.gif | Bin 1079 -> 0 bytes plugins/notification/public/style.css | 78 ------------------------------------------------------------------------------ plugins/notification/test/functional/notification_plugin_admin_controller_test.rb | 21 --------------------- plugins/notification/test/functional/notification_plugin_profile_controller_test.rb | 43 ------------------------------------------- plugins/notification/test/test_helper.rb | 1 - plugins/notification/test/unit/ext/profile_test.rb | 19 ------------------- plugins/notification/test/unit/notification_plugin/category_test.rb | 11 ----------- plugins/notification/test/unit/notification_plugin/lobby_note_content_test.rb | 11 ----------- plugins/notification/test/unit/notification_plugin/notification_content_test.rb | 11 ----------- plugins/notification/test/unit/notification_plugin_test.rb | 15 --------------- plugins/notification/views/notification_plugin_admin/index.html.erb | 12 ------------ plugins/notification/views/notification_plugin_profile/_event.html.erb | 9 --------- plugins/notification/views/notification_plugin_profile/index.html.erb | 17 ----------------- plugins/notification/views/notification_plugin_profile/lobby_notes.html.erb | 54 ------------------------------------------------------ plugins/notification/views/notification_plugin_profile/notifications.html.erb | 19 ------------------- 23 files changed, 0 insertions(+), 489 deletions(-) delete mode 100644 plugins/notification/controllers/notification_plugin_admin_controller.rb delete mode 100644 plugins/notification/controllers/notification_plugin_profile_controller.rb delete mode 100644 plugins/notification/lib/ext/profile.rb delete mode 100644 plugins/notification/lib/notification_plugin.rb delete mode 100644 plugins/notification/lib/notification_plugin/category_notification.rb delete mode 100644 plugins/notification/lib/notification_plugin/helpers/viewer_helper.rb delete mode 100644 plugins/notification/lib/notification_plugin/lobby_note_content.rb delete mode 100644 plugins/notification/lib/notification_plugin/notification_content.rb delete mode 100644 plugins/notification/public/ajax-loader.gif delete mode 100644 plugins/notification/public/style.css delete mode 100644 plugins/notification/test/functional/notification_plugin_admin_controller_test.rb delete mode 100644 plugins/notification/test/functional/notification_plugin_profile_controller_test.rb delete mode 100644 plugins/notification/test/test_helper.rb delete mode 100644 plugins/notification/test/unit/ext/profile_test.rb delete mode 100644 plugins/notification/test/unit/notification_plugin/category_test.rb delete mode 100644 plugins/notification/test/unit/notification_plugin/lobby_note_content_test.rb delete mode 100644 plugins/notification/test/unit/notification_plugin/notification_content_test.rb delete mode 100644 plugins/notification/test/unit/notification_plugin_test.rb delete mode 100644 plugins/notification/views/notification_plugin_admin/index.html.erb delete mode 100644 plugins/notification/views/notification_plugin_profile/_event.html.erb delete mode 100644 plugins/notification/views/notification_plugin_profile/index.html.erb delete mode 100644 plugins/notification/views/notification_plugin_profile/lobby_notes.html.erb delete mode 100644 plugins/notification/views/notification_plugin_profile/notifications.html.erb diff --git a/plugins/notification/controllers/notification_plugin_admin_controller.rb b/plugins/notification/controllers/notification_plugin_admin_controller.rb deleted file mode 100644 index 6d0b75a..0000000 --- a/plugins/notification/controllers/notification_plugin_admin_controller.rb +++ /dev/null @@ -1,20 +0,0 @@ -class NotificationPluginAdminController < AdminController - append_view_path File.join(File.dirname(__FILE__) + '/../views') - - #FIXME create admin configuration for categories - def index - @settings ||= Noosfero::Plugin::Settings.new(environment, NotificationPlugin, params[:settings]) - if request.post? - @settings.categories = nil if @settings.categories.blank? - @settings.save! - redirect_to :action => 'index' - end - end - - def create - -#render :text => 'bli' -raise params.inspect - end - -end diff --git a/plugins/notification/controllers/notification_plugin_profile_controller.rb b/plugins/notification/controllers/notification_plugin_profile_controller.rb deleted file mode 100644 index 1827c0c..0000000 --- a/plugins/notification/controllers/notification_plugin_profile_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -class NotificationPluginProfileController < ProfileController -# append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - #FIXME make this test -# needs_profile - - protect 'see_loby_notes', :profile - - def lobby_notes - @date = params[:date].nil? ? Date.today : Date.parse(params[:date]) - @events = profile.lobby_notes.by_day(@date).paginate(:per_page => per_page, :page => params[:page]) - - if request.xhr? - render :partial => 'event', :collection => @events - else - render :file => 'notification_plugin_profile/lobby_notes', :layout => 'embed' - end - end - - def index - @events = current_person.lobby_notes.find(:all, :conditions => {:profile => profile } ) - @event = NotificationPlugin::LobbyNoteContent.new - end - - def create - @event = NotificationPlugin::LobbyNoteContent.new(params[:event]) - @event.profile = profile - @event.created_by = current_person - @events = current_person.lobby_notes - unless @event.save - flash[:error] = _('Note not saved') - end - render :partial => 'event', :collection => @events - end - - def notifications - @date = params[:date].nil? ? Date.today : Date.parse(params[:date]) - - if request.xhr? - @event = NotificationPlugin::NotificationContent.new(params[:event]) - @event.profile = profile - @event.created_by = current_person - @event.save! - - @events = profile.notifications.paginate(:per_page => per_page, :page => params[:page]) - render :partial => 'event', :collection => @events - else - @events = profile.notifications.paginate(:per_page => per_page, :page => params[:page]) - render :file => 'notification_plugin_profile/notifications' - end - end -end - diff --git a/plugins/notification/lib/ext/profile.rb b/plugins/notification/lib/ext/profile.rb deleted file mode 100644 index 5bf007a..0000000 --- a/plugins/notification/lib/ext/profile.rb +++ /dev/null @@ -1,13 +0,0 @@ -require_dependency 'profile' - -Profile.class_eval do - has_many :notifications, :source => 'articles', :class_name => 'NotificationPlugin::NotificationContent', :order => 'start_date' - has_many :lobby_notes, :source => 'articles', :class_name => 'NotificationPlugin::LobbyNoteContent', :order => 'start_date' -end - -Person.class_eval do -# has_many :notifications, :source => 'articles', :class_name => 'NotificationPlugin::NotificationContent', :order => 'start_date' - has_many :lobby_notes, :foreign_key => 'created_by_id', :class_name => 'NotificationPlugin::LobbyNoteContent', :order => 'start_date,created_at' -# named_scope :lobby_notes_by_profile -end - diff --git a/plugins/notification/lib/notification_plugin.rb b/plugins/notification/lib/notification_plugin.rb deleted file mode 100644 index 12b383e..0000000 --- a/plugins/notification/lib/notification_plugin.rb +++ /dev/null @@ -1,15 +0,0 @@ -class NotificationPlugin < Noosfero::Plugin - - def self.plugin_name - "Notification Plugin" - end - - def self.plugin_description - _("A plugin that add a new content type called notification where a communitty adminsitrator could notify community .") - end - - def content_types - [NotificationPlugin::NotificationContent, NotificationPlugin::LobbyNoteContent] - end - -end diff --git a/plugins/notification/lib/notification_plugin/category_notification.rb b/plugins/notification/lib/notification_plugin/category_notification.rb deleted file mode 100644 index 7d051aa..0000000 --- a/plugins/notification/lib/notification_plugin/category_notification.rb +++ /dev/null @@ -1,4 +0,0 @@ -#FIXME make this test -class NotificationPlugin::CategoryNotification < Category - -end diff --git a/plugins/notification/lib/notification_plugin/helpers/viewer_helper.rb b/plugins/notification/lib/notification_plugin/helpers/viewer_helper.rb deleted file mode 100644 index efd8d85..0000000 --- a/plugins/notification/lib/notification_plugin/helpers/viewer_helper.rb +++ /dev/null @@ -1,8 +0,0 @@ -module NotificationPlugin::Helpers::ViewerHelper - - def lobby_notes_plugin_stylesheet - plugin_stylesheet_path = NotificationPlugin.public_path('style.css') - stylesheet_link_tag plugin_stylesheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_stylesheet_path.to_s}" - end - -end diff --git a/plugins/notification/lib/notification_plugin/lobby_note_content.rb b/plugins/notification/lib/notification_plugin/lobby_note_content.rb deleted file mode 100644 index 38f8741..0000000 --- a/plugins/notification/lib/notification_plugin/lobby_note_content.rb +++ /dev/null @@ -1,31 +0,0 @@ -class NotificationPlugin::LobbyNoteContent < Event - - before_validation :set_title - - def self.short_description - 'Lobby note for gatekeepers' - end - - def self.description - 'Notify gatekeeper' - end - - def set_title - self.name = _('Notification %s') % self.profile.lobby_notes.count unless self.profile.nil? - end - - -#FIXME make the html output specific -# def to_html(options = {}) -# source = options["source"] -# embeded = options.has_key? "embeded" -# prompt_id = options["prompt_id"] -# pairwise_content = self -# lambda do -# locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id } -# render :file => 'content_viewer/prompt.rhtml', :locals => locals -# end -# end -# - -end diff --git a/plugins/notification/lib/notification_plugin/notification_content.rb b/plugins/notification/lib/notification_plugin/notification_content.rb deleted file mode 100644 index 40ea6f0..0000000 --- a/plugins/notification/lib/notification_plugin/notification_content.rb +++ /dev/null @@ -1,24 +0,0 @@ -class NotificationPlugin::NotificationContent < Article - - def self.short_description - 'Notification for users' - end - - def self.description - 'Notification for users of community' - end - -#FIXME make the html output specific -# def to_html(options = {}) -# source = options["source"] -# embeded = options.has_key? "embeded" -# prompt_id = options["prompt_id"] -# pairwise_content = self -# lambda do -# locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id } -# render :file => 'content_viewer/prompt.rhtml', :locals => locals -# end -# end -# - -end diff --git a/plugins/notification/public/ajax-loader.gif b/plugins/notification/public/ajax-loader.gif deleted file mode 100644 index 5f78ce7..0000000 Binary files a/plugins/notification/public/ajax-loader.gif and /dev/null differ diff --git a/plugins/notification/public/style.css b/plugins/notification/public/style.css deleted file mode 100644 index 8101ad9..0000000 --- a/plugins/notification/public/style.css +++ /dev/null @@ -1,78 +0,0 @@ -#wrap-1 { - width: 100% !important; -} - -#wrap-2 { - width: 100%; - position: absolute; - margin: 0px; - padding: 0px; -} - -#content { - box-shadow: none; - margin: 0px; - padding: 0px; -} - -.box-1 { - margin: 0px; -} - -body { - background: none; - width: 100%; - height: 100%; -} - -.lobby-notes { - width: 100%; - height: 100%; - font-size: 24px; - -} - -#lobby-note-elements { - list-style: none; - margin-left: 30px; - margin-right: 30px; - padding: 0px; -} - -#lobby-note-elements .title { - font-weight: bold; -} - -#lobby-note-elements .created_by { - font-size: 12px; -} - -#lobby-note-elements li { - border-top: solid #1759b2; - background-color: #f4f8fa; - padding: 10px; - width: 100%; - text-align: justify; - margin-top: 30px; -} - -.lobby-header{ - text-align: center; -} - -#content .lobby-header h1{ - text-align: center; - font-size: 30px; -} - -.lobby-header img{ - position: absolute; - left: 0px; - top: 0px; - margin-left: 30px; -} - -.lobby-header .before{ - float: left; - margin-left: 200px; -} diff --git a/plugins/notification/test/functional/notification_plugin_admin_controller_test.rb b/plugins/notification/test/functional/notification_plugin_admin_controller_test.rb deleted file mode 100644 index 7ab190a..0000000 --- a/plugins/notification/test/functional/notification_plugin_admin_controller_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - - -class NotificationPluginAdminControllerTest < ActionController::TestCase - - - def setup - @controller = NotificationPluginAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @environment = fast_create(Environment) - - login_as(create_admin_user(@environment)) - end - - should 'get a first prompt' do - get :index - assert_response :success - end - -end diff --git a/plugins/notification/test/functional/notification_plugin_profile_controller_test.rb b/plugins/notification/test/functional/notification_plugin_profile_controller_test.rb deleted file mode 100644 index f17c87a..0000000 --- a/plugins/notification/test/functional/notification_plugin_profile_controller_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class NotificationPluginProfileControllerTest < ActionController::TestCase - - def setup - @environment = Environment.default - - @controller = NotificationPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - @user = create_user('john', :email => 'john@doe.org', :password => 'dhoe', :password_confirmation => 'dhoe') - @profile = fast_create(Community, :environment_id => @environment.id) - @role = Role.create(:name => 'somerole', :permissions => ['see_loby_notes']) - @profile.affiliate(@user.person, role) - - login_as(@user.login) - end - - attr_reader :profile, :role - - should 'access lobby_notes action' do - get :lobby_notes, :profile => profile.identifier - assert :lobby_notes - assert_response :success - end - - should 'list the lobby notes of profile' do - note1 = fast_create(NotificationPlugin::LobbyNoteContent, :profile_id => profile.id, :start_date => Date.today) - note2 = fast_create(NotificationPlugin::LobbyNoteContent, :profile_id => profile.id, :start_date => Date.today) - get :lobby_notes, :profile => profile.identifier - - assert_equivalent [note1, note2], assigns(:events) - end - - should 'not see lobby_notes if there is no see_loby_notes permission' do - role.permissions = [] - role.save - get :lobby_notes, :profile => profile.identifier - assert_response :forbidden - end - -end diff --git a/plugins/notification/test/test_helper.rb b/plugins/notification/test/test_helper.rb deleted file mode 100644 index cca1fd3..0000000 --- a/plugins/notification/test/test_helper.rb +++ /dev/null @@ -1 +0,0 @@ -require File.dirname(__FILE__) + '/../../../test/test_helper' diff --git a/plugins/notification/test/unit/ext/profile_test.rb b/plugins/notification/test/unit/ext/profile_test.rb deleted file mode 100644 index 2a4718a..0000000 --- a/plugins/notification/test/unit/ext/profile_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class ProfileTest < ActiveSupport::TestCase - - should "comunity have notifications method defined" do - profile = Community.new - assert_nothing_raised do - profile.notifications - end - end - - should "comunity have lobby_notes method defined" do - profile = Community.new - assert_nothing_raised do - profile.lobby_notes - end - end - -end diff --git a/plugins/notification/test/unit/notification_plugin/category_test.rb b/plugins/notification/test/unit/notification_plugin/category_test.rb deleted file mode 100644 index b59407d..0000000 --- a/plugins/notification/test/unit/notification_plugin/category_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class NotificationPlugin::CategoryNotificationTest < ActiveSupport::TestCase - - should 'create the category for notifications' do - assert_nothing_raised NameError do - notification = CategoryNotification.new - end - end - -end diff --git a/plugins/notification/test/unit/notification_plugin/lobby_note_content_test.rb b/plugins/notification/test/unit/notification_plugin/lobby_note_content_test.rb deleted file mode 100644 index 1e60ce2..0000000 --- a/plugins/notification/test/unit/notification_plugin/lobby_note_content_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class NotificationPlugin::LobbyNoteContentTest < ActiveSupport::TestCase - - should 'create the content type lobby note' do - assert_nothing_raised NameError do - note = LobbyNoteContent.new - end - end - -end diff --git a/plugins/notification/test/unit/notification_plugin/notification_content_test.rb b/plugins/notification/test/unit/notification_plugin/notification_content_test.rb deleted file mode 100644 index 2425e93..0000000 --- a/plugins/notification/test/unit/notification_plugin/notification_content_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class NotificationPlugin::NotificationContentTest < ActiveSupport::TestCase - - should 'create the content type notification' do - assert_nothing_raised NameError do - notification = NotificationContent.new - end - end - -end diff --git a/plugins/notification/test/unit/notification_plugin_test.rb b/plugins/notification/test/unit/notification_plugin_test.rb deleted file mode 100644 index 4b8086a..0000000 --- a/plugins/notification/test/unit/notification_plugin_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class NotificationPluginTest < ActiveSupport::TestCase - - should "add notification content for content types" do - notification = NotificationPlugin.new - assert notification.content_types.include?(NotificationPlugin::NotificationContent) - end - - should "add lobby notes content for content types" do - notification = NotificationPlugin.new - assert notification.content_types.include?(NotificationPlugin::LobbyNoteContent) - end - -end diff --git a/plugins/notification/views/notification_plugin_admin/index.html.erb b/plugins/notification/views/notification_plugin_admin/index.html.erb deleted file mode 100644 index 6d2d6b4..0000000 --- a/plugins/notification/views/notification_plugin_admin/index.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -

<%= _('Notification settings')%>

- - - - <% button_bar do %> - <%= button :back, _('Back to admin panel'), :controller => 'admin_panel', :action => 'index' %> - <% end %> - diff --git a/plugins/notification/views/notification_plugin_profile/_event.html.erb b/plugins/notification/views/notification_plugin_profile/_event.html.erb deleted file mode 100644 index c54baef..0000000 --- a/plugins/notification/views/notification_plugin_profile/_event.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
  • -
    <%= event.title %>
    - - <%= _("%{author} on %{date}") % {:author => event.author_name, :date => show_time(event.created_at) } %> - -
    - <%= event.body %> -
    -
  • diff --git a/plugins/notification/views/notification_plugin_profile/index.html.erb b/plugins/notification/views/notification_plugin_profile/index.html.erb deleted file mode 100644 index a5139fb..0000000 --- a/plugins/notification/views/notification_plugin_profile/index.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -

    <%= _('Lobby Notes')%>

    - - -
    - <%= flash[:error] %> - <%= form_remote_tag :url => {:action => 'create'}, :update => 'lobby_notes', :success => "$('leave_note_content').value=''", :complete => "jQuery('#leave_note_form').removeClass('loading').find('*').attr('disabled', false)", :loading => "jQuery('#leave_note_form').addClass('loading').find('*').attr('disabled', true)", :html => {:id => 'leave_note_form' } do %> - <%= limited_text_area :event, :body, 420, 'leave_note_content', :cols => 50, :rows => 2, :class => 'autogrow' %> - <%= submit_button :new, _('New') %> - <% end %> -
    - - - diff --git a/plugins/notification/views/notification_plugin_profile/lobby_notes.html.erb b/plugins/notification/views/notification_plugin_profile/lobby_notes.html.erb deleted file mode 100644 index 8e5a1f2..0000000 --- a/plugins/notification/views/notification_plugin_profile/lobby_notes.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<% extend NotificationPlugin::Helpers::ViewerHelper %> - -<%= lobby_notes_plugin_stylesheet %> - - - -
    - -
    - <%= image_tag profile.profile_custom_image(:thumb) %> -

    - <%= @profile.name %> -

    -

    <%= _("You have %s notifications (%s)") % [ @events.count, show_date(@date)] %>

    -
    - <%= -#link_to _('Before'), {:action => 'lobby_notes'} -%> -
    -
    - - - -
    diff --git a/plugins/notification/views/notification_plugin_profile/notifications.html.erb b/plugins/notification/views/notification_plugin_profile/notifications.html.erb deleted file mode 100644 index a8607d1..0000000 --- a/plugins/notification/views/notification_plugin_profile/notifications.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

    <%= _('Notifications')%>

    - - -
    - <%= flash[:error] %> - <%= form_remote_tag :url => {:action => 'notifications'}, :update => 'notifications', :success => "$('leave_notification_content').value='';$('leave_notification_title').value=''", :complete => "jQuery('#leave_notification_form').removeClass('loading').find('*').attr('disabled', false)", :loading => "jQuery('#leave_notification_form').addClass('loading').find('*').attr('disabled', true)", :html => {:id => 'leave_notification_form' } do %> - <%= _('Title:') %> - <%= text_field :event, :name, :id => 'leave_notification_title' %> - <%= limited_text_area :event, :body, 420, 'leave_notification_content', :cols => 50, :rows => 3, :class => 'autogrow' %> - <%= submit_button :new, _('New') %> - <% end %> -
    - - - -- libgit2 0.21.2