Commit e30eb192c7b8d5d61475e287224d09530dec03e6

Authored by Leandro Santos
1 parent 1a711c0c

removing notification plugin

Showing 23 changed files with 0 additions and 489 deletions   Show diff stats
plugins/notification/controllers/notification_plugin_admin_controller.rb
... ... @@ -1,20 +0,0 @@
1   -class NotificationPluginAdminController < AdminController
2   - append_view_path File.join(File.dirname(__FILE__) + '/../views')
3   -
4   - #FIXME create admin configuration for categories
5   - def index
6   - @settings ||= Noosfero::Plugin::Settings.new(environment, NotificationPlugin, params[:settings])
7   - if request.post?
8   - @settings.categories = nil if @settings.categories.blank?
9   - @settings.save!
10   - redirect_to :action => 'index'
11   - end
12   - end
13   -
14   - def create
15   -
16   -#render :text => 'bli'
17   -raise params.inspect
18   - end
19   -
20   -end
plugins/notification/controllers/notification_plugin_profile_controller.rb
... ... @@ -1,53 +0,0 @@
1   -class NotificationPluginProfileController < ProfileController
2   -# append_view_path File.join(File.dirname(__FILE__) + '/../../views')
3   -
4   - #FIXME make this test
5   -# needs_profile
6   -
7   - protect 'see_loby_notes', :profile
8   -
9   - def lobby_notes
10   - @date = params[:date].nil? ? Date.today : Date.parse(params[:date])
11   - @events = profile.lobby_notes.by_day(@date).paginate(:per_page => per_page, :page => params[:page])
12   -
13   - if request.xhr?
14   - render :partial => 'event', :collection => @events
15   - else
16   - render :file => 'notification_plugin_profile/lobby_notes', :layout => 'embed'
17   - end
18   - end
19   -
20   - def index
21   - @events = current_person.lobby_notes.find(:all, :conditions => {:profile => profile } )
22   - @event = NotificationPlugin::LobbyNoteContent.new
23   - end
24   -
25   - def create
26   - @event = NotificationPlugin::LobbyNoteContent.new(params[:event])
27   - @event.profile = profile
28   - @event.created_by = current_person
29   - @events = current_person.lobby_notes
30   - unless @event.save
31   - flash[:error] = _('Note not saved')
32   - end
33   - render :partial => 'event', :collection => @events
34   - end
35   -
36   - def notifications
37   - @date = params[:date].nil? ? Date.today : Date.parse(params[:date])
38   -
39   - if request.xhr?
40   - @event = NotificationPlugin::NotificationContent.new(params[:event])
41   - @event.profile = profile
42   - @event.created_by = current_person
43   - @event.save!
44   -
45   - @events = profile.notifications.paginate(:per_page => per_page, :page => params[:page])
46   - render :partial => 'event', :collection => @events
47   - else
48   - @events = profile.notifications.paginate(:per_page => per_page, :page => params[:page])
49   - render :file => 'notification_plugin_profile/notifications'
50   - end
51   - end
52   -end
53   -
plugins/notification/lib/ext/profile.rb
... ... @@ -1,13 +0,0 @@
1   -require_dependency 'profile'
2   -
3   -Profile.class_eval do
4   - has_many :notifications, :source => 'articles', :class_name => 'NotificationPlugin::NotificationContent', :order => 'start_date'
5   - has_many :lobby_notes, :source => 'articles', :class_name => 'NotificationPlugin::LobbyNoteContent', :order => 'start_date'
6   -end
7   -
8   -Person.class_eval do
9   -# has_many :notifications, :source => 'articles', :class_name => 'NotificationPlugin::NotificationContent', :order => 'start_date'
10   - has_many :lobby_notes, :foreign_key => 'created_by_id', :class_name => 'NotificationPlugin::LobbyNoteContent', :order => 'start_date,created_at'
11   -# named_scope :lobby_notes_by_profile
12   -end
13   -
plugins/notification/lib/notification_plugin.rb
... ... @@ -1,15 +0,0 @@
1   -class NotificationPlugin < Noosfero::Plugin
2   -
3   - def self.plugin_name
4   - "Notification Plugin"
5   - end
6   -
7   - def self.plugin_description
8   - _("A plugin that add a new content type called notification where a communitty adminsitrator could notify community .")
9   - end
10   -
11   - def content_types
12   - [NotificationPlugin::NotificationContent, NotificationPlugin::LobbyNoteContent]
13   - end
14   -
15   -end
plugins/notification/lib/notification_plugin/category_notification.rb
... ... @@ -1,4 +0,0 @@
1   -#FIXME make this test
2   -class NotificationPlugin::CategoryNotification < Category
3   -
4   -end
plugins/notification/lib/notification_plugin/helpers/viewer_helper.rb
... ... @@ -1,8 +0,0 @@
1   -module NotificationPlugin::Helpers::ViewerHelper
2   -
3   - def lobby_notes_plugin_stylesheet
4   - plugin_stylesheet_path = NotificationPlugin.public_path('style.css')
5   - stylesheet_link_tag plugin_stylesheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_stylesheet_path.to_s}"
6   - end
7   -
8   -end
plugins/notification/lib/notification_plugin/lobby_note_content.rb
... ... @@ -1,31 +0,0 @@
1   -class NotificationPlugin::LobbyNoteContent < Event
2   -
3   - before_validation :set_title
4   -
5   - def self.short_description
6   - 'Lobby note for gatekeepers'
7   - end
8   -
9   - def self.description
10   - 'Notify gatekeeper'
11   - end
12   -
13   - def set_title
14   - self.name = _('Notification %s') % self.profile.lobby_notes.count unless self.profile.nil?
15   - end
16   -
17   -
18   -#FIXME make the html output specific
19   -# def to_html(options = {})
20   -# source = options["source"]
21   -# embeded = options.has_key? "embeded"
22   -# prompt_id = options["prompt_id"]
23   -# pairwise_content = self
24   -# lambda do
25   -# locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id }
26   -# render :file => 'content_viewer/prompt.rhtml', :locals => locals
27   -# end
28   -# end
29   -#
30   -
31   -end
plugins/notification/lib/notification_plugin/notification_content.rb
... ... @@ -1,24 +0,0 @@
1   -class NotificationPlugin::NotificationContent < Article
2   -
3   - def self.short_description
4   - 'Notification for users'
5   - end
6   -
7   - def self.description
8   - 'Notification for users of community'
9   - end
10   -
11   -#FIXME make the html output specific
12   -# def to_html(options = {})
13   -# source = options["source"]
14   -# embeded = options.has_key? "embeded"
15   -# prompt_id = options["prompt_id"]
16   -# pairwise_content = self
17   -# lambda do
18   -# locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id }
19   -# render :file => 'content_viewer/prompt.rhtml', :locals => locals
20   -# end
21   -# end
22   -#
23   -
24   -end
plugins/notification/public/ajax-loader.gif

