diff --git a/plugins/notification/controllers/notification_plugin_profile_controller.rb b/plugins/notification/controllers/notification_plugin_profile_controller.rb index 80c5804..20d081a 100644 --- a/plugins/notification/controllers/notification_plugin_profile_controller.rb +++ b/plugins/notification/controllers/notification_plugin_profile_controller.rb @@ -33,5 +33,21 @@ class NotificationPluginProfileController < ProfileController 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/views/notification_plugin_profile/index.html.erb b/plugins/notification/views/notification_plugin_profile/index.html.erb index e8f7431..a5139fb 100644 --- a/plugins/notification/views/notification_plugin_profile/index.html.erb +++ b/plugins/notification/views/notification_plugin_profile/index.html.erb @@ -5,7 +5,7 @@ <%= 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 note') %> + <%= submit_button :new, _('New') %> <% end %> diff --git a/plugins/notification/views/notification_plugin_profile/notifications.html.erb b/plugins/notification/views/notification_plugin_profile/notifications.html.erb new file mode 100644 index 0000000..a8607d1 --- /dev/null +++ b/plugins/notification/views/notification_plugin_profile/notifications.html.erb @@ -0,0 +1,19 @@ +

<%= _('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