1.05 KB

plugins/notification/public/style.css
... ... @@ -1,78 +0,0 @@
1   -#wrap-1 {
2   - width: 100% !important;
3   -}
4   -
5   -#wrap-2 {
6   - width: 100%;
7   - position: absolute;
8   - margin: 0px;
9   - padding: 0px;
10   -}
11   -
12   -#content {
13   - box-shadow: none;
14   - margin: 0px;
15   - padding: 0px;
16   -}
17   -
18   -.box-1 {
19   - margin: 0px;
20   -}
21   -
22   -body {
23   - background: none;
24   - width: 100%;
25   - height: 100%;
26   -}
27   -
28   -.lobby-notes {
29   - width: 100%;
30   - height: 100%;
31   - font-size: 24px;
32   -
33   -}
34   -
35   -#lobby-note-elements {
36   - list-style: none;
37   - margin-left: 30px;
38   - margin-right: 30px;
39   - padding: 0px;
40   -}
41   -
42   -#lobby-note-elements .title {
43   - font-weight: bold;
44   -}
45   -
46   -#lobby-note-elements .created_by {
47   - font-size: 12px;
48   -}
49   -
50   -#lobby-note-elements li {
51   - border-top: solid #1759b2;
52   - background-color: #f4f8fa;
53   - padding: 10px;
54   - width: 100%;
55   - text-align: justify;
56   - margin-top: 30px;
57   -}
58   -
59   -.lobby-header{
60   - text-align: center;
61   -}
62   -
63   -#content .lobby-header h1{
64   - text-align: center;
65   - font-size: 30px;
66   -}
67   -
68   -.lobby-header img{
69   - position: absolute;
70   - left: 0px;
71   - top: 0px;
72   - margin-left: 30px;
73   -}
74   -
75   -.lobby-header .before{
76   - float: left;
77   - margin-left: 200px;
78   -}
plugins/notification/test/functional/notification_plugin_admin_controller_test.rb
... ... @@ -1,21 +0,0 @@
1   -require File.dirname(__FILE__) + '/../test_helper'
2   -
3   -
4   -class NotificationPluginAdminControllerTest < ActionController::TestCase
5   -
6   -
7   - def setup
8   - @controller = NotificationPluginAdminController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11   - @environment = fast_create(Environment)
12   -
13   - login_as(create_admin_user(@environment))
14   - end
15   -
16   - should 'get a first prompt' do
17   - get :index
18   - assert_response :success
19   - end
20   -
21   -end
plugins/notification/test/functional/notification_plugin_profile_controller_test.rb
... ... @@ -1,43 +0,0 @@
1   -require File.dirname(__FILE__) + '/../test_helper'
2   -
3   -class NotificationPluginProfileControllerTest < ActionController::TestCase
4   -
5   - def setup
6   - @environment = Environment.default
7   -
8   - @controller = NotificationPluginProfileController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11   -
12   - @user = create_user('john', :email => 'john@doe.org', :password => 'dhoe', :password_confirmation => 'dhoe')
13   - @profile = fast_create(Community, :environment_id => @environment.id)
14   - @role = Role.create(:name => 'somerole', :permissions => ['see_loby_notes'])
15   - @profile.affiliate(@user.person, role)
16   -
17   - login_as(@user.login)
18   - end
19   -
20   - attr_reader :profile, :role
21   -
22   - should 'access lobby_notes action' do
23   - get :lobby_notes, :profile => profile.identifier
24   - assert :lobby_notes
25   - assert_response :success
26   - end
27   -
28   - should 'list the lobby notes of profile' do
29   - note1 = fast_create(NotificationPlugin::LobbyNoteContent, :profile_id => profile.id, :start_date => Date.today)
30   - note2 = fast_create(NotificationPlugin::LobbyNoteContent, :profile_id => profile.id, :start_date => Date.today)
31   - get :lobby_notes, :profile => profile.identifier
32   -
33   - assert_equivalent [note1, note2], assigns(:events)
34   - end
35   -
36   - should 'not see lobby_notes if there is no see_loby_notes permission' do
37   - role.permissions = []
38   - role.save
39   - get :lobby_notes, :profile => profile.identifier
40   - assert_response :forbidden
41   - end
42   -
43   -end
plugins/notification/test/test_helper.rb
... ... @@ -1 +0,0 @@
1   -require File.dirname(__FILE__) + '/../../../test/test_helper'
plugins/notification/test/unit/ext/profile_test.rb
... ... @@ -1,19 +0,0 @@
1   -require File.dirname(__FILE__) + '/../../test_helper'
2   -
3   -class ProfileTest < ActiveSupport::TestCase
4   -
5   - should "comunity have notifications method defined" do
6   - profile = Community.new
7   - assert_nothing_raised do
8   - profile.notifications
9   - end
10   - end
11   -
12   - should "comunity have lobby_notes method defined" do
13   - profile = Community.new
14   - assert_nothing_raised do
15   - profile.lobby_notes
16   - end
17   - end
18   -
19   -end
plugins/notification/test/unit/notification_plugin/category_test.rb
... ... @@ -1,11 +0,0 @@
1   -require File.dirname(__FILE__) + '/../../test_helper'
2   -
3   -class NotificationPlugin::CategoryNotificationTest < ActiveSupport::TestCase
4   -
5   - should 'create the category for notifications' do
6   - assert_nothing_raised NameError do
7   - notification = CategoryNotification.new
8   - end
9   - end
10   -
11   -end
plugins/notification/test/unit/notification_plugin/lobby_note_content_test.rb
... ... @@ -1,11 +0,0 @@
1   -require File.dirname(__FILE__) + '/../../test_helper'
2   -
3   -class NotificationPlugin::LobbyNoteContentTest < ActiveSupport::TestCase
4   -
5   - should 'create the content type lobby note' do
6   - assert_nothing_raised NameError do
7   - note = LobbyNoteContent.new
8   - end
9   - end
10   -
11   -end
plugins/notification/test/unit/notification_plugin/notification_content_test.rb
... ... @@ -1,11 +0,0 @@
1   -require File.dirname(__FILE__) + '/../../test_helper'
2   -
3   -class NotificationPlugin::NotificationContentTest < ActiveSupport::TestCase
4   -
5   - should 'create the content type notification' do
6   - assert_nothing_raised NameError do
7   - notification = NotificationContent.new
8   - end
9   - end
10   -
11   -end
plugins/notification/test/unit/notification_plugin_test.rb
... ... @@ -1,15 +0,0 @@
1   -require File.dirname(__FILE__) + '/../test_helper'
2   -
3   -class NotificationPluginTest < ActiveSupport::TestCase
4   -
5   - should "add notification content for content types" do
6   - notification = NotificationPlugin.new
7   - assert notification.content_types.include?(NotificationPlugin::NotificationContent)
8   - end
9   -
10   - should "add lobby notes content for content types" do
11   - notification = NotificationPlugin.new
12   - assert notification.content_types.include?(NotificationPlugin::LobbyNoteContent)
13   - end
14   -
15   -end
plugins/notification/views/notification_plugin_admin/index.html.erb
... ... @@ -1,12 +0,0 @@
1   -<h1><%= _('Notification settings')%></h1>
2   -
3   -<ul>
4   -<% NotificationPlugin::CategoryNotification.all.map do |category| %>
5   - <li><%= category.name %></li>
6   -<% end %>
7   -</ul>
8   -
9   - <% button_bar do %>
10   - <%= button :back, _('Back to admin panel'), :controller => 'admin_panel', :action => 'index' %>
11   - <% end %>
12   -
plugins/notification/views/notification_plugin_profile/_event.html.erb
... ... @@ -1,9 +0,0 @@
1   -<li>
2   - <div class='title'><%= event.title %></div>
3   - <span class='created_by'>
4   - <%= _("%{author} on %{date}") % {:author => event.author_name, :date => show_time(event.created_at) } %>
5   - </span>
6   - <div class='body'>
7   - <%= event.body %>
8   - </div>
9   -</li>
plugins/notification/views/notification_plugin_profile/index.html.erb
... ... @@ -1,17 +0,0 @@
1   -<h1><%= _('Lobby Notes')%></h1>
2   -
3   -
4   -<div id='leave_note'>
5   - <%= flash[:error] %>
6   - <%= 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 %>
7   - <%= limited_text_area :event, :body, 420, 'leave_note_content', :cols => 50, :rows => 2, :class => 'autogrow' %>
8   - <%= submit_button :new, _('New') %>
9   - <% end %>
10   -</div>
11   -
12   -
13   -<ul id='lobby_notes'>
14   -<% @events.map do |event| %>
15   - <%= render :partial => 'event', :locals => {:event => event}%>
16   -<% end %>
17   -</ul>
plugins/notification/views/notification_plugin_profile/lobby_notes.html.erb
... ... @@ -1,54 +0,0 @@
1   -<% extend NotificationPlugin::Helpers::ViewerHelper %>
2   -
3   -<%= lobby_notes_plugin_stylesheet %>
4   -
5   -<script type="text/javascript">
6   -
7   -function update_stream(recursive) {
8   - jQuery.ajax({
9   - url: '/profile/<%= params[:profile] %>/plugin/notification/lobby_notes',
10   - type: 'get',
11   - start : jQuery('#lobby-notes').addClass("loading"),
12   - success: function(data) {
13   - jQuery("#lobby-note-elements").html(data);
14   - jQuery("#lobby-notes").removeClass("loading");
15   - },
16   - error: function(ajax, stat, errorThrown) {
17   - }
18   - });
19   -
20   - if (recursive) {
21   - setTimeout(function() {
22   - update_stream(true);
23   - }, 10000);
24   - }
25   -}
26   -
27   -jQuery(document).ready(function() {
28   - jQuery('#lobby-notes').addClass("loading");
29   -
30   - update_stream(true);
31   -});
32   -
33   -</script>
34   -
35   -<div id='lobby-notes' class='lobby-notes'>
36   -
37   - <div class='lobby-header'>
38   - <%= image_tag profile.profile_custom_image(:thumb) %>
39   - <h1>
40   - <%= @profile.name %>
41   - </h1>
42   - <h2><%= _("You have %s notifications (%s)") % [ @events.count, show_date(@date)] %></h2>
43   - <div class='before'>
44   - <%=
45   -#link_to _('Before'), {:action => 'lobby_notes'}
46   -%>
47   - </div>
48   - </div>
49   -
50   - <ul id='lobby-note-elements'>
51   - <%= render :partial => 'event', :collection => @events %>
52   - </ul>
53   -
54   -</div>
plugins/notification/views/notification_plugin_profile/notifications.html.erb
... ... @@ -1,19 +0,0 @@
1   -<h1><%= _('Notifications')%></h1>
2   -
3   -
4   -<div id='leave_note'>
5   - <%= flash[:error] %>
6   - <%= 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 %>
7   - <%= _('Title:') %>
8   - <%= text_field :event, :name, :id => 'leave_notification_title' %>
9   - <%= limited_text_area :event, :body, 420, 'leave_notification_content', :cols => 50, :rows => 3, :class => 'autogrow' %>
10   - <%= submit_button :new, _('New') %>
11   - <% end %>
12   -</div>
13   -
14   -
15   -<ul id='notifications'>
16   -<% @events.map do |event| %>
17   - <%= render :partial => 'event', :locals => {:event => event}%>
18   -<% end %>
19   -</ul>